问题描述
如何更改超出限制线的条形图的颜色?现在,越过极限线的条会更改颜色.但是,我想更改穿过极限线的零件的颜色.
How to change the color of the bar chart past the limit line?Now, bars that cross the limit line change color.But, I want to change the color of the part cross the limit line.
推荐答案
我认为您可以使用stackedBarChart
来实现.
I think you can achieve that with stackedBarChart
.
在文档中,您可以看到如何为每个添加数据酒吧.这样,您将如下所示设置条形图的数据:
Here in the docs you can see how to add the data for each bar.With this, you will set the data for a barchart as follows:
BarEntry(xPosition, floatArray(belowLineNumber, aboverLineNumber)
对于颜色,您只需要为数据集添加颜色列表(在您的特定情况下为两种颜色):
For the colors, you just need to add a list of colors fot the data set(two colors in your specific case):
dataSet.color = listOf(YourColor1, YourColor2)
希望有帮助!
这篇关于MPAndroidChart如何更改超过极限线的条形图的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!