1 Reply Latest reply on May 22, 2006 12:44 PM by maxkool

    loading different charts at different intervals

    maxkool Level 1
      hello all! i have had a great deal of hlep from the folks here at the forum and i have even posted some of the solutions. i have one more issue that is making me crazy. i know how to use setinterval to call a data service and what not. what i cant seem to figure out is how would i call lets say different charts at different intervals. for example my data is split into 7 categories (each with 6 data points), my end uses dont want a huge chart with all the data crammed in there. so, they want the chart to cycle through the catergories automatically. like i said i can set up a combo box so it sends the category with right data but how do i set it up so it runs by itself. do i set up an array with the different charts? of is there a way to step through data? once again i come humble before you looking for that magic guidance!!!

      thanks!!!

      j
        • 1. Re: loading different charts at different intervals
          maxkool Level 1
          ok i guess i should post what im trying to do:

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Canvas xmlns:mx=" http://www.macromedia.com/2003/mxml" marginLeft="0"
          marginRight="0"
          height="100%" width="100%"
          xmlns:local="*"
          initialize="myHTTPData.send();trace('calling service');" backgroundColor="#cccccc"
          creationComplete="startApp()">
          <mx:HTTPService url=" http://datasource id="myHTTPData" method="GET" result="refreshdata" >
          <mx:request>
          <deptID>{data}</deptID>
          <deptIDsub>{datasub}</deptIDsub>
          <datacat>{categories.selectedItem.data}</datacat>
          </mx:request>
          </mx:HTTPService>
          <mx:Script><![CDATA[
          var data: String; // Set default value if none is passed.
          var datasub: String;
          ]]></mx:Script>

          <mx:Script>

          var cards = [ {label:"Murder", data:"Murder"}, {label:"Rape", data:"Rape"}, {label:"Fel Assault", data:"FelAssault"}, {label:"Robbery", data:"Robbery"}, {label:"Burglary", data:"Burglary"}, {label:"Gr.Larceny", data:"GrLarceny"}, {label:"G.L.A", data:"GLA"} ];

          var selectedItem bject;

          </mx:Script>

          <mx:Script>
          function getPreferredHeight()
          {
          return _parent.layoutHeight;
          }
          function getPreferredWidth()
          {
          return _parent.layoutWidth;
          }
          </mx:Script>


          <mx:Script>
          <![CDATA[

          import mx.servicetags.HTTPService;
          function startApp()
          {
          setInterval(this,"refreshdata",3000);
          }
          function refreshdata()
          {

          myHTTPData.send();
          }
          ]]>

          </mx:Script>
          <mx:Effect>
          <mx:SeriesInterpolate duration="1000" minimumElementDuration="200" elementOffset="0" name="rearrangeData" />
          </mx:Effect>

          <mx:HBox >
          <mx anel title="Crime stats" >
          <mx:HBox>
          <mx:ColumnChart id="linechart" dataProvider="{myHTTPData.result.expenses}" showDataTips="true" width="530" height="280" >
          <mx:horizontalAxis>
          <mx:CategoryAxis dataProvider="{myHTTPData.result.expenses}" categoryField="Month"/>
          </mx:horizontalAxis>
          <mx:series>
          <mx:Array>
          <mx:ColumnSeries yField="Count" showDataEffect="rearrangeData" name="{categories.selectedItem.data} 2006" >
          <mx:fill>
          <mx:SolidColor color="green" />
          </mx:fill>
          </mx:ColumnSeries>
          <mx:ColumnSeries yField="Expenses" showDataEffect="rearrangeData" name="{categories.selectedItem.data} 2005">
          <mx:fill>
          <mx:SolidColor color="blue"/>
          </mx:fill>
          </mx:ColumnSeries>
          </mx:Array>
          </mx:series>
          </mx:ColumnChart>
          <mx:VBox> <mx:Legend dataProvider="linechart"/>
          <mx:Label text="Categories" />
          <mx:ComboBox id="categories" dataProvider="{cards}" change="selectedItem=event.target.selectedItem">



          </mx:ComboBox></mx:VBox>

          </mx:HBox>
          </mx anel>
          </mx:HBox>
          </mx:Canvas>


          I would like to be able to have the chart scroll through each category in the combo box automatcially.

          thanks for any help