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

[Series Charts] Provide custom crosshair overlay time formatting #1429

Conversation

justinkambic
Copy link
Contributor

@justinkambic justinkambic commented Jan 14, 2019

Summary

As a user of this component, we have encountered a case where we're expressing time in the current locality in other parts of our UI, but cannot change the locality or format of the date string displayed by the crosshair overlay when the mouse is used.

I've modified the existing code to use moment.js only because it seemed expedient to easily support this use case.

Checklist

  • This was checked in mobile
  • This was checked in IE11
  • This was checked in dark mode
  • Any props added have proper autodocs
  • Documentation examples were added
  • A changelog entry exists and is marked appropriately
  • This was checked for breaking changes and labeled appropriately
  • Jest tests were updated or added to match the most common scenarios
  • This was checked against keyboard-only and screenreader scenarios
  • This required updates to Framer X components

@justinkambic justinkambic changed the title Series chart provide additional time formatting [Series Charts] Provide custom crosshair overlay time formatting Jan 14, 2019
@justinkambic justinkambic force-pushed the series_chart-provide-additional-time-formatting branch from 0477ba2 to 5d03a69 Compare January 14, 2019 16:01
CHANGELOG.md Outdated
@@ -4,6 +4,7 @@ No public interface changes since `6.3.0`.

## [`6.3.0`](https://github.com/elastic/eui/tree/v6.3.0)

- Added custom date string formatting for series charts crosshair overlay ([#1429](https://github.com/elastic/eui/pull/1429))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\This changelog entry is now out of date, needs to be moved back to the top

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 7968372.

if (xType === SCALE.TIME || xType === SCALE.TIME_UTC) {
return new Date(x).toISOString(); // TODO add a props for time formatting
return moment(x).format(xCrosshairFormat);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either check to see that xCrosshairFormat is passed through, or add a default value for the prop that matches the original implementation (otherwise xCrosshairFormat is required and this is a breaking change for charts).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also updated in 7968372 - added tests in a later commit as well.

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@justinkambic justinkambic merged commit 5f20258 into elastic:master Jan 15, 2019
@snide snide mentioned this pull request Jan 18, 2019
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

Successfully merging this pull request may close these issues.

2 participants