[英]creating a custom label for axis y in ASP.Net chart as a string
I have a 3 point axis for axisY
in a chart for ASP.NET. 我在ASP.NET的图表中有一个3轴的
axisY
轴。 Right now it shows 1, 2, and 3. I need to assign string values to the points. 现在它显示1,2和3.我需要为点分配字符串值。 I have found that it is somewhere in here:
我发现它在这里的某个地方:
Chart1.ChartAreas[0].AxisY.CustomLabels.Add(??????);
Not sure how to get it not to have to take a double
value and be able to assign a string to the point. 不知道如何让它不必采用
double
值并且能够为该点指定一个字符串。
You have to create a custom label, set its properties, then add it to the axis 您必须创建自定义标签,设置其属性,然后将其添加到轴
What about this? 那这个呢?
CustomLabel label = new CustomLabel();
label.FromPosition = -1.0;
label.ToPosition = 1.0;
label.Text = "0";
label.RowIndex = 0;
Chart1.ChartAreas[0].AxisY.CustomLabels.Clear();
Chart1.ChartAreas[0].AxisY.CustomLabels.Add(label);
This will render a 0 where the Y-axis meets the X-axis. 这将呈现0,其中Y轴与X轴相交。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.