Skip to content

Commit 086c469

Browse files
renovate[bot]markov00stratoulaElenaStoeva
authored
Update dependency @elastic/charts to v63 (main) (#175316)
## Note about `@elastic/charts` BREAKING CHANGE In version 62.0.0 we introduced a breaking change in time-series charts: the default "extra" legend value now represents the last data point in the passed data array. It doesn't try to reconcile anymore the data computed domain with a passed domain in `Settings.xDomain` but instead it renders directly the last element of the passed array. The reasons for this change can be found at elastic/elastic-charts#2115 or can be asked directly to our `#charts` slack channel There are a couple of implementations in Kibana that use both the `showLegendExtra` in the chart configuration. I've commented them out so that the owner teams can help me fix this breaking change if necessary. In general, the fix requires that the data passed to the chart contains all the buckets, even empty buckets with null/zeros should be passed. To achieve this, your ES query you should provide the `extended_bounds` settings in the [data histogram agg](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html#search-aggregations-bucket-histogram-aggregation-extended-bounds) and use a `min_doc_count:0`. If that doesn't work, please ping me and we can find an alternative solution. This should not limit the query performance, generating empty date buckets on the server side has a similar or even less performance impact than what we were doing on the client side to calculate every missing bucket, to fillup the chart in particular situations. Please double-check your queries/data fetches and push a commit to this PR or ping me with the updated data fetch strategy. fix #153079 This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@elastic/charts](https://togithub.com/elastic/elastic-charts) | [`61.2.0` -> `63.0.0`](https://renovatebot.com/diffs/npm/@elastic%2fcharts/61.2.0/63.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@elastic%2fcharts/63.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@elastic%2fcharts/63.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@elastic%2fcharts/61.2.0/63.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@elastic%2fcharts/61.2.0/63.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>elastic/elastic-charts (@&#8203;elastic/charts)</summary> ### [`v63.0.0`](https://togithub.com/elastic/elastic-charts/blob/HEAD/CHANGELOG.md#6300-2024-01-24) [Compare Source](https://togithub.com/elastic/elastic-charts/compare/v62.0.0...v63.0.0) ##### Features - **legend:** expose extra raw values ([#&#8203;2308](https://togithub.com/elastic/elastic-charts/issues/2308)) ([85bfe06](https://togithub.com/elastic/elastic-charts/commit/85bfe0668d66fd24e78f2bba8be4570fa926e94c)) ##### BREAKING CHANGES - **legend:** The `CustomLegend.item` now exposes both the `raw` and the `formatted` version of the extra value. ### [`v62.0.0`](https://togithub.com/elastic/elastic-charts/blob/HEAD/CHANGELOG.md#6200-2024-01-23) [Compare Source](https://togithub.com/elastic/elastic-charts/compare/v61.2.0...v62.0.0) ##### Bug Fixes - **deps:** update dependency [@&#8203;elastic/eui](https://togithub.com/elastic/eui) to ^91.3.1 ([#&#8203;2286](https://togithub.com/elastic/elastic-charts/issues/2286)) ([d4d7b5d](https://togithub.com/elastic/elastic-charts/commit/d4d7b5db6681ec0c65ef8b7e576f1b5fc8b5433a)) - **deps:** update dependency [@&#8203;elastic/eui](https://togithub.com/elastic/eui) to v92 ([#&#8203;2290](https://togithub.com/elastic/elastic-charts/issues/2290)) ([cc537fa](https://togithub.com/elastic/elastic-charts/commit/cc537faf43d88acc9abab7e0dac9360bd460b574)) - **legend:** improve last value handling ([#&#8203;2115](https://togithub.com/elastic/elastic-charts/issues/2115)) ([9f99447](https://togithub.com/elastic/elastic-charts/commit/9f9944734c4a13bfe9e4ffc9f4c0f39da5f9931f)) ##### BREAKING CHANGES - **legend:** In cartesian charts, the default legend value now represents the data points that coincide with the latest datum in the X domain. Please consider passing every data point, even the empty ones (like empty buckets/bins/etc) if your x data domain doesn't fully cover a custom x domain passed to the chart configuration. </details> --- --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Elena Stoeva <elenastoeva99@gmail.com>
1 parent 3e4f1ed commit 086c469

File tree

13 files changed

+49
-9
lines changed

13 files changed

+49
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"@dnd-kit/utilities": "^2.0.0",
102102
"@elastic/apm-rum": "^5.16.0",
103103
"@elastic/apm-rum-react": "^2.0.2",
104-
"@elastic/charts": "61.2.0",
104+
"@elastic/charts": "63.0.0",
105105
"@elastic/datemath": "5.0.3",
106106
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.9.1-canary.1",
107107
"@elastic/ems-client": "8.5.1",

x-pack/plugins/observability/public/pages/overview/components/sections/logs/logs_section.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ export function LogsSection({ bucketSize }: Props) {
142142
showLegend
143143
legendPosition={Position.Right}
144144
xDomain={{ min, max }}
145-
showLegendExtra
145+
// Please double check if the data passed to the chart contains all the buckets, even the empty ones.
146+
// the showLegendExtra will display the last element of the data array as the default legend value
147+
// and if empty buckets are filtered out you can probably see a value that doesn't correspond
148+
// to the value in the last time bucket visualized.
149+
// showLegendExtra
146150
locale={i18n.getLocale()}
147151
/>
148152
{series &&

x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/external_alert.test.ts.snap

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/alerts/__snapshots__/alerts_histogram.test.ts.snap

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/alerts/alerts_histogram.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export const getAlertsHistogramLensAttributes: GetLensAttributes = (
7070
scale: 'interval',
7171
params: {
7272
interval: 'auto',
73+
includeEmptyRows: true,
7374
},
7475
},
7576
'e09e0380-0740-4105-becc-0a4ca12e3944': {
@@ -79,6 +80,7 @@ export const getAlertsHistogramLensAttributes: GetLensAttributes = (
7980
isBucketed: false,
8081
scale: 'ratio',
8182
sourceField: '___records___',
83+
params: { emptyAsNull: true },
8284
},
8385
'34919782-4546-43a5-b668-06ac934d3acd': {
8486
label: `Top values of ${stackByField}`,

x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/events.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export const getEventsHistogramLensAttributes: GetLensAttributes = (
7171
scale: 'interval',
7272
params: {
7373
interval: 'auto',
74+
includeEmptyRows: true,
7475
},
7576
},
7677
'e09e0380-0740-4105-becc-0a4ca12e3944': {
@@ -80,6 +81,7 @@ export const getEventsHistogramLensAttributes: GetLensAttributes = (
8081
isBucketed: false,
8182
scale: 'ratio',
8283
sourceField: '___records___',
84+
params: { emptyAsNull: true },
8385
},
8486
'34919782-4546-43a5-b668-06ac934d3acd': {
8587
label: `Top values of ${stackByField}`,

x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/external_alert.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export const getExternalAlertLensAttributes: GetLensAttributes = (
9191
scale: 'interval',
9292
params: {
9393
interval: 'auto',
94+
includeEmptyRows: true,
9495
},
9596
},
9697
'0a923af2-c880-4aa3-aa93-a0b9c2801f6d': {
@@ -100,6 +101,7 @@ export const getExternalAlertLensAttributes: GetLensAttributes = (
100101
isBucketed: false,
101102
scale: 'ratio',
102103
sourceField: '___records___',
104+
params: { emptyAsNull: true },
103105
},
104106
'42334c6e-98d9-47a2-b4cb-a445abb44c93': {
105107
label: TOP_VALUE(`${stackByField}`), // could be event.category

x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/dns_top_domains.test.ts.snap

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export const getDnsTopDomainsLensAttributes: GetLensAttributes = (
133133
scale: 'interval',
134134
params: {
135135
interval: 'auto',
136+
includeEmptyRows: true,
136137
},
137138
},
138139
'2a4d5e20-f570-48e4-b9ab-ff3068919377': {
@@ -142,6 +143,7 @@ export const getDnsTopDomainsLensAttributes: GetLensAttributes = (
142143
scale: 'ratio',
143144
sourceField: 'dns.question.name',
144145
isBucketed: false,
146+
params: { emptyAsNull: true },
145147
},
146148
},
147149
columnOrder: [

x-pack/plugins/stack_alerts/public/rule_types/threshold/visualization.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,11 @@ export const ThresholdVisualization: React.FunctionComponent<Props> = ({
269269
baseTheme={chartsBaseTheme}
270270
xDomain={domain}
271271
showLegend={!!termField}
272-
showLegendExtra
272+
// Please double check if the data passed to the chart contains all the buckets, even the empty ones.
273+
// the showLegendExtra will display the last element of the data array as the default legend value
274+
// and if empty buckets are filtered out you can probably see a value that doesn't correspond
275+
// to the value in the last time bucket visualized.
276+
// showLegendExtra
273277
legendPosition={Position.Bottom}
274278
locale={i18n.getLocale()}
275279
/>

0 commit comments

Comments
 (0)