如何在 CombinedChart 中突出显示一个 BarDataSet 条目?
How to highlight one BarDataSet entry in a CombinedChart?
我正在使用 MPAndroidChart。我有一个组合图表,由一个条形图和一个折线图组成。当我打开图表 activity 时,我希望在 x 位置 3.0f 处突出显示条形图的条目。当我调用 mCombinedChart.highlight(3.0f, int dataSetIndex, false)
时,它会给我一个空指针异常,而不管我有什么 int
作为数据集索引。我怎样才能实现我的目标?
创建高亮对象:Highlight high = new Highlight(float x, int dataSetIndex);
调用设置数据索引方法: high.setDataIndex(int dataIndex);
mCombinedChart.highlightValue(high, false)
使用setDataIndex方法选择您要使用的组合图表的数据对象,并将dataSetIndex值作为您选择的数据对象的数据集的索引。
我正在使用 MPAndroidChart。我有一个组合图表,由一个条形图和一个折线图组成。当我打开图表 activity 时,我希望在 x 位置 3.0f 处突出显示条形图的条目。当我调用 mCombinedChart.highlight(3.0f, int dataSetIndex, false)
时,它会给我一个空指针异常,而不管我有什么 int
作为数据集索引。我怎样才能实现我的目标?
创建高亮对象:
Highlight high = new Highlight(float x, int dataSetIndex);
调用设置数据索引方法:
high.setDataIndex(int dataIndex);
mCombinedChart.highlightValue(high, false)
使用setDataIndex方法选择您要使用的组合图表的数据对象,并将dataSetIndex值作为您选择的数据对象的数据集的索引。