Android - Dynamically changing x-axis label


#1

I have an app where I have a bar graph (column series) displaying data for x number of months inside a fragment and I want the x axis label to change dynamically based on a set of selections.

For example, the bar graph initially starts off with displaying data for the current month (July). Then the user has an option of viewing data for last month, the last 90 days, or a full year. I want the bar graph’s x-axis data to dynamically change. So if I picked “last month”, the x-axis label should change from {July} to {June}. Then “last 90 days” should change the label from {June} to {April, May, June, July}. However, my labels get scrambled and it looks like the following image instead.

  data display for last 90 days

I tried removing all the series inside my chart  with chart.removeSeries(seriesList) and readding new series with no luck. It seems like the old data still persists inside my chart and affects the order of my labels.

Any help would be appreciated on my issue.


#2

Nevermind, I figured it out. Turned out I had to remove all the series AND the axes.