Skip to content

Commit

Permalink
feat(hooks): add setOptions for useEcharts
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed May 7, 2024
1 parent e7f0a30 commit e4d53aa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/hooks/common/echarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ export function useEcharts<T extends ECOption>(optionsFactory: () => T, hooks: C
await onUpdated?.(chart!);
}

function setOptions(options: T) {
chart?.setOption(options);
}

/** render chart */
async function render() {
if (!isRendered()) {
Expand Down Expand Up @@ -225,6 +229,7 @@ export function useEcharts<T extends ECOption>(optionsFactory: () => T, hooks: C

return {
domRef,
updateOptions
updateOptions,
setOptions
};
}

0 comments on commit e4d53aa

Please sign in to comment.