3 Replies Latest reply on Aug 25, 2010 10:39 PM by BhaskerChari

    axisTitleStyleName for LineChart , how to set it

    Malena Mesarina

      Hi,

       

      it looks like LineChart does not have an axisTItleStyleName (although from documentation it looks like other charts do) . So how can I set the style of the axis title of a LineChart?

       

      any ideas?

       

      Can't find any documentation on this.

       

      -Malena

        • 1. Re: axisTitleStyleName for LineChart , how to set it
          Subeesh Arakkan Level 4
          <?xml version="1.0" encoding="utf-8"?>
          
          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
          
              xmlns:s="library://ns.adobe.com/flex/spark" 
          
              xmlns:mx="library://ns.adobe.com/flex/mx"  xmlns:local="*">
          
              <fx:Script><![CDATA[
          
                  import mx.collections.ArrayCollection;
          
                  [Bindable]
          
                  public var expenses:ArrayCollection = new ArrayCollection([
          
                  {Month:"Jan", Profit:2000, Expenses:1500},
          
                  {Month:"Feb", Profit:1000, Expenses:200},
          
                  {Month:"Mar", Profit:1500, Expenses:500}
          
                  ]);
          
              ]]></fx:Script>
          
              
          
              <fx:Style>
          
                  .myEmbeddedStyle {
          
                  fontFamily:myMyriad;
          
                  fontSize:20;
          
                  }
          
              </fx:Style>
          
              
          
              <mx:Panel title="Axis title">
          
                  <mx:LineChart id="column"
          
                      showDataTips="true"
          
                      dataProvider="{expenses}" 
          
                      axisTitleStyleName="myEmbeddedStyle"
          
                      >
          
                      <mx:horizontalAxis>
          
                          <mx:CategoryAxis 
          
                              dataProvider="{expenses}" 
          
                              categoryField="Month" 
          
                              title="FY 2006"
          
                              />
          
                      </mx:horizontalAxis>
          
                      <mx:series>
          
                          <mx:LineSeries 
          
                              xField="Month" 
          
                              yField="Profit" 
          
                              displayName="Profit"
          
                              />
          
                          <mx:LineSeries 
          
                              xField="Month" 
          
                              yField="Expenses" 
          
                              displayName="Expenses"
          
                              />
          
                      </mx:series>
          
                  </mx:LineChart>
          
                  <mx:Legend dataProvider="{column}"/>
          
              </mx:Panel>
          
          </s:Application>
          
          • 2. Re: axisTitleStyleName for LineChart , how to set it
            Malena Mesarina Level 1

            Hi Subeesh,

             

            yeah, I have seen already how axisTitleStyleName was set in mxml . But I need to set it in Actionscript since I am displaying my LineChart dynamically. However the weird thing is that axisTitleStyleName does not appear as a property of Linechart.

             

            I don't know why...

             

            -Malena

            • 3. Re: axisTitleStyleName for LineChart , how to set it
              BhaskerChari Level 4

              Hi Malena,

               

              It does not appear as a property of LineChart since it is a style property ...So you need to make use of the setStyle() method in order to set the

               

              axisStyleName in actionscript...

               

              <mx:Style>

                      .lineChartAxisStyle {

                      fontFamily:myMyriad;

                      fontSize:20;
                     
                      color:#CDF3AE;

                      }

                  </mx:Style>

               

               

              lineChart.setStyle("axisTitleStyleName", "lineChartAxisStyle");

               

               

              Thanks,

              Bhasker Chari