0 Replies Latest reply on Dec 10, 2009 11:40 AM by PanicT

    DateTimeAxis min/max bug? Problems with consistent padding. Date Wrapping.


      I have been working on a problem with a BarChart object that I've created using dynamic data.


      My primary issue is that I can't seem to get the proper min/max values to set for the chart.


      To solve this I manually found the min and max of the data set of Dates and set the min and max of the chart. This allowed me to finally see all the floating custom bars (each bar is rendered with a user set fill), however now if I have a bar that extends over a year change the horizontal axis labels do not wrap the date properly, so instead of 2/10 (feb 2010) being the last date, 12/09 (dec 2009) is the last date.


      I've been trying to dynamically adjust the padding based upon a change event, but so far to no avail. Partially I think because I'm not sure which event for the function to fire on.


      private function dateAxisGen(r:Array):void {
                      var min:Number = r[0].startTime.time;
                      var max:Number = r[0].endTime.time;
                      const PAD:Number = 2;
                      const MILLISEC_IN_MONTH:Number = 2629743830;
                      const MILLISEC_IN_WEEK:Number = 604800000;
                      const MILLISEC_IN_DAY:Number = 864;
                      for (var i:int = 1; i < r.length; i++) {
                          var o:OperationXT = OperationXT(r[i]);
                          min = Math.min(o.startTime.time, min);
                          max = Math.max(o.endTime.time, max);
                      // Calculates the maximum range, then adds an appropriate
                      // padding to the chart via extra time. TODO
                      /* var range:Number = max - min;
                      if(range >= MILLISEC_IN_MONTH) {
                          dAxis.padding = (MILLISEC_IN_WEEK/1000000)/PAD;
                          dAxis.padding = (MILLISEC_IN_WEEK/1000000)/PAD;
                      } else if(range >= MILLISEC_IN_WEEK) {
                          dAxis.padding = (MILLISEC_IN_DAY)/PAD;
                          dAxis.padding = (MILLISEC_IN_DAY)/PAD;
                      } else {
                          dAxis.padding = PAD;
                      dAxis.minimum = new Date(min);
                      dAxis.maximum = new Date(max);



      this, however, does not adjust the padding properly when an operation is removed from the list. Not to mention I still have the date wrapping error. It gives me the following error:


      Cannot access a property or method of a null object reference.
          at mx.charts::AxisRenderer/measureHorizontalGutters()[C:\work\flex\dmv_automation\projects\d atavisualisation\src\mx\charts\AxisRenderer.as:2244]
          at mx.charts::AxisRenderer/calcRotationAndSpacing()[C:\work\flex\dmv_automation\projects\dat avisualisation\src\mx\charts\AxisRenderer.as:1858]
          at mx.charts::AxisRenderer/adjustGutters()[C:\work\flex\dmv_automation\projects\datavisualis ation\src\mx\charts\AxisRenderer.as:1534]
          at mx.charts.chartClasses::CartesianChart/updateAxisLayout()[C:\work\flex\dmv_automation\pro jects\datavisualisation\src\mx\charts\chartClasses\CartesianChart.as:2239]
          at mx.charts.chartClasses::CartesianChart/updateDisplayList()[C:\work\flex\dmv_automation\pr ojects\datavisualisation\src\mx\charts\chartClasses\CartesianChart.as:1366]
          at mx.core::UIComponent/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8065]
          at mx.managers::LayoutManager/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\f ramework\src\mx\managers\LayoutManager.as:663]
          at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\gumbo_beta2\frameworks\projects \framework\src\mx\managers\LayoutManager.as:736]
          at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\gumbo_beta2\frameworks\ projects\framework\src\mx\managers\LayoutManager.as:1069]



      Any help with my problem would be greatly appreciated.



      Alright, so I've discovered that the ONLY time the date wrapping error occurs is when the axis labels contain only the month and year, any other time it places it properly.


      Does anyone know where I can report this bug?