parent
65fc6d9064
commit
88714653d3
After Width: | Height: | Size: 2.7 KiB |
@ -0,0 +1,112 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- echart表格 -->
|
||||
<div ref="bar_dv" :style="echartStyle"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as echarts from 'echarts';
|
||||
export default {
|
||||
// 样式
|
||||
props: {
|
||||
echartStyle: {
|
||||
type: Object,
|
||||
default(){
|
||||
return {}
|
||||
}
|
||||
},
|
||||
id: {
|
||||
type: String,
|
||||
default(){
|
||||
return "barChart"
|
||||
}
|
||||
}, xAxisData: {
|
||||
type: Array,
|
||||
default(){
|
||||
return []
|
||||
}
|
||||
},
|
||||
legendData: {
|
||||
type: Array,
|
||||
default(){
|
||||
return []
|
||||
}
|
||||
},
|
||||
seriesData: {
|
||||
type: Array,
|
||||
default(){
|
||||
return []
|
||||
}
|
||||
},
|
||||
xAxisName: {
|
||||
type: String,
|
||||
default(){
|
||||
return null
|
||||
}
|
||||
},
|
||||
yAxisName: {
|
||||
type: String,
|
||||
default(){
|
||||
return null
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
//
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
drawLine(id) {
|
||||
this.charts = echarts.init(this.$refs.bar_dv);
|
||||
this.charts.setOption({
|
||||
xAxis: {
|
||||
type: "category",
|
||||
// boundaryGap: false,
|
||||
data: this.xAxisData,
|
||||
name:this.xAxisName,
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
name:this.yAxisName
|
||||
},
|
||||
grid: {
|
||||
left: '15',
|
||||
right: '40',
|
||||
bottom: '30',
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
bottom: '5',
|
||||
name:"自动接警",
|
||||
data: this.legendData
|
||||
},
|
||||
series: this.seriesData,
|
||||
tooltip : {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
label: {
|
||||
backgroundColor: '#6a7985'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(function() {
|
||||
this.drawLine('barChart')
|
||||
})
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
#barChart{
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue