Annotation and redraw


#1

I would like a bit more explanation on how the annotations work.

I have a financial chart (stock quotes) on which I would like to draw a horizontal line for the open price of the stock and another one for the last price.

All this works well.my graph is drawn without issues.

When I zoom in to the point of only seeing the lasp price and no longer the open price I have a problem. My app redraw the chart when a new quote comes in. This works fine too but… the chart is rescaled to a size that makes the open annotation visible again and I would like to avoid that.

This is the way my delegate for the chart is written.

- (void)sChartRenderFinished:(ShinobiChart *)chart
{
    if (firstChartRender) {
        firstChartRender = NO;
    }
    if (self.tradingAsset.tradingAssetPrice > 0 && self.tradingAsset.tradingAssetOpenPrice > 0) {
        if (!self.openAnnotation) {
            self.openAnnotation = [SChartAnnotation horizontalLineAtPosition:[NSNumber numberWithFloat:self.tradingAsset.tradingAssetOpenPrice]
                                                                                withXAxis:chart.xAxis
                                                                                 andYAxis:chart.yAxis
                                                                                withWidth:2.f
                                                                                withColor:[UIColor yellowColor]];
            self.openAnnotation.position = SChartAnnotationBelowData;
            [chart addAnnotation:self.openAnnotation];
        }
        if (!self.lastAnnotation) {
            self.lastAnnotation = [SChartAnnotation horizontalLineAtPosition:[NSNumber numberWithFloat:self.tradingAsset.tradingAssetPrice]
                                                                                withXAxis:chart.xAxis
                                                                                 andYAxis:chart.yAxis
                                                                                withWidth:2.f
                                                                                withColor:[UIColor whiteColor]];
            self.lastAnnotation.position = SChartAnnotationAboveData;
            [chart addAnnotation:self.lastAnnotation];
        } else {
            self.lastAnnotation.yValue = [NSNumber numberWithFloat:self.tradingAsset.tradingAssetPrice];
        }

    }

}

Am I missing something or does it means that when the chart is redrawn it is also rescaled to a size that automatically makes all the annotations visible?