wip
This commit is contained in:
parent
3ec5bbaa09
commit
78bb19967f
|
@ -14,17 +14,26 @@
|
||||||
|
|
||||||
let chartElement;
|
let chartElement;
|
||||||
let chart;
|
let chart;
|
||||||
|
let currentType = null
|
||||||
|
|
||||||
const updateChart = async (newOptions) => {
|
const updateChart = async (newOptions) => {
|
||||||
|
console.log('update')
|
||||||
// Line charts won't transition from category to datetime types properly without
|
// 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.
|
// calling this with an empty object first; I don't know why this works.
|
||||||
await chart?.updateOptions({})
|
if (newOptions?.xaxis?.type && newOptions.xaxis.type !== currentType ) {
|
||||||
|
console.log('calling render')
|
||||||
|
await renderChart(chartElement);
|
||||||
|
|
||||||
|
} else {
|
||||||
await chart?.updateOptions(newOptions)
|
await chart?.updateOptions(newOptions)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const renderChart = async (newChartElement) => {
|
const renderChart = async (newChartElement) => {
|
||||||
|
console.log('render')
|
||||||
await chart?.destroy()
|
await chart?.destroy()
|
||||||
chart = new ApexCharts(newChartElement, optionsCopy)
|
chart = new ApexCharts(newChartElement, optionsCopy)
|
||||||
|
currentType = optionsCopy?.xaxis?.type
|
||||||
await chart.render()
|
await chart.render()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {}
|
return { type: 'solid' }
|
||||||
}
|
}
|
||||||
|
|
||||||
$: console.log("opt", options);
|
$: console.log("opt", options);
|
||||||
|
|
Loading…
Reference in New Issue