AAChartModel / AAChartKit

📈📊🚀🚀🚀An elegant modern declarative data visualization chart framework for iOS, iPadOS and macOS. Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types. 极其精美而又强大的现代化声明式数据可视化图表框架,支持柱状图、条形图、折线图、曲线图、折线填充图、曲线填充图、气泡图、扇形图、环形图、散点图、雷达图、混合图等各种类型的多达几十种的信息图图表,完全满足工作所需.
https://cocoapods.org/pods/AAChartKit
MIT License
4.72k stars 751 forks source link

自定义图例饼图怎么显示隐藏某一块? #1550

Closed CoderLR closed 3 months ago

CoderLR commented 3 months ago

折线图可以使用aa_hideTheSeriesElementContentWithSeriesElementIndex、aa_showTheSeriesElementContentWithSeriesElementIndex来控制Series的显示和隐藏。 但是,饼图的话只有一个Series,请问我点击自定义的图例调用什么方法来显示和隐藏呢?

AAChartModel commented 3 months ago

参考:

AAChartModel commented 3 months ago

参考此次提交的内容:

关键内容为:

- (void)showOrHideDataPointOfSeriesElementWithDataPointIndex:(NSUInteger)dataPointIndex isVisible:(BOOL)isVisible {
    NSString *jsStr = [NSString stringWithFormat:@AAJSFunc(function showDataPoint(pointIndex, visibility) {
        let point = aaGlobalChart.series[0].data[pointIndex];
        point.setVisible(visibility);
    }

    showDataPoint(%tu, %u)), dataPointIndex, isVisible];

    [self.aaChartView evaluateJavaScript:jsStr completionHandler:^(id item, NSError * _Nullable error) {
        NSLog(@"%@",error);
    }];

    NSLog(@"隐藏或显示 dataPointIndex 值为 %tu", dataPointIndex);
}