1

对于我的图表实现,我希望用户能够选择他们认为合适的任意数据点。The issue is that it seems like whenever another data point is selected, the previous one gets deselected. 唯一可行的方法是将所选BOOL对象作为我的数据源对象的一部分,然后在每次选择时在图表上调用reloadData和。redrawChart

-(void)sChart:(ShinobiChart *)chart toggledSelectionForPoint:(SChartDataPoint *)dataPoint inSeries:(SChartSeries *)series atPixelCoordinate:(CGPoint)pixelPoint {

...

    myDataObject.selected = !myDataObject.selected;
    dataPoint.selected = myDataObject.selected;
    [self.chart reloadData];
    [self.chart redrawChart];
}

然后dataPointAtIndex将处理它。

-(id<SChartData>)sChart:(ShinobiChart *)chart dataPointAtIndex:(NSInteger)dataIndex forSeriesAtIndex:(NSInteger)seriesIndex {
...
datapoint.selected = myDataObject.selected;
}

但这似乎是一种浪费,效率较低的做事方式,而且这没有在选择之间保持放大的好处。

4

1 回答 1

0

我想你要找的是series.togglePointSelection = YES. 这将允许系列点的选择切换,而不是一次只设置一个。

希望这可以帮助!

于 2014-08-20T07:46:35.783 回答