Skip to content

Commit 1b4c801

Browse files
committed
暂时修复 graphType 切换含 scatter 时的更新问题
1 parent cdd74d9 commit 1b4c801

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

patches/function-plot+2.0.0-0.patch

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
diff --git a/node_modules/function-plot/dist/chart.js b/node_modules/function-plot/dist/chart.js
2+
index 22e47a9..e57ce85 100644
3+
--- a/node_modules/function-plot/dist/chart.js
4+
+++ b/node_modules/function-plot/dist/chart.js
5+
@@ -445,7 +445,10 @@ export class Chart extends EventEmitter.EventEmitter {
6+
return d.data.map(datumDefaults);
7+
}, (d) => {
8+
// The key is the function set or other value that uniquely identifies the datum.
9+
- return d.fn || d.r || d.x || d.text;
10+
+ return JSON.stringify({
11+
+ function: d.fn || d.r || d.x || d.text,
12+
+ graphType: d.graphType || 'interval'
13+
+ });
14+
});
15+
// exit
16+
graphs.exit().remove();
117
diff --git a/node_modules/function-plot/dist/graph-types/polyline.js b/node_modules/function-plot/dist/graph-types/polyline.js
218
index 19ee726..018786b 100644
319
--- a/node_modules/function-plot/dist/graph-types/polyline.js

src/editor/datum.vue

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
:label="t('inputs.graphType')"
2121
v-model.lazy="dataItem.graphType"
2222
v-if="dataItem.graphType !== 'text'"
23-
@change="graphTypeChange(dataItem)"
2423
:key="selectKey"
2524
>
2625
<s-picker-item v-for="type in allowedGraphType" :value="type.value">
@@ -173,23 +172,9 @@ function fnTypeChange(dataItem: InternalDatum) {
173172
block.value.querySelectorAll("input").forEach((ele) => (ele.value = ""));
174173
}
175174
}
176-
const scatteredSet = new WeakSet<InternalDatum>();
177175
178-
import emitter from "@/mitt";
179176
import { cloneDeep } from "lodash-es";
180-
function graphTypeChange(dataItem: InternalDatum) {
181-
if (dataItem.graphType === "scatter") {
182-
if (!scatteredSet.has(dataItem)) {
183-
scatteredSet.add(dataItem);
184-
emitter.emit("require-full-update",'scatter appear');
185-
}
186-
} else {
187-
if (scatteredSet.has(dataItem)) {
188-
scatteredSet.delete(dataItem);
189-
emitter.emit("require-full-update",'scatter disappear');
190-
}
191-
}
192-
}
177+
193178
const fnType = computed(() => getFnType(dataItem.value?.fnType));
194179
const allowedGraphType = computed(() =>
195180
getAllowedGraphType(dataItem.value?.fnType)

0 commit comments

Comments
 (0)