Skip to content

Commit 607ec16

Browse files
committed
feat: add default data
1 parent e22cd51 commit 607ec16

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/base/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,13 @@ const BaseChart = <C extends PlotConfig>(
9999
const { current: container } = containerRef
100100
/* istanbul ignore else */
101101
if (container) {
102-
const { data, ...config } = restProps as ChartConfig
102+
const { data = [], ...config } = restProps as ChartConfig
103103
configRef.current = cloneDeep(config)
104-
chartRef.current = new Chart(container, restProps as C)
104+
const mergedConfig = {
105+
...config,
106+
data,
107+
} as any
108+
chartRef.current = new Chart(container, mergedConfig)
105109
chartRef.current.render()
106110
/* istanbul ignore else */
107111
if (stateManager && stateManagerCfg) {

0 commit comments

Comments
 (0)