8 Replies Latest reply on Aug 18, 2009 2:09 AM by KalavatiSingh

    Text Bar labels in a Column Chart

    KalavatiSingh Level 1

      Hi,

                         I want to add an id to Column charts( to each column i mean)  .The id is a Text id .Can any one let me know how to add Labels( text label) in a Column Charts.Any example/docs will be of great help.

       

       

       

      Regards

      Kalavati Singh

      kalavati_singh@yahoo.co.in

        • 1. Re: Text Bar labels in a Column Chart
          _Natasha_ Level 4

          Hi,

           

          ColumnSeries has labelField and labelFunction properties.

           

          http://livedocs.adobe.com/flex/3/langref/mx/charts/series/ColumnSeries.html

          • 2. Re:  labels in a Column Chart
            KalavatiSingh Level 1

            Hi Natasha,

                                I want to display the labels  from an array. any idea on this

             

             

             

            Regards

            Kalavati

            • 3. Re:  labels in a Column Chart
              _Natasha_ Level 4

              Not from series dataProvider?

               

              Is these labels should be connected to any parts of Chart.

               

              You can use annotationElements property of chart to add any data to it.

              CartasianDataCanvas also useful thing.

              • 4. Re:  labels in a Column Chart
                KalavatiSingh Level 1

                Hi ,

                      I want to display them on the top of  each column ,however i written the code  but the ids are not displayed here is the code

                 

                 

                 

                 

                . I need your help in writing a  labelfunction to a column chart.
                                   I have plotted a column Chart from an array ,Each column  has a id i want to display the id in the top.(see the Flex examples to  know how  the labels look  http://blog.flexexamples.com/2008/01/23/displaying-the-labels-vertically-in-flex-columncha rt-control/)
                Here is   my code
                [Bindable]
                public var DECKER:Array = [
                {freq_value:"640", freq_value1:-60,id:"qqq"},
                {freq_value:"642", freq_value1:-60,id:"www"},
                {freq_value:"644", freq_value1:-60,id:"qqq"},
                {freq_value:"646", freq_value1:-60,id:"FX"},
                {freq_value:"648", freq_value1:-60,id:"qqq"},
                {freq_value:"650", freq_value1:-60,id: "TT"},
                {freq_value:"652", freq_value1:-60,id:"qqq"},
                {freq_value:"654", freq_value1:-60,id: "TC22T"},
                {freq_value:"656", freq_value1:-60,id:"qqq"},
                {freq_value:"658", freq_value1:-60,id:"W-D"},
                {freq_value:"660", freq_value1:-60,id:"WT-D"},
                {freq_value:"662", freq_value1:-60,id: "Tyy"},
                {freq_value:"664", freq_value1:-60,id:"F11"},
                {freq_value:"666", freq_value1:-60,id:"qqq"},},
                {freq_value:"668", freq_value1:-60,id:"WT2-D"},
                {freq_value:"670", freq_value1:-60,id:"FpX"},
                {freq_value:"672", freq_value1:-60,id: "TCT"},
                {freq_value:"674", freq_value1:-60,id:"FtX"},
                {freq_value:"676", freq_value1:-60,id: "TCeT"},
                {freq_value:"678", freq_value1:-60,id:"FOX"},
                {freq_value:"680", freq_value1:-60,id: "TCwT"},
                {freq_value:"682", freq_value1:-60,id:"XXX"},
                {freq_value:"684", freq_value1:-60,id:"WT3-D"},
                {freq_value:"686", freq_value1:-60,id:"qqq"},
                {freq_value:"688", freq_value1:-60,id:"FFF"},
                {freq_value:"690", freq_value1:-60,id:"qqq"}
                ];
                my column series is
                <mx:ColumnSeries dataProvider="{DECKER}" xField="freq_value"  yField="freq_value1" labelFunction="labelFunc" >
                <mx:stroke>
                <mx:Stroke color="0xFF0000" weight="2" alpha="1.0" />
                </mx:stroke>
                <mx:fill>
                <mx:SolidColor color="0xFF0000" alpha="0.5" />
                </mx:fill>

                </mx:ColumnSeries>



                    Let me  know if you need any further details on it
                Regards
                Kalavati
                • 5. Re:  labels in a Column Chart
                  _Natasha_ Level 4

                  You don't need to create a labelFunction.

                  You need to set labelField = "id"

                   

                  To see labels on the upper point you need to set labelPosition="outside" in ColumnSeries.

                  • 6. Re:  labels in a Column Chart
                    KalavatiSingh Level 1

                    Hi,

                         I tried by  replacing with labelposition=" outside" labelFeild="id"

                        I get en error

                     

                     

                    TypeError: Error #1034: Type Coercion failed: cannot convert mx.charts::LineChart@583c5c1 to mx.charts.ColumnChart.
                        at mx.charts.series::ColumnSeries/updateTransform()[C:\work\flex\dmv_automation\projects\dat avisualisation\src\mx\charts\series\ColumnSeries.as:1295]
                        at mx.charts.chartClasses::Series/validateTransform()[C:\work\flex\dmv_automation\projects\d atavisualisation\src\mx\charts\chartClasses\Series.as:1571]
                        at mx.charts.chartClasses::Series/updateDisplayList()[C:\work\flex\dmv_automation\projects\d atavisualisation\src\mx\charts\chartClasses\Series.as:828]
                        at mx.charts.series::ColumnSeries/updateDisplayList()[C:\work\flex\dmv_automation\projects\d atavisualisation\src\mx\charts\series\ColumnSeries.as:1354]
                        at mx.core::UIComponent/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:6351]
                        at mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\f ramework\src\mx\managers\LayoutManager.as:622]
                        at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\managers\LayoutManager.as:677]
                        at Function/http://adobe.com/AS3/2006/builtin::apply()
                        at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framew ork\src\mx\core\UIComponent.as:8628]
                        at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8568]

                     

                       after googling for some time i donot know if its a bug or error

                     

                     

                    Regards

                    Kalavati

                    • 7. Re:  labels in a Column Chart
                      _Natasha_ Level 4

                      Do you use ColumnChart or LineChart?

                       

                      Do you have LineChart in you code?

                      • 8. Re:  labels in a Column Chart
                        KalavatiSingh Level 1

                        Hi,

                            I am using Column as well as Line Charts .Actaully I  have a multi series chart where I have a single Line Chart  i am having Line Series & Column series  plotted inside that.

                         

                         

                         

                        Regards

                        Kalavati