diff --git a/app/components/chart-panel.tsx b/app/components/chart-panel.tsx index d445fd16c..ca7eec6ef 100644 --- a/app/components/chart-panel.tsx +++ b/app/components/chart-panel.tsx @@ -1,7 +1,7 @@ import { Box, BoxProps, Theme } from "@mui/material"; import { makeStyles } from "@mui/styles"; import clsx from "clsx"; -import React, { forwardRef, HTMLProps } from "react"; +import React, { HTMLProps, forwardRef } from "react"; import ChartPanelLayoutCanvas, { chartPanelLayoutGridClasses, @@ -52,7 +52,7 @@ export const ChartWrapper = forwardRef( {(editing || layoutType === "tab") && } ({ +const useStyles = makeStyles((theme) => ({ canvasChartPanelLayout: { // Provide some space at the bottom of the canvas layout to make it possible // to resize vertically the last charts marginBottom: "10rem", + transform: ({ scale }) => `scale(${scale})`, + transformOrigin: "top", + transition: "transform 0.3s ease-in-out", + }, + + scaled: { + [`& .chart-wrapper:hover`]: { + outline: `4px solid ${theme.palette.primary.main}`, + cursor: "pointer", + }, + [`& .chart-wrapper:hover *`]: { + pointerEvents: "none", + }, }, })); @@ -118,7 +139,6 @@ const DashboardPreview = (props: DashboardPreviewProps) => { const [isDragging, setIsDragging] = useState(false); const [activeChartKey, setActiveChartKey] = useState(null); const [over, setOver] = useState(null); - const classes = useStyles(); const renderChart = useCallback( (chartConfig: ChartConfig) => { return layoutType === "canvas" ? ( @@ -142,14 +162,40 @@ const DashboardPreview = (props: DashboardPreviewProps) => { [dataSource, editing, layoutType, state.layout.type] ); + const [scale, setScale] = useState(1); + const classes = useStyles({ scale }); + if (layoutType === "canvas") { return ( - + <> + setScale(value as number)} + color="primary" + sx={{ + position: "absolute", + top: "8rem", + right: "2rem", + zIndex: 1000, + textTransform: "none", + }} + > + 0.25x + 0.5x + 1x + + + + ); }