0
我正在開發一個項目,我必須在圖形表示中顯示數據。爲了實現這一目標,我使用了Mpchart庫。根據我的項目要求,我必須根據該酒吧編號在同一索引上顯示酒吧的每一根酒吧,但它正變成我不想擁有的堆疊酒吧。如何通過使用MpChart製作堆疊條形圖來停止圖android
例如: -
ArrayList<String> labels = new ArrayList<String>();
labels.add("January");
labels.add("February");
labels.add("March");
labels.add("April");
labels.add("May");
labels.add("June");
labels.add("March");
labels.add("April");
labels.add("May");
labels.add("June");
// for create Grouped Bar chart
ArrayList<BarEntry> group1 = new ArrayList<>();
group1.add(new BarEntry(1f, 0));
group1.add(new BarEntry(8f, 0));
group1.add(new BarEntry(1f, 0));
group1.add(new BarEntry(1f, 0));
ArrayList<BarEntry> group2 = new ArrayList<>();
group2.add(new BarEntry(2f, 1));
group2.add(new BarEntry(2f, 1));
group2.add(new BarEntry(2f, 1));
group2.add(new BarEntry(2f, 1));
ArrayList<BarEntry> group3 = new ArrayList<>();
group3.add(new BarEntry(3f, 2));
group3.add(new BarEntry(3f, 2));
group3.add(new BarEntry(3f, 2));
group3.add(new BarEntry(3f, 2));
ArrayList<BarEntry> group4 = new ArrayList<>();
group4.add(new BarEntry(4f, 3));
group4.add(new BarEntry(4f, 3));
group4.add(new BarEntry(4f, 3));
group4.add(new BarEntry(4f, 3));
ArrayList<BarEntry> group5 = new ArrayList<>();
group5.add(new BarEntry(5f, 4));
group5.add(new BarEntry(5f, 4));
group5.add(new BarEntry(5f, 4));
group5.add(new BarEntry(5f, 4));
ArrayList<BarEntry> group6 = new ArrayList<>();
group6.add(new BarEntry(6f, 5));
group6.add(new BarEntry(6f, 5));
group6.add(new BarEntry(6f, 5));
group6.add(new BarEntry(6f, 5));
ArrayList<BarEntry> group7 = new ArrayList<>();
group7.add(new BarEntry(7f, 6));
group7.add(new BarEntry(7f, 6));
group7.add(new BarEntry(7f, 6));
group7.add(new BarEntry(7f, 6));
ArrayList<BarEntry> group8 = new ArrayList<>();
group8.add(new BarEntry(8f, 7));
group8.add(new BarEntry(8f, 7));
group8.add(new BarEntry(8f, 7));
group8.add(new BarEntry(8f, 7));
ArrayList<BarEntry> group9 = new ArrayList<>();
group9.add(new BarEntry(9f, 8));
group9.add(new BarEntry(9f, 8));
group9.add(new BarEntry(9f, 8));
group9.add(new BarEntry(9f, 8));
ArrayList<BarEntry> group10 = new ArrayList<>();
group10.add(new BarEntry(10f, 9));
group10.add(new BarEntry(10f, 9));
group10.add(new BarEntry(10f, 9));
group10.add(new BarEntry(10f, 9));
BarDataSet barDataSet1 = new BarDataSet(group1, "Group 1");
barDataSet1.setColors(ColorTemplate.COLORFUL_COLORS);
barChart.isTransitionGroup();
BarDataSet barDataSet2 = new BarDataSet(group2, "Group 2");
barDataSet2.setColors(ColorTemplate.COLORFUL_COLORS);
BarDataSet barDataSet3 = new BarDataSet(group3, "Group 3");
barDataSet3.setColors(ColorTemplate.COLORFUL_COLORS);
BarDataSet barDataSet4 = new BarDataSet(group4, "Group 4");
barDataSet4.setColors(ColorTemplate.COLORFUL_COLORS);
BarDataSet barDataSet5 = new BarDataSet(group5, "Group 5");
barDataSet5.setColors(ColorTemplate.COLORFUL_COLORS);
BarDataSet barDataSet6 = new BarDataSet(group6, "Group 6");
barDataSet6.setColors(ColorTemplate.COLORFUL_COLORS);
BarDataSet barDataSet7 = new BarDataSet(group7, "Group 7");
barDataSet7.setColors(ColorTemplate.COLORFUL_COLORS);
BarDataSet barDataSet8 = new BarDataSet(group8, "Group 8");
barDataSet8.setColors(ColorTemplate.COLORFUL_COLORS);
BarDataSet barDataSet9 = new BarDataSet(group9, "Group 9");
barDataSet9.setColors(ColorTemplate.COLORFUL_COLORS);
BarDataSet barDataSet10 = new BarDataSet(group10, "Group 10");
barDataSet10.setColors(ColorTemplate.COLORFUL_COLORS);
它使杆放樣和相同的索引條彼此重疊。
我怎麼能並排顯示出來的一面。
我使用的庫Mpchart版本提前2.1.6
謝謝。