diff --git a/src/components/G2/charts/Column/1.vue b/src/components/G2/charts/Column/1.vue
new file mode 100644
index 00000000..ef551a6b
--- /dev/null
+++ b/src/components/G2/charts/Column/1.vue
@@ -0,0 +1,47 @@
+
+
+
+
+
diff --git a/src/components/G2/index.js b/src/components/G2/index.js
index d0ea745e..b7a7aab3 100644
--- a/src/components/G2/index.js
+++ b/src/components/G2/index.js
@@ -2,3 +2,4 @@ import Vue from 'vue'
Vue.component('G2Line1', resolve => { require(['@/components/G2/charts/Line/1.vue'], resolve) })
Vue.component('G2Pie1', resolve => { require(['@/components/G2/charts/Pie/1.vue'], resolve) })
+Vue.component('G2Column1', resolve => { require(['@/components/G2/charts/Column/1.vue'], resolve) })
diff --git a/src/mock/chart/G2Column.js b/src/mock/chart/G2Column.js
new file mode 100644
index 00000000..8bb4007d
--- /dev/null
+++ b/src/mock/chart/G2Column.js
@@ -0,0 +1,24 @@
+import Mock from 'mockjs'
+
+Mock.mock('/api/chart/G2Column', 'post', ({body, type, url}) => {
+ const _body = JSON.parse(body)
+ switch (_body.code) {
+ case 1:
+ return {
+ code: 0,
+ msg: '请求成功',
+ data: [
+ { year: '1951 年', sales: 38 },
+ { year: '1952 年', sales: 52 },
+ { year: '1956 年', sales: 61 },
+ { year: '1957 年', sales: 145 },
+ { year: '1958 年', sales: 48 },
+ { year: '1959 年', sales: 38 },
+ { year: '1960 年', sales: 38 },
+ { year: '1962 年', sales: 38 }
+ ]
+ }
+ default:
+ return {}
+ }
+})
diff --git a/src/mock/chart/index.js b/src/mock/chart/index.js
index 35ed9155..4f20b0f0 100644
--- a/src/mock/chart/index.js
+++ b/src/mock/chart/index.js
@@ -1,2 +1,3 @@
import './G2Line'
import './G2Pie'
+import './G2Column'
diff --git a/src/pages/demo/chart/index/index.vue b/src/pages/demo/chart/index/index.vue
index 39c9c813..8526efe3 100644
--- a/src/pages/demo/chart/index/index.vue
+++ b/src/pages/demo/chart/index/index.vue
@@ -4,13 +4,19 @@
+
+
+
diff --git a/src/pages/demo/chart/index/mixins/chart.js b/src/pages/demo/chart/index/mixins/chart.js
index 466e434f..5ec7f3f2 100644
--- a/src/pages/demo/chart/index/mixins/chart.js
+++ b/src/pages/demo/chart/index/mixins/chart.js
@@ -2,8 +2,11 @@ export default {
data () {
return {
// 数据
- G2Line1: [],
- G2Pie1: []
+ chartData: {
+ G2Line1: [],
+ G2Pie1: [],
+ G2Column1: []
+ }
}
},
mounted () {
@@ -15,12 +18,16 @@ export default {
syncData () {
const api = [
{url: '/api/chart/G2Line', data: {code: 1}},
- {url: '/api/chart/G2Pie', data: {code: 1}}
+ {url: '/api/chart/G2Pie', data: {code: 1}},
+ {url: '/api/chart/G2Column', data: {code: 1}}
]
this.$axios.all(api.map(e => this.$axios.post(e.url, e.data)))
- .then(this.$axios.spread((G2Line1, G2Pie1) => {
- this.G2Line1 = G2Line1
- this.G2Pie1 = G2Pie1
+ .then(this.$axios.spread((G2Line1, G2Pie1, G2Column1) => {
+ this.chartData = {
+ G2Line1,
+ G2Pie1,
+ G2Column1
+ }
}))
}
}
diff --git a/src/pages/demo/chart/index/mixins/layout.js b/src/pages/demo/chart/index/mixins/layout.js
index 018048b2..dc873d85 100644
--- a/src/pages/demo/chart/index/mixins/layout.js
+++ b/src/pages/demo/chart/index/mixins/layout.js
@@ -4,7 +4,8 @@ export default {
layout: {
layout: [
{'x': 0, 'y': 0, 'w': 8, 'h': 9, 'i': '0'},
- {'x': 8, 'y': 0, 'w': 4, 'h': 9, 'i': '1'}
+ {'x': 8, 'y': 0, 'w': 4, 'h': 9, 'i': '1'},
+ {'x': 0, 'y': 9, 'w': 5, 'h': 7, 'i': '2'}
],
colNum: 12,
rowHeight: 30,