Adjust chart plugin copy (#8595)

* Adjust chart plugin copy

* Adjust

* Remove cast

* constants
This commit is contained in:
Jaco 2022-12-22 08:57:26 +02:00 committed by GitHub
parent dbbb64869c
commit de7ff8e4e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
})
};
}