-
Notifications
You must be signed in to change notification settings - Fork 121
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
feat: add minInterval option for custom xDomain #240
Merged
emmacunningham
merged 12 commits into
elastic:master
from
emmacunningham:fix/discover-bars
Jun 19, 2019
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ed2a6ec
feat: setup test data for discover series
emmacunningham bdaded6
feat: add custom minInterval
emmacunningham ff523a6
chore: resolve merge conflict
emmacunningham e242144
fix: throw error iff xDomain defined
emmacunningham 39c1f31
fix: fix linting errors
emmacunningham 55e5685
test(x_domain): add tests for isDomainWithInterval
emmacunningham bd84a92
refactor(domain): add minInterval to DomainRange
emmacunningham f171e24
refactor: remove unused property and resolve merg conflict
emmacunningham 674f3cb
docs: add knob for minInterval
emmacunningham f31e9b6
feat: add validation for custom minInterval and tests
emmacunningham 9de618a
refactor: add JSDocs to domain properties & refactor
emmacunningham ad51d74
fix(domain): allow any minInterval for single datum set
emmacunningham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please add the jsdocs to documents the meaning of
minInterval
? It's important to stress that this should be the minimum interval available between data. If for example we are visualizing yearly data from 2016 to 2019 and we the consumer compute the first interval an error will occur: 2016 is a leap year this the interval is greater then the minComputedInterval of 365 days.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a datum with monthly aggregation they should provide 28 days as the minInterval.
It's worth also having a look at the current
data_histogram
intervals https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html because with time intervals there is always a distinction between calendar intervals and fixed intervals.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also suggest to check if there is a better way to specify that interval. In particular, for Time domains.
I'd like to avoid pushing the consumer to compute that minInterval in millis manually and rather accept also some
data_histogram
intervals values like1D
or1M
or similar. This facilitate the use of the library and enables the consumer to just specify a simple interval.Keep also an eye on this deprecation: elastic/kibana#27410
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markov00
See comment explaining minInterval with warnings about certain kinds of timeseries intervals here: 9de618a
It would certainly be possible to extend the type of
minInterval
to accept either a rawnumber
which would match the same units as the raw datum or a shorthand for intervals specific to a certain unit that we internally use to compute the actual minInterval of a domain. We could do something like:And then TimeInterval could be defined either as just a
string
that we parse ourselves or an interface with explicitunit: string
andlength: number
where validunit
s are restricted to a certain set of strings.However, this seems to potentially duplicate efforts because on the Kibana side, we are already using
@elastic/datemath
andparseInterval
(note thatparseInterval
is not a part of@elastic/datemath
and is instead a function defined within Kibana) to transform the returned interval from Elasticsearch (a separate issue is that it seems the Discover query still uses the deprecatedinterval
field instead ofcalendar_interval
orfixed_interval
). That is, in the Discover data, we get backchartData.ordered.interval
which is amoment
duration which requires no additional parsing or transformation and is passed directly in as the value ofminInterval
:So for developer users of
elastic-charts
in Kibana, they should already have the ability to directly pass in correctly formatted customminInterval
values given the tools that exist within Kibana.If we want to support more custom time interval shorthands within
elastic-charts
itself, that seems to me to be an additional enhancement to consider outside of this PR (the functionality exposed by this PR is needed for the Discover replacement, which does not need support for interval shorthands; and any other app within Kibana should be able to use theparseInterval
helper to get the milliseconds value) because we may want to consider how to avoid duplication of efforts between our own internal parser and Kibana's. (One small difference that may be an issue is that Kibana is usingmoment
whileelastic-charts
usingluxon
which uses slightly different strings to define patterns.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @emmacunningham for the clarification. Yes let's keep it like it is for the moment