MPAndroidChart-如何更改PieChart中心背景的颜色? [英] MPAndroidChart - How to change the color of PieChart center Background?

查看:138
本文介绍了MPAndroidChart-如何更改PieChart中心背景的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 MPAndroidChart 库来开发圆形图表.但是只有饼图可用.所以我尝试给出两个xvalue坐标,一种颜色类似于背景.所以我得到了类似于圆图的东西.但是我无法更改饼图中的中心文本的背景颜色和字体颜色?

Im trying to use the MPAndroidChart library to develop a circular chart. But only Pie chart is available. So i tried giving two xvalue coordinates, with one color similar to background. So i got something similar to circular chart. But i'm not able to change the background color and font color of center text inside the pie chart?

谢谢!

推荐答案

有两种可能的解决方案:

There are two possible solutions:

检索图表使用的 Paint 对象绘制中心孔"并按所需方式对其进行修改

Retrieve the Paint object used by the chart to draw the "center-hole" and modify it the way you want

Paint p1 = mChart.getPaint(Chart.PAINT_HOLE);
p1.setColor(...);

Paint p2 = mChart.getPaint(Chart.PAINT_CENTER_TEXT);
p2.setColor(...);

或者,如果您仍然只显示一个值,请使用此选项: CircleDisplay

Or use this, if you only display one value anyway: CircleDisplay

这篇关于MPAndroidChart-如何更改PieChart中心背景的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆