Below is some sample code that can draw LineSeries Graph dynamically.
It works perfectly . The one thing I don't know how to set is the
linestroke for this graphs.
how can i set this for the graph that is getting drawn below.
<mx:lineStroke>
<mx:Stroke weight="2"/>
</mx:lineStroke>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.charts.series.LineSeries;
import mx.controls.Alert;
[Bindable]
private var expensesAC:ArrayCollection = new ArrayCollection
( [
{ Month: "Jan", Profit: 2000, Expenses: 1500, Amount:
450 },
{ Month: "Feb", Profit: 1000, Expenses: 200, Amount:
600 },
{ Month: "Mar", Profit: 1500, Expenses: 500, Amount:
300 },
{ Month: "Apr", Profit: 1800, Expenses: 1200, Amount:
900 },
{ Month: "May", Profit: 2400, Expenses: 575, Amount:
500 } ]);
private var cFields:Array = [
{ 'label' : 'Profit' },
{ 'label' : 'Expenses' },
{ 'label' : 'Amount' },
];
[Bindable]
private var cFieldsData:ArrayCollection = new ArrayCollection
(cFields);
public function drawChart():void {
var ls:LineSeries= new LineSeries();
linechart2.series = [ls]; // associate the array
var tempObj:Object;
//create a series for each series of data
//Profit series
ls = new LineSeries();
ls.displayName = 'Profit';
ls.yField = 'Profit';
// ls.form = "lines";
linechart2.series[0] = ls;
//Profit series
ls = new LineSeries();
ls.displayName = 'Expenses';
ls.yField = 'Expenses';
// ls.form = "curve";
linechart2.series[1] = ls;
//Amount series
ls = new LineSeries();
ls.displayName = 'Amount';
ls.yField = 'Amount';
// ls.form = "curve";
linechart2.series[2] = ls;
}
]]>
<mx:LineChart id="linechart2" height="100%" width="100%"
paddingLeft="5" paddingRight="5"
showDataTips="true" dataProvider="{expensesAC}">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Month"/>
</mx:horizontalAxis>
</mx:LineChart>
<mx:Legend dataProvider="{linechart2}"/>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---