Skip to content

Commit 12970d0

Browse files
fix: echarts json rerendering on data change
1 parent dcffd4d commit 12970d0

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

client/packages/lowcoder-comps/src/comps/chartComp/chartComp.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ ChartTmpComp = withViewFn(ChartTmpComp, (comp) => {
142142
opts={{ locale: getEchartsLocale() }}
143143
option={option}
144144
theme={mode !== 'map' ? themeConfig : undefined}
145+
mode={mode}
145146
/>
146147
)}
147148
</ReactResizeDetector>

client/packages/lowcoder-comps/src/comps/chartComp/reactEcharts/core.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ export default class EChartsReactCore extends PureComponent<EChartsReactProps> {
6767
return;
6868
}
6969

70+
if(this.props.mode === "json") {
71+
this.updateEChartsOption();
72+
return;
73+
}
74+
7075
// when these props are not isEqual, update echarts
7176
const pickKeys = ["option", "notMerge", "lazyUpdate", "showLoading", "loadingOption"];
7277
if (!isEqual(_.pick(this.props, pickKeys), _.pick(prevProps, pickKeys))) {

client/packages/lowcoder-comps/src/comps/chartComp/reactEcharts/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,8 @@ export type EChartsReactProps = {
6969
* should update echarts options
7070
*/
7171
readonly shouldSetOption?: (prevProps: EChartsReactProps, props: EChartsReactProps) => boolean;
72+
/**
73+
* echarts mode: ui | json | map
74+
*/
75+
readonly mode?: 'ui' | 'json' | 'map'
7276
};

0 commit comments

Comments
 (0)