4 Replies Latest reply on Jun 7, 2010 6:38 AM by Sumanta150374

    Displaying '<' sign in mxml:ColumnSeries displayName

    Sumanta150374

      How to display '<' sign in mxml:ColumnSeries displayName? I have to show A<10K as displayName in mxml:ColumnSeries - however none of the option

      works ('&lt;' '&#60;'). Can somebody please help me?

        • 1. Re: Displaying '<' sign in mxml:ColumnSeries displayName
          BhaskerChari Level 4

          Hi Sumunta,

           

          Check the code below:

           

          Note that you need to set the display name in ActionScript. I have set them in creationComplete, you can set them based on your requirement. But the concept here is you need to set in AS.

           

          <?xml version="1.0"?>
          <mx:Application xmlns:mx="
          http://www.adobe.com/2006/mxml" creationComplete="init()">
              <mx:Script>
                  <![CDATA[         
                  import mx.collections.ArrayCollection;

                  [Bindable]
                  private var medalsAC:ArrayCollection = new ArrayCollection( [
                      { Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
                      { Country: "China", Gold: 32, Silver:17, Bronze: 14 },
                      { Country: "Russia", Gold: 27, Silver:27, Bronze: 38 } ]);
                     
                  public function init():void
            {
             barS1.displayName='A&#0060;10K';
             barS2.displayName="Silver&#0060;20K";
             barS3.displayName="Bronze&#0062;20K";
            }
                  ]]>
              </mx:Script>

              <!-- Define custom colors for use as fills. -->
              <mx:SolidColor id="sc1" color="yellow" alpha=".8"/>
              <mx:SolidColor id="sc2" color="0xCCCCCC" alpha=".6"/>
              <mx:SolidColor id="sc3" color="0xFFCC66" alpha=".6"/>

              <!-- Define custom Strokes for the columns. -->
              <mx:Stroke id="s1" color="yellow" weight="2"/>
              <mx:Stroke id="s2" color="0xCCCCCC" weight="2"/>
              <mx:Stroke id="s3" color="0xFFCC66" weight="2"/>

              <mx:Panel title="ColumnChart and BarChart Controls Example"
                  height="100%" width="100%" layout="horizontal">
                  <mx:BarChart id="bar" height="100%" width="45%"
                      paddingLeft="5" paddingRight="5"
                      showDataTips="true" dataProvider="{medalsAC}">
                         
                      <mx:verticalAxis>
                          <mx:CategoryAxis categoryField="Country"/>
                      </mx:verticalAxis>
                         
                      <mx:series>
                          <mx:BarSeries id="barS1"
                              yField="Country"
                              xField="Gold"
                              displayName="A&#0060;10K"
                              fill="{sc1}"
                              stroke="{s1}"
                          />
                          <mx:BarSeries id="barS2"
                              yField="Country"
                              xField="Silver"
                              displayName="Silver&#0060;20K"
                              fill="{sc2}"
                              stroke="{s2}"
                          />
                          <mx:BarSeries id="barS3"
                              yField="Country"
                              xField="Bronze"
                              displayName="Bronze"
                              fill="{sc3}"
                              stroke="{s3}"
                          />
                      </mx:series>
                  </mx:BarChart>

                  <mx:Legend dataProvider="{bar}"/>

              </mx:Panel>
          </mx:Application>

           


          If this post answers your question or helps, please kindly mark it as such.


          Thanks,

          Bhasker Chari

           

          • 2. Re: Displaying '<' sign in mxml:ColumnSeries displayName
            David_F57 Level 5

            hi,

             

            You can simply bind a string value to the display name

             

            [Bindable] private var myDispName:String="A < 10k"; no need to worry about asc codes etc...

             

            displayName="{myDispName}"

             

             

            David.

            1 person found this helpful
            • 4. Re: Displaying '<' sign in mxml:ColumnSeries displayName
              BhaskerChari Level 4

              Hi David,

               

              Its not working with the Bindable string, I have tested it.

               

              Thanks,

              Bhasker Chari