我正在使用MPAndroidChart library。
performance= result.getJSONArray("performance");
for(int i = 0; i<performance.length();i++){
JSONObject jsonChildNode = performance.getJSONObject(i);
Iterator iterator = jsonChildNode.keys();
int j=0;
duration= new ArrayList<>();
barEntries= new ArrayList<>();
while(iterator.hasNext()){
String key = (String)iterator.next();
String issue = jsonChildNode.optString(key) ;
Float val=parseFloat(issue);
duration.add(key);
barEntries.add(new BarEntry(val,j));
}
j++;
barDataSet= new BarDataSet(barEntries,"Qty");
barDataSet.setColors(ColorTemplate.COLORFUL_COLORS);
barData= new BarData(duration,barDataSet);
barChart.setData(barData);
barChart.animateY(3000);
输出就像下面一样
enter image description here
答案 0 :(得分:0)
像这样循环移动j ++,
std::string func1();
int main()
{
try
{
std::string const prop = func1();
std::cout << prop << std::endl;
}
catch (std::exception const& e)
{
// Error handling ...
}
}