Skip to content

Commit 5958dcd

Browse files
committed
绘图组件跟随新定义
1 parent 08bfd29 commit 5958dcd

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/graph/graph.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ const fullUpdateState = defineModel<boolean>({ required: true });
4040
const plotRef = ref<HTMLDivElement>();
4141
const errorMsg = ref<string | undefined>(undefined);
4242
43-
function findError(graphData: FunctionPlotDatum[]) {
44-
for (const [index, dataItem] of graphData.entries()) {
43+
function findError(datum: FunctionPlotDatum[]) {
44+
for (const [index, dataItem] of datum.entries()) {
4545
const fnType = getFnType(dataItem.fnType);
4646
for (const input of fnType.inputs) if (!dataItem[input.value]) return index;
4747
for (const coord of fnType.coord ?? [])
@@ -56,11 +56,12 @@ const { width, height } = useElementSize(plotRef);
5656
let unwatchHandler: WatchHandle | null = null;
5757
const emit = defineEmits(["require-post-update"]);
5858
import functionPlot from "function-plot";
59+
5960
onMounted(() => {
6061
const handleUpdate = throttle(() => {
6162
if (import.meta.env.DEV) console.log("graph update");
62-
const graphData = profile.getOriginalData();
63-
const flag = findError(graphData);
63+
const datum = profile.getPublicDatum();
64+
const flag = findError(datum);
6465
if (flag) {
6566
errorMsg.value = `Invalid input in function ${flag + 1}`;
6667
return;
@@ -69,11 +70,11 @@ onMounted(() => {
6970
if (!plotRef.value) throw new Error("plotRef is null");
7071
functionPlot({
7172
target: plotRef.value,
72-
data: graphData,
73+
data: datum,
7374
width: width.value,
7475
height: height.value,
75-
annotations: profile.getOriginalAnnotaion(),
76-
...profile.getOriginalOptions(),
76+
annotations: profile.getPublicAnnotations(),
77+
...profile.getPublicOptions(),
7778
});
7879
if (fullUpdateState.value) {
7980
fullUpdateState.value = false;

0 commit comments

Comments
 (0)