How to get MajorDiv when AutoDivSpacing=true

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

jval
Posts: 40
Joined: Mon May 04, 2015 1:46 pm

How to get MajorDiv when AutoDivSpacing=true

Post by jval » Wed Jul 01, 2015 5:05 pm

Hello.
Axis AutoDivSpacing = true is good for me but I would like to get properly MajorDiv and MajorDivCount values and use these (show to user, write to file, etc.). But when AutoDivSpacing is true they are not correct. For example (see screenshot 1) for minimum 0 and maximum 100 I see on the graph 20 Divs (major) and increment like 5 between these. But in Editor page I see MajorDiv = 20 and MajorDivCount = 5. It's incorrect and my questions - can I get properly values when AutoDivSpacing is true?
Or may be I don't understand what these properties indicate?
p.s. for X axis it's more strange situation (see screenshot 2). I have 26 Divs and increment like 0.5 but MajorDiv = 1 and MajorDivCount = 13 . I don't understand why such values are.
Thank you.
axis div quiestion.jpg
axis div quiestion.jpg (175.3 KiB) Viewed 10479 times
axis div quiestion 2.jpg
axis div quiestion 2.jpg (144.66 KiB) Viewed 10477 times

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

Re: How to get MajorDiv when AutoDivSpacing=true

Post by ArctionPasi » Mon Jul 06, 2015 1:26 pm

Hi,

When AutoDivSpacing is used, these properties are not usable, because they are for controlling the divisions explicitly.

The major divisions spacing can be done automatically by leaving the AutoDivSpacing enabled. The
spacing is calculated as user-friendly as possible, depending on labels font size and
AutoDivSeparationPercent properties. Increase the value to obtain less major divisions. Minor divisions
are calculated between major divisions by using MinorDivCount property value.

By setting AutoDivSpacing disabled, you can control the division spacing manually with MajorDiv
property, if you want to control spacing by magnitude. Or use MajorDivCount property to control
spacing by division count. KeepDivCountOnRangeChange property can be used to force maintaining
the divisions count same when range is changed, since MajorDivCount and MajorDiv depend on each
other.

Major division tick style can be set from MajorDivTickStyle property. Edit the ticks and labels
orientation by using MajorDivTickStyle.Alignment property. The value labels are drawn next to major
division ticks. Edit the minor division properties with MinorDivTickStyle property, respectively.

More explanations in divisions, ticks and grids can be found in the User's Manual https://www.arction.com/wp-content/uplo ... manual.pdf, Page 48.

I hope this helps :)
LightningChart Support Team, PT

lokesh
Posts: 45
Joined: Tue Feb 14, 2017 8:48 am

Re: How to get MajorDiv when AutoDivSpacing=true

Post by lokesh » Wed Feb 15, 2017 4:56 pm

Hi,
My question is exactly the same and I couldn't find the correct MajorDiv from any of the exposed properties. So, I thought instead of creating another thread, I might ask it here as my question literally is "How to get MajorDiv when AutoDivSpacing=true?"
ArctionPasi wrote: When AutoDivSpacing is used, these properties are not usable, because they are for controlling the divisions explicitly.
I kind of realised that and and I am wondering if I could get this information based on the number of scale labels or something. Basically, is there some workaround for getting the MajorDiv value when the AutoDivSpacing is true? I am sorry to bother you but I like the way the scale is set by the AutoDivSpacing and would like to use it by default. Otherwise, I would have to set it manually all the time.

Thank you.

Regards,
Lokesh

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

Re: How to get MajorDiv when AutoDivSpacing=true

Post by ArctionPasi » Sat Feb 18, 2017 6:19 am

You can use axis.GetMajorTicks() to get list of tick values that were used in rendering the previous time.
LightningChart Support Team, PT

lokesh
Posts: 45
Joined: Tue Feb 14, 2017 8:48 am

Re: How to get MajorDiv when AutoDivSpacing=true

Post by lokesh » Mon Feb 20, 2017 3:36 pm

Thanks ArctionPasi. I will try that.