Pre loader

iOS: Vertical axis major tick marks are not showing by 5 as one would expect

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

0
0

I am using an SCINumericAxis for my y-axis. I am setting the visibleRange to (Min = 28, Max = 76). I am leaving the minorsPerMajor to the default of 5. However when looking at my graph (attached) you can see that the major tick labels are actually every 6 minors, e.g. 30, 36, 42, etc. when they should be 30, 35, 40, etc for minorsPerMajor set to 5.

Please advise on how to fix this issue as my major tick labels should be every 5, not every 6.

Version
3.1
Images
  • Brad Taber
    Investigating further and trying different values for minorsPerMajor I realize now that the minor tick marks are not intended to indicate 31, 32, 33, etc as the values in between 30 and 36. Therefore I misunderstood how to control the spread for the major tick labels, I thought you could accomplish that with minorsPerMajor. So my real question then is: how do I control the frequency of the major tick labels. As in the example posted above, I would like it to be on the 5s, e.g. 30, 35, 40, etc as this is more understandable for my users similar to how the time axis major tick labels occurs on the 5s. Thank you for any thoughts on this.
  • You must to post comments
0
0

Hi, Brad.

What you need is to create your own TickProvider and in updateTicks method add to majorTicks only those values that you need. See the code:

import SciChart.Protected.SCITickProvider
class CustomNumericTickProvider: SCINumericTickProvider {
  override func updateTicks(minorTicks: SCIDoubleValues!, majorTicks: SCIDoubleValues!) {

    let start = self.axis.visibleRange.minAsDouble.rounded()
    let end = self.axis.visibleRange.maxAsDouble.rounded()


    let step: Double = 5
    var current: Double = (start / step).rounded(.up) * step
    while current <= end {
        majorTicks.add(current)
        current += step
    }
  }
}

For more details, take a look at https://www.scichart.com/documentation/ios/current/axis-ticks—tickprovider-and-deltacalculator-api.html#creating-your-own-tickprovider

Images
  • 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