diff --git a/src/editor/data.vue b/src/editor/data.vue index d59cb71..38f0493 100644 --- a/src/editor/data.vue +++ b/src/editor/data.vue @@ -147,8 +147,9 @@ watch(fnType, (newFnType) => { graphType: newGraphType, }); }); + watch( - () => self.value.graphType, + () => props.self.graphType, (newGraphType) => { if (newGraphType === "scatter" && "closed" in self.value) self.value.closed = false; diff --git a/src/states.ts b/src/states.ts index 11fef0e..1d6a629 100644 --- a/src/states.ts +++ b/src/states.ts @@ -33,7 +33,7 @@ export const useProfile = defineStore("profile", () => { const importedDatum = importedProfile?.data; const processedDatum = importedDatum ? importedDatum.map(toPrivateData) - : [toPrivateData({ fn: "x^2" })]; + : [toPrivateData({ fn: "x^2", graphType: "polyline" })]; const datum = ref(processedDatum); @@ -42,7 +42,8 @@ export const useProfile = defineStore("profile", () => { .filter(({ hidden }) => !(hidden && forExport)) .map((data) => (data.hidden ? getInvisible() : toPublicData(data))); - const addData = () => datum.value.push(toPrivateData({})); + const addData = () => + datum.value.push(toPrivateData({ graphType: "polyline" })); const importedAnnotations = importedProfile?.annotations; const processedAnnotations = importedAnnotations