简体   繁体   中英

How to hide label of data points in line chart

Please refer to the picture below.

Basically I have a C# chart control with some series on it, I have one series with label (the red line in the picture) but I want to be able to toggle the label on/off. Is that possible? I can't find any properties that can do so.

Thanks a lot.

图表

Short of clearing the text of the labels one simple method is to make the color transparent.

You can do it for the whole Series s1 :

s1.LabelForeColor = checkBox_test.Checked ? Color.Black: Color.Transparent;

..or for individual DataPoints dp :

dp.LabelForeColor = checkBox_test.Checked ? Color.Blue : Color.Transparent;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM