我想将标签固定在 x 或 y 轴上,因此它们始终是静态的。我还想将标签与数字和字符串混合在一起,如图所示。另外y轴从-1开始,我怎么能总是从0开始呢?
Setting CustomLabels https://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.customlabel%28v=vs.110%29.aspx很棘手,因为他们 and ToPositions https://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.customlabel.toposition%28v=vs.110%29.aspx需要正确设置,否则它们将不会显示在正确的位置!
See here https://stackoverflow.com/questions/31893852/windows-form-chart-label-modification/31895616?s=1%7C0.4010#31895616 and here https://stackoverflow.com/questions/32432342/different-label-types-on-one-axis-in-chart/32444146?s=2%7C0.3914#32444146了解更多示例!
这是我读到的关于你的问题的一个答案:
CA.AxisY.Minimum = 0;
CA.AxisY.Maximum = 4;
CA.AxisY.Interval = 1;
int old = 3;
for (int i = 0; i < 5; i++ )
{
CustomLabel cl = new CustomLabel(i - 0.5d, i + 0.5d,
i < old ? i + "" : i == old ? "old" : "too old", 0, LabelMarkStyle.None);
CA.AxisY.CustomLabels.Add(cl);
}
The and Maximum https://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.axis.maximum%28v=vs.110%29.aspx显示的值可以为所有轴单独设置。和CustomLabels
我们经常需要强制执行Interval https://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.axis.interval%28v=vs.110%29.aspx ..
使用相同的setup https://stackoverflow.com/questions/33556748/unproportional-bubble-chart-with-the-size-paramater-in-c-sharp-visual-studio/33557399#33557399代码如您的其他问题中所示..
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)