I would to use the repeater class to create multiple instances
of a tab.Each tab displays the same chart with a different data
provider.Everything is working when I don't include a legend.
See source code below.However ,if I uncommented out the legend
I am getting the following example :
ReferenceError: Error #1069: Property marker not found on
mx.charts.LineChart and there is no default value.
at mx.charts::Legend/::addLegendItem()
Thank you for your help.
Regards-Claude
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var expensesA:ArrayCollection = new ArrayCollection(
[
{ Month: "Jan", Profit: 20000, Expenses: 1500, Amount:
450 },
{ Month: "Feb", Profit: 1000, Expenses: 15000, Amount:
600 },
{ Month: "Mar", Profit: 15000, Expenses: 5000, Amount:
300 },
{ Month: "Apr", Profit: 1800, Expenses: 1200, Amount:
900 },
{ Month: "May", Profit: 2400, Expenses: 575, Amount:
500 } ]);
private var expensesB:ArrayCollection = new ArrayCollection(
[
{ Month: "Jan", Profit: 20000, Expenses: 150, Amount:
450 },
{ Month: "Feb", Profit: 1000, Expenses: 1500, Amount:
600 },
{ Month: "Mar", Profit: 15000, Expenses: 500, Amount:
300 },
{ Month: "Apr", Profit: 1800, Expenses: 120, Amount:
900 },
{ Month: "May", Profit: 2400, Expenses: 55, Amount:
500 } ]);
private var expensesC:ArrayCollection = new ArrayCollection(
[
{ Month: "Jan", Profit: 2000, Expenses: 1500, Amount:
40 },
{ Month: "Feb", Profit: 100, Expenses: 15000, Amount:
60 },
{ Month: "Mar", Profit: 1500, Expenses: 5000, Amount:
30 },
{ Month: "Apr", Profit: 180, Expenses: 1200, Amount:
90 },
{ Month: "May", Profit: 240, Expenses: 575, Amount:
50 } ]);
]]>
</mx:Script>
<mx:ArrayCollection id="tabList">
<mx:Object name="ExpensesA" dataProvider="{expensesA}" />
<mx:Object name="ExpensesB" dataProvider="{expensesB}"/>
<mx:Object name="ExpensesC" dataProvider="{expensesC}"/>
</mx:ArrayCollection>
<mx:Panel title="LogAxis Example" height="100%" width="100%">
<mx:TabNavigator id="tabnav" width="100%" height="100%">
<mx:Repeater id="tabRepeater" dataProvider="{tabList}" >
<mx:VBox label="{tabRepeater.currentItem.name}">
<mx:HBox width="100%" height="100%">
<mx:LineChart id="lineChart" height="100%" width="100%"
paddingLeft="5" paddingRight="5"
showDataTips="true"
dataProvider="{tabRepeater.currentItem.dataProvider}"
name="{tabRepeater.currentItem.name}" click="trace
(event.currentTarget.id+'*'+event.currentTarget.name)">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Month"/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LogAxis interval="10"/>
</mx:verticalAxis>
<mx:series>
<mx:LineSeries yField="Profit" form="curve"
displayName="Profit"/>
<mx:LineSeries yField="Expenses" form="curve"
displayName="Expenses"/>
<mx:LineSeries yField="Amount" form="curve"
displayName="Amount"/>
</mx:series>
</mx:LineChart>
<!--
<mx:Legend dataProvider="{lineChart}" />
-->
</mx:HBox>
</mx:VBox>
</mx:Repeater>
</mx:TabNavigator>
</mx:Panel>
</mx:Application>