12

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);
Luis Filipe
  • 8,488
  • 7
  • 48
  • 76
sowjanya attaluri
  • 903
  • 2
  • 9
  • 27

2 Answers2

20

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;
TaW
  • 53,122
  • 8
  • 69
  • 111
0

I suggest getting each of your points, looping through them and adding each one. I noticed you want to set a name so I just created a counter then appended an integer value to the end of 'ser', name how you please.

Dim counter as int = 0;
foreach (Series ser in chart.Series)
{
   ser.Name = "ser" & counter + 1;
   ser.IsVisibleInLegend = false;
   ser.IsXValueIndexed = true;
   ser.XValueType = ChartValueType.Time;
   ser.YAxisType = AxisType.Primary;
   ser.ChartType = SeriesChartType.Line;
   this.chart1.Series.Add(ser);
   counter += 1;
}
ImDeveloping
  • 101
  • 9