mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Update dependency @elastic/charts to v46.12.0 (main) (#135946)
* Update dependency @elastic/charts to v46.12.0 * fix: breaking changes with Metric API Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co> Co-authored-by: nickofthyme <nicholas.partridge@elastic.co>
This commit is contained in:
parent
c7a5b1336d
commit
6200837594
4 changed files with 26 additions and 43 deletions
|
@ -104,7 +104,7 @@
|
|||
"@elastic/apm-rum": "^5.12.0",
|
||||
"@elastic/apm-rum-react": "^1.4.2",
|
||||
"@elastic/apm-synthtrace": "link:bazel-bin/packages/elastic-apm-synthtrace",
|
||||
"@elastic/charts": "46.11.2",
|
||||
"@elastic/charts": "46.12.0",
|
||||
"@elastic/datemath": "5.0.3",
|
||||
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.3.0-canary.1",
|
||||
"@elastic/ems-client": "8.3.3",
|
||||
|
|
|
@ -313,24 +313,21 @@ describe('MetricVisComponent', function () {
|
|||
.find(Metric)
|
||||
.props().data![0][0]!;
|
||||
|
||||
expect(getConfig(undefined)).not.toHaveProperty('domain');
|
||||
expect(getConfig(undefined)).not.toHaveProperty('domainMax');
|
||||
expect(getConfig(undefined)).not.toHaveProperty('progressBarDirection');
|
||||
|
||||
expect(getConfig('foobar')).not.toHaveProperty('domain');
|
||||
expect(getConfig('foobar')).not.toHaveProperty('domainMax');
|
||||
expect(getConfig('foobar')).not.toHaveProperty('progressBarDirection');
|
||||
|
||||
const configWithProgress = getConfig(basePriceColumnId) as MetricWProgress;
|
||||
|
||||
expect(configWithProgress.domain).toEqual({ min: 0, max: table.rows[0][basePriceColumnId] });
|
||||
expect(configWithProgress.domainMax).toEqual(table.rows[0][basePriceColumnId]);
|
||||
expect(configWithProgress.progressBarDirection).toBe('vertical');
|
||||
|
||||
expect(configWithProgress).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"color": "#343741",
|
||||
"domain": Object {
|
||||
"max": 28.984375,
|
||||
"min": 0,
|
||||
},
|
||||
"domainMax": 28.984375,
|
||||
"extra": <span />,
|
||||
"progressBarDirection": "vertical",
|
||||
"subtitle": undefined,
|
||||
|
@ -661,10 +658,7 @@ describe('MetricVisComponent', function () {
|
|||
Array [
|
||||
Object {
|
||||
"color": "#343741",
|
||||
"domain": Object {
|
||||
"max": 28.984375,
|
||||
"min": 0,
|
||||
},
|
||||
"domainMax": 28.984375,
|
||||
"extra": <span />,
|
||||
"progressBarDirection": "vertical",
|
||||
"subtitle": "Median products.base_price",
|
||||
|
@ -674,10 +668,7 @@ describe('MetricVisComponent', function () {
|
|||
},
|
||||
Object {
|
||||
"color": "#343741",
|
||||
"domain": Object {
|
||||
"max": 28.984375,
|
||||
"min": 0,
|
||||
},
|
||||
"domainMax": 28.984375,
|
||||
"extra": <span />,
|
||||
"progressBarDirection": "vertical",
|
||||
"subtitle": "Median products.base_price",
|
||||
|
@ -687,10 +678,7 @@ describe('MetricVisComponent', function () {
|
|||
},
|
||||
Object {
|
||||
"color": "#343741",
|
||||
"domain": Object {
|
||||
"max": 25.984375,
|
||||
"min": 0,
|
||||
},
|
||||
"domainMax": 25.984375,
|
||||
"extra": <span />,
|
||||
"progressBarDirection": "vertical",
|
||||
"subtitle": "Median products.base_price",
|
||||
|
@ -700,10 +688,7 @@ describe('MetricVisComponent', function () {
|
|||
},
|
||||
Object {
|
||||
"color": "#343741",
|
||||
"domain": Object {
|
||||
"max": 25.784375,
|
||||
"min": 0,
|
||||
},
|
||||
"domainMax": 25.784375,
|
||||
"extra": <span />,
|
||||
"progressBarDirection": "vertical",
|
||||
"subtitle": "Median products.base_price",
|
||||
|
@ -713,10 +698,7 @@ describe('MetricVisComponent', function () {
|
|||
},
|
||||
Object {
|
||||
"color": "#343741",
|
||||
"domain": Object {
|
||||
"max": 25.348011363636363,
|
||||
"min": 0,
|
||||
},
|
||||
"domainMax": 25.348011363636363,
|
||||
"extra": <span />,
|
||||
"progressBarDirection": "vertical",
|
||||
"subtitle": "Median products.base_price",
|
||||
|
@ -728,10 +710,7 @@ describe('MetricVisComponent', function () {
|
|||
Array [
|
||||
Object {
|
||||
"color": "#343741",
|
||||
"domain": Object {
|
||||
"max": 24.984375,
|
||||
"min": 0,
|
||||
},
|
||||
"domainMax": 24.984375,
|
||||
"extra": <span />,
|
||||
"progressBarDirection": "vertical",
|
||||
"subtitle": "Median products.base_price",
|
||||
|
|
|
@ -10,7 +10,14 @@ import React, { useCallback } from 'react';
|
|||
|
||||
import numeral from '@elastic/numeral';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { Chart, Metric, MetricSpec, RenderChangeListener, Settings } from '@elastic/charts';
|
||||
import {
|
||||
Chart,
|
||||
Metric,
|
||||
MetricSpec,
|
||||
RenderChangeListener,
|
||||
Settings,
|
||||
MetricWProgress,
|
||||
} from '@elastic/charts';
|
||||
import { getColumnByAccessor, getFormatByAccessor } from '@kbn/visualizations-plugin/common/utils';
|
||||
import { ExpressionValueVisDimension } from '@kbn/visualizations-plugin/common';
|
||||
import {
|
||||
|
@ -162,16 +169,13 @@ const MetricVisComponent = ({ data, config, renderComplete }: MetricVisComponent
|
|||
? getColumnByAccessor(config.dimensions.breakdownBy, data.columns)
|
||||
: undefined;
|
||||
|
||||
let getProgressBarConfig = (_row: DatatableRow) => ({});
|
||||
let getProgressBarConfig = (_row: DatatableRow): Partial<MetricWProgress> => ({});
|
||||
|
||||
if (config.dimensions.progressMax) {
|
||||
const maxColId = getColumnByAccessor(config.dimensions.progressMax, data.columns)?.id;
|
||||
if (maxColId) {
|
||||
getProgressBarConfig = (_row: DatatableRow) => ({
|
||||
domain: {
|
||||
min: 0,
|
||||
max: _row[maxColId],
|
||||
},
|
||||
getProgressBarConfig = (_row: DatatableRow): Partial<MetricWProgress> => ({
|
||||
domainMax: _row[maxColId],
|
||||
progressBarDirection: config.metric.progressDirection,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1429,10 +1429,10 @@
|
|||
dependencies:
|
||||
object-hash "^1.3.0"
|
||||
|
||||
"@elastic/charts@46.11.2":
|
||||
version "46.11.2"
|
||||
resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-46.11.2.tgz#8d95515e4c0adf5fd94392d304dc5b5ea8416be0"
|
||||
integrity sha512-RcqrjMguXNCS+O8hnd8DtCTlVtZxmzdfu0N+ez+zA3a41YOblet1qt6YfLsEY/5wFiJndacR+O8pNHjbeLV7gA==
|
||||
"@elastic/charts@46.12.0":
|
||||
version "46.12.0"
|
||||
resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-46.12.0.tgz#95c5ba2d4eff75b52fb294b867fb7b147da3383a"
|
||||
integrity sha512-YIILkL3CXSoBMBiwj1N6FJTWMB9PpKi1bfMZVJCGHb23+J3LiiAqsQYsZbm7L28ziH3s0RveRomRcfVo38NvMg==
|
||||
dependencies:
|
||||
"@popperjs/core" "^2.4.0"
|
||||
bezier-easing "^2.1.0"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue