Ok, so i've got the problem where i'm trying to add a
series to a line chart and it just doesn't seem to be
working correctly.

Here's a test file that i created to test this.  has
anyone been able to get this to work.  I can get the
chart created, the dataprovider is added/updated on
the chart, but the graph never updates correctly, and
it doesn't add the series into the chart.  has anyone
found a way to make the charts update dynamically?

Thanks!

-------- code below ---------

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.macromedia.com/2003/mxml";
xmlns="*" horizontalAlign="left" verticalAlign="top"
xmlns:cell="cellrenders.*" 
creationComplete="initFunc();">
        
        <mx:Script>
                <![CDATA[
                        import de.richinternet.utils.Dumper;
                        import mx.charts.series.LineSeries;
                        
                        public var arrGraph:Array = new Array(10);
                        public var graphNum:Number  = 0;
                        
                        private function initFunc():Void  {
                                var thisobj = new Object();
                                var j:Number = 0;
                                for (var i=0;i<100;i=i+10)   {
                                        thisobj.timeval = new 
String("thismonth"+i);
                                        thisobj.propval = i;
                                        arrGraph.push(thisobj);
                                }
                        }
                        
                        public function CreateGraph():Void  {
                                var ls:Object;
                        
myPanel.createChild(mx.charts.LineChart,"lineChart"+graphNum,{width:"200",height:"100"});
                                                ls = new LineSeries();
                                                ls.dataProvider = arrGraph;
                                                ls.setStyle("stroke", new
mx.graphics.Stroke(0x000000,2,100)); 
                                                ls.name = "machine"+graphNum; 
// ID of series as
"ABC.AC"
                                                ls.xField = "timeval";
                                                ls.yField = "propval";
                                                //ls.renderer=new 
SimpleLineRenderer(); // no
line shadow
                                                //myChart.series.addItem(ls);
                                                //dg.dataProvider = 
UpdateResult;
                                        
myPanel["lineChart"+graphNum].series.addItem(ls); 
                                                
myPanel["lineChart"+graphNum].series.update();
                                                //mySeries =
graphTile["lineChart"+i].createChildAtDepth("Blah",
graphTile["lineChart"+i].findNextAvailableDepth(),{dataProvider:chartPropertyObj["machineval"+machinePoolObj[j]],renderer:
mx.charts.renderers.SimpleLineRenderer,series:new
Array() });
                                                //Dumper.dump(mySeries);
                                        
//graphTile["lineChart"+i].createChildren();
                                        
myPanel["lineChart"+graphNum].invalidate();
                        }
                ]]>
        </mx:Script>
        

        <mx:Panel title="Graph" id="myPanel">
                <mx:Button label="Graph it" click="CreateGraph()"/>
        </mx:Panel>
        
</mx:Application>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to