flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vitali Kabak (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-33052) Runtime error when using a chart in a module in an app that is also using charts
Date Thu, 22 Aug 2013 12:23:54 GMT

    [ https://issues.apache.org/jira/browse/FLEX-33052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13747471#comment-13747471
] 

Vitali Kabak commented on FLEX-33052:
-------------------------------------

I used a workaround like:

if (styleManager.parent)
				{
					const requiredClasses: Array = [
						"mx.charts.chartClasses.ChartBase",
						"mx.charts.chartClasses.CartesianChart",
						"mx.charts.chartClasses.PolarChart",
						"mx.charts.AreaChart",
						"mx.charts.series.AreaSeries",
						"mx.charts.series.BarSeries",
						"mx.charts.BarChart",
						"mx.charts.series.ColumnSeries",
						"mx.charts.ColumnChart",
						"mx.charts.series.LineSeries",
						"mx.charts.LineChart",
						"mx.charts.series.PieSeries",
						"mx.charts.PieChart",
						"mx.charts.AxisRenderer",
						".blockCategoryAxis",
						".blockNumericAxis",
						".linedNumericAxis",
						".dashedNumericAxis",
						".dashedCategoryAxis",
						".hangingCategoryAxis",
						".horizontalGridLines"
					];

					for (var i: int = 0; i < requiredClasses.length; i++)
					{
						if (styleManager.getStyleDeclaration(requiredClasses[i]) == null)
						{
							var parentStyle: CSSStyleDeclaration = styleManager.parent.getStyleDeclaration(requiredClasses[i]);

							if (parentStyle)
							{

								var style: CSSStyleDeclaration = new CSSStyleDeclaration(new CSSSelector(requiredClasses[i]),
styleManager, true);

								style.defaultFactory = parentStyle.defaultFactory;
							}
						}
					}
				}

Sometimes when I run our app, it throws the same error, since styleManager.parent is null
in the child app (so I don't have a source from where to copy style declarations into child
app).
Our app is big and complicated, so I can't attach an example (also the issue in this case
is not 100% reproducible).

In order to fix this problem all chart classes, that use styleManager.getStyleDeclaration
(all Charts, Series, AxisRenderer and GridLines) should have a fix in initStyles() method.
Method getMergedStyleDeclaration should be used instead of getStyleDeclaration and all operations
with style declaration should be inside "if" block. Something like:

private function initStyles():Boolean
{
        HaloDefaults.init(styleManager);
		
		var chartBaseStyle:CSSStyleDeclaration = styleManager.getMergedStyleDeclaration("mx.charts.chartClasses.ChartBase");
if (chartBaseStyle)
{
		chartBaseStyle.setStyle("chartSeriesStyles", HaloDefaults.chartBaseChartSeriesStyles);
		chartBaseStyle.setStyle("fill", new SolidColor(0xFFFFFF, 0));
		chartBaseStyle.setStyle("calloutStroke", new SolidColorStroke(0x888888,2));
}		
        return true;
    }
                
> Runtime error when using a chart in a module in an app that is also using charts
> --------------------------------------------------------------------------------
>
>                 Key: FLEX-33052
>                 URL: https://issues.apache.org/jira/browse/FLEX-33052
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Charts
>    Affects Versions: Adobe Flex SDK Previous
>         Environment: Affected OS(s): All OS Platforms
> Language Found: English
>            Reporter: Adobe JIRA
>
> This is a regression in 4.6. It doesn't matter if the modules are Spark or not. Works
fine in 4.5.1 and below.
> See attached FB project.
> Steps to reproduce:
> 1. Create an app that uses a chart and create a module that also uses a chart.
>  
>  Actual Results:
>  
> TypeError: Error #1009: Cannot access a property or method of a null object reference.
> 	at mx.charts.chartClasses::ChartBase/initStyles()[E:\dev\4.y\frameworks\projects\charts\src\mx\charts\chartClasses\ChartBase.as:1862]
>  
>  Expected Results:
>  
> No error and chart loads fine.
>  
>  Workaround (if any):
>  
>  Copy chart styles from module's parent styleManager into the module's own styleManager.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message