Specify the value of the labelFunction property for one of the vertical axis renderers. : Label « Components « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Components » LabelScreenshots 
Specify the value of the labelFunction property for one of the vertical axis renderers.
Specify the value of the labelFunction property for one of the vertical axis renderers.
           

<!--
Code from Flex 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 
  (1proper attribution to Adobe is given as the owner of the user guide; and 
  (2any 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/CustomLabelsOnAxisRenderer.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" height="600">
    <fx:Script>
         
        import mx.formatters.NumberFormatter; 
        import mx.charts.chartClasses.IAxisRenderer; 
        import mx.collections.ArrayCollection; 
        private function CMstoInches(ar:IAxisRenderer, strCMs:String):String 
            var n:NumberFormatter = new NumberFormatter()
            n.precision = 1
            return n.format((Number(strCMs0.393700787).toString())
        
        [Bindable
        private var SampleHeightData:ArrayCollection = new ArrayCollection([ 
            Age: "Birth", height: 53}
            Age: "3", height: 57 }
            Age: "6", height: 64 }
            Age: "9", height: 70 }
            Age: "12", height: 82 }
            Age: "15", height: 88 
            ])
        [Bindable
        private var HeightData:ArrayCollection = new ArrayCollection([ 
            Age: "Birth"552105325:5450:5875:6090:6295:63 }
            Age: "3"556105725:5850:6275:6490:6695:67 }
            Age: "6"562106325:6450:6875:7090:7295:73 }
            Age: "9"566106725:6850:7275:7490:7695:77 }
            Age: "12"570107125:7250:7675:8090:8295:83 }
            Age: "15"574107525:7650:8075:8490:8695:87 
        ])
      
    </fx:Script>
    <fx:Declarations>
        <mx:SolidColorStroke id="s1" weight="1" />
    </fx:Declarations>
    <s:layout>
        <s:VerticalLayout />
    </s:layout>
    <s:Panel
        title="Multiple Axis Example, Boys: Age - Height percentiles"
        height="100%" width="100%">
        <s:layout>
            <s:HorizontalLayout />
        </s:layout>
        <mx:ColumnChart id="linechart" height="100%" width="100%"
            paddingLeft="5" paddingRight="5" showDataTips="true"
            dataProvider="{HeightData}">
            <mx:seriesFilters>
                <fx:Array />
            </mx:seriesFilters>
            <mx:backgroundElements>
                <mx:GridLines gridDirection="both" />
            </mx:backgroundElements>
            <mx:horizontalAxis>
                <mx:CategoryAxis id="h1" categoryField="Age"
                    title="Age in Months" ticksBetweenLabels="false" />
            </mx:horizontalAxis>
            <mx:verticalAxis>
                <mx:LinearAxis id="v1" title="Height"
                    baseAtZero="false" />
            </mx:verticalAxis>
            <mx:verticalAxisRenderers>
                <mx:AxisRenderer axis="{v1}" placement="right" />
                <mx:AxisRenderer axis="{v1}" placement="right"
                    labelFunction="CMstoInches" highlightElements="true" />
            </mx:verticalAxisRenderers>
            <mx:horizontalAxisRenderers>
                <mx:AxisRenderer axis="{h1}" placement="bottom" />
                <mx:AxisRenderer axis="{h1}" placement="top" />
            </mx:horizontalAxisRenderers>
            <mx:series>
                <mx:LineSeries yField="5" form="curve" displayName="5%" />
                <mx:LineSeries yField="10" form="curve"
                    displayName="10%" />
                <mx:LineSeries yField="25" form="curve"
                    displayName="25%" />
                <mx:LineSeries yField="50" form="curve"
                    displayName="50%" />
                <mx:LineSeries yField="75" form="curve"
                    displayName="75%" />
                <mx:LineSeries yField="90" form="curve"
                    displayName="90%" />
                <mx:LineSeries yField="95" form="curve"
                    displayName="95%" />
                <mx:ColumnSeries displayName="Height of Child X"
                    dataProvider="{SampleHeightData}" yField="height"
                    fills="{[0xCC6600]}" />
            </mx:series>
        </mx:ColumnChart>
        <mx:Legend dataProvider="{linechart}" />
    </s:Panel>
</s:Application>

   
    
    
    
    
    
    
    
    
    
    
  
Related examples in the same category
1.Set Labels for VSliderSet Labels for VSlider
2.TextField CSS ClassTextField CSS Class
3. tag represents a Label control<mx:Label> tag represents a Label control
4.Label with Label with <mx:Label>
5.Set all Label components to use the Blue colorSet all Label components to use the Blue color
6.Apply a drop shadow to a Label control by using expanded MXML syntax and inline syntaxApply a drop shadow to a Label control by using expanded MXML syntax and inline syntax
7.Styling LabelStyling Label
8. represents a Label control<s:Label> represents a Label control
9.Use ActionScript to declare two Label controlsUse ActionScript to declare two Label controls
10.Defines myName and myHometown variables and binds them to the text of Label controls in the initVars() methodDefines myName and myHometown variables and binds them to the text of Label controls in the initVars() method
11.Use bindable string variable to set the Label textUse bindable string variable to set the Label text
12.Binds variables to LabelBinds variables to Label
13.Create a region that is 50 pixels wide for the axis labels, titles, and tick marksCreate a region that is 50 pixels wide for the axis labels, titles, and tick marks
14.Set the labelGap property of a chart's axesSet the labelGap property of a chart's axes
15.Binding ActionScript variable to Label controlBinding ActionScript variable to Label control
16.Set Label text with attribute and nested tagSet Label text with attribute and nested tag
17.Define a Label tagDefine a Label tag
18.Selectable LabelSelectable Label
19.Truncate Label To Fit the widthTruncate Label To Fit the width
20.Label with ConstraintsLabel with Constraints
21.Format float number for LabelFormat float number for Label
22.Label ControlLabel Control
23.Label Control Link EventLabel Control Link Event
24.Apply a drop shadow to Label controls by using expanded MXML syntax and inline syntaxApply a drop shadow to Label controls by using expanded MXML syntax and inline syntax
25.Use ActionScript to change value of Button's label property when button clickedUse ActionScript to change value of Button's label property when button clicked
26.Creates a Button control with a label and an icon:Creates a Button control with a label and an icon:
27.Block changes Button's label property when the user clicks the buttonBlock changes Button's label property when the user clicks the button
28.Button labelButton label
29.Set label for a Button with child tagSet label for a Button with child tag
30.label for check box and buttonlabel for check box and button
31.A Button control with the label "Hello world!":A Button control with the label
32.Truncate To Fit by setting truncateToFit to trueTruncate To Fit by setting truncateToFit to true
33.Celsius and Fahrenheit converterCelsius and Fahrenheit converter
34.Inline Celsius and Fahrenheit converterInline Celsius and Fahrenheit converter
35.without an explicit function callwithout an explicit function call
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.