What’s the new (Swift) signature for V2’s updateDataContext(withContext label: SCIDefaultTickLabel!, data dataValue: SCIGenericType, style: SCITextFormattingStyle!) -> SCITickLabelProtocol!
? Obviously the SciGenericType is different.
My searches aren’t pulling up anything except hits on the V2 documentation, and all of those now 404.
I’m using that call to put gesture recognizers on some tick labels. I want those gesture recognizers to be different than the one I’m putting on the entire chart. And I need to update the locations every time theX axis changes. An alternate way to achieve this would also be welcome.
- Hal Mueller asked 3 years ago
- You must login to post comments
Hi, there.
If I understand your issue correctly, you can get major ticks coordinates, like this:
1) If You use SCINumericAxis, subclass SCINumericLabelProvider and override “updateTickLabels:majorTicks:” method, like this
import SciChart.Protected.SCILabelProviderBase
class CustomLabelProvider: SCINumericLabelProvider {
override func updateTickLabels(_ formattedTickLabels: NSMutableArray!, majorTicks: SCIDoubleValues!) {
super.updateTickLabels(formattedTickLabels, majorTicks: majorTicks)
print("formattedTickLabels: \(formattedTickLabels)")
print("majorTicks: \(majorTicks)")
}
}
2) create an instance and set it to xAxis.labelProvider:
let xAxis = SCINumericAxis()
xAxis.labelProvider = CustomLabelProvider()
You will get your major ticks on each update, see the screenshot.
Let us know if that helps.
- Andriy P answered 3 years ago
-
I’m almost there. I’m getting an array of NSMutableAttributedString, and then the SciDoubleValues parameter gives me the data values in its itemsArray. What I’m really after is the UILabel itself, or at least the frame of that label, or the frame where it will be drawn. I need to put a separate gesture recognizer on each label. Suggestions?
-
I ended up taking a different path. I already had a hit test on the SciChartSurface instance. I extended that, and tested whether the tap location is outside of SciChartSurface.renderableSeriesArea.frame, and moved the logic that had been in updateDataContext(…) to that tap gesture handler.
- You must login to post comments
Please login first to submit.