Just a quick guess, but maybe you need to reverse these two statements?

[Before]
chart.series = mySeries;
mySeries.push(lseries);

So that you instead push the series onto the series stack before
applying the series to the chart:

[After]
chart.series = mySeries;
mySeries.push(lseries);

-matt horn
flex docs

> -----Original Message-----
> From: flexcoders@yahoogroups.com 
> [mailto:[EMAIL PROTECTED] On Behalf Of app.developer
> Sent: Friday, January 05, 2007 11:16 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Dynamic LineChart; no line showing
> 
> I would like to dynamically produce a line chart with dynamic 
> data and multiple line series produced by actionscript 
> instead of the mxml tags. The following code produces 
> everything but the lines. Does anyone see what I'm missing 
> that would prevent the lines from showing?
> 
> =====================================================
> MXML:
> =====================================================
> 
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml 
> <http://www.adobe.com/2006/mxml> " 
> layout="absolute" 
> creationComplete="init()" backgroundGradientColors="[#ffffff,
> #ffffff]">
> <mx:Script>
> <![CDATA[
> import mx.charts.chartClasses.Series;
> import mx.charts.*;
> import mx.charts.Legend;
> import mx.charts.series.*;
> import mx.charts.renderers.*;
> import mx.charts.events.*;
> import mx.collections.*;
> import mx.collections.ArrayCollection;
> import mx.controls.Alert;
> import mx.utils.ObjectUtil;
> import mx.rpc.events.ResultEvent;
> import mx.rpc.events.FaultEvent;
> 
> public var chart:LineChart = new LineChart(); public var 
> mySeries:Array = new Array(); public var legend:Legend = new 
> Legend(); public var lseries:LineSeries = new LineSeries ();
> 
> [Bindable]
> public var dp:ArrayCollection = new
> ArrayCollection();
> 
> import mx.events.IndexChangedEvent;
> 
> public function init():void{
> this.dataManager.getNics(); 
> 
> }
> 
> 
> public function createChart():void{
> 
> chart.height=400;
> chart.width=400;
> 
> chart.showDataTips=true;
> this.boxer.addChild(chart);
> 
> chart.series = mySeries;
> 
> mySeries.push(lseries); 
> 
> legend.width = 300;
> legend.height = 26;
> legend.dataProvider =chart;
> this.boxer.addChild(legend);
> }
> 
> //getNics
> public function getNics_result
> (event:ResultEvent):void{
> 
> chart.height=300;
> chart.width=400;
> chart.showDataTips=true;
> this.boxer.addChild(chart);
> 
> for ( var
> i:Number=0;i<event.result.length;i++){
> //Alert.show
> (ObjectUtil.toString(event.result.list.source[i].NICID), i as String);
> 
> this.dataManager.getNicbyID
> (event.result.list.source[i].NICID);
> 
> var lseries:LineSeries=new
> LineSeries();
> 
> lseries.displayName="NIC "+event.result.list.source[i].NICID;
> lseries.xField="BandIn";
> 
> 
> mySeries.push(lseries);
> }
> 
> chart.series = mySeries;
> 
> legend.width = 300;
> legend.height = 26;
> legend.id = "chartLegend";
> legend.dataProvider = chart;
> this.boxer.addChild(legend);
> }
> 
> private function getNics_fault
> (event:FaultEvent):void
> {
> Alert.show(ObjectUtil.toString
> (event.fault),'getNics');
> }
> 
> //getNicbyID
> public function getNicbyID_result
> (event:ResultEvent):void{;
> chart.dataProvider = event.result as
> ArrayCollection;
> Alert.show(ObjectUtil.toString
> (chart.dataProvider));
> }
> 
> private function getNicbyID_fault
> (event:FaultEvent):void
> {
> Alert.show(ObjectUtil.toString
> (event.fault),'getNicbyID');
> }
> 
> ]]>
> </mx:Script>
> 
> <mx:Style>
> @font-face {
> fontFamily: labelFont;
> src:url("/resources/arial.ttf");
> }
> LineChart{
> fontFamily: labelFont;
> }
> </mx:Style> 
> 
> <mx:RemoteObject
> id="dataManager"
> showBusyCursor="true"
> source="chartsamplers.cfcServerMonitor"
> destination="ColdFusion" >
> <mx:method name="getNics" 
> result="getNics_result(event)" 
> fault="getNics_fault(event)" />
> <mx:method name="getNicbyID"
> result="getNicbyID_result(event)" 
> fault="getNicbyID_fault(event)" />
> </mx:RemoteObject>
> 
> <mx:VBox id="boxer" width="749" height="600" x="10" y="10"/>
> 
> 
> </mx:Application>
> 
> =====================================================
> CFC
> =====================================================
> <cfcomponent name="cfcServerMonitor" output="false">
> 
> <cffunction access="remote" name="getNics" output="false" 
> returntype="query">
> <cfset Result = QueryNew("NICID", "Integer")>
> 
> <cfset newRow = QueryAddRow(Result)>
> <cfset temp = QuerySetCell(Result, "NICID", 2)> <cfset newRow 
> = QueryAddRow(Result)> <cfset temp = QuerySetCell(Result, 
> "NICID", 3445)>
> 
> <cfreturn result>
> 
> </cffunction>
> 
> <cffunction access="remote" name="getNicbyID" output="false" 
> returntype="query">
> 
> <cfargument name="nicID" type="string" required="false" > 
> <cfset Result = QueryNew("BandIn,DateCreated", "Integer, Date")>
> 
> <cfset newRow = QueryAddRow(Result)>
> <cfset temp = QuerySetCell(Result, "BandIn", 341)> <cfset 
> temp = QuerySetCell(Result, "DateCreated", "2007-01-05 
> 08:15:00")> <cfset newRow = QueryAddRow(Result)> <cfset temp 
> = QuerySetCell(Result, "BandIn", 333)> <cfset temp = 
> QuerySetCell(Result, "DateCreated", "2007-01-05 08:15:33")> 
> <cfset newRow = QueryAddRow(Result)> <cfset temp = 
> QuerySetCell(Result, "BandIn", 332)> <cfset temp = 
> QuerySetCell(Result, "DateCreated", "2007-01-05 08:15:44")> 
> <cfset newRow = QueryAddRow(Result)> <cfset temp = 
> QuerySetCell(Result, "BandIn", 113)> <cfset temp = 
> QuerySetCell(Result, "DateCreated", "2007-01-05 08:15:55")>
> 
> 
> <cfquery name="qRead" dbtype="query" >
> Select BandIn, DateCreated
> From Result
> Order by DateCreated
> </cfquery>
> 
> <cfreturn qRead>
> </cffunction>
> 
> </cfcomponent>
> 
> tia
> Precia
> 
> 
> 
>  
> 

Reply via email to