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

[Lens] Workspace panel dimensions by chart type #168651

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
5321b42
support aspect ratio in workspace panel
drewdaemon Oct 11, 2023
fec74d4
aspect ratios for XY charts
drewdaemon Oct 11, 2023
ed0e849
add support for setting width/height
drewdaemon Oct 18, 2023
efc0896
set dimensions from expression renderer
drewdaemon Oct 23, 2023
e4f2bd9
better typing
drewdaemon Oct 23, 2023
392b656
set aspect ratio on XY charts
drewdaemon Oct 24, 2023
dedfb1f
use gitpkg
drewdaemon Oct 24, 2023
e56b0ad
Merge branch 'main' of github.com:elastic/kibana into 136993/workspac…
drewdaemon Oct 24, 2023
91721c9
revert getDisplayOptions
drewdaemon Oct 25, 2023
b2131cd
Merge branch 'main' of github.com:elastic/kibana into 136993/workspac…
drewdaemon Oct 30, 2023
279e0d5
revert some unused changes
drewdaemon Oct 30, 2023
6d7bde0
update default metric color
drewdaemon Oct 30, 2023
3864ca8
Merge branch 'main' of github.com:elastic/kibana into 136993/workspac…
drewdaemon Nov 1, 2023
6fce51f
update chart dep
drewdaemon Nov 2, 2023
3c481fe
Merge branch 'main' of github.com:elastic/kibana into 136993/workspac…
drewdaemon Nov 8, 2023
dfa0492
hide incorrect chart with veil
drewdaemon Nov 8, 2023
441d34b
update comment
drewdaemon Nov 8, 2023
af7204c
Merge branch 'main' into 136993/workspace-dimensions-by-chart-type
kibanamachine Nov 8, 2023
d97cfca
fix package.json
drewdaemon Nov 8, 2023
7d2d00f
Merge branch '136993/workspace-dimensions-by-chart-type' of github.co…
drewdaemon Nov 8, 2023
e18da0f
update yarn.lock
drewdaemon Nov 8, 2023
57e9f12
Update dependency @elastic/charts to v61
renovate[bot] Nov 8, 2023
d11c2b3
XY renderer requests correct aspect ratio on first render
drewdaemon Nov 13, 2023
14ae004
request correct dimensions for every vis type
drewdaemon Nov 13, 2023
dc273f7
request dimension from choropleth chart renderer
drewdaemon Nov 13, 2023
ca167d5
fix: metric background breaking change
nickofthyme Nov 14, 2023
b3f8e27
chore: migrate all current theme usage to legacy, merge eui usages
nickofthyme Nov 14, 2023
31bbe74
chore: remove unneeded size hacks on tickLine styles
nickofthyme Nov 14, 2023
f5a8ecf
chore: remove usage of chart plugin theme.useChartsTheme
nickofthyme Nov 14, 2023
737b4e3
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Nov 14, 2023
eca9e79
workspace prompt screens are always full
drewdaemon Nov 14, 2023
430906e
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Nov 14, 2023
b1bbf64
chore: remove theme from charts theme service
nickofthyme Nov 14, 2023
8c7eec5
fix: type and test errors
nickofthyme Nov 14, 2023
dbf047c
fix bad chart margins in xy expression renderer
nickofthyme Nov 15, 2023
e43fe2d
use max of old outsideDimensions
nickofthyme Nov 15, 2023
3e7bf25
verify and update screenshot changes
nickofthyme Nov 15, 2023
47c3f05
fix fn tests due to metric changes part 1
nickofthyme Nov 16, 2023
f8c7a95
Merge branch 'main' into renovate/main-@elasticcharts
nickofthyme Nov 16, 2023
3b5d884
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Nov 16, 2023
cd8ca2f
fix metric empty background color
nickofthyme Nov 20, 2023
a996cf2
Merge remote-tracking branch 'upstream/renovate/main-@elasticcharts' …
nickofthyme Nov 20, 2023
e31fb5f
update charts with changes to background colors
nickofthyme Nov 21, 2023
7fb3674
Merge branch 'main' into renovate/main-@elasticcharts
nickofthyme Nov 21, 2023
7eeab53
update merge errors and fix snapshots
nickofthyme Nov 22, 2023
d6835d0
Merge branch 'main' of github.com:elastic/kibana into 136993/workspac…
drewdaemon Nov 27, 2023
9ade84f
functional test
drewdaemon Nov 27, 2023
9a7407b
augment functional test
drewdaemon Nov 28, 2023
a05555b
fix aspect ratios in constrained-dimension case
drewdaemon Nov 28, 2023
0eaa8f5
constrain gauge dimensions
drewdaemon Nov 28, 2023
2fca769
show veil for gauge
drewdaemon Nov 28, 2023
6e161aa
update jest tests and fix margin issue
nickofthyme Nov 29, 2023
a2c806e
Merge branch 'main' into renovate/main-@elasticcharts
nickofthyme Nov 29, 2023
b8f771c
fix chart margin export constant
nickofthyme Nov 29, 2023
fbe0866
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Nov 29, 2023
54b921b
update functional test assertions and jest snapshots
nickofthyme Nov 29, 2023
5842081
Merge remote-tracking branch 'upstream/renovate/main-@elasticcharts' …
nickofthyme Nov 29, 2023
2e00558
Merge branch 'main' into renovate/main-@elasticcharts
nickofthyme Nov 30, 2023
1c568cd
update empty color in fn test case
nickofthyme Nov 30, 2023
9acca95
Merge branch 'main' of github.com:elastic/kibana into 136993/workspac…
drewdaemon Nov 30, 2023
9483de1
Merge branch 'renovate/main-@elasticcharts' into 136993/workspace-dim…
drewdaemon Nov 30, 2023
cb8eabc
fix typing
drewdaemon Nov 30, 2023
8146c27
fix gauge tests
drewdaemon Nov 30, 2023
041da61
Merge branch 'main' into 136993/workspace-dimensions-by-chart-type
kibanamachine Dec 1, 2023
29b3f5f
fix XY chart renderer test
drewdaemon Dec 1, 2023
e4046ce
update metric renderer tests
drewdaemon Dec 1, 2023
2f28750
fix types and tests
drewdaemon Dec 1, 2023
9de20f9
Merge branch '136993/workspace-dimensions-by-chart-type' of github.co…
drewdaemon Dec 1, 2023
6f2bcf1
fix visualization unit test
drewdaemon Dec 1, 2023
ba8e3d2
Merge branch 'main' of github.com:elastic/kibana into 136993/workspac…
drewdaemon Dec 7, 2023
0920713
Merge branch '136993/workspace-dimensions-by-chart-type' of github.co…
drewdaemon Dec 18, 2023
6252969
replace metric default color in tests
drewdaemon Dec 18, 2023
464b898
fix visualize embeddable filter events
drewdaemon Dec 18, 2023
f5c70fe
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Dec 18, 2023
18d5cea
fix goal colors
drewdaemon Dec 19, 2023
b52f61d
Merge branch '136993/workspace-dimensions-by-chart-type' of github.co…
drewdaemon Dec 19, 2023
b221c86
Merge branch 'main' of github.com:elastic/kibana into 136993/workspac…
drewdaemon Dec 21, 2023
643c380
change test order
drewdaemon Dec 21, 2023
b3dfebc
update limits
drewdaemon Dec 21, 2023
4d90e52
always retry
drewdaemon Dec 21, 2023
a8f39df
fix test
drewdaemon Dec 21, 2023
9b7ae0c
update test
drewdaemon Jan 2, 2024
c63274e
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Jan 2, 2024
85e0efb
Merge branch 'main' into 136993/workspace-dimensions-by-chart-type
kibanamachine Jan 2, 2024
a9c6184
Merge branch 'main' into 136993/workspace-dimensions-by-chart-type
stratoula Jan 3, 2024
3318505
CSS optimization
drewdaemon Jan 3, 2024
819cfc2
increase pixel tolerance
drewdaemon Jan 3, 2024
ad17e99
Merge branch '136993/workspace-dimensions-by-chart-type' of github.co…
drewdaemon Jan 3, 2024
9206cc8
clarify check
drewdaemon Jan 3, 2024
a253ba2
resolve import
drewdaemon Jan 3, 2024
13b8c14
remove mention of dimensions
drewdaemon Jan 3, 2024
ffa6226
always constrain correct dimension
drewdaemon Jan 4, 2024
8826615
don't apply aspect ratio when percentages are requested
drewdaemon Jan 4, 2024
e926602
better functional testing
drewdaemon Jan 4, 2024
f3bab7a
Merge branch 'main' into 136993/workspace-dimensions-by-chart-type
kibanamachine Jan 4, 2024
f1b86b0
Merge branch 'main' into 136993/workspace-dimensions-by-chart-type
kibanamachine Jan 5, 2024
c77eacf
Merge branch 'main' into 136993/workspace-dimensions-by-chart-type
mbondyra Jan 5, 2024
f0f9401
Merge branch 'main' of github.com:elastic/kibana into 136993/workspac…
drewdaemon Jan 8, 2024
bfaca9f
Merge branch '136993/workspace-dimensions-by-chart-type' of github.co…
drewdaemon Jan 8, 2024
6921d6d
don't constrain xy-dimensions unless vertical time series
drewdaemon Jan 9, 2024
e9ece42
don't enforce aspect ratio for pixel-style requests
drewdaemon Jan 9, 2024
b9e1d8a
new XY chart behavior
drewdaemon Jan 10, 2024
c35c408
remove now-unnecessary resize observer
drewdaemon Jan 10, 2024
f9831c9
Merge branch 'main' into 136993/workspace-dimensions-by-chart-type
kibanamachine Jan 10, 2024
3fc46aa
remove drag-drop border
drewdaemon Jan 10, 2024
b4405fc
Merge branch '136993/workspace-dimensions-by-chart-type' of github.co…
drewdaemon Jan 10, 2024
81618a3
fix jest test
drewdaemon Jan 10, 2024
12030b0
try to only show veil when resize actually occurs
drewdaemon Jan 11, 2024
08cfc65
fix initial dimension computation
drewdaemon Jan 11, 2024
ab24e8b
move things to useEffect hooks
drewdaemon Jan 11, 2024
71f29b3
update snapshots and veil color
drewdaemon Jan 11, 2024
716242c
more styles feedback
drewdaemon Jan 11, 2024
38f0d85
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jan 11, 2024
851e935
fix one test
drewdaemon Jan 11, 2024
8f32090
Merge branch '136993/workspace-dimensions-by-chart-type' of github.co…
drewdaemon Jan 12, 2024
927afa3
Turn on veil only for Lens
drewdaemon Jan 12, 2024
4c25bc1
Merge branch 'main' into 136993/workspace-dimensions-by-chart-type
kibanamachine Jan 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pageLoadAssetSize:
expressionLegacyMetricVis: 23121
expressionMetric: 22238
expressionMetricVis: 23121
expressionPartitionVis: 28000
expressionPartitionVis: 29000
expressionRepeatImage: 22341
expressionRevealImage: 25675
expressions: 140958
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React, { useEffect } from 'react';
import { useCallback, useRef, useState } from 'react';
import fastIsEqual from 'fast-deep-equal';
import { useResizeObserver } from '@elastic/eui';
import { euiThemeVars } from '@kbn/ui-theme';
import type { ChartSizeSpec } from './types';

/**
* This hook is used to show a veil over the chart while it is being resized
* in response to a change in the container dimensions.
*
* It is only relevant if client dimensions are being requested based on chart configuration.
*
* This whole feature is a nice-to-have. If it proves to be a source of bugs,
* we can consider removing it and accepting the aesthetic drawback.
*/
export function useSizeTransitionVeil(
chartSizeSpec: ChartSizeSpec,
setChartSize: (d: ChartSizeSpec) => void,
// should be retrieved from handlers.shouldUseSizeTransitionVeil function
shouldUseVeil: boolean
) {
const containerRef = useRef<HTMLDivElement>(null);
const containerSize = useResizeObserver(containerRef.current);
const currentContainerSize = useRef<{ width: number; height: number }>(containerSize);

// This useEffect hook is here to make up for the fact that the initial container size
// is not correctly reported by the useResizeObserver hook (see https://github.com/elastic/eui/issues/7458).
useEffect(() => {
currentContainerSize.current = {
width: containerRef.current?.clientWidth ?? 0,
height: containerRef.current?.clientHeight ?? 0,
};
}, []);

const [showVeil, setShowVeil] = useState(false);
const currentChartSizeSpec = useRef<ChartSizeSpec>();
const specJustChanged = useRef<boolean>(false);

useEffect(() => {
if (!fastIsEqual(containerSize, currentContainerSize.current) && specJustChanged.current) {
// If the container size has changed, we need to show the veil to hide the chart since it
// be rendered based on the previous container size before being updated to the current size.
//
// 1. we show the veil
// 2. the charts library will render the chart based on the previous container dimensions
// 3. the charts library will resize the chart to the updated container dimensions
// 4. we hide the veil
setShowVeil(true);
currentContainerSize.current = containerSize;
}
}, [setShowVeil, containerSize]);

useEffect(() => {
if (!fastIsEqual(chartSizeSpec, currentChartSizeSpec.current)) {
setChartSize(chartSizeSpec);
currentChartSizeSpec.current = chartSizeSpec;
specJustChanged.current = true;

setTimeout(() => {
specJustChanged.current = false;
}, 500);
}
}, [chartSizeSpec, setChartSize]);

const onResize = useCallback(() => {
setShowVeil(false);
}, []);

return {
veil: (
<div
css={{
height: '100%',
width: '100%',
backgroundColor: euiThemeVars.euiColorEmptyShade,
position: 'absolute',
zIndex: 1,
display: shouldUseVeil && showVeil ? 'block' : 'none',
}}
/>
),
onResize,
containerRef,
};
}
4 changes: 3 additions & 1 deletion src/plugins/chart_expressions/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ export {
getOverridesFor,
isOnAggBasedEditor,
} from './utils';
export type { Simplify, MakeOverridesSerializable } from './types';
export type { Simplify, MakeOverridesSerializable, ChartSizeSpec, ChartSizeEvent } from './types';
export { isChartSizeEvent } from './types';
export { getColorCategories } from './color_categories';
export { useSizeTransitionVeil } from './chart_size_transition_veil';
5 changes: 4 additions & 1 deletion src/plugins/chart_expressions/common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
"outDir": "target/types",
"types": [
"jest",
"node"
"node",
"@emotion/react/types/css-prop",
]
},
"include": [
"**/*.ts",
"**/*.tsx",
],
"exclude": [
"target/**/*"
Expand All @@ -17,5 +19,6 @@
"@kbn/core-execution-context-common",
"@kbn/expressions-plugin",
"@kbn/data-plugin",
"@kbn/ui-theme",
]
}
25 changes: 25 additions & 0 deletions src/plugins/chart_expressions/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Side Public License, v 1.
*/

import type { ExpressionRendererEvent } from '@kbn/expressions-plugin/public';
import React from 'react';

export type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
Expand All @@ -26,3 +27,27 @@ export type MakeOverridesSerializable<T> = {
? MakeOverridesSerializable<T[KeyType]>
: NonNullable<T[KeyType]>;
};

export interface ChartSizeEvent extends ExpressionRendererEvent {
name: 'chartSize';
data: ChartSizeSpec;
}

export type ChartSizeUnit = 'pixels' | 'percentage';

interface ChartSizeDimensions {
x?: { value: number; unit: ChartSizeUnit };
y?: { value: number; unit: ChartSizeUnit };
}

export interface ChartSizeSpec {
// if maxDimensions are provided, the aspect ratio will be computed from them
maxDimensions?: ChartSizeDimensions;
minDimensions?: ChartSizeDimensions;
aspectRatio?: { x: number; y: number };
}

export function isChartSizeEvent(event: ExpressionRendererEvent): event is ChartSizeEvent {
const expectedName: ChartSizeEvent['name'] = 'chartSize';
return event.name === expectedName;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { PersistedState } from '@kbn/visualizations-plugin/public';
import type { ChartsPluginSetup } from '@kbn/charts-plugin/public';
import type { IFieldFormat, SerializedFieldFormat } from '@kbn/field-formats-plugin/common';
import type { AllowedSettingsOverrides, AllowedChartOverrides } from '@kbn/charts-plugin/common';
import type { ChartSizeSpec } from '@kbn/chart-expressions-common';
import type { AllowedGaugeOverrides, GaugeExpressionProps } from './expression_functions';

export type FormatFactory = (mapping?: SerializedFieldFormat) => IFieldFormat;
Expand All @@ -22,4 +23,6 @@ export type GaugeRenderProps = GaugeExpressionProps & {
renderComplete: () => void;
uiState: PersistedState;
overrides?: AllowedGaugeOverrides & AllowedSettingsOverrides & AllowedChartOverrides;
shouldUseVeil: boolean;
setChartSize: (d: ChartSizeSpec) => void;
};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ describe('GaugeComponent', function () {
paletteService: await paletteThemeService.getPalettes(),
uiState,
renderComplete: jest.fn(),
setChartSize: jest.fn(),
shouldUseVeil: false,
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import type { PaletteOutput } from '@kbn/coloring';
import { FieldFormat } from '@kbn/field-formats-plugin/common';
import type { CustomPaletteState } from '@kbn/charts-plugin/public';
import { EmptyPlaceholder } from '@kbn/charts-plugin/public';
import { getOverridesFor } from '@kbn/chart-expressions-common';
import {
type ChartSizeSpec,
getOverridesFor,
useSizeTransitionVeil,
} from '@kbn/chart-expressions-common';
import { isVisDimension } from '@kbn/visualizations-plugin/common/utils';
import { i18n } from '@kbn/i18n';
import {
Expand Down Expand Up @@ -178,6 +182,8 @@ export const GaugeComponent: FC<GaugeRenderProps> = memo(
chartsThemeService,
renderComplete,
overrides,
shouldUseVeil,
setChartSize,
}) => {
const {
shape: gaugeType,
Expand Down Expand Up @@ -253,6 +259,26 @@ export const GaugeComponent: FC<GaugeRenderProps> = memo(
[renderComplete]
);

const chartSizeSpec: ChartSizeSpec = {
maxDimensions: {
...(gaugeType === GaugeShapes.HORIZONTAL_BULLET
? {
x: { value: 600, unit: 'pixels' },
y: { value: 300, unit: 'pixels' },
}
: {
y: { value: 600, unit: 'pixels' },
x: { value: 300, unit: 'pixels' },
}),
},
};

const { veil, onResize, containerRef } = useSizeTransitionVeil(
chartSizeSpec,
setChartSize,
shouldUseVeil
);

const table = data;
const accessors = getAccessorsFromArgs(args, table.columns);

Expand Down Expand Up @@ -359,7 +385,8 @@ export const GaugeComponent: FC<GaugeRenderProps> = memo(
: {};

return (
<div className="gauge__wrapper">
<div className="gauge__wrapper" ref={containerRef}>
{veil}
<Chart {...getOverridesFor(overrides, 'chart')}>
<Settings
noResults={<EmptyPlaceholder icon={icon} renderComplete={onRenderChange} />}
Expand All @@ -369,6 +396,7 @@ export const GaugeComponent: FC<GaugeRenderProps> = memo(
ariaLabel={args.ariaLabel}
ariaUseDefaultSummary={!args.ariaLabel}
onRenderChange={onRenderChange}
onResize={onResize}
locale={i18n.getLocale()}
{...getOverridesFor(overrides, 'settings')}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { ExpressionRenderDefinition } from '@kbn/expressions-plugin/common/expression_renderers';
import { StartServicesGetter } from '@kbn/kibana-utils-plugin/public';
import { METRIC_TYPE } from '@kbn/analytics';
import { extractContainerType, extractVisualizationType } from '@kbn/chart-expressions-common';
import {
ChartSizeEvent,
extractContainerType,
extractVisualizationType,
} from '@kbn/chart-expressions-common';
import { ExpressionGaugePluginStart } from '../plugin';
import { EXPRESSION_GAUGE_NAME, GaugeExpressionProps, GaugeShapes } from '../../common';
import { getFormatService, getPaletteService } from '../services';
Expand Down Expand Up @@ -66,16 +70,27 @@ export const gaugeRenderer: (
handlers.done();
};

const setChartSize = (chartSizeSpec: ChartSizeEvent['data']) => {
const event: ChartSizeEvent = {
name: 'chartSize',
data: chartSizeSpec,
};

handlers.event(event);
};

const { GaugeComponent } = await import('../components/gauge_component');
render(
<KibanaThemeProvider theme$={core.theme.theme$}>
<div className="gauge-container" data-test-subj="gaugeChart">
<GaugeComponent
{...config}
setChartSize={setChartSize}
formatFactory={getFormatService().deserialize}
chartsThemeService={plugins.charts.theme}
paletteService={getPaletteService()}
renderComplete={renderComplete}
shouldUseVeil={handlers.shouldUseSizeTransitionVeil()}
uiState={handlers.uiState as PersistedState}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { ExpressionRenderDefinition } from '@kbn/expressions-plugin/common/expression_renderers';
import { StartServicesGetter } from '@kbn/kibana-utils-plugin/public';
import { METRIC_TYPE } from '@kbn/analytics';
import { extractContainerType, extractVisualizationType } from '@kbn/chart-expressions-common';
import {
ChartSizeEvent,
extractContainerType,
extractVisualizationType,
} from '@kbn/chart-expressions-common';
import { I18nProvider } from '@kbn/i18n-react';
import { MultiFilterEvent } from '../../common/types';
import { ExpressionHeatmapPluginStart } from '../plugin';
Expand Down Expand Up @@ -78,6 +82,18 @@ export const heatmapRenderer: (
handlers.done();
};

const chartSizeEvent: ChartSizeEvent = {
name: 'chartSize',
data: {
maxDimensions: {
x: { value: 100, unit: 'percentage' },
y: { value: 100, unit: 'percentage' },
},
},
};

handlers.event(chartSizeEvent);

const timeZone = getTimeZone(getUISettings());
const { HeatmapComponent } = await import('../components/heatmap_component');
const { isInteractive } = handlers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ import {
import { getColumnByAccessor } from '@kbn/visualizations-plugin/common/utils';
import { Datatable } from '@kbn/expressions-plugin/common';
import { StartServicesGetter } from '@kbn/kibana-utils-plugin/public';
import { extractContainerType, extractVisualizationType } from '@kbn/chart-expressions-common';
import {
ChartSizeEvent,
extractContainerType,
extractVisualizationType,
} from '@kbn/chart-expressions-common';
import { ExpressionLegacyMetricPluginStart } from '../plugin';
import { EXPRESSION_METRIC_NAME, MetricVisRenderConfig, VisParams } from '../../common';

Expand Down Expand Up @@ -92,6 +96,18 @@ export const getMetricVisRenderer: (
handlers.done();
};

const chartSizeEvent: ChartSizeEvent = {
name: 'chartSize',
data: {
maxDimensions: {
x: { value: 100, unit: 'percentage' },
y: { value: 100, unit: 'percentage' },
},
},
};

handlers.event(chartSizeEvent);

render(
<KibanaThemeProvider theme$={core.theme.theme$}>
<VisualizationContainer
Expand Down
Loading