Pre loader

Tag: text label

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 votes
4k views

Hi,

I am using SciChart_iOS_SDK_3.0.0.5074 with Swift 5.

I want to show string type on X-axis. I am using below code snippet.

class YearsLabelProvider: SCILabelProviderBase<SCINumericAxis> {

   var xLabels: [String] = ["Test", "Test", "Test", "Test", "Test", "Test", "Test", "Test",     "Test", "Test", "Test", "Test", "Test", "Test"]

   func update(_ axis: ISCIAxisCore!) { }

   override func formatLabel(_ dataValue: ISCIComparable!) -> ISCIString! {
        let index = Int(dataValue.toDouble())
        return NSString(string: index >= 0 && index < xLabels.count ? xLabels[index] : "")
    }

    override func formatCursorLabel(_ dataValue: ISCIComparable!) -> ISCIString! {
        let index = Int(dataValue.toDouble())

        var result: String?

        if (index >= 0 && index < xLabels.count) {
            result = xLabels[index]
        }
        return NSString(string: result!)
    }
}

Application crashes while loading with the following error –

” *** Terminating app due to uncaught exception ‘Initializer not allowed Exception’, reason: ‘Parameterless initializer of Chart.YearsLabelProvider class shouldn’t be used. Please use one of the designated initializers instead'”

Kindly help us resolving this issue since this is a showstopper issue.
I would also like to know about what data SCIXyDataSeries accepts when we are working with strings.

Showing 1 result

Try SciChart Today

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

Start TrialCase Studies