简体   繁体   English

为什么在向MSChart中的Y轴添加自定义标签后,所有其他非自定义标签消失了?

[英]Why on adding custom label to Y-Axis in MSChart all other non-custom labels disappear?

I trying to add custom label in Windows.Forms.DataVisualization.Charting. 我试图在Windows.Forms.DataVisualization.Charting中添加自定义标签。 Here is my code. 这是我的代码。

axisXData = new string[] { "05.06.2016", "06.06.2016"};    
axisYDataHigh = new double[] { 1.1364, 1.1372};
axisYDataOpen = new double[] { 1.1349, 1.1356};
axisYDataLow = new double[] { 1.1332, 1.1345};
axisYDataClose = new double[] { 1.1351, 1.1351};
chart1.Series["Series1"].Points.DataBindXY(axisXData, axisYDataHigh,axisYDataLow, axisYDataOpen, axisYDataClose);

I got nice chart with showed labels in YAxis. 我在YAxis中有显示标签的漂亮图表。 But when I tryed add custom label with: 但是当我尝试添加自定义标签时:

chart1.ChartAreas[0].AxisY.CustomLabels.Add(1.1334, 1,1366, "1.135");

all other labels disappeared and only custom label showed. 其他所有标签均消失,仅显示自定义标签。 How to make non-custom labels not disappear? 如何使非定制标签不消失?

Update (*) : 更新(*):

CustomLabels can be displayed in several rows. CustomLabels可以显示在几行中。

Normal Labels will only display in row 0. 普通Labels将仅显示在第0行中。

For this default row the rule is: It is either or: Either regular Labels or CustomLabels . 对于此默认行,规则为:它为或:常规LabelsCustomLabels No way to combine them, unfortunately. 不幸的是,没有办法将它们结合起来。

MSDN: MSDN:

Labeling Axes Using Custom Labels 使用自定义标签标记轴

Use custom labels to provide custom text for axes. 使用自定义标签为轴提供自定义文本。 Custom labels are implemented using the CustomLabels collection property. 定制标签是使用CustomLabels集合属性实现的。 If you use custom labels, the chart area does not display axis labels from data points. 如果使用自定义标签,则图表区域不会显示来自数据点的轴标签。

(*) But , as Tanner points out, CustomLabels can be combined on the same Axis if you move them to a row > 0 by setting their RowIndex property. (*) 但是 ,正如坦纳指出, CustomLabels可以在同一组合Axis ,如果你设置了他们移动到某一行> 0 RowIndex属性。

Note : they still can't be combined with normal Labels on the same line. 注意 :它们仍不能与同一行上的普通Labels结合使用。

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

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