如何通过分解y轴来降低mschart的高度 [英] How reduce the height of an mschart by breaking up the y-axis
问题描述
如何降低mschart的高度,如下所示:
在我的情况下,我不希望折旧图表视图。
this.chart1.ChartAreas [0 ] .AxisY.ScaleBreakStyle.Enabled = FALSE;
您似乎在寻找 AxisY.ScaleBreakStyle
。
下面是一个例子:
系列s = chart1.Series [0];
ChartArea ca = chart1.ChartAreas [0];
Axis ay = ca.AxisY;
s.ChartType = SeriesChartType.Line; (int i = 0; i <100; i ++)s.Points.AddXY(i,rnd.Next(100)+50)的
;
s.Points.AddXY(s.Points.Count,123456);
ay.ScaleBreakStyle.Enabled = true; //<<< ===启用或停用!
yy.ScaleBreakStyle.LineWidth = 1;
yy.ScaleBreakStyle.LineColor = Color.OrangeRed;
ay.ScaleBreakStyle.StartFromZero = StartFromZero.Auto;
yy.ScaleBreakStyle.Spacing = 2;
ay.ScaleBreakStyle.StartFromZero = StartFromZero.Auto;
请注意,有很多情况下它不起作用。 MSDN:
以下任何一种情况都不支持缩放: 使用饼图,圆环图,漏斗图,金字塔图,径向图或任何堆叠图表类型。 自定义标签为使用。 指定对数Y轴。使用Y轴,包括滚动和缩放功能。 使用三维图表。
更新:当然,您也可以在运行时禁用中断。
How can I reduce the height of an mschart like this:
[EDIT] In my case I do not want break chart view.
this.chart1.ChartAreas[0].AxisY.ScaleBreakStyle.Enabled = false;
You seem to be looking for AxisY.ScaleBreakStyle
.
Here is an example:
Series s = chart1.Series[0];
ChartArea ca = chart1.ChartAreas[0];
Axis ay = ca.AxisY;
s.ChartType = SeriesChartType.Line;
for (int i = 0; i < 100; i++) s.Points.AddXY(i, rnd.Next(100) + 50 );
s.Points.AddXY(s.Points.Count, 123456);
ay.ScaleBreakStyle.Enabled = true; // <<<=== enable or disable!
ay.ScaleBreakStyle.LineWidth = 1;
ay.ScaleBreakStyle.LineColor = Color.OrangeRed;
ay.ScaleBreakStyle.StartFromZero = StartFromZero.Auto;
ay.ScaleBreakStyle.Spacing = 2;
ay.ScaleBreakStyle.StartFromZero = StartFromZero.Auto;
Note that there a quite a few cases where it will not work. MSDN:
Scale breaks are not supported under any of the following conditions:
Pie, doughnut, funnel, pyramid, radial or any stacked chart types are used.
Custom intervals for labels, tick marks or grid lines are enabled.
The minimum or maximum value for the axis is set.
Custom labels are used.
A logarithmic Y-axis is specified.
Axis views on the Y-axis, which include scrolling and zooming, are used.
3-D charts are used.
Update: Of course you can also disable the break at runtime..
这篇关于如何通过分解y轴来降低mschart的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!