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

RangeSelector inputs MS format #3739

Closed
pawelfus opened this issue Jan 21, 2015 · 5 comments
Closed

RangeSelector inputs MS format #3739

pawelfus opened this issue Jan 21, 2015 · 5 comments
Assignees
Labels

Comments

@pawelfus
Copy link
Contributor

@pawelfus pawelfus commented Jan 21, 2015

Example: http://jsfiddle.net/qhgfpjqL/14/

And image, for better description:
screen shot 2015-01-21 at 12 25 32 pm

Of course there should be 01s000ms.

@TorsteinHonsi
Copy link
Collaborator

@TorsteinHonsi TorsteinHonsi commented Jan 21, 2015

This is not really a fix, but the last point in your demo had an x value of 999.9 milli seconds, hence the last value was rounded up. So it comes down to a problem of sub-millisecond date formatting.

Broken down to dateFormat: http://jsfiddle.net/highcharts/qhgfpjqL/16/

Add the last point and it looks better: http://jsfiddle.net/highcharts/qhgfpjqL/15/

@pawelfus
Copy link
Contributor Author

@pawelfus pawelfus commented Jan 21, 2015

Indeed, that's the real reason. Maybe dateFormatter should simply round values? There may be similar case when full date will be funny: http://jsfiddle.net/qhgfpjqL/20/ However, rounding doesn't sound like real solution.

I'm not sure if we can force users to use only integer timestamps..

@TorsteinHonsi
Copy link
Collaborator

@TorsteinHonsi TorsteinHonsi commented Jan 22, 2015

Yes, probably doing Math.round or parseInt on the incoming argument to dateFormatter would do it. But at a performance cost...

@KacperMadej
Copy link
Contributor

@KacperMadej KacperMadej commented Sep 13, 2018

If
'L': pad(Math.round(timestamp % 1000), 3)
could be replaced with
'L': pad(Math.floor(timestamp % 1000), 3)
then %L will display only full units (milliseconds) as any other date and time format.

This also allow resolving sub-millisecond precision with custom Highcharts.dateFormats.
Demo: http://jsfiddle.net/BlackLabel/qhgfpjqL/39/

@TorsteinHonsi
Copy link
Collaborator

@TorsteinHonsi TorsteinHonsi commented Sep 14, 2018

Makes sense!

KacperMadej added a commit that referenced this issue Sep 17, 2018
…teFormat to match other date and time formats.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants