Crosshair gets mixed up on Rotate


Hello again,

I’ve noticed that with the latest release (2.9.1, but could have also been in some earlier versions) that if the user displays a cross-hair, then rotates the device, the crosshair is then at the incorrect coordinates. In the version I was using previously (, the crosshair rotated correctly with the chart.

I was able to reproduce this in the included “Getting Started” objC example.

  1. Add “lineSeries.crosshairEnabled = YES;” in SeriesAtIndex.
  2. Add “chart.crosshair = [[SChartCrosshair alloc] initWithChart: chart];” in ViewDidLoad.

This isn’t a major issue, but is certainly an annoyance. Is there a simple work-around for this?

Thank you.


Hi cbolton,

Thanks for bringing this to our attention!

I have implemented a work around solution that involves adding the “viewWillTransitionToSize” implementation below:

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
    [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context)
         SChartCrosshair *ch = (SChartCrosshair *)_chart.crosshair;
         double pixelX = _chart.plotAreaFrame.origin.x + [_chart.xAxis pixelValueForDataValue:@(ch.trackingPoint.x)];
         double pixelY = _chart.plotAreaFrame.origin.y + [_chart.yAxis pixelValueForDataValue:@(ch.trackingPoint.y)];
         CGPoint point = CGPointMake(pixelX, pixelY);
         [_chart.crosshair showAtPoint:point inChart:_chart];
     } completion:^(id<UIViewControllerTransitionCoordinatorContext> context){}];
    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];

I have informed our development team of this issue and we will update this forum post when a fix for this issue has been released.

Sorry for any inconvenience this may cause.

Kind regards,
Andrew Polkinghorn.


Thank you for the work around. Looks good again now.