Ik heb meerdere lijngrafieken en deze wil ik in een TileList drukken. Alleen de TileList rendered de default instantie van mijn mxml klasse LijnGrafiek met default x-as en y-as waarden. Dus er wordt geen lijn getoond. In het geheel wordt variabele arrdp straks een globale var en dmv Bindable attribuut luisterd het ernaar. Ik heb wel een andere werkende oplossing met een normale container, maar ik wil het graag in een TileList zodat ik niet hoef te denken aan hoeveel grafieken er naast mekaar kunnen staan.
De vraag is waarom wordt de grafiek niet getoond.
Applicatie.mxml:
LijnGrafiek.mxml
ps: Zijn er code-tags aanwezig voor Flex/mxml
De vraag is waarom wordt de grafiek niet getoond.
Applicatie.mxml:
Flash ActionScript:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();" xmlns:local="*"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] private var arrdp:ArrayCollection = new ArrayCollection(); private function init():void { var myChart:LijnGrafiek = new LijnGrafiek(); myChart.initialize(); var arr:Array = new Array(); var ent:Entry = new Entry(); ent.datum = new Date(2009,11,5); ent.waarde = 1000; arr.push(ent); ent = new Entry(); ent.datum = new Date(2009,11,6); ent.waarde = 1100; arr.push(ent); myChart.addSeries(arr, "serie1", "datum", "waarde"); arrdp.addItem(myChart); } ]]> </mx:Script> <mx:TileList id="myList" dataProvider="arrdp" itemRenderer="LijnGrafiek" width="100%" height="100%" /> </mx:Application> |
LijnGrafiek.mxml
Flash ActionScript:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
| <?xml version="1.0" encoding="utf-8"?> <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"> <mx:Script> <![CDATA[ import mx.charts.series.LineSeries; import mx.charts.chartClasses.IAxis; public var lineDrawed:Boolean = false; private function horizontalLabel(labelValue:Object, previousValue:Object, axis:IAxis):String { var result:String = "Onbekend"; if(labelValue is Date) result = dateformatter.format(labelValue); return result; } public function addSeries(entries:Array, serienaam:String, xAsProperty:String, yAsProperty:String):void { if(entries != null && entries.length > 1) { var ls:LineSeries = new LineSeries(); ls.xField = xAsProperty; ls.yField = yAsProperty; ls.displayName = serienaam; ls.dataProvider = entries; lijngrafiek.series.push(ls); } } ]]> </mx:Script> <mx:DateFormatter id="dateformatter" formatString="D/M/YY" /> <mx:LineChart id="lijngrafiek" showDataTips="true"> <mx:verticalAxis> <mx:LinearAxis displayName="Waarde" /> </mx:verticalAxis> <mx:horizontalAxis> <mx:DateTimeAxis displayName="Datum" labelFunction="horizontalLabel"/> </mx:horizontalAxis> </mx:LineChart> <mx:Legend dataProvider="{lijngrafiek}" /> </mx:Panel> |
ps: Zijn er code-tags aanwezig voor Flex/mxml
To say of what is that it is not, or of what is not that it is, is false, while to say of what is that it is, and of what is not that it is not, is true. | Aristoteles