如何在chartControl中的X轴上显示小时 [英] How to display Hours on X-axis in chartControl

查看:557
本文介绍了如何在chartControl中的X轴上显示小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个日期读取器,其中有两个字段,如column1,为hours = 5,6,7,8,9,10,11,12,13,.......,23. column2为Count = 10,20,0,40,....并且我绑定到chartcontrol

X轴=小时

y轴=计数应显示.

我已经编写了类似以下代码:Chart1.Series ["Series1"].Points.DataBind(dr,"Hour of Day","Total","Tooltip = Hour Of Day,Label = Total");

通过这种方式,我在垂直的Y轴上显示计数,但X轴未显示为5,6,7,8,9,10,11,12,13,....,23像00:00,00:00,00:00 ....

所以我应该更改..以正确的方式显示,例如x轴5,6,7,8,..... datareader值.

Hi,

I have a datereader with two fields like column1 as hours=5,6,7,8,9,10,11,12,13,.......,23. column2 as Count=10,20,0,40,.... and i am binding to chartcontrol

X-axis =hours

y-axis=count should be display.

I have written code like: Chart1.Series["Series1"].Points.DataBind(dr, "Hour Of Day", "Total", "Tooltip=Hour Of Day, Label=Total");

By this i am displaying count on Y-axis in vertical but X-axis is not displaying as 5,6,7,8,9,10,11,12,13,.......,23 it is showing like 00:00,00:00,00:00....

so should i change.. to display in correct way like x-axis 5,6,7,8,..... datareader values.

推荐答案

请参阅带有代码的Microsoft MSChart示例 ...对您很有用.
See the Microsoft MSChart samples with code...It would be useful for you.


如果希望它看起来像是时间值图,则可以将xDateTime值用作xaxis.否则,如果您只想使用小时,请确保xaxis的数据类型不是DateTime.
If you want it to appear like a value over time graph, you could use DateTime values for the xaxis. Otherwise if you just want to use hours, make sure the datatype of the xaxis is not DateTime.


这篇关于如何在chartControl中的X轴上显示小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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