C#MSChart-图表区域限制 [英] C# MSChart - charts area limits

查看:357
本文介绍了C#MSChart-图表区域限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图表和三个图表区域,它们在视图,缩放和光标中对齐: 这与我有关以前的帖子.除了三个ChartArea在开始时未对齐之外,其他所有方法都运行良好.以下是问题的图片:

I have one Chart and three ChartArea that are aligned in view, zoom, cursor: this is my related previous post. All things works well except that the three ChartArea are not aligned at the beginning. Following an image of the problem:

我认为这取决于Y值轴的位数.通过一些研究,我尝试以下配置:

I think it depends from the digit's number of Y values axis. From some research I try the following configuration:

// selezione e zoom
dlChart.ChartAreas[VOLTAGE_AREA].CursorX.Interval = 1;
dlChart.ChartAreas[VOLTAGE_AREA].CursorX.IsUserEnabled = true;
dlChart.ChartAreas[VOLTAGE_AREA].CursorX.IsUserSelectionEnabled = true;
// generale
dlChart.ChartAreas[VOLTAGE_AREA].AxisX.LabelStyle.Format = "dd/MM/yy - HH:mm:ss.fff";       
dlChart.ChartAreas[VOLTAGE_AREA].AxisX.ScaleView.Zoomable = true;
dlChart.ChartAreas[VOLTAGE_AREA].AxisY.LabelStyle.Format = "D5";

在女巫的最后一行:

dlChart.ChartAreas[VOLTAGE_AREA].AxisY.LabelStyle.Format = "D5";

应始终指定五位数字.这以某种方式减轻了问题,但并没有取消问题.此外,在此行中,只要我滚动图表,该程序就会在下面引发很多形式异常:

should specifies always five digits. This mitigate in some way the problem but it doesn't desappers. Furthermore with this row the program starts to throws very lots exceptions of form below any time I scroll the graph:

Generate exception: 'System.FormatException' in mscorlib.dll

有人知道这个问题的解决方案吗?预先感谢.

Does anyone knows the solution for this problem? Thanks in advance.

推荐答案

您是否尝试过使用图表区域对齐选项?我会尝试类似的东西:

Have you tried using the chart area alignment options? I would try something like:

//define inner plot position of the chart areas
dlChart.ChartAreas[0].InnerPlotPosition.Auto = true;
dlChart.ChartAreas[1].InnerPlotPosition.Auto = true;
dlChart.ChartAreas[2].InnerPlotPosition.Auto = true;

//set our second chart area's alignments to match our first chart area
dlChart.ChartAreas[1].AlignmentOrientation = AreaAlignmentOrientations.Vertical;
dlChart.ChartAreas[1].AlignmentStyle = AreaAlignmentStyles.All;
dlChart.ChartAreas[1].AlignWithChartArea = dlChart.ChartAreas[0].Name;

//set our third chart area's alignments to match our first chart area
dlChart.ChartAreas[2].AlignmentOrientation = AreaAlignmentOrientations.Vertical;
dlChart.ChartAreas[2].AlignmentStyle = AreaAlignmentStyles.All;
dlChart.ChartAreas[2].AlignWithChartArea = dlChart.ChartAreas[0].Name;

这篇关于C#MSChart-图表区域限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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