Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 mschart 显示一段时间内的一些值。
它看起来像这样:
如您所见,第一个值来自 15:11,最后一个值来自 16:10 但在 x 轴上显示日期。我怎样才能改变这个?
编辑:将 XValueType 更改为 ChartValueType.Time 会导致:
要在 XAxis 上显示与 DateTime 相关的值,您可以选择设置该XValueType属性。
XValueType
在您的情况下Series[0].XValueType = ChartValueType.Time,显示与时间相关的值是正确的。
Series[0].XValueType = ChartValueType.Time
要格式化您可以使用的值ChartAreas[0].AxisX.LabelStyle.Format,这会将您的值转换为所需的格式,例如HH:mm:ss.
ChartAreas[0].AxisX.LabelStyle.Format
HH:mm:ss
ChartAreas[0].AxisX.LabelStyle.Format ="HH:mm:ss";