1 Reply Latest reply on Aug 9, 2006 8:48 AM by peterent

    adding ColumnSeries to column chart

      How can I add ColumnSeries to a column chart at runtime?
      I have tried many methods, but the ColumnSeries didn't show correctly.
      Thanks.
      Gavin
        • 1. Re: adding ColumnSeries to column chart
          peterent Level 2
          This is from the Flex 2 documentation (look up ColumnChart and the examples):

          <mx:ColumnChart id="column" height="100%" width="45%"
          paddingLeft="5" paddingRight="5"
          showDataTips="true" dataProvider="{medalsAC}">

          <mx:horizontalAxis>
          <mx:CategoryAxis categoryField="Country"/>
          </mx:horizontalAxis>

          <mx:series>
          <mx:ColumnSeries xField="Country" yField="Gold" displayName="Gold"/>
          <mx:ColumnSeries xField="Country" yField="Silver" displayName="Silver"/>
          <mx:ColumnSeries xField="Country" yField="Bronze" displayName="Bronze"/>
          </mx:series>
          </mx:ColumnChart>

          It uses this dataProvider:

          [Bindable]
          private var medalsAC:ArrayCollection = new ArrayCollection( [
          { Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
          { Country: "China", Gold: 32, Silver:17, Bronze: 14 },
          { Country: "Russia", Gold: 27, Silver:27, Bronze: 38 } ]);