HLOCChart Control in Flex4


 

HLOCChart Control in Flex4

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

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

HLOCChart  control in Flex4:

The HLOCChart Control is a MX Component. There is no Spark component. The HLOCChart Control represents financial data. It represents the data in a series of lines which is represents the high, low, opening, and closing values of data series.

You can provide the data to the chart control by using data provider property. You will use <mx:horizontalAxis> or <mx:verticalAxis> and <mx:Series> in it. You will use xField, closeField, highField, lowField and openField property for series. You can use more than one series in it. You can set the color by using <mx:SolidColor> and <mx:SolidColorStroke>. The tag of HLOCChart Control is <mx:HLOCChart>.

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:Script>

<![CDATA[

import mx.collections.ArrayCollection;

[Bindable]

private var market1:ArrayCollection = new ArrayCollection( [

{ Date: "25-Jan", Open: 40.75, High: 40.75, Low: 40.24, Close:40.31},

{ Date: "26-Jan", Open: 39.98, High: 40.78, Low: 39.97, Close:40.34},

{ Date: "27-Jan", Open: 40.38, High: 40.66, Low: 40, Close:40.63},

{ Date: "28-Jan", Open: 40.49, High: 40.99, Low: 40.3, Close:40.98},

{ Date: "29-Jan", Open: 40.13, High: 40.4, Low: 39.65, Close:39.95},

{ Date: "1-Feb", Open: 39.00, High: 39.50, Low: 38.7, Close:38.6},

{ Date: "2-Feb", Open: 38.68, High: 39.34, Low: 37.75, Close:38.84},

{ Date: "3-Feb", Open: 38.76, High: 38.76, Low: 38.03, Close:38.12},

{ Date: "4-Feb", Open: 37.98, High: 37.98, Low: 36.56, Close:36.69},

{ Date: "5-Feb", Open: 36.61, High: 37, Low: 36.48, Close:36.86} ]);

]]>

</fx:Script>

<s:Panel title="HLOCChart Control Example" width="650" height="469">

<s:layout>

<s:HorizontalLayout/>

</s:layout>

<mx:HLOCChart id="hlocchart1"

paddingRight="10"

paddingLeft="10"

paddingBottom="10"

paddingTop="10"

showDataTips="true"

dataProvider="{market1}" width="547" height="429">

<mx:verticalAxis>

<mx:LinearAxis baseAtZero="false" />

</mx:verticalAxis>

<mx:horizontalAxis>

<mx:CategoryAxis categoryField="Date" title="Date"/>

</mx:horizontalAxis>

<mx:series>

<mx:HLOCSeries openField="Open"

highField="High"

lowField="Low"

closeField="Close"

displayName="Date">

</mx:HLOCSeries>

</mx:series>

</mx:HLOCChart>

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

</s:Panel>

</s:Application>

Output:

Running Application:

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

Download this code

Ads