no message
Former-commit-id: dd09d6b1c896f1ed594f452ba29c47421e827dd1 Former-commit-id: 00c0180c258f09256e70d19f33e3db0ef5da58d2 Former-commit-id: 4cda50a2b215586ea6696c2d91627acae23164f5
This commit is contained in:
32
src/components/charts/G2/components/Column/base.vue
Normal file
32
src/components/charts/G2/components/Column/base.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<!-- 如果需要开启自动高度功能 需要在这里设置 style="height: 100%;" -->
|
||||
<div ref="chart" style="height: 100%;"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import G2 from '@/components/charts/G2/mixins/G2.js'
|
||||
export default {
|
||||
mixins: [
|
||||
G2
|
||||
],
|
||||
methods: {
|
||||
// 初始化图表
|
||||
init () {
|
||||
// mixin 中提供 creatChart
|
||||
this.creatChart()
|
||||
// 本组件的特殊设置
|
||||
this.chart.source(this.data)
|
||||
this.chart.scale('y', {
|
||||
tickInterval: 20
|
||||
})
|
||||
this.chart.interval().position('x*y')
|
||||
// 渲染图表
|
||||
this.chart.render()
|
||||
},
|
||||
// 数据源改变 重新渲染新的数据
|
||||
changeData () {
|
||||
this.chart.changeData(this.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -2,3 +2,4 @@ import Vue from 'vue'
|
||||
|
||||
Vue.component('G2LineBase', resolve => { require(['@/components/charts/G2/components/Line/base.vue'], resolve) })
|
||||
Vue.component('G2LineStep', resolve => { require(['@/components/charts/G2/components/Line/step.vue'], resolve) })
|
||||
Vue.component('G2ColumnBase', resolve => { require(['@/components/charts/G2/components/Column/base.vue'], resolve) })
|
||||
|
||||
Reference in New Issue
Block a user