X-Axis Labels at exactly each hour

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

jrandomuser
Posts: 1
Joined: Thu Sep 01, 2016 7:29 pm

X-Axis Labels at exactly each hour

Post by jrandomuser » Thu Sep 01, 2016 7:36 pm

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

User avatar
ArctionPasi
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: X-Axis Labels at exactly each hour

Post by ArctionPasi » Thu Sep 01, 2016 7:54 pm

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. :)
LightningChart Support Team, PT