Skip to content Skip to sidebar Skip to footer

MPAndroidChart BarChart XValues Issue

I noticed an issue with the BarChart of MPAndroidChart and need a fix. First my code: this.barChart = (BarChart) view.findViewById(R.id.bar_fragment_bar_chart); this.barChart.setDr

Solution 1:

I'm not exactly sure what you want. But to center the x-labels above the bars, call:

chart.getXLabels().setCenterXLabelText(true);

As for the groups inside the barchart, maybe you should check out the example project and see what is done here:

https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java

Update:

If you simply want to have a separate color for each day, put all entries in one DataSet, and add 7 colors (one for each day) to the dataset. The x-values array in that case needs to be as long as the array of entries you provided, containing the different dates.


Post a Comment for "MPAndroidChart BarChart XValues Issue"