[chart.crosshair showAtPoint:inChart] has strange 1st time behavior


#1

Please see this video http://take.ms/y2A4X

In sChartRenderFinished delegate, I’m trying to show the crosshair at a remember point on the chart where user has previously selected. Using the following code.

[self.theChart.crosshairshowAtPoint:CGPointMake(rememberedCrossHairX, 0) inChart:self.theChart];

1st half of the video showing: The crosshair shows correctly at the correct position. However pan or zoom or changing axisRange doesn’t make the crosshair follow the chart. Is this a bug?

2nd half of the video showing: normal behaviour after a long-tap to activate the crosshair behavior.


#2

Hi torinnguyen,

Thanks for getting in touch - this is a known issue with the new crosshair API, where there is no way to inform the chart if the crosshair is shown or hidden. Unfortunately this means the chart assumes the crosshair is hidden and will pass gestures through to the panning code, instead of the crosshair code. This has been raised as something we’re hoping to fix before the next release, so I’ve noted this forum post on our internal bug tracker so we’ll let you know when the release is out.

Kind regards


#3

Is it possible to give me an ETA for the next release? I’m planning to release my app to the app store soon.

Currently, I create a boolean flag to track whether the 1st crosshair is being shown or not. If the 1st crosshair is currently being shown upoin any pan/zoom event, I would hide the crosshair immediately. This is a bad UX, but I can’t think of a simpler way to workaround it. Any suggestion?


#4

Hi Torinn,

Apologies it’s taken a while to get back to you.

This is currently very high on our list of priorities (it’s likely it’ll be completed in the next month), however I’m afraid I can’t offer anything much more concrete than that. I’ll make sure we add a note to the task to ensure that you’re updated as soon as this fix goes out.

Kind regards,

Sam


#5

Hello,

I can confirm that the problem still exists at ShinobiCharts - Version: 2.8.5-ALPHA1

Also there is another problem which probably related to this one.

I am trying to position crosshair pragrammatically to the latest dataPoint in the series with the following code:

-(void) showRandomCrosshair: (UIButton*) sender {
    NSArray * series = self.lineChart.series;
    SChartMappedSeries * crosshairSeries = series[0];
   
    NSArray * dataPoints = [crosshairSeries dataSeries].dataPoints;
    NSUInteger cnt = dataPoints.count;
   
    if ( cnt == 0) {
        return;
    }

    SChartDataPoint *dataPoint = dataPoints[cnt-1];

    SChartPoint point;
   
    NSNumber * xDP = @([(NSDate*)dataPoint.sChartXValue timeIntervalSince1970]);

    point.x = xDP.doubleValue;

    point.y = [dataPoint.sChartYValue doubleValue];
    SChartCrosshair* crosshair = (SChartCrosshair*) self.lineChart.crosshair;
   
    crosshair.enableCrosshairLines = YES;
    crosshair.interpolatePoints = NO;
    crosshair.outOfRangeBehavior = SChartCrosshairOutOfRangeBehaviorHide;
    crosshair.trackingSeries = crosshairSeries;

    CGPoint viewPoint = CGPointMake(
                                    [self.lineChart.xAxis pixelValueForDataValue: @(point.x)],
                                    [self.lineChart.yAxis pixelValueForDataValue: @(point.y)]
                                    );

    crosshair.trackingPoint = point;
    [crosshair showAtPoint:viewPoint inChart:self.lineChart];

}

Please note I have timeseries with NSDate as x values. This code kind of works, but does not show crosshair on the last point in the series.

It seems there is some code to keep crosshair tooltip onscreen ?

This is visual result, my intent was to attach crosshair to the LAST point:


#6

Hi deem0n,

We’ve not yet fixed the original issue - keep an eye on the changelog in our releases to know when this has been fixed.

It’s hard to say if the issue you have reported is related to the original issue in this thread. It would be really useful if you could send us a reproducible example of this to info@shinobicontrols so we can take a closer look.

Thanks

Ryan