diff --git a/packages/client/src/components/app/charts/ApexChart.svelte b/packages/client/src/components/app/charts/ApexChart.svelte index db99a00834..7d78a1ad98 100644 --- a/packages/client/src/components/app/charts/ApexChart.svelte +++ b/packages/client/src/components/app/charts/ApexChart.svelte @@ -14,17 +14,26 @@ let chartElement; let chart; + let currentType = null const updateChart = async (newOptions) => { + console.log('update') // Line charts won't transition from category to datetime types properly without // calling this with an empty object first; I don't know why this works. - await chart?.updateOptions({}) - await chart?.updateOptions(newOptions) + if (newOptions?.xaxis?.type && newOptions.xaxis.type !== currentType ) { + console.log('calling render') + await renderChart(chartElement); + + } else { + await chart?.updateOptions(newOptions) + } } const renderChart = async (newChartElement) => { + console.log('render') await chart?.destroy() chart = new ApexCharts(newChartElement, optionsCopy) + currentType = optionsCopy?.xaxis?.type await chart.render() } diff --git a/packages/client/src/components/app/charts/AreaChart.svelte b/packages/client/src/components/app/charts/AreaChart.svelte index 888b1c8820..93dbb29393 100644 --- a/packages/client/src/components/app/charts/AreaChart.svelte +++ b/packages/client/src/components/app/charts/AreaChart.svelte @@ -153,7 +153,7 @@ } } - return {} + return { type: 'solid' } } $: console.log("opt", options);