diff --git a/src/plugins/d3/__stories__/scatter/PerformanceIssue.stories.tsx b/src/plugins/d3/__stories__/scatter/PerformanceIssue.stories.tsx index 4513d121..df34f94b 100644 --- a/src/plugins/d3/__stories__/scatter/PerformanceIssue.stories.tsx +++ b/src/plugins/d3/__stories__/scatter/PerformanceIssue.stories.tsx @@ -1,5 +1,6 @@ import React from 'react'; import {Meta, Story} from '@storybook/react'; +import {action} from '@storybook/addon-actions'; import {Button} from '@gravity-ui/uikit'; import {settings} from '../../../../libs'; import {ChartKit} from '../../../../components/ChartKit'; @@ -42,8 +43,7 @@ const Template: Story = () => { return (
- {/* @ts-ignore */} - +
); }; diff --git a/src/plugins/d3/renderer/D3Widget.tsx b/src/plugins/d3/renderer/D3Widget.tsx index 5cf7a3b8..23d777ff 100644 --- a/src/plugins/d3/renderer/D3Widget.tsx +++ b/src/plugins/d3/renderer/D3Widget.tsx @@ -17,10 +17,22 @@ type ChartDimensions = { const D3Widget = React.forwardRef>( function D3Widget(props, forwardedRef) { + const {data, onLoad, onRender} = props; const ref = React.useRef(null); const debounced = React.useRef void> | undefined>(); const [dimensions, setDimensions] = React.useState>(); + //FIXME: add chartPerfomance data to callbacks; + React.useLayoutEffect(() => { + if (onLoad) { + onLoad({}); + } + + if (onRender) { + onRender({}); + } + }, []); + const handleResize = React.useCallback(() => { const parentElement = ref.current?.parentElement; @@ -78,7 +90,7 @@ const D3Widget = React.forwardRef )} diff --git a/src/plugins/highcharts/__stories__/scatter/PerformanceIssue.stories.tsx b/src/plugins/highcharts/__stories__/scatter/PerformanceIssue.stories.tsx index 220a67a3..577be32e 100644 --- a/src/plugins/highcharts/__stories__/scatter/PerformanceIssue.stories.tsx +++ b/src/plugins/highcharts/__stories__/scatter/PerformanceIssue.stories.tsx @@ -1,5 +1,6 @@ import React from 'react'; import {Meta, Story} from '@storybook/react'; +import {action} from '@storybook/addon-actions'; import {Button} from '@gravity-ui/uikit'; import {settings} from '../../../../libs'; import {ChartKit} from '../../../../components/ChartKit'; @@ -44,7 +45,12 @@ const Template: Story = () => { return (
- +
); }; diff --git a/src/plugins/indicator/__stories__/Indicator.stories.tsx b/src/plugins/indicator/__stories__/Indicator.stories.tsx index c7611b77..6e1859ca 100644 --- a/src/plugins/indicator/__stories__/Indicator.stories.tsx +++ b/src/plugins/indicator/__stories__/Indicator.stories.tsx @@ -1,5 +1,6 @@ import React from 'react'; import {Meta, Story} from '@storybook/react'; +import {action} from '@storybook/addon-actions'; import {withKnobs, boolean, color as colorKnob, radios, text} from '@storybook/addon-knobs'; import {cloneDeep} from 'lodash'; import {Button} from '@gravity-ui/uikit'; @@ -48,7 +49,13 @@ const Template: Story = () => { return (
- +
); };