在Mschart轴上更改日期时间格式 [英] Changing datetime format on mschart axis

查看:147
本文介绍了在Mschart轴上更改日期时间格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用mschart在一段时间内显示一些值.

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

它看起来像这样:

您可以看到第一个值是从15:11开始,最后一个值是从16:10开始 但是在x轴上,它显示的是日期. 我该如何更改?

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?

将XValueType更改为ChartValueType.Time会导致以下情况:

Changing XValueType to ChartValueType.Time leads to this:

推荐答案

要在XAxis上显示与DateTime相关的值,可以选择设置XValueType属性.

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

对于您来说,Series[0].XValueType = ChartValueType.Time是显示与时间相关的值的正确方法.

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

要格式化值,可以使用ChartAreas[0].AxisX.LabelStyle.Format,它将把您的值转换为所需的格式,例如HH:mm:ss.

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

这篇关于在Mschart轴上更改日期时间格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆