Hey there,
I spent the last half day or so hunting a really annoying problem. Maybe this Information can provide others meanings to get this sorted out quicker...
I created a Barchart which is filled by a grouped DataSource. The Barchart is configured to stack the dataitems and group them by a category. So far so good.
The Chart is displayed in Firefox without a problem, everything adds up and the stacks are correctly aligned. But when I display the same chart with Chrome the stacks are wrong. Meaning that the stack of category A contains elements with category B and vice versa.
After thorough investigation we narrowed the problem down to the default sort of the datasource. It seems that the chart depends on data that is correctly sorted by the category field, so that the items of every group are in the SAME ORDER. In Firefox that is the case, probably because my original data was already sorted in that way, but in Chrome (which apparently uses QuickSort (for arrays with 10 or less elements ) => NOT STABLE) the order for one entity is wrong. And so the elements in the chart are mixed up. If you ask me the charts implementation for dividing the categories MUST NOT rely on correctly sorted Datasources or if so it should enforce are correct sorting.
We fixed the problem by explicitly providing a sort-clause to the datasource specifying both the group field and after that the category field.
Heres a Fiddle to reproduce the issue:
http://jsfiddle.net/zaCPt/3/
Use Chrome if you want to see the difference! Or look at the attached screenshot, both charts use the same data. Top is unsorted datasource, Bottom is sorted
Chrome Version is 28.0.1500.95 m
Regards,
Kristoffer Witt
I spent the last half day or so hunting a really annoying problem. Maybe this Information can provide others meanings to get this sorted out quicker...
I created a Barchart which is filled by a grouped DataSource. The Barchart is configured to stack the dataitems and group them by a category. So far so good.
The Chart is displayed in Firefox without a problem, everything adds up and the stacks are correctly aligned. But when I display the same chart with Chrome the stacks are wrong. Meaning that the stack of category A contains elements with category B and vice versa.
After thorough investigation we narrowed the problem down to the default sort of the datasource. It seems that the chart depends on data that is correctly sorted by the category field, so that the items of every group are in the SAME ORDER. In Firefox that is the case, probably because my original data was already sorted in that way, but in Chrome (which apparently uses QuickSort (for arrays with 10 or less elements ) => NOT STABLE) the order for one entity is wrong. And so the elements in the chart are mixed up. If you ask me the charts implementation for dividing the categories MUST NOT rely on correctly sorted Datasources or if so it should enforce are correct sorting.
We fixed the problem by explicitly providing a sort-clause to the datasource specifying both the group field and after that the category field.
Heres a Fiddle to reproduce the issue:
http://jsfiddle.net/zaCPt/3/
Use Chrome if you want to see the difference! Or look at the attached screenshot, both charts use the same data. Top is unsorted datasource, Bottom is sorted
Chrome Version is 28.0.1500.95 m
Regards,
Kristoffer Witt