Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable auto x-keys sorting when parseTime is set to false #83

Closed
kenn opened this issue Oct 3, 2012 · 1 comment
Closed

Disable auto x-keys sorting when parseTime is set to false #83

kenn opened this issue Oct 3, 2012 · 1 comment

Comments

@kenn
Copy link

kenn commented Oct 3, 2012

The setData method automatically sorts x-keys, but it's problematic in some cases, particular when parseTime: false is speficied.

Given this data,

Morris.Line({
  element: 'demo',
  data: [
    {x: '9:30am',  y: 10},
    {x: '9:45am',  y: 20},
    {x: '10:00am', y: 30},
    {x: '10:15am', y: 40},
    {x: '10:30am', y: 50},
  ],
  xkey: 'x',
  ykeys: ['y'],
  labels: ['ever increasing'],
  parseTime: false
});

We get this chart.

Notice that the leftmost x-key becomes 10:00am, where it should have been 9:30am.

Btw I had hard time figuring this out... users reported this problem but it only occurred when the x-keys span between 9:59am and 10:00am. :)

I think when parseTime: false is specified, automatic sorting on x-keys should be disabled, as the doc says:

Set to false to skip time/date parsing for X values, instead treating them as an equally-spaced series.

So it makes more sense to leave X values as they are.

@oesmith
Copy link
Contributor

oesmith commented Oct 3, 2012

Good spot! I guess I was just lucky that all my graphs with parseTime: false so far have had ordered x-keys :)

@oesmith oesmith closed this as completed in 7775332 Oct 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants