Page 1 of 1

X-Axis Labels at exactly each hour

Posted: Thu Sep 01, 2016 7:36 pm
by jrandomuser
I have a line chart that I am passing data to that needs to be displayed along a specific X-axis. The X needs to have 12 labels at 2 Hour intervals exactly on the hour. So 09:00, 11:00, 13:00 etc...
I've set the AutoDivSpacing = false and MajorDivCount=12 but I ended up with only 7 labels at 7:11, 9:02, 10:53, 12:45, 14:36, 16:28, 18:19.

How do I specify a beginning and ending point for the Range? Current Hour to Current Hour + 12.
How do I make it display 12 divs at exactly each 2 hour interval?

Thanks

Re: X-Axis Labels at exactly each hour

Posted: Thu Sep 01, 2016 7:54 pm
by ArctionPasi
Hi,

you can do it pretty much like this, when axis.ValueType = Time.

axisX.KeepDivCountOnRangeChange = false;
axisX.AutoDivSpacing = false;
axisX.MajorDiv = 2 * 3600;
axisX.SetRange(now.Hour * 3600, (now.Hour + 12) * 3600);


When axis range adjusts, either MajorDivCount or MajorDiv has to adjust. KeepDivCountOnRangeChange = false here lets chart to adjust the MajorDivCount because MajorDiv is set and setting the axis range with SetRange. :)