我正在使用 ios-charts 并成功实现了堆叠条形图。 但是,我想在每个堆叠条的顶部仅显示堆叠总数,而不是堆叠条的每个条目的值。 目前,我所能做的就是隐藏单个值,并将 ChartDataSet.drawValuesEnabled 设置为 false。
这是可行的吗?
谢谢!
最佳答案
不确定是否有更简单的方法,但您可以使用 MarkerView
来实现这一目标。 MarkerView
将显示突出显示的条目,因此在附加它后,您需要通过突出显示方法之一突出显示图表中的所有条目:
highlightValue(int xIndex, int dataSetIndex)
Highlights the value at the given x-index in the given DataSet.
highlightValues(Highlight[] highs)
Highlights the values at the given indices in the given DataSets.
关于ios-charts/mpandroidcharts 堆叠条形标签总计而不是每个条目的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33691834/