wip
This commit is contained in:
parent
3ec5bbaa09
commit
78bb19967f
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
return {}
|
||||
return { type: 'solid' }
|
||||
}
|
||||
|
||||
$: console.log("opt", options);
|
||||
|
|
Loading…
Reference in New Issue