2
我使用Charts来绘制饼图。它工作正常,但我需要将选定的部分索引传递给下一个viewcontroller。我使用下面的代码,并阅读他们的release notes图表3.0。我在Swift 3中工作。在以前的版本中,所选索引是从entry.dataSetIndex获得的。danielgindi /图表饼图选定索引
通过此代码我总是得到0索引。请任何帮助。
extension ViewController: ChartViewDelegate {
func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) {
print(highlight.dataSetIndex)
}
}
我真的很感谢你的回答,节省我的时间。 真的非常感谢这篇文章。 –