这里是json,我想显示与MPAndroidChart library 一起显示的图表。
[
{
"MonthName": "February",
"Year": "2016",
"IssuesCount": 3,
"ClientName": "A",
"IssueStatus": "Total",
},
{
"MonthName": "February",
"Year": "2016",
"IssuesCount": 13,
"ClientName": "B",
"IssueStatus": "Total",
},
{
"MonthName": "February",
"Year": "2016",
"IssuesCount": 1,
"ClientName": "A",
"IssueStatus": "Closed",
},
{
"MonthName": "February",
"Year": "2016",
"IssuesCount": 2,
"ClientName": "B",
"IssueStatus": "Closed",
},
{
"MonthName": "February",
"Year": "2016",
"IssuesCount": 1,
"ClientName": "A",
"IssueStatus": "OutStanding",
},
{
"MonthName": "February",
"Year": "2016",
"IssuesCount": 10,
"ClientName": "B",
"IssueStatus": "OutStanding",
},
{
"MonthName": "March",
"Year": "2016",
"IssuesCount": 1,
"ClientName": "A",
"IssueStatus": "OutStanding",
},
{
"MonthName": "March",
"Year": "2016",
"IssuesCount": 0,
"ClientName": "B",
"IssueStatus": "OutStanding",
},
{
"MonthName": "March",
"Year": "2016",
"IssuesCount": 0,
"ClientName": "A",
"IssueStatus": "Closed",
{
"MonthName": "March",
"Year": "2016",
"IssuesCount": 0,
"ClientName": "B",
"IssueStatus": "Closed",
},
{
"MonthName": "March",
"Year": "2016",
"IssuesCount": 3,
"ClientName": "A",
"IssueStatus": "Total",
},
{
"MonthName": "March",
"Year": "2016",
"IssuesCount": 9,
"ClientName": "B",
"IssueStatus": "Total",
}
]
我正在使用MPAndroidChart库,请建议如何继续这样做。我很难将特定月份的详细信息分组并显示单个月的多个条形图。
修改
答案 0 :(得分:1)
这是可能的。
你需要什么:
BarData
个对象,填充:BarEntries
barData.setGroupSpace(...)
barDataSet.setBarSpace(...)
可以像这样创建堆叠的BarEntry
:
new BarEntry(new float[] { stackvalue1, stackvalue2 }, xIndex);
xIndex
对应于条目应映射到的x轴上的月份(在您的情况下)。
This example创建的图表就像您在上图中显示的图表一样。