Skip to content

Commit

Permalink
add legend to zoomed in plot
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed May 31, 2022
1 parent 8de768e commit fd81d2a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion webview/src/plots/components/ZoomablePlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,17 @@ export const ZoomablePlot: React.FC<ZoomablePlotOwnProps> = ({
}
}, [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 (
<button className={styles.zoomablePlot} onClick={handleOnClick}>
Expand Down

0 comments on commit fd81d2a

Please sign in to comment.