c#Winform MSChart反向Y轴 [英] c# Winform MSChart reverse Y Axis
问题描述
我在Windows窗体上使用MSChart控件.
我正在尝试使用AxisY.IsReversed = true
使 Y轴下降,但仍将X轴保持在底部.默认情况下,当我使用AxisY.IsReversed = true
时,X轴会上升到顶部.然后,我尝试设置AxisY.Crossing = Max
以将轴翻转到Y轴的最大末端(在底部),但不会移到X轴以下,而只能移到正上方. /p>
请帮助我!!!!!
您描述的行为与Microsoft演示项目中显示的行为相同.我相信没有任何调整可以使X轴的标签仅显示在X轴的下方,因为没有与Axis.LabelPosition
属性类似的东西可以指定标签应该在该轴的下方.
如果您指定chart1.ChartAreas[0].AxisX.IsMarksNextToAxis = false;
,则标签将显示在图表的顶部,而不是所需的底部.
您唯一可以使用的调整是不设置 AxisY.IsReversed = true;
,而是将所有Y值设置为*-1
(将它们设置为负数).然后使用LabelStyle.Format
将负数格式化为正数.
chart1.ChartAreas[0].AxisY.IsReversed = false;
chart1.ChartAreas[0].AxisY.LabelStyle.Format = "##.##;##.##;##.##";
I am using the MSChart control on a Windows form.
I am trying to have a descending Y axis by using AxisY.IsReversed = true
, but still keep the X axis on the bottom. By default, when I used AxisY.IsReversed = true
, then the X axis goes up to the top. I then tried the setting the AxisY.Crossing = Max
to flip the axis to the maximum end of the Y axis (which is at the bottom) but it won't go below the X axis, it only goes as far as just above it.
Please help me!!!!!
The behavior you describe is the same behavior as shown in Microsoft demo project. I believe there is no tweak to make labels of X axis simply appear under the X axis, as there is nothing similar to Axis.LabelPosition
property, that would specify, that labels should be under the axis.
Either when you specify chart1.ChartAreas[0].AxisX.IsMarksNextToAxis = false;
, then labels appear on top of the chart, not on the bottom as desired.
The only tweak you can use, is not to set AxisY.IsReversed = true;
, but make all your Y values *-1
(make them negative). Then use LabelStyle.Format
to format negative numbers as positive.
chart1.ChartAreas[0].AxisY.IsReversed = false;
chart1.ChartAreas[0].AxisY.LabelStyle.Format = "##.##;##.##;##.##";
这篇关于c#Winform MSChart反向Y轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!