[mod]折线饼状图组件

init
wangxi 4 years ago
parent 53f66d4c13
commit 73e2ce463b

@ -0,0 +1,99 @@
<template>
<div>
<!-- echart表格 -->
<div id="lineChart" :style="echartStyle"></div>
</div>
</template>
<script>
import * as echarts from 'echarts';
export default {
props: {
//
echartStyle: {
type: Object,
default(){
return {}
}
},
//line-线area-bar-
isType: {
type: String,
default(){
return "line"
}
},
xAxisData: {
type: Array,
default(){
return []
}
},
yAxisData: {
type: Array,
default(){
return []
}
},
},
data(){
return {
//
}
},
methods: {
drawLine(id) {
this.charts = echarts.init(document.getElementById(id));
this.charts.setOption({
xAxis: {
type: "category",
boundaryGap: false,
data: this.xAxisData,
},
yAxis: {
type: "value",
},
series: [
{
data: this.yAxisData,
type: this.isType==='area'?'line': this.isType,
areaStyle: this.isType!=='area'?null:
{
color:"#B9DDFF"
},
itemStyle : {
normal : {
lineStyle:{
color:'#1890FF'
},
}
},
},
],
tooltip : {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
}
});
},
},
mounted() {
this.$nextTick(function() {
this.drawLine('lineChart')
})
},
};
</script>
<style scoped>
#lineChart{
width: 100%;
}
</style>
Loading…
Cancel
Save