Mixing Series Types in Flex 2 Charts

Becareful when you mix series types in the Flex 2 (BETA 2) Charting Components. All of the documentation says that any chart that extends the CartesianChart can use other series types. This is true but you run into issues beacuse the chart tries to format the series data based on its chart type (makes sense, except we now what to combine series types).

For example if you had an <mx:ColumnChart> with a <mx:ColumnSeries> and <mx:LineSeries> , the chart would result in something like the following:
seriesTypes_column.jpg
Notice how the line doesn’t quite line up with the column chart.

If we change the <mx:ColumnChart> to an <mx:CartesianChart>, problem solved. The CartesianChart takes the data for what it is and doesn’t try to shoehorn the series in to a specific display. Now check out the ColumnChart, the line series lines up with the column chart.

seriesTypes_cartesian.jpg

Update: It should be becareful what type of chart you use. Basically if you are mixing series types, then use the CartesianChart and you won’t run into this problem. Basically what happened below is we tried to force data displayed as a line into a ColumnChart because we used the ColumnChart control. If you use the CartesianChart you won’t have this problem. Thank you Ely!

Leave a Reply

Your email address will not be published. Required fields are marked *