سؤال

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?

هل كانت مفيدة؟

المحلول

//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;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top