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

Comments

Projects
None yet
3 participants
@pawelfus
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Jan 21, 2015

Collaborator

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/

Collaborator

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

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Jan 21, 2015

Contributor

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..

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Jan 22, 2015

Collaborator

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

Collaborator

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

This comment has been minimized.

Show comment
Hide comment
@KacperMadej

KacperMadej Sep 13, 2018

Contributor

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/

Contributor

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/

@KacperMadej KacperMadej added the Bug label Sep 13, 2018

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Sep 14, 2018

Collaborator

Makes sense!

Collaborator

TorsteinHonsi commented Sep 14, 2018

Makes sense!

KacperMadej added a commit that referenced this issue Sep 17, 2018

Fixed #3739, changed rounding method to Math.foor for milliseconds da…
…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