AChartEngine transparent background

别等时光非礼了梦想. 提交于 2019-12-17 18:36:33

问题


I have a problem. I'm making a graph with AChartEngine and I would like to have the background of the whole graph to be transparent:

XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
(...)
renderer.setMargins(new int[]{0,0,0,0});
renderer.setApplyBackgroundColor(true);
renderer.setMarginsColor(Color.TRANSPARENT);
renderer.setBackgroundColor(Color.TRANSPARENT);
(...)
GraphicalView g = ChartFactory.getTimeChartView(this, dataset, renderer, "dd/MM");

But it isn't working properly:

As you can see, there is a black box appearing behind the x-labels. What am I doing wrong?

Thanks in advance,
yellos


回答1:


Try setMarginsColor(Color.argb(0x00, 0x01, 0x01, 0x01)); It looks like there's a bug when setting the color as black transparent




回答2:


If you want to set transparent background color, you can try:

renderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00));

It just be work for me!



来源:https://stackoverflow.com/questions/9314342/achartengine-transparent-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!