1 Reply Latest reply on Aug 12, 2011 2:47 AM by JabbyPandaUA

    weird axis behaviour

    TB_DK

      Hello,

       

      I have a problem with a DateTime Axis... Minimum and maximum are set by two DateChooser and dataare handed over to the chart via a submit function. The graphs in the chart do appear correctly, but at  some point the x-axis jumps and is showing the older date on the right side instead of showing it on the left side. See the screenshots below:

       

      ok.jpgfalsch.jpg

      It always happens when there are two times the first of a month involved... e.g.: 01-03-2011 - 01-04-2011!

       

      As I said, data in the chart are shown correct, only the axis goes wrong. Any clue why?

      Here the setup of the chart:

       

      <mx:LineChart x="36" y="125" id="lChart" width="654" height="230"
                            dataProvider="{getDataInputResult.lastResult.Tables.o3DataIn.Rows}"
                            showDataTips="true" seriesFilters="[]">
                <mx:backgroundElements>
                     <mx:GridLines gridDirection="both">
                          <mx:horizontalFill>
                               <s:SolidColor color="0xCCCCCC" alpha=".3"/>
                          </mx:horizontalFill>
                     </mx:GridLines>
                </mx:backgroundElements>
      
                <mx:verticalAxis>
                     <mx:LinearAxis id="yAxis" displayName="O3" title="Ozon (ppb)" baseAtZero="false" autoAdjust="true"/>
                </mx:verticalAxis>
                
                <mx:verticalAxisRenderers>
                     <mx:AxisRenderer axis="{yAxis}" verticalAxisTitleAlignment="vertical">
                          <mx:axisStroke>
                               <s:SolidColorStroke weight="1" color="#C0C0C0"/>                         
                          </mx:axisStroke>
                     </mx:AxisRenderer>
                </mx:verticalAxisRenderers>
                
                <mx:horizontalAxis>
                     <mx:DateTimeAxis id="dtaH" dataUnits="days"
                                          minimum="{startDate.selectedDate}"
                                          maximum="{getMaxTimeResult.lastResult}" 
                                          labelFunction="dateAxis_labelFunc"
                                          autoAdjust="false"
                                          baseAtZero="false"
                                          displayName="Dato"/>
                </mx:horizontalAxis>
                
                <mx:series>
                     <mx:LineSeries id="lnDEHM" displayName="DEHM model" yField="DEHM" xField="time" form="curve">
                          <mx:lineStroke>
                               <s:Stroke color="0x0099FF" weight="3"/>
                          </mx:lineStroke>
                     </mx:LineSeries>
                     <mx:LineSeries id="lnDEOM" displayName="MATCH model" yField="DEOM" xField="time" form="curve">
                          <mx:lineStroke> <!-- SolidColorStroke does not work well together with the legend component -->
                               <s:Stroke color="0xE48701" weight="3"/>
                          </mx:lineStroke>
                     </mx:LineSeries>  
                </mx:series>
      
           </mx:LineChart>

       

      and here the dateAxis_labelFunc:

       

      private function dateAxis_labelFunc(item:Object, prevValue:Object, axis:DateTimeAxis):String
                     {
                          var datNum:Number = Date.parse(item);
                          var tempDate:Date = new Date(datNum);
                          return dateFormatter.format(tempDate);
                     }

       

      Thanks for looking at it!

       

      Bests, Thomas