From fd81d2a22dd54c483414e5466b60ba53a14439ad Mon Sep 17 00:00:00 2001 From: Matt Seddon Date: Mon, 30 May 2022 16:40:19 +1000 Subject: [PATCH 1/5] add legend to zoomed in plot --- webview/src/plots/components/ZoomablePlot.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/webview/src/plots/components/ZoomablePlot.tsx b/webview/src/plots/components/ZoomablePlot.tsx index 1bd6f73d69..58e3747a77 100644 --- a/webview/src/plots/components/ZoomablePlot.tsx +++ b/webview/src/plots/components/ZoomablePlot.tsx @@ -31,7 +31,17 @@ export const ZoomablePlot: React.FC = ({ } }, [plotProps, id, renderZoomedInPlot]) - const handleOnClick = () => renderZoomedInPlot(plotProps, id) + const handleOnClick = () => { + const zoomedPlotWithLegend = { ...plotProps } as VegaLiteProps & { + spec: { encoding?: { color?: { legend?: { disable?: boolean } } } } + } + if ( + zoomedPlotWithLegend.spec.encoding?.color?.legend?.disable !== undefined + ) { + delete zoomedPlotWithLegend.spec.encoding.color.legend.disable + } + return renderZoomedInPlot(zoomedPlotWithLegend, id) + } return (