我正在使用MPAndroid图表,并且在这里遵循教程Android Bar & Radar Chart using Volley MSQL PHP JSON

但是,我收到此错误

java - MPAndroid图表,带有来自Volley的json数据-LMLPHP

我该如何解决这个TIA。

我正在使用MPAndroidChart 3.0.3

最佳答案

您的解决方案在这里


因为MPchart无法通过String设置其描述。

Description description = new Description();
description.setText("Add Your string here");
chart.setDescription(description);



  您可以像下面的代码一样设置BarData:


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();

关于java - MPAndroid图表,带有来自Volley的json数据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52773118/

10-14 09:15