Pre loader

Text label on X-Axis not working

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

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.

Version
3.0.0.5074
  • You must to post comments
1
0

I am considering applying server-side licensing for my javerScript application.

In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)

However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)

I wonder if there is a sample code implemented in C++ for server-side licensing.

Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?

  • You must to post comments
1
0

see a sample implementation

xAxis.labelProvider = SCINumericLabelProvider(labelFormatter: YearsLabelProvider())

class YearsLabelProvider: ISCILabelFormatter {

    var xLabels: [String]

    init() {
        xLabels = ["Test1", "Test2", "Test3", "Test4", "Test5", "Test6", "Test7", "Test8", "Test9", "Test10", "Test11", "Test12", "Test13", "Test14"]
    }

    func update(_ axis: ISCIAxisCore!) { }

    func formatLabel(_ dataValue: Double) -> ISCIString! {
        // return a formatting string for tick labels
        let index = Int(dataValue)
        return NSString(string: index >= 0 && index < xLabels.count ? xLabels[index] : "")
    }

    func formatCursorLabel(_ dataValue: Double) -> ISCIString! {
        // return a formatting string for modifiers’ axis labels
        return formatLabel(dataValue)
    }
}
  • You must to post comments
Showing 2 results
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