Skip to content

Commit

Permalink
Chart: merge layout for figure
Browse files Browse the repository at this point in the history
resolves #2274
  • Loading branch information
Fred Lefévère-Laoide authored and Fred Lefévère-Laoide committed Nov 26, 2024
1 parent f67b93a commit 3532910
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions frontend/taipy-gui/src/components/Taipy/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -394,12 +395,7 @@ const Chart = (props: ChartProp) => {
layout.template = template;
}
if (props.figure) {
return {
...(props.figure[0].layout as Partial<Layout>),
...layout,
title: title || layout.title || (props.figure[0].layout as Partial<Layout>).title,
clickmode: "event+select",
} as Layout;
return merge({},props.figure[0].layout as Partial<Layout>, layout, {title: title || layout.title || (props.figure[0].layout as Partial<Layout>).title, clickmode: "event+select"});
}
return {
...layout,
Expand Down

0 comments on commit 3532910

Please sign in to comment.