【发布时间】:2016-11-29 05:38:55
【问题描述】:
我正在使用Charts 绘制饼图。它工作正常,但我需要将选定的部分索引传递给下一个视图控制器。我使用了下面的代码,还阅读了他们的release notes for Charts 3.0。我在 Swift 3 中工作。在以前的版本中,选定的索引是从 entry.dataSetIndex 获得的。
通过这段代码,我总是得到 0 索引。请帮忙。
extension ViewController: ChartViewDelegate {
func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) {
print(highlight.dataSetIndex)
}
}
【问题讨论】:
标签: ios charts swift3 pie-chart