no message
Former-commit-id: 4bfe822510fad9d3caab87f4ff29ce200740555e Former-commit-id: 0336d2c16b1a871375b0d94720c950640397e10d Former-commit-id: d8acf08adce671df5fefe8eaf573defd2f6e424f
This commit is contained in:
81
src/components/charts/G2/components/Radar/base.vue
Normal file
81
src/components/charts/G2/components/Radar/base.vue
Normal file
@@ -0,0 +1,81 @@
|
||||
<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
|
||||
],
|
||||
data () {
|
||||
return {
|
||||
// DataView数据转换设置
|
||||
transformSetting: {
|
||||
type: 'fold',
|
||||
fields: ['a', 'b'],
|
||||
key: 'key',
|
||||
value: 'value'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
dvMaker () {
|
||||
return new this.DataSet.DataView().source(this.data).transform(this.transformSetting)
|
||||
},
|
||||
// 初始化图表
|
||||
init () {
|
||||
// mixin 中提供 creatChart
|
||||
this.creatChart()
|
||||
// 本组件的特殊设置
|
||||
this.chart.source(this.dvMaker(), {
|
||||
value: {
|
||||
min: 0,
|
||||
max: 80
|
||||
}
|
||||
})
|
||||
this.chart.coord('polar', {
|
||||
radius: 0.8
|
||||
})
|
||||
this.chart.axis('item', {
|
||||
line: null,
|
||||
tickLine: null,
|
||||
grid: {
|
||||
lineStyle: {
|
||||
lineDash: null
|
||||
},
|
||||
hideFirstLine: false
|
||||
}
|
||||
})
|
||||
this.chart.axis('value', {
|
||||
line: null,
|
||||
tickLine: null,
|
||||
grid: {
|
||||
type: 'polygon',
|
||||
lineStyle: {
|
||||
lineDash: null
|
||||
}
|
||||
}
|
||||
})
|
||||
this.chart.legend('key', {
|
||||
marker: 'circle',
|
||||
offset: 10
|
||||
})
|
||||
this.chart.line().position('item*value').color('key').size(2)
|
||||
this.chart.point().position('item*value').color('key').shape('circle').size(4).style({
|
||||
stroke: '#fff',
|
||||
lineWidth: 1,
|
||||
fillOpacity: 1
|
||||
})
|
||||
this.chart.area().position('item*value').color('key')
|
||||
// 渲染图表
|
||||
this.chart.render()
|
||||
},
|
||||
// 数据源改变 重新渲染新的数据
|
||||
changeData () {
|
||||
this.chart.changeData(this.dvMaker())
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -10,3 +10,5 @@ Vue.component('G2LineStep', resolve => { require(['@/components/charts/G2/compon
|
||||
Vue.component('G2NightingaleRoseBase', resolve => { require(['@/components/charts/G2/components/NightingaleRose/base.vue'], resolve) })
|
||||
|
||||
Vue.component('G2PieBase', resolve => { require(['@/components/charts/G2/components/Pie/base.vue'], resolve) })
|
||||
|
||||
Vue.component('G2RadarBase', resolve => { require(['@/components/charts/G2/components/Radar/base.vue'], resolve) })
|
||||
|
||||
Reference in New Issue
Block a user