diff --git a/src/configs/element.ts b/src/configs/element.ts
index bf3c650d..f64ca2a3 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 00000000..15e03e13
--- /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 edbdbcea..caacf0bf 100644
--- a/src/views/Editor/CanvasTool/index.vue
+++ b/src/views/Editor/CanvasTool/index.vue
@@ -34,12 +34,17 @@
+
+
+ { createChartElement(chart); chartPoolVisible = false }" />
+
+
+
+
+
-
-
-
@@ -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,
}
},
})