no message
Former-commit-id: 3e6434c86b341668215ee62f1bb8a051d3e6cf61 Former-commit-id: 560c230393b7171404bc75faee74ea061a46ade1 Former-commit-id: 9248be31f0fe0e1e123509c7ea90634fe6f92505
This commit is contained in:
35
src/components/charts/G2/components/Bar/base.vue
Normal file
35
src/components/charts/G2/components/Bar/base.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<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.axis('x', {
|
||||
label: {
|
||||
offset: 12
|
||||
}
|
||||
})
|
||||
this.chart.coord().transpose()
|
||||
this.chart.interval().position('x*y')
|
||||
// 渲染图表
|
||||
this.chart.render()
|
||||
},
|
||||
// 数据源改变 重新渲染新的数据
|
||||
changeData () {
|
||||
this.chart.changeData(this.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -3,3 +3,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) })
|
||||
Vue.component('G2BarBase', resolve => { require(['@/components/charts/G2/components/Bar/base.vue'], resolve) })
|
||||
|
||||
Reference in New Issue
Block a user