I am using the MPAndroidChart library. In BarChart by-default all the bars are vertical (bottom-up), how to display it in horizontally?
There are two types of bar-charts in terms of orientation.
BarChart
, looks e.g. like this:
The horizontal bar-chart (bars go left-right), class HorizontalBarChart
, looks like this:
In addition to that, there are also so called stacked-bars (multiple values in a single bar), which can be used in both horizontal- and vertical BarChart
. Entries for stacked bars can be created via constructor of the BarEntry
class.
// normal entry
BarEntry normalEntry = new BarEntry(float value, int xIndex);
// stacked entry
BarEntry stackedEntry = new BarEntry(float [] values, int xIndex);
Also, check out the documentation on setting data.