Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
biggermork #1
How do I dynamically add a series to a chart? flex 1.5
I have a problem where I'm trying to add a series to a line chart and it just
doesn't work correctly.
Here's a test fiel that i created to test this. has anyone ever 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. Nothing is drawn!
Has anyone found a way to make the charts update dynamically?
<?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",he
ight:"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:chartPrope rtyObj
["machineval"+machinePoolObj[j]],renderer:
mx.charts.renderers.SimpleLineRenderer,series:new Array() });
//Dumper.dump(mySeries);
//graphTile["lineChart"+i].createChildren();
myPanel["lineChart"+graphNum].invalidate();
graphNum++;
}
]]>
</mx:Script>
<mx:Panel title="Graph" id="myPanel">
<mx:Button label="Graph it" click="CreateGraph()"/>
</mx:Panel>
</mx:Application>
biggermork Guest
-
Dynamically changing chart labels
HI I'm after an how too really, point me in the right direction is possible. I have a new dashboard app, monitoring a server, last part is load... -
Multiple series chart with differing dates
Is there a way to display multiple series on a chart when the data for the horizontal axis doesn't match up? For example: if data1 (val, date)... -
dynamically creating pie chart
I have a format that we use to create pie charts and i would like to create a tool to generate the chart in the format we want just by passing 3... -
Multiple Chart Series using different dataProvider
I am trying to display a chart that first of all plots some data (Plot Series) from a webservice call, which I had no problem with, then adds... -
Dynamic Series in Bar Chart
Hi all, Considering the below sample data in XML: <?xml version="1.0" encoding="utf-8"?> <data> <region name="North America">...



Reply With Quote

