Hello I'm using two different Apex Options. Below I will put the name just for reference.
const chartOptionsBalance = useCallback(
(id: string): ApexOptions => ({
chart: {
background: "transparent",
id,
},
}....
const chartOptionsNoBalanceData = useCallback(
(id: string): ApexOptions => ({
chart: {
id
....
}
What Im trying to do based on my pedal_left_balance is to show the one that has and the other one that doesnt.
My problem is if I go from a tab that I have to none its okay. But when i go from a none to having I still have the old options.
I will post below what I'm trying but it doesnt work
const balanceOptions = useMemo(
() =>
filteredStatistics[0].pedal_balance_left !== null
? chartOptionsBalance("Balance")
: chartOptionsNoBalanceData("Balance"),
[],
);
useEffect(() => {
return filteredStatistics[0].pedal_balance_left !== null
? ApexCharts.exec(
"Balance",
"updateOptions",
chartOptionsBalance("Balance"),
true,
)
: ApexCharts.exec(
"Balance",
"updateOptions",
chartOptionsNoBalanceData("Balance"),
true,
);
}, [props.currentTabStat]);