In this section you can see how we can provide the skin to data item in chart control.
In this section you can see how we can provide the skin to data item in chart control.In this section you can see how we can provide the skin to data item in chart control. We will use the itemRenderer for providing the skin to data item. In this example we change the representation of data item. we use the image for showing the data values in the chart.
|
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s=" library://ns.adobe.com/flex/spark"xmlns:mx=" library://ns.adobe.com/flex/mx"minWidth=" 955" minHeight="600">} mx|LegendItem{ font-family: verdana;} </fx:Style> <fx:Script><![CDATA[ import mx.collections.ArrayCollection; import mx.core.BitmapAsset;[ Bindable][ Embed(source="C:/work/bikrant/flex4component/skinningchartitem/girlstud.jpg")][ Bindable][ Embed(source="C:/work/bikrant/flex4component/skinningchartitem/students.gif")] public var boyStudent:Class;[ Bindable] public var gitlStudentFactory:ClassFactory = new ClassFactory(gitlStudent);[ Bindable] public var boyStudentFactory:ClassFactory = new ClassFactory(boyStudent);[ Bindable] public var student:ArrayCollection = new ArrayCollection([{Stream: "Management", Girls:1000, Boys:1400, TotalStudent:2400},{Stream: "Computer Science", Girls:800, Boys:1200, TotalStudent:2000},{Stream: "Mechanical", Girls:200, Boys:1500, TotalStudent:1700},{Stream: "Electical", Girls:800, Boys:850, TotalStudent:1650},{Stream: "Electronics", Girls:500, Boys:1000, TotalStudent:1500},{Stream: "Civil", Girls:300, Boys:900, TotalStudent:1200}]); ]]> </fx:Script> <s:Panel title="Skinning Data item in Chart Example " width="546" height="564"> <s:layout> <s:VerticalLayout horizontalAlign="center"/>dataProvider=" {student}"showDataTips=" true"fontFamily=" verdana"width=" 537" height="445">xField=" Boys"yField=" Girls"displayName=" Boys/Girls"itemRenderer=" {gitlStudentFactory}"legendMarkerRenderer=" {gitlStudentFactory}"radius=" 20"/> <mx:PlotSeries id="ps2"xField=" TotalStudent"yField=" Boys"displayName=" TotalStudent/Boys"itemRenderer=" {boyStudentFactory}"legendMarkerRenderer=" {boyStudentFactory}"radius=" 20"/>xField=" TotalStudent"yField=" Girls"displayName=" TotalStudent/Girls"fill=" {s3}"stroke=" {scs3}"itemRenderer=" mx.charts.renderers.TriangleItemRenderer"radius=" 10"/> </mx:series></s:Application> |
To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.