danvk/dygraphs — pull request #118 by klausw-g (2012-02-07 02:56:08+00:00)
Title: Fix data ordering bug from issue 278, and clean up datasets handling

The code was declaring this.layout_.datasets as an array, assuming
numerical indices, but accessing them as an object using string labels
as keys. This caused problems with Chrome which reorders numeric-looking
string labels, for example sorting "10" before "09".

This changelist redefines datasets to be an array indexed by series
number, and maintains a separate setNames array used in those places
where it's needed.

As part of the refactoring, also change indexFromSetname to use a lookup
instead of looping over all series each time, and provide a getLabels()
convenience function.

Includes a test for this in axis_labels.js that also demonstrates the
bug.