This post might reveal a few goodies that are coming as a part of the upcoming 3.2 release, but it is something a number of you have asked for. Basically, the issue is that you want to have multiple axes in our chart components. The fact that our Charts are based upon the excellent Spark skinning framework makes this endeavour a lot easier. 

When you draw something on a chart, there is always an underlying series that tells the chart its bounds. That is, given a X position (or a Y Position) on a chart, what is the value associated with that point with reference to the series. The linear axis will always use the first series, regardless of how many you have to draw the ticks. The actual painting of the series is independant, since the series is the source of the truth, the axis is dependant on it. 

With 3.2, we are introducing a new variable on the axis, called associatedSeries. 


* By default, the first series is used to paint the default axis.

* If you associate another series with this axis, that series will be used

       * to calculate the min and max values.



      public function get associatedSeries():Series


This allows you to override the series associated with the axis. Combine this with the power of the Spark Skinning framework, you can embed additional axes easily!

A little eye candy:



We are a few weeks away from official 3.2 release, but this is just one of the many exciting additions coming to charts in 3.2!

Below are the files used for this demo. They will not run with version < 3.2, but we do have preview builds available for those of you who cannot wait!

DualAxisChart.mxml (4.11 kb)

CustomLineChartSkin.mxml (4.46 kb)