Friday, December 25, 2009

AnyChart: Scatter Plot with missing Values, legend highlight problem

  AnyChart lets you create good looking charts. And here is one of those charts, original example may be found here http://www.anychart.com/products/anychart/gallery/sample_180.html



  Problem:

  When you have missing points as in this example above you can fill those points with "Missing" word.
  And it just fine until you enable "Legend" control in chart. To have for example this chart below




  Now when you hover legend line corresponding to legend item should be highlighted. But if you will do as in first example you will see that not all points in line get highlighted. As shown in screen-shot above.
if you have debugger version of Flash Player you will see Action Script exception notification.



Hack:

Note: This hack won't work for those who use point events. Since event will fail if first point is absent. Isn't it strange? For those who don't use point events, but have legend here comes hack.

Step 1: Remove missing points, and there will be no exception. But you will loose point "C" on axis. And it is not what we want.



 Step 2: The hack starts here. Add add fake series with all points. Here we have used another "bug" of AnyChart. When value is missing or equals to zero Bar is most of the time invisible. I have seen it slightly when resized.

 Step 3: Turn off auto items in legend, and manually add legend items.

Now you have scatter plot line chart with missing points and working legend.

I have used AnyChart 5.1.2 and IE8

 Solution: I wish Action Script exception of legend and/or point event will be fixed in next version.

No comments:

Post a Comment