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

In Chrome x axis data stays in order it was entered, but in QT's webkit it sorts the x axis data by value #36

Closed
DavidGoldwasser opened this issue Jan 12, 2014 · 1 comment

Comments

@DavidGoldwasser
Copy link

In this case my data was sorted by year. Explicitly sorting using one of the options below seemed to do the trick. Maybe it is good practice to always explicitly sort, but I wasn't sure if it should be required.

x.addOrderRule("Year");

By the way, just started using dimple, so far I love it. Nice looking charts with very little code. Only basic chart type I didn't see that would be nice is a pie chart.

@johnkiernander
Copy link
Member

Thank you for your kind words. I hope to add pie charts fairly soon, I've done some of the planning but I need to get to work on the code.

Regarding your x axis sorting I'm guessing this is an issue with parsing. The dimple logic will order by date if the values can all be parsed as dates, or numerically if they can be parsed as numbers, or by opposing axis value in any other case. As you noticed there are significant differences in the parsing logic for browser engines, particularly around dates. Chrome will somehow make a date out of any string vaguely resembling one (not always correctly), while webkit is fairly strict. I imagine there are similarities with the numbers, particularly if there are string elements around the numbers.

So in short, if your values are open to ambiguity it is best to specify an order rule as you suggest.

I'm going to close this issue because fixing it would increase the amount of required user interaction (i.e. specifying formatting) and with dimple I'm aiming for it to correctly guess what you want most of the time but allow you to override those guesses easily. I think we are still ok on that basis, and in this case it just needs an override as you suggest.

NB. Probably not relevant to your case but the Time Axis doesn't have this problem because it uses a set date format with D3's date parsing.

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