Windows窗体图表设置固定的混合标签 [英] Windows Forms Chart set fixed mixed labels

查看:203
本文介绍了Windows窗体图表设置固定的混合标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的x或y轴上修正我的标签,因此它们总是静态的。我也想混合标签与数字和字符串,如图所示。此外,y轴从-1开始,我如何始终从0开始?



解决方案

设置



最低 显示的最大 值可以分别为所有轴设置。使用 CustomLabels 我们通常需要强制执行 Interval ..



使用相同的设置代码,如在您的其他问题..


I would like to fix my labels on my x or y axis, so they are always static. I also want to mix the labelling with numbers and strings like in shown picture. Furthermore the y axis starting with -1, how can I always start with 0?

解决方案

Setting CustomLabels is tricky as their FromPositions and ToPositions need to be set correctly or else they won't show at the right positions!

See here and here for more examples!

Here is one for your question, as I read it:

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 Minimum and Maximum values shown can be set for all axes separately. With CustomLabels we often need to enforce the Interval ..

Using the same setup code as in your other question..

这篇关于Windows窗体图表设置固定的混合标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆