title: Flex reset chart axis minimum/maximum
body: <p>I am showing a stacked bar chart with Flex, and I am dynamically changing the data of the dataprovider.</p>
  
  <p>However, the minimum and maximum for the y-axis do not get reset with the new data. So if one dataset had a value of -100,000, but the next dataset has only positive values, the y-axis still starts at -100,000.</p>
  
  <p>How can I force the chart to redraw. I tried myChart.validateNow(), dataprovider.refresh(), etc.</p>
  
  <pre><code>    &lt;mx:ColumnChart id="myChart"
                      dataProvider="{_arrCol_chartData}"
                      columnWidthRatio="0.8"
                      type="stacked"
                      width="100%"
                      height="100%"&gt;
          &lt;mx:annotationElements&gt;
              &lt;mx:CartesianDataCanvas id="canvas"
                                      includeInRanges="true"/&gt;
          &lt;/mx:annotationElements&gt;
  
          &lt;mx:horizontalAxis&gt;
              &lt;mx:CategoryAxis dataProvider="{_arrCol_chartData}"
                               categoryField="Month"
                               id="a1"/&gt;
          &lt;/mx:horizontalAxis&gt;
          &lt;mx:verticalAxisRenderers&gt;
              &lt;mx:AxisRenderer axis="{a1}"
                               tickPlacement="none"
                               showLabels="false"
                               showLine="false"/&gt;
          &lt;/mx:verticalAxisRenderers&gt;
  
          &lt;mx:series&gt;
              &lt;mx:ColumnSeries yField="invisible"
                               displayName="invisible"
                               showDataEffect="slideIn"
                               hideDataEffect="slideOut"&gt;
                  &lt;mx:fill&gt;
                      &lt;!--Set alpha to 0 to hide invisible column.--&gt;
                      &lt;mx:SolidColor color="0xFFFFFF"
                                     alpha="0"/&gt;
                  &lt;/mx:fill&gt;
              &lt;/mx:ColumnSeries&gt;
              &lt;mx:ColumnSeries yField="freeCashflow"
                               styleName="standardSeries"
                               labelFunction="setCurrencyLabel"&gt;
                  &lt;mx:fill&gt;
                      &lt;mx:SolidColor color="0xCCCCCC"
                                     alpha="1"/&gt;
                  &lt;/mx:fill&gt;
              &lt;/mx:ColumnSeries&gt;
              &lt;mx:ColumnSeries yField="invisibleTop"
                               displayName="invisible"
                               showDataEffect="slideIn"
                               hideDataEffect="slideOut"&gt;
                  &lt;mx:fill&gt;
                      &lt;!--Set alpha to 0 to hide invisible column.--&gt;
                      &lt;mx:SolidColor color="0xFFFFFF"
                                     alpha="0"/&gt;
                  &lt;/mx:fill&gt;
              &lt;/mx:ColumnSeries&gt;
              &lt;mx:ColumnSeries yField="bottom"
                               styleName="standardSeries"
                               labelFunction="setCurrencyLabel"&gt;
  
                  &lt;mx:fill&gt;
                      &lt;mx:SolidColor color="0x1B95D5"
                                     alpha="1"/&gt;
                  &lt;/mx:fill&gt;
              &lt;/mx:ColumnSeries&gt;
              &lt;mx:ColumnSeries yField="top"
                               id="topColumn"
                               styleName="standardSeries"
                               labelFunction="setCurrencyLabel"&gt;
                  &lt;mx:fill&gt;
                      &lt;mx:SolidColor color="0x00FF00"
                                     alpha="1"/&gt;
                  &lt;/mx:fill&gt;
              &lt;/mx:ColumnSeries&gt;
          &lt;/mx:series&gt;
      &lt;/mx:ColumnChart&gt;
  
  [Bindable]  
  private var _arrCol_chartData : ArrayCollection = new ArrayCollection([
              { ID: FREE_CASHFLOW, Month: "Free Cashflow", freeCashflow: 0, invisible: 0, invisibleTop: 5000 },
              { ID: CAPITAL_RESERVES, Month: "Capital Reserves", bottom: 0, invisible: 0 },
              { ID: REINVESTMENT_MONEY, Month: "Reinvestment Money", bottom: 0, invisible: 0 },
              { ID: PROFIT_SHARING, Month: "Profit Sharing", bottom: 0, invisible: 0 },
              { ID: DISTRIBUTABLE, Month: "Distributable", top: 0, invisible: 0 }]);
  
  
  function changeDate() : void {
    _arrCol_chartData.getItemAt( 0 ).bottom = 1000;
    _arrCol_chartData.refresh();
  }
  </code></pre>
  
  <p>Thx,
  Martin</p>