简体   繁体   English

如何将永久工具提示或标签添加到MSChart C#的一系列Charttype点

[英]How to add permanent tooltips or labels to series of Charttype point to a MSChart c#

I have a chart with series of type "point". 我有一系列“点”类型的图表。 I would like to display an additional data near every point, just like toolTip, only I want it permanent and not only on mouse hover. 我想在每个点附近显示其他数据,就像toolTip一样,只是我希望它永久存在,而不仅仅是在鼠标悬停时。

For example lets say I have a datbase with points, and for each point there is x,y and some unique label. 例如,假设我有一个带有点的数据库,每个点都有x,y和一些唯一的标签。 If that is how I display points on my chart: 如果那是我在图表上显示点的方式:

 Series series = new Series("Default");
 series.ChartType = SeriesChartType.Point; 

for(int i=0; i<datbase.Count; i++)
{
 chart.Series[0].Points.AddXY(database[i].x,database[i].y);
}

how to get a graph with the points on it, and above each point displayed its unique label? 如何获得带有点的图形,并且在每个点上方显示其唯一标签?

Thanks 谢谢

You could try the following: 您可以尝试以下方法:

Series series = new Series("Default");
series.ChartType = SeriesChartType.Point; 

for(int i=0; i<datbase.Count; i++)
{
  int index = chart.Series[0].Points.AddXY(database[i].x,database[i].y);
  chart.Series[0].Points[index].Label = "Your Label Text";
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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