Set Axis label for Column chart : Column Chart Axis « Chart « Flex






Set Axis label for Column chart

Set Axis label for Column chart
          
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script>
    
    import mx.controls.Alert;

    import mx.collections.ArrayCollection;

    [Bindable]
    private var productSales:ArrayCollection = new ArrayCollection( [
            { Quarter: "1", PC: 10000, Mac: 3000, Gadgets: 1000, Total: 14000 },
            { Quarter: "2", PC: 12000, Mac: 4000, Gadgets: 2000, Total: 18000 },
            { Quarter: "3", PC: 15000, Mac: 8000, Gadgets: 5000, Total: 28000 },
            { Quarter: "4", PC: 20000, Mac: 10000, Gadgets: 9000, Total: 39000 }
            ]);
 
       
    public function setAxisLabel(labelValue:Object, previousLabelValue:Object,axis:CategoryAxis, labelItem:Object):String {
       return "Label:" + labelValue;
    }

  
  </mx:Script>

  <mx:Panel title="ColumnChart Example" width="100%" height="100%" >
    <mx:ColumnChart id="columnChart" height="100%" width="100%" showDataTips="true" dataProvider="{productSales}">
      <mx:verticalAxis>
        <mx:LinearAxis title="Quantity" />
      </mx:verticalAxis>
      <mx:horizontalAxis>
        <mx:CategoryAxis dataProvider="{productSales}" categoryField="Quarter"
                    labelFunction="setAxisLabel" title="Fiscal Year" displayName="Quarter"/>
      </mx:horizontalAxis>
        <mx:series>
          <mx:ColumnSeries xField="Quarter" yField="PC" displayName="PC"/>
          <mx:ColumnSeries xField="Quarter" yField="Mac" displayName="Mac"/>
          <mx:ColumnSeries xField="Quarter" yField="Gadgets" displayName="Gadgets"/>
        </mx:series>
      </mx:ColumnChart>
      <mx:Legend dataProvider="{columnChart}" direction="horizontal"/>
    </mx:Panel>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.horizontal Axis Renderer for ColumnCharthorizontal Axis Renderer for ColumnChart
2.Axis Renderer for ColumnChartAxis Renderer for ColumnChart
3.vertical Axis Renderer for ColumnChartvertical Axis Renderer for ColumnChart
4.Create a ColumnChart control with the default axis locations (bottom and left).Create a ColumnChart control with the default axis locations (bottom and left).
5.Column Chart Axis LabelColumn Chart Axis Label
6.Customize horizontalAxisRenderer and AxisRendererCustomize horizontalAxisRenderer and AxisRenderer
7.Customize axisStrokeCustomize axisStroke
8.use the secondHorizontalAxisRenderer and secondVerticalAxisRenderer properties to control the appearance of the secondary axisuse the secondHorizontalAxisRenderer and secondVerticalAxisRenderer properties to control the appearance of the secondary axis
9.The following example removes tick marks from the horizontal axis:The following example removes tick marks from the horizontal axis:
10.Date Time Axis RangeDate Time Axis Range
11.Adding axis titlesAdding axis titles
12.Set LinearAxis, and formats the values to include a dollar sign and a thousands separator.Set LinearAxis, and formats the values to include a dollar sign and a thousands separator.
13.Create two functions that access complex data for both the axis and the seriesCreate two functions that access complex data for both the axis and the series
14.Remove tick marks from the horizontal axisRemove tick marks from the horizontal axis