Click on bar chart/ColumnSeries in Android


#1

I am using column series to plot a bar chart. I am trying to change the color of selected bar.

I am using series.getStyle() to set the style(background, area color for bar) and series.getSelectedStyle for selected graph.

I am not able to update the selected color of bar. I also try to update the color in onPointSelectionStateChanged.

Please let me know the updates.


#2

Hi captain0585,

Am I right in thinking you are trying to change the colour of just one of the bars in the series, as opposed to changing the colour of all the bars? If that’s the case then at present  shinobicharts for Android doesn’t support this (at least out of the box) - individual point styling is a feature high up on our roadmap so do keep a look out for upcoming releases!

In the meantime you can use the following workaround to achieve this:

  • Use a different ColumnSeries for each data point (obviously if you have a large number of data points this workaround might not scale too well).
  • Give each series the same stackId - it doesn’t matter what value it is, just as long as it’s the same.
  • Now, when you select a bar you are effectively selecting the whole series, but the whole series only contains the one bar so only that bar will change to its selected colour.

Hope that helps!

Patrick


#3

Just to let you know we released v1.9.0 of  shinobicharts  for Android earlier this month and it includes individual point styling and point-based selection for ColumnSeries (and BarSeries, OHLCSeries and CandlestickSeries). It is available for download in our Support Portal.

For more details please see our User Guide.

Patrick