Pre loader

updateDataContext(...)

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

1
0

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.

Version
4.1.1
  • You must to post comments
1
0

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.

Images
  • Hal Mueller
    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?
  • Hal Mueller
    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 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