Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart: merge layout for figure #2282

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading