PlotChart Control in Flex4


 

PlotChart Control in Flex4

The PlotChart Control is a MX Component. There is no Spark component.

The PlotChart Control is a MX Component. There is no Spark component.

PlotChart control in Flex4:

The PlotChart Control is a MX Component. There is no Spark component. The PlotChart Control represents the each data value by a single point. This point represents the Cartesian coordinate position along x-axis and y-axis. You can provide the data to the chart control by using data provider property. You will use xField, yField and radius property for series.  You can use more than one series in it. You can change the icon style by busing itrmRenderer property.
There are some default item renderer classes:
1. BoxItemRenderer
2. CircleItemRenderer
3. CrossItemRenderer
4. DiamondItemRenderer
5. ShadowBoxItemRenderer
TriangleItemRenderer
You can set the color by using <mx:SolidColor> and <mx:SolidColorStroke>.
The tag of PlotChart Control is <mx:PlotChart>.

Example:strong>

<?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">

<fx:Declarations>

<s:SolidColor id="s1" color="#990000" alpha=".3"/>

<s:SolidColor id="s2" color="#808080" alpha=".3"/>

<s:SolidColor id="s3" color="#cc00cc" alpha=".3"/>

<s:SolidColorStroke id="scs1" color="#990000" weight="2"/>

<s:SolidColorStroke id="scs2" color="#808080" weight="2"/>

<s:SolidColorStroke id="scs3" color="#cc00cc" weight="2"/>

</fx:Declarations>

<fx:Script>

<![CDATA[

import mx.collections.ArrayCollection;

[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="PlotChart Control Example" width="546" height="564">

<s:layout>

0

<s:VerticalLayout/>

</s:layout>

<mx:PlotChart id="pchart"

1

dataProvider="{student}"

showDataTips="true"

fontFamily="verdana"

2

width="537" height="445">

<mx:series>

<mx:PlotSeries id="ps1"

3

xField="Boys"

yField="Girls"

displayName="Boys/Girls"

4

fill="{s1}"

stroke="{scs1}"

itemRenderer="mx.charts.renderers.CrossItemRenderer"

5

radius="10"/>

<mx:PlotSeries id="ps2"

xField="TotalStudent"

6

yField="Boys"

displayName="TotalStudent/Boys"

fill="{s2}"

7

stroke="{scs2}"

itemRenderer="mx.charts.renderers.DiamondItemRenderer"

radius="10"/>

8

<mx:PlotSeries id="ps3"

xField="TotalStudent"

yField="Girls"

9

displayName="TotalStudent/Girls"

fill="{s3}"

stroke="{scs3}"

0

itemRenderer="mx.charts.renderers.TriangleItemRenderer"

radius="10"/>

</mx:series>

1

</mx:PlotChart>

<mx:Legend dataProvider="{pchart}"/>

</s:Panel>

2

</s:Application>

Output:

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

3

Download this code

Ads