0

I am using the MPAndroid library to create bar charts. To create a barEntry, we make an object like (2, 10) which represents the (x, y) values.

I wanted to know if it's possible to create entries such as this (2-10, 10) where 2-10 is the range.

I know this can be achieved by looping through the range and creating the bar entries individually. Also, reducing the space between the bars will make them appear as a single bar. But this method becomes very costly once the range increases.

Is there some other optimized approach to achieve this ?

sauvik
  • 2,224
  • 1
  • 17
  • 25
  • Apart from the approach you mentioned (creating entries individually and reducing space to make appear as a single bar) the only other way would be to create a custom BarChartRenderer. You would do that by inspecting the source code for the same and adapting it to your needs. There is an example of a custom renderer [here](https://stackoverflow.com/questions/41340819/mpandroidchart-add-custom-image-inside-bars) – David Rawson Mar 18 '17 at 04:33
  • thanks for answering. For now, I am using a line chart. Coloring the area under the line makes it look like a bar which gets the job done. This won't work for every scenario but it will do for my particular case. – sauvik Mar 18 '17 at 18:10

0 Answers0