SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components


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()

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.

  • You must to post comments
Best Answer

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{
    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,

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

Please first to submit.