Pre loader

minorsPerMajor Behavior

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
0
0

I’m not sure if I’m understanding the Axes minorsPerMajor behavior correctly, or if this is a Scichart issue.

Using a “vanilla” axis like:

xAxis = DateAxis(this)
xAxis.drawMajorGridLines = false
xAxis.drawMinorGridLines = false
xAxis.drawMajorTicks = true
xAxis.drawMinorTicks = false
xAxis.textFormatting = "h:mma\nMMM d"
xAxis.subDayTextFormatting = "h:mma\nMMM d"
xAxis.minorsPerMajor = 1 // does not change # minor ticks no matter what it is set at, if drawMinorTicks = true
val xAxes: AxisCollection = chartSurface.getXAxes()
xAxes.add(xAxis)

If I set drawMinorTicks=false, I get no minor ticks, as expected. However, if I set it to true, I always get a bunch of ticks, no matter what I set minorsPerMajor to. I want just 1 mnor tick between majors. I’ve attached screenshots of the axis with drawMinorTicks set to both true and false using the above code.

Thanks for your assistance.

Version
4.2.0.4557
Images
  • You must to post comments
Best Answer
0
0

Hi there,

It looks like default implementation of TickProvider for DateAxis ignores minorsPerMajor value in some cases. I’m going to create a task to investigate why this happens. For now to workaround this issue by creating custom TickProvider which override minorDelta value used to generate minor ticks:

class CustomDateTickProvider extends DateTickProvider{
    @Override
    protected void updateTicks(DoubleValues minorTicks, DoubleValues majorTicks) {
        // override minor delta value used by updateTicks() to increase minor tick frequency by 2x
        currentMinorDelta = currentMajorDelta / 2d;
        super.updateTicks(minorTicks, majorTicks);
    }
}

and then set it for axis:

dateAxis.setTickProvider(new CustomDateTickProvider());

Is this suitable for your needs?

Hope this will help you!

Best regards,
Yura

  • C Bolton
    Thank you. That looks like it should work.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies