0 Replies Latest reply on Dec 2, 2008 10:22 AM by tharkad

    Setting chart axis min and max programmatically

      I'm just starting out with charting and I have a set of simple histograms to display. The charts must be created completely programmatically. I'm using this code to make the chart:

      chart = new ColumnChart();
      chart.dataProvider = histogram1;
      var columns:ColumnSeries = new ColumnSeries();

      This works great. In response to an event I change the chart to show a different historgram:

      chart.dataProvider = histogram2;

      The chart changes on screen. But the axes of the chart also change to best fit the data. For this application I would like to set the min and max of both axes so that the scale does not change when different data is displayed. I see MXML example of doing this but I cannot find a way to do it programmatically. In the debugger the chart variable has a horizontalAxis member with a maximum member but the code:

      chart.horizontalAxis.maximum = 40;

      gives poptiential access error and when running it does not change the maximum.

      Any ideas would be helpful.