Is there any way to change the message "No chart data available" when the chart is not populated?
Edit: Found the answer
chart.setNoDataText("Description that you want");
Is there any way to change the message "No chart data available" when the chart is not populated?
Edit: Found the answer
chart.setNoDataText("Description that you want");
On
If you also want to customize look & feel, you can do it through Paint object:
mChart.setNoDataText("Description that you want");
Paint p = mChart.getPaint(Chart.PAINT_INFO);
p.setTextSize(...);
p.setColor(...);
p.setTypeface(...);
...
On
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_firestore__eintraege__heute);
mChart = findViewById(R.id.chartZuckerHeute);
mChart.setNoDataText("PUT IT HERE ON TOP; WORKED FOR ME");
On
It's a little bit old thread, but I had the same issue so my solution was to set nodatatext immediately after the initialization of a chart:
PieChart pieChart = findViewById(R.id.chart) //in case of fragment view.findViewById(R.id.chart)
pieChart.setNoDataText("Loading");
On
If setNoDataText is not working, you have to set it (and after that run an invalidate()) when you are initializing the chart. Don't do it when you are right away to set the data.
update answer