From 35329104c80b0208c098d86fb9e57482817e216d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fred=20Lef=C3=A9v=C3=A8re-Laoide?= Date: Tue, 26 Nov 2024 11:44:22 +0100 Subject: [PATCH] Chart: merge layout for figure resolves #2274 --- frontend/taipy-gui/src/components/Taipy/Chart.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/frontend/taipy-gui/src/components/Taipy/Chart.tsx b/frontend/taipy-gui/src/components/Taipy/Chart.tsx index fd2269ae73..c8411cbf78 100644 --- a/frontend/taipy-gui/src/components/Taipy/Chart.tsx +++ b/frontend/taipy-gui/src/components/Taipy/Chart.tsx @@ -17,6 +17,7 @@ import { useTheme } from "@mui/material"; import Box from "@mui/material/Box"; import Skeleton from "@mui/material/Skeleton"; import Tooltip from "@mui/material/Tooltip"; +import merge from "lodash/merge"; import { nanoid } from "nanoid"; import { Config, @@ -300,7 +301,7 @@ const Chart = (props: ChartProp) => { const theme = useTheme(); const module = useModule(); - const refresh = useMemo(() => data?.__taipy_refresh !== undefined ? nanoid() : false, [data]); + const refresh = useMemo(() => (data?.__taipy_refresh !== undefined ? nanoid() : false), [data]); const className = useClassNames(props.libClassName, props.dynamicClassName, props.className); const active = useDynamicProperty(props.active, props.defaultActive, true); const render = useDynamicProperty(props.render, props.defaultRender, true); @@ -394,12 +395,7 @@ const Chart = (props: ChartProp) => { layout.template = template; } if (props.figure) { - return { - ...(props.figure[0].layout as Partial), - ...layout, - title: title || layout.title || (props.figure[0].layout as Partial).title, - clickmode: "event+select", - } as Layout; + return merge({},props.figure[0].layout as Partial, layout, {title: title || layout.title || (props.figure[0].layout as Partial).title, clickmode: "event+select"}); } return { ...layout,