diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 84abe7be6d..36bb026d96 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -1655,7 +1655,7 @@ { "type": "select", "label": "Format", - "key": "yAxisUnits", + "key": "valueUnits", "options": ["Default", "Thousands", "Millions"], "defaultValue": "Default" }, @@ -1813,7 +1813,7 @@ { "type": "select", "label": "Format", - "key": "yAxisUnits", + "key": "valueUnits", "options": ["Default", "Thousands", "Millions"], "defaultValue": "Default" }, @@ -1966,7 +1966,7 @@ { "type": "select", "label": "Format", - "key": "yAxisUnits", + "key": "valueUnits", "options": ["Default", "Thousands", "Millions"], "defaultValue": "Default" }, @@ -2410,7 +2410,7 @@ { "type": "select", "label": "Format", - "key": "yAxisUnits", + "key": "valueUnits", "options": ["Default", "Thousands", "Millions"], "defaultValue": "Default" }, @@ -5341,7 +5341,7 @@ { "type": "select", "label": "Format", - "key": "yAxisUnits", + "key": "valueUnits", "options": ["Default", "Thousands", "Millions"], "defaultValue": "Default" }, @@ -5436,7 +5436,7 @@ { "type": "select", "label": "Format", - "key": "yAxisUnits", + "key": "valueUnits", "options": ["Default", "Thousands", "Millions"], "defaultValue": "Default" }, @@ -5485,7 +5485,7 @@ { "type": "select", "label": "Format", - "key": "yAxisUnits", + "key": "valueUnits", "options": ["Default", "Thousands", "Millions"], "defaultValue": "Default" }, @@ -5567,7 +5567,7 @@ { "type": "select", "label": "Format", - "key": "yAxisUnits", + "key": "valueUnits", "options": ["Default", "Thousands", "Millions"], "defaultValue": "Default" }, diff --git a/packages/client/src/components/app/charts/ApexChart.svelte b/packages/client/src/components/app/charts/ApexChart.svelte index 411774c353..3f0ce221e5 100644 --- a/packages/client/src/components/app/charts/ApexChart.svelte +++ b/packages/client/src/components/app/charts/ApexChart.svelte @@ -8,6 +8,9 @@ const component = getContext("component") export let options + + // Apex charts directly modifies the options object with default properties and internal variables. These being present could unintentionally cause issues to the provider of this prop as the changes are reflected in that component as well. To prevent any issues we clone this here to provide a buffer. + $: optionsCopy = cloneDeep(options); /* export let invalid = false @@ -27,8 +30,8 @@ return parsedValue } - const parseOptions = (options) => { - const parsedOptions = { series: [], ...cloneDeep(options)} + const parseOptions = (optionsCopy) => { + const parsedOptions = { series: [], ...cloneDeep(optionsCopy)} // Object form of series, used by most charts if (parsedOptions.series.some(entry => Array.isArray(entry?.data))) { @@ -41,7 +44,7 @@ return parsedOptions; } - $: parsedOptions = parseOptions(options); + $: parsedOptions = parseOptions(optionsCopy); */ let chartElement; @@ -58,7 +61,7 @@ const renderChart = async (newChartElement) => { try { await chart?.destroy() - chart = new ApexCharts(newChartElement, options) + chart = new ApexCharts(newChartElement, optionsCopy) await chart.render() } catch(e) { //console.log(e) @@ -69,17 +72,17 @@ return true } - $: noData = options == null || options?.series?.length === 0 + $: noData = optionsCopy == null || optionsCopy?.series?.length === 0 $: hide = noData || !seriesValid // Call render chart upon changes to hide, as apex charts has issues with rendering upon changes automatically // if the chart is hidden. $: renderChart(chartElement, hide) - $: updateChart(options) - $: seriesValid = isSeriesValid(options?.series || []) + $: updateChart(optionsCopy) + $: seriesValid = isSeriesValid(optionsCopy?.series || []) -{#key options?.customColor} +{#key optionsCopy?.customColor}
{#if $builderStore.inBuilder && noData }