-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[TSVB] Timeseries Drop last bucket set default to false #97257
[TSVB] Timeseries Drop last bucket set default to false #97257
Conversation
series, | ||
yAxis, | ||
onBrush, | ||
xAxisFormatter, | ||
annotations, | ||
syncColors, | ||
palettesService, | ||
interval, | ||
shouldDropLastBucket, |
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.
In fact, the drop bucket happens on the server side. I think the name of the variable does not reflect the essence of what you want. Please rename
@elasticmachine merge upstream |
xAxisFormatter={this.xAxisFormatter(interval)} | ||
annotations={this.prepareAnnotations()} | ||
syncColors={syncColors} | ||
palettesService={palettesService} | ||
interval={interval} | ||
shouldDropLastBucket={Boolean( |
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.
? renderEndzoneTooltip( | ||
interval, | ||
seriesData[0][0], | ||
seriesData[seriesData.length - 1][0], |
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.
please extract logic for getting domain into a separate method
const caclulateDomainForSeries = (series) => {
const seriesData = series[0]?.data || [];
return {
domainStart: seriesData[0][0],
domainEnd: seriesData[Math.max(seriesData.length - 1, 0)][0],
};
};
export const TimeSeries = ({
.....
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.
and then
let tooltipFormatter;
if (shouldDropLastBucket) {
const { domainStart, domainEnd } = caclulateDomainForSeries(series);
tooltipFormatter = renderEndzoneTooltip(
interval,
domainStart,
domainEnd,
decorateFormatter(xAxisFormatter)
);
} else {
tooltipFormatter = decorateFormatter(xAxisFormatter);
}
@elasticmachine merge upstream |
@stratoula @dziyanadzeraviankina I think we should also update our sample visualizations. |
I was going to create an issue for that 🙂 |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@@ -14,7 +14,7 @@ export function dropLastBucket(resp, panel, series) { | |||
const shouldDropLastBucket = isLastValueTimerangeMode(panel, series); | |||
|
|||
if (shouldDropLastBucket) { | |||
const seriesDropLastBucket = get(series, 'override_drop_last_bucket', 1); | |||
const seriesDropLastBucket = get(series, 'override_drop_last_bucket', 0); |
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 think the following code works wrong, override_drop_last_bucket
should has a priority todrop_last_bucket
// wrong code
const seriesDropLastBucket = get(series, 'override_drop_last_bucket', 0);
const dropLastBucket = get(panel, 'drop_last_bucket', seriesDropLastBucket);
@dziyanadzeraviankina @stratoula think we can that in scope of that PR
expect(domainBounds?.domainStart).toBeUndefined(); | ||
expect(domainBounds?.domainEnd).toBeUndefined(); |
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.
expect(domainBounds?.domainStart).toBeUndefined(); | |
expect(domainBounds?.domainEnd).toBeUndefined(); | |
expect(domainBounds).toBeUndefined(); |
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.
LGTM, tested it locally
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.
LGTM
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.
LGTM
Pinging @elastic/kibana-app (Team:KibanaApp) |
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.
This PR introduces a bug in the tooltip. When the last bucket is kept, the tooltip only shows the current time. Steps to reproduce:
- Install the ecommerce data
- Go to the ecommerce dashboard
- Hover over the TSVB chart with annotations
@elasticmachine run elasticsearch-ci/docs |
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.
LGTM!
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
@elasticmachine run elasticsearch-ci/docs |
* [TSVB] Timeseries Drop last bucket should default to false * Rename isLastBucketDropped prop and move series domain calculation to a separate file * Fix failing tests because of wrong default value * update drop_last_bucket.js * Refactor drop_last_bucket and some functional tests * Change infra metrics test values because of last bucket value changed * Refactor series_domain_calculation and related code * Update series_domain_calculations.test * Update series_domain_calculations.test * Fix tooltip showing wrong time * Refactor index Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Alexey Antonov <alexwizp@gmail.com>
) * [TSVB] Timeseries Drop last bucket should default to false * Rename isLastBucketDropped prop and move series domain calculation to a separate file * Fix failing tests because of wrong default value * update drop_last_bucket.js * Refactor drop_last_bucket and some functional tests * Change infra metrics test values because of last bucket value changed * Refactor series_domain_calculation and related code * Update series_domain_calculations.test * Update series_domain_calculations.test * Fix tooltip showing wrong time * Refactor index Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Alexey Antonov <alexwizp@gmail.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Alexey Antonov <alexwizp@gmail.com>
Closes #95756
Summary
Changed the default value of
Drop last bucket
setting to false.Added a tooltip indicating there's partial data. It's displayed for the last value in case the last bucket is not dropped either for the whole visualization or for any series. (To test that last bucket should intersect the time selector)
To drop last bucket for the series:
Data
->Options
select "Yes" forOverride Index Pattern?
and thenDrop last bucket
Checklist
For maintainers