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.
- C Bolton asked 2 years ago
- last edited 2 years ago
- You must login to post comments
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
- Yura Khariton answered 2 years ago
- Thank you. That looks like it should work.
- You must login to post comments
Please login first to submit.