[英]Changing datetime format on mschart axis
I'm using mschart to display some values over a timeperiod. 我正在使用mschart在一段时间内显示一些值。
It looks something like this: 它看起来像这样:
As you can see the first value is from 15:11 and the last from 16:10 But on the x-axis it's on displaying the days. 正如您所看到的,第一个值是从15:11开始,最后一个值是从16:10开始但是在x轴上显示的是天数。 How can I change this? 我怎么能改变这个?
EDIT: Changing XValueType to ChartValueType.Time leads to this: 编辑:将XValueType更改为ChartValueType.Time会导致:
To show DateTime related values on the XAxis you can choose to set the XValueType
property. 要在XAxis上显示与DateTime相关的值,您可以选择设置XValueType
属性。
In your case Series[0].XValueType = ChartValueType.Time
would be the right thing to display time related values. 在你的情况下, Series[0].XValueType = ChartValueType.Time
是显示时间相关值的正确选择。
To format the values you can use ChartAreas[0].AxisX.LabelStyle.Format
which would translate your values into the required format say like HH:mm:ss
. 要格式化值,您可以使用ChartAreas[0].AxisX.LabelStyle.Format
,它会将您的值转换为所需的格式,例如HH:mm:ss
。
ChartAreas[0].AxisX.LabelStyle.Format ="HH:mm:ss";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.