Removing crosshair after resetting series and reloading chart



I have a line series chart with two cases: a combined line of all values or, if the user unchecks a checkbox, mulitple lines representing each set of data. If I have a crosshair showing on the single line, say, and toggle the checkbox, I reload the data on the chart, get multiple lines as expected and then the crosshair returns.

The code is similar to this

     [(SChartCrosshair *)self.chart.crosshairremoveCrosshair];


Calling hide on the crosshair exhibits the same behaviour. Calling removeCrosshair before reloadData exhibits the same behaviour as well. I’ve tried setting selected to NO on my data points and my series. The tooltip comes back every time.

Here’s what I’d like: if the crosshair is showing when the user taps the checkbox, the crosshair hides, the chart resets zoom and shows the single line or multiple line as appropriate. 




Greetings Program!

I was trying to replicate the issue with the “MultipleAxes” sample app but couldn’t. The sample app is fairly simple so I can’t really say if it was a good test but I added a button to it to toggle between one and two series and used your code above for the action.

- (void)viewDidLoad
    [super viewDidLoad];

    // Create the chart and add to the view code.

    UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 140, 50)];
    [button addTarget:self
    button.backgroundColor = [UIColor redColor];

    [self.view addSubview:button];

    _numberOfSeries = 1;

-(void) buttonClicked:(id)sender
    _numberOfSeries = _numberOfSeries == 1 ? 2 : 1;

    [_chart reloadData];
    [_chart redrawChart];

    [(SChartCrosshair *)_chart.crosshair removeCrosshair];

    [_chart.xAxis resetZoomLevelWithAnimation:YES];
    [_chart.yAxis resetZoomLevelWithAnimation:YES];

-(SChartSeries*)sChart:(ShinobiChart *)chart seriesAtIndex:(NSInteger)index {
    SChartLineSeries* lineSeries = [[SChartLineSeries alloc] init];
    SChartLineSeries* lineSeries2 = [[SChartLineSeries alloc] init];
// SChartColumnSeries* columnSeries = [[SChartColumnSeries alloc] init];
    lineSeries.crosshairEnabled = true;
    lineSeries2.crosshairEnabled = true;

// return index == 1 ? columnSeries : lineSeries;
    return index == 1 ? lineSeries : lineSeries2;

See if you can replicate the issue in the sample app or perhaps post some more of your chart code.