Define two colors and then uses those colors in the axis renderers and in the strokes and fills for the chart items : Column Chart « Chart « Flex






Define two colors and then uses those colors in the axis renderers and in the strokes and fills for the chart items

Define two colors and then uses those colors in the axis renderers and in the strokes and fills for the chart items
           

<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".

This user guide is licensed for use under the terms of the Creative Commons Attribution 
Non-Commercial 3.0 License. 

This License allows users to copy, distribute, and transmit the user guide for noncommercial 
purposes only so long as 
  (1) proper attribution to Adobe is given as the owner of the user guide; and 
  (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms. 
The best way to provide notice is to include the following link. 
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

-->


    <!-- charts/StyledMultipleAxes.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"
    creationComplete="srv_fe.send();srv_strk.send()" height="600">
    <fx:Script> 
         
        [Bindable] 
        public var c1:Number = 0x224488; 
        [Bindable] 
        public var c2:Number = 0x884422; 
      
    </fx:Script>
    <fx:Declarations>
        <!--
            To see data in an HTML table, go to
            http://aspexamples.adobe.com/chart_examples/stocks.aspx
        -->
        <!--
            View source of the following pages to see the structure of the data
            that Flex uses in this example.
        -->
        <mx:HTTPService id="srv_fe"
            url="http://aspexamples.adobe.com/chart_examples/stocks-xml.aspx?tickerSymbol=FE" />
        <mx:HTTPService id="srv_strk"
            url="http://aspexamples.adobe.com/chart_examples/stocks-xml.aspx?tickerSymbol=STRK" />
        <mx:SolidColorStroke id="h1Stroke" color="{c1}"
            weight="8" alpha=".75" caps="square" />
        <mx:SolidColorStroke id="h2Stroke" color="{c2}"
            weight="8" alpha=".75" caps="square" />
    </fx:Declarations>
    <s:layout>
        <s:VerticalLayout />
    </s:layout>
    <s:Panel title="Multiple Axes with Multiple Data Series" width="400"
        height="400">
        <s:layout>
            <s:VerticalLayout />
        </s:layout>
        <mx:ColumnChart id="myChart" showDataTips="true"
            height="250" width="350">
            <mx:horizontalAxis>
                <mx:DateTimeAxis id="h1" dataUnits="days" />
            </mx:horizontalAxis>
            <mx:horizontalAxisRenderers>
                <mx:AxisRenderer placement="bottom" axis="{h1}" />
            </mx:horizontalAxisRenderers>
            <mx:verticalAxisRenderers>
                <mx:AxisRenderer placement="left" axis="{v1}">
                    <mx:axisStroke>{h1Stroke}</mx:axisStroke>
                </mx:AxisRenderer>
                <mx:AxisRenderer placement="right" axis="{v2}">
                    <mx:axisStroke>{h2Stroke}</mx:axisStroke>
                </mx:AxisRenderer>
            </mx:verticalAxisRenderers>
            <mx:series>
                <mx:ColumnSeries dataProvider="{srv_fe.lastResult.data.result}"
                    xField="date" yField="close" displayName="FE">
                    <mx:verticalAxis>
                        <mx:LinearAxis id="v1" minimum="2" maximum="5" />
                    </mx:verticalAxis>
                    <mx:fill>
                        <mx:SolidColor color="{c1}" />
                    </mx:fill>
                </mx:ColumnSeries>
                <mx:LineSeries dataProvider="{srv_strk.lastResult.data.result}"
                    xField="date" yField="close" displayName="STRK">
                    <mx:verticalAxis>
                        <mx:LinearAxis id="v2" minimum="40" maximum="50" />
                    </mx:verticalAxis>
                    <mx:lineStroke>
                        <mx:SolidColorStroke color="{c2}" weight="4"
                            alpha="1" />
                    </mx:lineStroke>
                </mx:LineSeries>
            </mx:series>
        </mx:ColumnChart>
        <mx:Legend dataProvider="{myChart}" />
    </s:Panel>
</s:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.PieChart vs ColumnChartPieChart vs ColumnChart
2.ColumnChart DemoColumnChart Demo
3.Waterfall Stacked ColumnChartWaterfall Stacked ColumnChart
4.Create a PieChart control from the selected columns in the ColumnChart control.Create a PieChart control from the selected columns in the ColumnChart control.
5.Column Chart Demo and CategoryAxisColumn Chart Demo and CategoryAxis
6.Combine column chart and pie chartCombine column chart and pie chart
7.Using strokes in ActionScriptUsing strokes in ActionScript
8.You can also represent the range of dates in MXML by using the following syntax:You can also represent the range of dates in MXML by using the following syntax:
9.Creating a custom Legend controlCreating a custom Legend control
10.Stack the Profit and Expenses fields, in which some of the values are negative.Stack the Profit and Expenses fields, in which some of the values are negative.
11.Add new grid lines as annotation elements to the chart and an image as the background elementAdd new grid lines as annotation elements to the chart and an image as the background element
12.Define the grid lines inside each chart control's definitionDefine the grid lines inside each chart control's definition
13.Turns on grid lines in both directions and applies them to the chart:Turns on grid lines in both directions and applies them to the chart:
14.Define set of filters, and then applies them to various chart elements:Define set of filters, and then applies them to various chart elements:
15.Mixed ChartMixed Chart
16.Multiple Axis ChartMultiple Axis Chart
17.Display two chartsDisplay two charts
18.Make Chart From Drag DropMake Chart From Drag Drop