简体   繁体   中英

Changing datetime format on mschart axis

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:

一只忙碌的猫

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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