From a25a736af71c9ba6db31929e2eaf9b5e4d694cc5 Mon Sep 17 00:00:00 2001 From: pipipi-pikachu <1171051090@qq.com> Date: Sat, 16 Jan 2021 15:34:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8F=92=E5=85=A5=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/configs/element.ts | 14 +++--- src/views/Editor/CanvasTool/ChartPool.vue | 59 +++++++++++++++++++++++ src/views/Editor/CanvasTool/index.vue | 19 ++++++-- 3 files changed, 81 insertions(+), 11 deletions(-) create mode 100644 src/views/Editor/CanvasTool/ChartPool.vue diff --git a/src/configs/element.ts b/src/configs/element.ts index bf3c650..f64ca2a 100644 --- a/src/configs/element.ts +++ b/src/configs/element.ts @@ -31,15 +31,15 @@ export const DEFAULT_LINE = { } export const DEFAULT_CHART = { - left: 0, - top: 0, - width: 500, - height: 500, + left: 300, + top: 81.25, + width: 400, + height: 400, data: { - labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'], + labels: ['类别1', '类别2', '类别3', '类别4', '类别5'], series: [ - [12, 19, 3, 5, 2, 18], - ] + [12, 19, 5, 2, 18], + ], }, } diff --git a/src/views/Editor/CanvasTool/ChartPool.vue b/src/views/Editor/CanvasTool/ChartPool.vue new file mode 100644 index 0000000..15e03e1 --- /dev/null +++ b/src/views/Editor/CanvasTool/ChartPool.vue @@ -0,0 +1,59 @@ + + + + + \ No newline at end of file diff --git a/src/views/Editor/CanvasTool/index.vue b/src/views/Editor/CanvasTool/index.vue index edbdbce..caacf0b 100644 --- a/src/views/Editor/CanvasTool/index.vue +++ b/src/views/Editor/CanvasTool/index.vue @@ -34,12 +34,17 @@ + + + + + + - - - @@ -66,12 +71,14 @@ import useCreateElement from '@/hooks/useCreateElement' import ShapePool from './ShapePool.vue' import LinePool from './LinePool.vue' +import ChartPool from './ChartPool.vue' export default defineComponent({ name: 'canvas-tool', components: { ShapePool, LinePool, + ChartPool, }, setup() { const store = useStore() @@ -84,7 +91,7 @@ export default defineComponent({ const { scaleCanvas } = useScaleCanvas() const { redo, undo } = useHistorySnapshot() - const { createImageElement } = useCreateElement() + const { createImageElement, createChartElement } = useCreateElement() const insertImageElement = (files: File[]) => { const imageFile = files[0] @@ -94,6 +101,8 @@ export default defineComponent({ const shapePoolVisible = ref(false) const linePoolVisible = ref(false) + const chartPoolVisible = ref(false) + const drawText = () => { store.commit(MutationTypes.SET_CREATING_ELEMENT, { type: 'text', @@ -125,9 +134,11 @@ export default defineComponent({ insertImageElement, shapePoolVisible, linePoolVisible, + chartPoolVisible, drawText, drawShape, drawLine, + createChartElement, } }, })