Mpandroidchart: How to style the "no data set" text?

Created on 16 Sep 2014  路  5Comments  路  Source: PhilJay/MPAndroidChart

Hi Phil,

is there any way to customize look & feel of No chart data available text in the same way ?

.setTextColor(...);
.setTypeface(...);
.setTextSize(...);

Right now it is available in orange color only.
Thanks in advance!

Most helpful comment

Not directly, but the chart provides a method called getPaint(int which) that allows you to retrieve any Paint object used for drawing.

So you can do it like this:

Paint p = mChart.getPaint(Chart.PAINT_INFO);
p.setTextSize(...);
p.setColor(...);
p.setTypeface(...);
//... and so on

I hope this helps.

Regards,
Phil

All 5 comments

Not directly, but the chart provides a method called getPaint(int which) that allows you to retrieve any Paint object used for drawing.

So you can do it like this:

Paint p = mChart.getPaint(Chart.PAINT_INFO);
p.setTextSize(...);
p.setColor(...);
p.setTypeface(...);
//... and so on

I hope this helps.

Regards,
Phil

This did the trick,
thank you for extra explanation with short code snippet.
Now it is fully customizable within Paint object!

thank you :)

Ty, kinda surprised there no direct way to modify it...

Do not forget to chart.validate(); right after you are done editing Paint.

Was this page helpful?
0 / 5 - 0 ratings