diff --git a/web/src/components/ui/charts/stories/BusterChart.ScatterChart.stories.tsx b/web/src/components/ui/charts/stories/BusterChart.ScatterChart.stories.tsx index 0aae479fa..d65ce1e8a 100644 --- a/web/src/components/ui/charts/stories/BusterChart.ScatterChart.stories.tsx +++ b/web/src/components/ui/charts/stories/BusterChart.ScatterChart.stories.tsx @@ -4,6 +4,10 @@ import { ChartType } from '../../../../api/asset_interfaces/metric/charts/enum'; import { IColumnLabelFormat } from '../../../../api/asset_interfaces/metric/charts/columnLabelInterfaces'; import { generateScatterChartData } from '../../../../mocks/chart/chartMocks'; import { sharedMeta } from './BusterChartShared'; +import { BusterChartProps } from '@/api/asset_interfaces/metric'; +import React from 'react'; +import { Slider } from '@/components/ui/slider'; +import { useDebounceFn } from '@/hooks'; type ScatterChartData = ReturnType; @@ -55,7 +59,46 @@ export const Default: Story = { export const LargeDataset: Story = { args: { ...Default.args, - data: generateScatterChartData(3000), - className: 'w-[400px] h-[400px]' + data: generateScatterChartData(3000) + }, + render: (args) => { + const [isPending, startTransition] = React.useTransition(); + const [points, setPoints] = React.useState(200); + const [data, setData] = React.useState(generateScatterChartData(points)); + + const { run: onSetData } = useDebounceFn( + (value: number) => { + startTransition(() => { + setData(generateScatterChartData(value)); + }); + }, + { wait: 700 } + ); + + const onChangeValue = (value: number) => { + setPoints(value); + onSetData(value); + }; + + return ( +
+
+ Number of points: +
+ onChangeValue(value[0])} + /> +
+ {points} +
+
+ +
+
+ ); } };