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.
- suraj gaikwad asked 5 years ago
- last edited 5 years ago
- You must login to post comments
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?
- Andrew Burnett-Thompson answered 5 years ago
- You must login to post comments
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)
}
}
- Nathaniel Thomas answered 5 years ago
- You must login to post comments
Please login first to submit.