Android controls chart background


#1

Hi,

I’m trying to change background of a simple ChartView instantiated in XML with no luck.  I’m able to add controls and datasets, but am unsure of how to change it.  Changing the view’s background as so:

chartView.setBackgroundColor(getResources().getColor(R.color.white));

doesn’t work, but it makes sense it wouldn’t do. I can’t seem to find any chart style that would change it.  Any help would be much appreciated.

Ryan


#2

When using fragments it goes like below, so I guess with views it should be similar (haven’t used the view mode, so can’t say for sure).

ChartStyle chartStyle = getShinobiChart().getStyle();

chartStyle.setPlotAreaBackgroundColor(Color.WHITE);

chartStyle.setCanvasBackgroundColor(Color.WHITE);

chartStyle.setBackgroundColor(Color.WHITE);


#3

Yep, that works.  Turns out the reason I couldn’t find a method in the style is that I had been referencing the DataSeries’ style, rather than the view’s. Doh.

Ryan