use of com.github.mikephil.charting.formatter.StackedValueFormatter in project openScale by oliexdev.
the class GraphFragment method generateColumnData.
private void generateColumnData() {
int[] numOfMonth = openScale.getCountsOfMonth(calYears.getYear());
LocalDate calMonths = LocalDate.of(calYears.getYear(), 1, 1);
List<IBarDataSet> dataSets = new ArrayList<>();
for (int i = 0; i < 12; i++) {
List<BarEntry> entries = new ArrayList<>();
entries.add(new BarEntry(calMonths.getMonthValue() - 1, numOfMonth[i]));
calMonths = calMonths.plusMonths(1);
BarDataSet set = new BarDataSet(entries, "month " + i);
set.setColor(ColorUtil.COLORS[i % 4]);
set.setDrawValues(false);
set.setValueFormatter(new StackedValueFormatter(true, "", 0));
dataSets.add(set);
}
BarData data = new BarData(dataSets);
chartTop.setData(data);
chartTop.setFitBars(true);
chartTop.invalidate();
}
Aggregations