Skip to content

Commit 4ba066b

Browse files
fix: echarts json rerendering on data change
1 parent 216b20d commit 4ba066b

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

client/packages/lowcoder-comps/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-comps",
3-
"version": "0.0.13",
3+
"version": "0.0.14",
44
"type": "module",
55
"license": "MIT",
66
"dependencies": {

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)