Mulgard Mulgard - 6 months ago 79
Android Question

MPAndroidChart: Combined Chart

I am using MPAndroidChart library.

I wanted to use the

to create a Chart like that:

enter image description here

Is that possible? I tried it out but it doesnt seem to work because
the entries arent working as i expected. You cant say an entry has
value 2 on the x-axis and value 300 on the y-axis. Also i cant create
two different y-axis, one for the bars and one for the lines.

Some curious thing is that MPAndroidChart first adds all x-values
and after that all y-values and you have no possibility to controll
which y-value belongs to which x-value because its just inserting
the y-values in order of their appearing and relates it to the next

Is there some way how i can create such a diagram with MPAndroidChart.
I actually dont want to be forced to use Google Charts because of the
required internet connection (but creating that kind of diagram would
work perfectly with Google Charts).

  • you can have 2 different axes
  • you have control which y-value belongs to which x-value (of course!)
  • check out the combined-chart-example
  • it looks like this:

enter image description here

UPDATE: v3.0.0+

The example for the CombinedChart has been extended, now allowing stacked bars and grouped bars together with other chart types.

The documentation shows how to setup a CombinedChart.