简体   繁体   English

如何更改图表中X轴的位置

[英]How to change the position of the X axis in the chart

How to change the position of the X axis in the chart, making it the top? 如何更改图表中X轴的位置,使其成为顶部? I show example on the image 我在图像上显示示例

在此处输入图片说明

Changing the position of an Axis is usually done by setting the Crossing property to some value on the other, perpendicular Axis : 通常,通过将Crossing属性设置为另一个垂直Axis上的某个值来更改Axis的位置:

ca = chart1.ChartAreas[0];
ca.AxisX.Crossing = 2500;

But in your case you can simply enable the 'secondary' axis AxisX2 : 但是在您的情况下,您只需启用 “辅助”轴AxisX2

ca.AxisX2.Enabled = AxisEnabled.True;

Probably you want to disable the regular x-axis: 可能您想禁用常规x轴:

ca.AxisX.Enabled = AxisEnabled.False;

Of course you will have to apply all sorts of stylings and settings to the new, secondary axis! 当然,您将必须将各种样式和设置应用于新的辅助轴!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM