Setup CandlestickChart : Candlestick Chart « Chart « Flex






Setup CandlestickChart

Setup CandlestickChart
        

<?xml version="1.0" encoding="iso-8859-1"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
    [Bindable]
    public var myData:Array = [
        {date: "1-Aug-10", open: 42.57, high: 43.08, low: 42.08, close: 42.75},
        {date: "11-Aug-10", open: 43.39, high: 44.12, low: 43.25, close: 44},
        {date: "12-Aug-10", open: 43.46, high: 46.22, low: 43.36, close: 46.1},
        ];

    public var myData2:Array = [
        {date: "11-Aug-10", open: 43.39, high: 44.12, low: 43.25, close: 44},
        {date: "1-Aug-10", open: 42.57, high: 43.08, low: 42.08, close: 42.75},
        {date: "12-Aug-10", open: 43.46, high: 46.22, low: 43.36, close: 46.1},
        ];
    public var myData3:Array = [
        {date: "12-Aug-10", open: 43.46, high: 46.22, low: 43.36, close: 46.1},
        {date: "11-Aug-10", open: 43.39, high: 44.12, low: 43.25, close: 44},
        {date: "1-Aug-10", open: 42.57, high: 43.08, low: 42.08, close: 42.75},

        ];

  </mx:Script>

    <mx:CandlestickChart id="mychart" dataProvider="{myData}" showDataTips="true" height="400" width="400">
        <mx:series>
            <mx:CandlestickSeries dataProvider="{myData}" 
                                  openField="open"                 
                                  highField="high" 
                                  lowField="low" 
                                  closeField="close"                
                                  displayName="My Data"/>
            <mx:CandlestickSeries dataProvider="{myData2}" 
                                  openField="open"                 
                                  highField="high" 
                                  lowField="low" 
                                  closeField="close"                
                                  displayName="My Data2"/>
            <mx:CandlestickSeries dataProvider="{myData3}" 
                                  openField="open"                 
                                  highField="high" 
                                  lowField="low" 
                                  closeField="close"                
                                  displayName="My Data3"/>
   
        </mx:series>
        <mx:horizontalAxis>
            <mx:CategoryAxis categoryField="date" title="Date"/>
        </mx:horizontalAxis>
        <mx:horizontalAxisRenderer>
            <mx:AxisRenderer canDropLabels="true"/>
        </mx:horizontalAxisRenderer>

    </mx:CandlestickChart>
    <mx:Legend dataProvider="{mychart}" direction="horizontal"/>
</mx:Application>

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.Candlestick chart displaying stock pricesCandlestick chart displaying stock prices
2.Candlestick Chart Heigh field and Low fieldCandlestick Chart Heigh field and Low field
3.Axis for Candlestick ChartAxis for Candlestick Chart
4.Legend for Candlestick ChartLegend for Candlestick Chart
5.Candlestick Chart Axis Label Rotation ExampleCandlestick Chart Axis Label Rotation Example
6.CandlestickChartCandlestickChart
7.Define the properties of the high-low lines and candlestick borders by using a Stroke classDefine the properties of the high-low lines and candlestick borders by using a Stroke class
8.Create a CandlestickChart controlCreate a CandlestickChart control