Skip to content

Commit 974277f

Browse files
authored
expose optionUpdateBehavior prop on TimeseriesChart (#512)
1 parent 228a9c4 commit 974277f

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/kumo": patch
3+
---
4+
5+
Expose `optionUpdateBehavior` prop on `TimeseriesChart` to control how ECharts applies option updates

packages/kumo/src/components/chart/TimeseriesChart.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type * as echarts from "echarts/core";
22
import type { LineSeriesOption, BarSeriesOption } from "echarts/charts";
3-
import type { EChartsOption, SeriesOption } from "echarts";
3+
import type { EChartsOption, SeriesOption, SetOptionOpts } from "echarts";
44
import { useEffect, useMemo, useRef } from "react";
55
import { Chart, ChartEvents, KumoChartOption } from "./EChart";
66

@@ -87,6 +87,11 @@ export interface TimeseriesChartProps {
8787
* @see https://echarts.apache.org/handbook/en/best-practices/aria/
8888
*/
8989
ariaDescription?: string;
90+
/**
91+
* Additional options passed as the second argument to `chart.setOption()`.
92+
* Defaults to `{ notMerge: false, lazyUpdate: true }`.
93+
*/
94+
optionUpdateBehavior?: SetOptionOpts;
9095
}
9196

9297
/**
@@ -138,6 +143,7 @@ export function TimeseriesChart({
138143
gradient,
139144
loading,
140145
ariaDescription,
146+
optionUpdateBehavior,
141147
}: TimeseriesChartProps) {
142148
const chartRef = useRef<echarts.ECharts | null>(null);
143149
const incompleteBefore = incomplete?.before;
@@ -392,6 +398,7 @@ export function TimeseriesChart({
392398
height={height}
393399
isDarkMode={isDarkMode}
394400
onEvents={events}
401+
optionUpdateBehavior={optionUpdateBehavior}
395402
/>
396403
)}
397404
</div>

0 commit comments

Comments
 (0)