2 Replies Latest reply on Apr 8, 2008 7:49 AM by Solerous

    Arraycollection conversion to chart data

    Solerous Level 1

      I'm trying to get ArrayCollection mapped to an array using the Blazeds turnkey sample code. In the sqladmin example, they are creating a List object in the Java code by executing the SQL query and storing it like this:

      // relevant code...

      while (rs.next()) {
      row=new HashMap();
      for (int i = 1; i <= colCount; i++) {
      row.put(rsmd.getColumnName(i), rs.getString(i));

      Then they put this result in a dataGrid:

      <mx:DataGrid id="dg" dataProvider="{resultSet}" width="100%" height="100%"/>

      and the following method.

      private function resultHandler(event:ResultEvent):void {
      resultSet = ArrayCollection(event.result);

      I'd like to display the same data in a chart, but I don't know how to do this. What I'd like to do is something like this:

      //pseudo code
      Horizontal Axis (x) = Data from Column 1
      Vertical Axis (y) = Data from Column 2

      ..or something like that. Anyone know what class the HashMap/List is sending back so that I can convert the info into Dates or numbers or somethow get it to show up on the chart?

      I was trying something like this, but it doesn't work:

      var axisArray:ArrayCollection = new ArrayCollection;
      for each (var obj:Object in resultSet) {
      var f:Number = new Number(obj);
      // axis data provider = axisArray