Hide/show series in Achartengine

笑着哭i 提交于 2019-12-11 07:25:55

问题


I have a dataset with 10 series in a Linechart.

I need to hide a serie when user click a button, and show it when user clicks again.

Is this possible with Achartengine.

Thanks.

A sample of the code:

XYSeriesRenderer r01 = new XYSeriesRenderer(); 
r01.setColor(Color.YELLOW); 
r01.setPointStyle(PointStyle.CIRCLE); 
r01.setFillBelowLine(true);
r01.setFillBelowLineColor(Color.YELLOW);
r01.setFillPoints(true);
r01.setLineWidth(4);
mRenderer.addSeriesRenderer(r01);

回答1:


One simple way is that you can set the renderer series color to "Color.TRANSPARENT", that's a 'pseudo' hiding. However, you may need to adjust the scale if you have some extreme figures.

A more complicated way would be using removeSeries() to remove all the current series and add the necessary one back to it again.




回答2:


Just remove the series and its renderer when you want to hide it and when you want it displayed, add it back and don't forget the renderer, again. You will probably have to call a repaint() on the view after each such operation.



来源:https://stackoverflow.com/questions/10640405/hide-show-series-in-achartengine

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