So I am going to assume you are using a loop, and lastLabel is a variable set 
to the last label created in the loop. You're code's going to break on the 
first iteration since it can't divide a null value by 2. You need to either set 
an initial value for lastLabel before the loop or not process that line on the 
first iteration, instead setting the position. That is probably what you really 
want to do since you would want your first label to be at a fixed position and 
the second to base it off of that.

I hope it doesn't seem that I'm talking down to you, I'm just trying to 
determine the best I can out of the little bit I'm seeing here.

--- In [email protected], Richard Rodseth <rrods...@...> wrote:
>
> Yes, I know a null pointer exception is not charting-specific :)
> 
> None of my code is in the stack crawl (shown below). The line in question
> is:
> 
>                 staggeredrightGutter / (lastLabel.width / 2));
> 
> and lastLabel is null. I can't reproduce all the code here (but I will note
> that the series list is built dynamically).
> 
> I'll keep digging. Thanks.
> 
> 
> TypeError: Error #1009: Cannot access a property or method of a null object
> reference.
>     at
> mx.charts::AxisRenderer/calcStaggeredSpacing()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\AxisRenderer.as:2200]
>     at
> mx.charts::AxisRenderer/calcRotationAndSpacing()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\AxisRenderer.as:1591]
>     at
> mx.charts::AxisRenderer/adjustGutters()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\AxisRenderer.as:1331]
>     at mx.charts::AxisRenderer/set
> gutters()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\AxisRenderer.as:803]
>     at
> mx.charts.chartClasses::CartesianChart/updateAxisLayout()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\chartClasses\CartesianChart.as:2032]
>     at
> mx.charts.chartClasses::CartesianChart/updateDisplayList()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\chartClasses\CartesianChart.as:1359]
>     at
> mx.core::UIComponent/validateDisplayList()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\UIComponent.as:6351]
>     at
> mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:622]
>     at
> mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:695]
>     at Function/http://adobe.com/AS3/2006/builtin::apply()
>     at
> mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8633]
>     at
> mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8573]



Reply via email to