Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show the marker points in line graph using c#

I am using Line graph in my application and is working fine. I tried to draw the marker points in line graph,but the marker points are not displaying. In line chart marker properties, I have chosen markerSize as 5,markerStyle as Circle,MarkerColor as blue.Refer my code below.

 series1.Name = "Series1";
 series1.IsVisibleInLegend = false;
 series1.IsXValueIndexed = true;
 series1.XValueType = ChartValueType.Time;
 series1.YAxisType = AxisType.Primary;
 series1.ChartType = SeriesChartType.Line;
 this.chart1.Series.Add(series1);
like image 382
sowjanya attaluri Avatar asked Dec 17 '15 07:12

sowjanya attaluri


People also ask

What is a marker on a line graph?

Line marker is a line that is drawn on chart plot and bound to some value on an axis. It may be used to show a trend or mark an important value.

How do I add a marker to a line graph in Excel?

On the Format tab, in the Current Selection group, click Format Selection. Click Marker Options, and then under Marker Type, make sure that Built-in is selected. In the Type box, select the marker type that you want to use.

What is a marker chart?

Marker chart (otherwise known as a point chart) is identical to a line chart without the lines. A marker chart shows only endpoints of segments that make each line up.


1 Answers

I don't see how the Markers can show up from your code.

You need to set a non-default MarkerStyle:

 series1.MarkerStyle = MarkerStyle.Circle;

If you use the debugger on that line you can see how the default is None !

Of course you will want to play with all other marker relates series properties, which all inherited from the DataPointCustomProperties

You are using ChartType.Line which is fine. Note that FastLine does not display markers!

If you only want to show some Markers simply style them for each point:

S1.Points[8].MarkerStyle = MarkerStyle.Triangle;
S1.Points[8].MarkerSize = 22;
S1.Points[8].MarkerColor = Color.Red;
like image 137
TaW Avatar answered Nov 15 '22 23:11

TaW