Reputation: 53
I'm using MPAndroid Chart, and I'm following the tutorial here Android Bar & Radar Chart using Volley MSQL PHP JSON
However, I'm getting this error
How can I fix this TIA.
I am using MPAndroidChart 3.0.3
Upvotes: 2
Views: 803
Reputation: 53
This is the problem,
Candidates name should be in X axis, Scores in Y axis, But look at the chart... Wrong destination of x and y, and the value of each x a is became nos
Upvotes: 0
Reputation: 53
thanks, but I cannot display the "text" value of X-axis, it will become numeric and goes to Y-axis, and the value of Y-axis became the labels of X-axis...
Upvotes: 0
Reputation: 3401
Your solution is here
Because the MPchart Can't set his description by String.
Description description = new Description();
description.setText("Add Your string here");
chart.setDescription(description);
You can set BarData like below code :
BarDataSet set1;
set1 = new BarDataSet(xValue, "");
set1.setDrawIcons(true);
set1.setStackLabels(new String[]{"Male", "Female"});
set1.setDrawValues(true);
set1.setValueTextSize(12f);
set1.setColors(ColorTemplate.JOYFUL_COLORS);
BarData data1 = new BarData(set1);
data1.setBarWidth(15f);
positiveChart.setData(data1);
positiveChart.setFitBars(true);
positiveChart.invalidate();
Upvotes: 1