-1

I am developing windows form application with C#. My application uses Chart Control but there is a problem.

I add a series (CharType is Line) to the Chart Control and then later draw my currrent series on the Plot Area.

A label is shown upon the series line, but I want to show label name only once. What should I do to show label name once?

TylerDurden
  • 1,632
  • 1
  • 20
  • 30
mrtkprc
  • 57
  • 7
  • So you have the Series line labeled in the Legend of the Chart? But you don't want it labeled anywhere else? I'm just trying to understand what you want. – Derek W Mar 16 '14 at 17:13

1 Answers1

0
//remove all labels on chart
foreach (DataPoint item in chart1.Series[0].Points)
{
    item.Label = "";
}

//alternatively disable all labels
chart1.Series[0].IsValueShownAsLabel == false

Now add label to last point. You could pick any Chart1.Series[0].Points[i] to put the label on, but in this example it adds the label to the last point

_Point Point = chart1.Series[0].Points[chart1.Series[0].Points.Count - 1];
_Point.Label = chart1.Series[0].Name;
TylerDurden
  • 1,632
  • 1
  • 20
  • 30