This one should be easy. Take your LinearAxis and set the autoAdjust property to true. Done deal, right?

Not always.

Let’s say you have a ColumnChart with four columns total, but two of the columns can be shown or hidden with check boxes. In this instance, since the underlying data isn’t changing, the chart will fail to adjust the LinearAxis whenever the visibility changes for one of the two columns.

Similar to my solution for resizing a data grid’s columns, the trick here is to basically force the chart to refresh itself:

public function refreshData () : void
    chart.series = null;
    chart.series = [columnOne, columnTwo, etc];

    xAxis.categoryField = null;
    xAxis.categoryField = "category";

That’s it! In this example I had a ColumnChart with a LinearAxis for the vertical axis and a CategoryAxis for the horizontal axis. I invoked refreshData() whenever the visibility of one of the two columns changed, and only specified the visible columns in the chart’s series property.

For an added bonus, if you set the showDataEffect property on your columns (to an effect like SeriesInterpolate) you’ll have a handsome animation each time your chart is refreshed!