문제

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