Jul
15
2010

Two LineSeries bugs in Flex 4

There are two bugs in Flex 4 in LineSeries: After a chart line stroke is defined by a SolidColorStroke object,the chart DataTip won't be visuable,the Legend marker will be always filled with black color(default value). Please view the issue demo. Here I will tell you why and find a way to handle the issue.

Open the LineSeries.as in Flex 4 SDK, the DataTip border is defined within findDataPoints() method, then locate line:if (istroke is Stroke). In Flex 4, the Stroke class is a Subclasses of the SolidColorStroke class, so here if statement will return. Why the Legend marker is always black? Because a chart's legendData property contains an Array of LegendData objects, one for each item in the Legend. Locate get legendData() method, as yu can see, every Legend marker is a LineSeriesLegendMarker object by default. go to the LineSeriesLegendMarker helper class, push F3 and open its definition, then locate line 2101:if (Stroke is Stroke). Here we get the issue because of Adobe Team's rush, I guess.

As we know the reason, lt's not difficult to fix the bug. Please view the LineSeriesEx.as I written as your refrence.

Tip: if a bug is caused by migration, one debugging tip with Flash Builder is:Copy the older source code in the project, the locate the warning place.

Of course, we can still use the Stroke class to define line stroke style, but we'd better replace the SolidColorStroke class with the Stroke class in Flex 4 project, Adobe Flex SDK Team need fix these two bugs. Cheers! In Flex Hero, they have been fixed.

View the final demo, downloadthe source code.

原文:http://www.riafan.com/article/flex/flex4-lineseries-two-bugs.html

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading