0 Replies Latest reply on Dec 18, 2007 6:52 AM by cdclose@gmail.com

    Multiple Series On One CategoryAxis

    cdclose@gmail.com
      I'm having an issue with getting multiple series to plot correctly on
      a chart with the same CategoryAxis.

      I have several ArrayCollections...for weight, height and BMI. Each
      ArrayCollection has a date and value. I need to use actionscript to
      create each one as a series and add that to the chart. I created an
      ArrayCollection that just has all the dates for the points to plot. I
      thought I could use this for the CategoryAxis dataProvider but when I
      do it this way it seems that it plots the points at the wrong
      dates.

      Here is a sample of how I am adding one of the series and the
      CategoryAxis:

      var hAxis:CategoryAxis = new CategoryAxis();
      hAxis.categoryField = 'startDate';
      hAxis.dataProvider = allTrendingDates;
      hAxis.labelFunction = lineChartDateFormat;
      linechart.horizontalAxis = hAxis;

      var bmiSeries:LineSeries = new LineSeries();
      bmiSeries.dataProvider = bmiTrendEntries;
      bmiSeries.displayName = 'BMI';
      bmiSeries.yField = 'bmi';
      linechart.series.push(bmiSeries);

      Here is my chart:

      <mx:PlotChart id="linechart" height="252" width="783" paddingLeft="5"
      paddingRight="5" showDataTips="true" y="130">

      <mx:verticalAxis>
      <mx:LinearAxis baseAtZero="{baseZeroCheckBox.selected}"/>
      </mx:verticalAxis>

      <mx:horizontalAxis>
      <mx:CategoryAxis categoryField="startDate"
      labelFunction="lineChartDateFormat"/>
      </mx:horizontalAxis>

      </mx:PlotChart>

      Any help is greatly appreciated.