Pre loader

Crash when using rollover modifier

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

I’m getting the following crash:

2020-02-14 16:45:43.902812-0500 CommonStock Development[2425:710225] -[SCIRolloverModifier onTouchesCancelled:]: unrecognized selector sent to instance 0x282ffe080
2020-02-14 16:45:43.904098-0500 CommonStock Development[2425:710225] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[SCIRolloverModifier onTouchesCancelled:]: unrecognized selector sent to instance 0x282ffe080’

whenever I try to scrub my chart, I must also note that in order for the legend to show, I have to tap really hard on the surface.

This is my code:

func set(data set: SimpleChartDataSet, alternate: SimpleChartDataSet) {

    let lineDataSeries = SCIXyDataSeries(xType: .double, yType: .double)
    let dashedDataSeries = SCIXyDataSeries(xType: .double, yType: .double)

    let group = DispatchGroup()
    group.enter()

    DispatchQueue.global(qos: .userInteractive).async {
        for (index, i) in set.enumerated() {
            lineDataSeries.append(x: Double(index), y: Double(i))
        }

        for (index, i) in alternate.enumerated() {
            dashedDataSeries.append(x: Double(index), y: Double(i))
        }

        group.leave()
    }

    group.notify(queue: .main) {

        let lineSeries = SCIFastMountainRenderableSeries()
        lineSeries.zeroLineY = set.min() ?? 0.0
        lineSeries.dataSeries = lineDataSeries
        lineSeries.strokeStyle = SCISolidPenStyle(color: UIColor.green, thickness: 2.0)
        lineSeries.areaStyle =  SCILinearGradientBrushStyle(start: CGPoint(x: 0, y: 1), end: CGPoint(x: 0, y: 0), start: UIColor.green, end: UIColor.clear)

        let dashedSeries = SCIFastLineRenderableSeries()
        dashedSeries.zeroLineY = set.min() ?? 0.0
        dashedSeries.dataSeries = dashedDataSeries
        dashedSeries.strokeStyle = SCISolidPenStyle(color: UIColor.white, thickness: 2.0, strokeDashArray: [2.0,2.0,2.0,2.0])

        SCIUpdateSuspender.usingWith(self.surface) {

            self.surface.xAxes.clear()
            self.surface.yAxes.clear()
            self.surface.renderableSeries.clear()

            let xAxis = SCINumericAxis()
            xAxis.drawLabels = false
            xAxis.drawMajorBands = false
            xAxis.drawMajorGridLines = false
            xAxis.drawMinorGridLines = false
            xAxis.drawMinorTicks = false
            xAxis.drawMajorTicks = false
            xAxis.drawLabels = false

            let yAxis = SCINumericAxis()
            yAxis.drawLabels = false
            yAxis.drawMajorBands = false
            yAxis.drawMajorGridLines = false
            yAxis.drawMinorGridLines = false
            yAxis.drawMinorTicks = false
            yAxis.drawMajorTicks = false
            yAxis.drawLabels = false

            self.surface.xAxes.add(items: xAxis)
            self.surface.yAxes.add(items: yAxis)
            self.surface.renderableSeries.add(items: lineSeries, dashedSeries )
            self.surface.chartModifiers.add(SCIRolloverModifier())
        }
    }
}
Version
3
  • You must to post comments
0
0

Update: I updated to the latest nightly release and now it’s not crashing BUT one issue still remains: I can only interact with the chart if I tap EXACTLY on the line of the mountain series, and it doesn’t really scrub (follow my drag)

Could this be because it’s inside a collection view cell?

  • You must to post comments
0
0

Hi, there.

Thanks for your question.

If I understand you correctly I think the problem is that collection view scroll interferes rollover scroll. For example, if your collection view scrolls vertically, the rollover will not work when you drag vertically. The same is with a horizontal scroll.

What I suggest is to play with a collection view scroll to disable it at some point.
See example below:

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView *view = [super hitTest:point withEvent:event];
if ([view isKindOfClass:[SCILayoutableView class]]) {
    self.scrollEnabled = NO;
} else {
    self.scrollEnabled = YES;
}
return view;

}

Let us know if it helps.

  • Pascale Beaulac
    It would be better if the function was added to the class. SCIRolloverModifier func onTouchesCancelled(_ :). Even if it does nothing with the call this would be a cleaner solution. I am having the same problem, and my surface is also part of a UICollectionViewController.
  • 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