Change/Remove Achartengine label backgroundcolor
Does anybody know a way to change or remove the background colors for the X labels in Achartengine for And开发者_运维百科roid?
I went through the documentation and the demo source, but couldn't find a way to do this with the supplied functions. Maybe I just didn't see it, but else I probably need to import the source itself and modify it when drawing the labels.
Before doing that I was wondering if anybody came across this issue and found a solution. Please let me know if you do. :)
Thanks.
So after a couple of hours working my way through the source code, I found out that the colors of the Label background is the same as the background of margins. So basically it is not possible to only change the background color of the Label.
The color of the margins can be set with:
renderer.setMarginsColor(int);
However, this somehow doesn't support transparency in colors, so it didn't fullfill my needs.
In the draw()
function of the XYChart
class in the org.achartengine.chart
package I found (somewhere around line 270 of the class):
drawBackground(mRenderer, canvas, x, bottom, width, height - bottom, paint, true, mRenderer.getMarginsColor());
This function draws the background color under the labels. I commented it out and it worked.
It works like a charm, as long as I don't need any graphs that do need that color.
Hopefully a future release will enable developers to do this without the need of editing the source.
精彩评论