3 Replies Latest reply on Nov 13, 2009 10:52 AM by 100amplifiers

    log axis graph gridlines possible?

    100amplifiers

      Hi,

       

      I'm totally new to Flex/Flash, and just using the 60-day demo of Flexbuilder 3 to see how I like it. I was trying to create a frequency response (FR) graph using the chart controls, but I couldn't get it to cooperate. An FR plot has a log scale X axis and linear y axisfr-plot.png. Mine will start at 10 and end at 1000, with 100 in the center. I can create that no problem. But I cannot make it display gridlines at 20, 30, 40 ... 600, 700, ... etc.  Is this poosible? Am I missing some control properties, or would I need to create my own programmatically?

       

      Here's my goal...

      fr-plot.png

      fr-plot.pngfr-plot.png

      Here's where I ended up...

      ---------------------------------------------------------------------

       

      <?xml version="1.0"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

                
          <mx:Panel title="Frequency Response" height="100%" width="100%">

       

              <mx:LineChart id="linechart" height="100%" width="100%"
                  paddingLeft="5" paddingRight="5"
                  showDataTips="true" dataProvider="{defineMeSomeDay}">
                     
                  <mx:horizontalAxis>
                      <mx:LogAxis interval="1" id="haxis" minimum="10" maximum="1000" title="Hz"/>
                  </mx:horizontalAxis>
                                   
                  <mx:verticalAxis>
                      <mx:LinearAxis id="vaxis" title="dB"/>
                  </mx:verticalAxis>
                        
                  <mx:series>
                      <mx:LineSeries yField="response" form="curve" displayName="response"/>
                  </mx:series>
                 
              </mx:LineChart>

       

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

       

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

      ---------------------------------------------------------------------

       

      Any suggestions or advice?

        • 1. Re: log axis graph gridlines possible?
          100amplifiers Level 1

          Whoa. There seems to be problem with picture uploading function of this forum. Weird. That post looked perfectly normal (1 graph picture) last night after I viewed it last.

           

          Whatever. Just ignore the extra FR graphs. They are all the same.

           

          ..Todd

          • 3. Re: log axis graph gridlines possible?
            100amplifiers Level 1

            Well that's what I would have thought, and I think I've tried every permutation of its properties, as well as every permutation of logAxis and horizontalAxis properties but nothing seems to do that. There is no 'minorTick' property for logAxis, only linearAxis.

             

            Here's my latest attempts with some actual data, since I discovered that without data many of the vertical axis properties do not get applied:

             

             

            <?xml version="1.0"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

             

                <mx:Script><![CDATA[
                 import mx.collections.ArrayCollection;
                 [Bindable]
                 public var response:ArrayCollection = new ArrayCollection([
                    {dB:0, Hz:1000},
                    {dB:.25, Hz:500},
                    {dB:2, Hz:90},
                    {dB:-.5, Hz:50},
                    {dB:-7, Hz:30},
                    {dB:-24, Hz:10},
                 ]);
              ]]></mx:Script>
             
             
                <mx:Array id="bg_grid">
                     <mx:GridLines direction="both">
                                <mx:horizontalStroke>
                                    <mx:Stroke weight=".5"/>
                                </mx:horizontalStroke>
                                <mx:verticalStroke>
                                    <mx:Stroke weight=".5" />
                                </mx:verticalStroke>
                            </mx:GridLines>
                  </mx:Array>    
                              
                <mx:Panel title="Frequency Response" height="100%" width="100%">

             


                    <mx:LineChart id="linechart" height="100%" width="100%"
                        showDataTips="true" dataProvider="{response}"
                        backgroundElements="{bg_grid}">
                           
                        <mx:horizontalAxis>
                            <mx:LogAxis    interval="1"  minimum="10" maximum="1000" title="Hz"/>
                        </mx:horizontalAxis>
                                         
                        <mx:verticalAxis>
                            <mx:LinearAxis  minorInterval="1"  autoAdjust="false" baseAtZero="false" maximum="6"  minimum="-24"  interval="3" title="dB"/>
                        </mx:verticalAxis>
                              
                        <mx:series>
                            <mx:LineSeries yField="dB"  xField="Hz" form="curve" displayName="response"/>
                        </mx:series>
                       
                    </mx:LineChart>

             

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

             

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