Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPAndroidChart: How to hide chart background?

I'm using MPAndroidChart library v2.0.8. I can modify the background just outside the barchart but inside, there is still a grey background and I don't know which method I can use.

barchart = (BarChart) findViewById(R.id.chart);
barchart.setBackgroundColor(getRessouces().getColor(R.color.default_color));

I have this result :

enter image description here

I would like the default color into the chart too.

Thanks a lot,

Kamel

like image 264
Kmel Avatar asked Aug 10 '26 17:08

Kmel


1 Answers

Have a look at the documentation.

You can remove or modify the background behind the "drawing-area" with these two methods:

  • setDrawGridBackground(boolean enabled): If enabled, the background rectangle behind the chart drawing-area will be drawn.
  • setGridBackgroundColor(int color): Sets the color the grid-background should be drawn with.
like image 152
Philipp Jahoda Avatar answered Aug 13 '26 09:08

Philipp Jahoda