From de7ff8e4e1f1e57569bb72098313d697decfe139 Mon Sep 17 00:00:00 2001 From: Jaco Date: Thu, 22 Dec 2022 08:57:26 +0200 Subject: [PATCH] Adjust chart plugin copy (#8595) * Adjust chart plugin copy * Adjust * Remove cast * constants --- packages/react-components/src/Chart/Line.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/react-components/src/Chart/Line.tsx b/packages/react-components/src/Chart/Line.tsx index 1296c07373..3e25c77e27 100644 --- a/packages/react-components/src/Chart/Line.tsx +++ b/packages/react-components/src/Chart/Line.tsx @@ -35,7 +35,7 @@ interface Config { const COLORS = ['#ff8c00', '#008c8c', '#8c008c']; -const chartOptions: ChartOptions = { +const BASE_OPTS: ChartOptions = { animation: { duration: 0 }, @@ -85,7 +85,10 @@ function calculateOptions (colors: (string | undefined)[] = [], legends: string[ return { chartData, - chartOptions: objectSpread({}, chartOptions, options) + chartOptions: objectSpread({}, BASE_OPTS, options, { + // Re-spread plugins for deep(er) copy + plugins: objectSpread({}, BASE_OPTS.plugins, options.plugins) + }) }; }