@@ -19,7 +19,7 @@ import {
1919 UPlotWrapperPropsOpts ,
2020 UPlotWrapperPropsScales ,
2121} from '@/components/UPlotWrapper' ;
22- import type { PlotData , PlotValues } from '@/store2/plotDataStore' ;
22+ import type { PlotValues } from '@/store2/plotDataStore' ;
2323import { setLiveMode } from '@/store2/liveModeStore' ;
2424import { formatByMetricType , getMetricType } from '@/common/formatByMetricType' ;
2525import { dataIdxNearest } from '@/common/dataIdxNearest' ;
@@ -43,7 +43,6 @@ import { rightPad, syncGroup, unFocusAlfa, yLockDefault } from '@/components2/Pl
4343import { useMetricName } from '@/hooks/useMetricName' ;
4444import { useMetricMeta } from '@/hooks/useMetricMeta' ;
4545import { useMetricData } from '@/hooks/useMetricData' ;
46- import { produce } from 'immer' ;
4746import { resetZoom , setPlotYLock , setTimeRange } from '@/store2/methods' ;
4847import { PlotBox } from '@/components2/Plot/PlotView/PlotBox' ;
4948
@@ -312,16 +311,14 @@ export function MetricWidget({ className, isDashboard, isEmbed, fixRatio }: Plot
312311 const onLegendShow = useCallback (
313312 ( index : number , show : boolean , single : boolean ) => {
314313 const idx = index - 1 ;
315- setData (
316- produce < PlotData > ( ( d ) => {
317- if ( single ) {
318- const otherShow = d . seriesShow . some ( ( _show , indexSeries ) => ( indexSeries === idx ? false : _show ) ) ;
319- d . seriesShow = d . seriesShow . map ( ( _ , indexSeries ) => ( indexSeries === idx ? true : ! otherShow ) ) ;
320- } else {
321- d . seriesShow [ idx ] = show ?? ! d . seriesShow [ idx ] ;
322- }
323- } )
324- ) ;
314+ setData ( ( d ) => {
315+ if ( single ) {
316+ const otherShow = d . seriesShow . some ( ( _show , indexSeries ) => ( indexSeries === idx ? false : _show ) ) ;
317+ d . seriesShow = d . seriesShow . map ( ( _ , indexSeries ) => ( indexSeries === idx ? true : ! otherShow ) ) ;
318+ } else {
319+ d . seriesShow [ idx ] = show ?? ! d . seriesShow [ idx ] ;
320+ }
321+ } ) ;
325322 } ,
326323 [ setData ]
327324 ) ;
0 commit comments