Changing datetime format on mschart axis

喜你入骨 提交于 2020-01-22 19:13:07

问题


I'm using mschart to display some values over a timeperiod.

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. How can I change this?

EDIT: Changing XValueType to ChartValueType.Time leads to this:


回答1:


To show DateTime related values on the XAxis you can choose to set the XValueType property.

In your case Series[0].XValueType = ChartValueType.Time would be the right thing to display time related values.

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";


来源:https://stackoverflow.com/questions/8833623/changing-datetime-format-on-mschart-axis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!