|
@@ -1,221 +1,256 @@
|
|
<!-- 圆柱柱状图 -->
|
|
<!-- 圆柱柱状图 -->
|
|
- <template>
|
|
|
|
-
|
|
|
|
|
|
+<template>
|
|
<div class="wrap-container sn-container">
|
|
<div class="wrap-container sn-container">
|
|
<div class="sn-content">
|
|
<div class="sn-content">
|
|
- <!-- <div class="sn-title"></div> -->
|
|
|
|
|
|
+ <div class="sn-title title">
|
|
|
|
+ <div class="titleZn">{{ title }}</div>
|
|
|
|
+ <div class="titleEn">{{ titleEn }}</div>
|
|
|
|
+ </div>
|
|
<div class="sn-body">
|
|
<div class="sn-body">
|
|
<div class="wrap-container">
|
|
<div class="wrap-container">
|
|
- <div class="chartsdom" id="cylindrical" >
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div class="chartsdom" id="cylindrical"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- </template>
|
|
|
|
-
|
|
|
|
- <script>
|
|
|
|
|
|
+</template>
|
|
|
|
|
|
- export default {
|
|
|
|
|
|
+<script>
|
|
|
|
+export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- option: null
|
|
|
|
-
|
|
|
|
|
|
+ option: null,
|
|
|
|
+ information: {},
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- mounted() {
|
|
|
|
- this.getEchart();
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
- getEchart() {
|
|
|
|
- let myChart = echarts.init(document.getElementById('cylindrical'));
|
|
|
|
- let information = {
|
|
|
|
- barWidth: 40,
|
|
|
|
- colorArray: {
|
|
|
|
- lineColor: 'rgba(199,214,242, 0.2)',
|
|
|
|
- labelColor: ' #c7d6f2'
|
|
|
|
- },
|
|
|
|
- area: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
|
|
|
- dataArray: [210, 200, 255, 320, 200, 255, 210]
|
|
|
|
-};
|
|
|
|
-this.option = {
|
|
|
|
- // animation: false, //去除加载时缓动动画
|
|
|
|
- backgroundColor: '#021032',
|
|
|
|
- tooltip: {
|
|
|
|
- trigger: 'axis',
|
|
|
|
- backgroundColor: 'rgba(9,40,84,0.8)',
|
|
|
|
- borderColor: 'rgba(9,40,84,0.8)',
|
|
|
|
- textStyle: {
|
|
|
|
- fontSize: 20,
|
|
|
|
- color: '#fff'
|
|
|
|
|
|
+ props: {
|
|
|
|
+ barWidth: {
|
|
|
|
+ type: Number,
|
|
},
|
|
},
|
|
- axisPointer: {
|
|
|
|
- type: 'shadow'
|
|
|
|
|
|
+ area: {
|
|
|
|
+ type: Array,
|
|
},
|
|
},
|
|
- formatter:
|
|
|
|
- "{b}<br/>{a} <span style='font-weight:bold'>{c}</span>"
|
|
|
|
- },
|
|
|
|
- xAxis: {
|
|
|
|
- axisLine: {
|
|
|
|
- lineStyle: {
|
|
|
|
- color: information.colorArray.lineColor
|
|
|
|
- }
|
|
|
|
|
|
+ dataArray: {
|
|
|
|
+ type: Array,
|
|
},
|
|
},
|
|
- axisTick: {
|
|
|
|
- show: false
|
|
|
|
|
|
+ title: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: ``,
|
|
},
|
|
},
|
|
- axisLabel: {
|
|
|
|
- color: information.colorArray.labelColor,
|
|
|
|
- fontSize: 20,
|
|
|
|
- margin: 30
|
|
|
|
|
|
+ titleEn: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: `Tongren Tobacco Planting Digital Management Platform`,
|
|
},
|
|
},
|
|
- splitLine: {
|
|
|
|
- show: true,
|
|
|
|
- interval: information.area.length,
|
|
|
|
- lineStyle: {
|
|
|
|
- color: information.colorArray.lineColor,
|
|
|
|
- width: 1
|
|
|
|
- }
|
|
|
|
|
|
+ unit: {
|
|
|
|
+ type: String,
|
|
},
|
|
},
|
|
- data: information.area
|
|
|
|
},
|
|
},
|
|
- grid: {
|
|
|
|
- left: '6%',
|
|
|
|
- right: '6%',
|
|
|
|
- bottom: '8%',
|
|
|
|
- top: '24%',
|
|
|
|
- containLabel: true
|
|
|
|
|
|
+ mounted() {
|
|
|
|
+ this.getEchart()
|
|
},
|
|
},
|
|
- yAxis: {
|
|
|
|
- type: 'value',
|
|
|
|
- axisTick: {
|
|
|
|
- show: false
|
|
|
|
- },
|
|
|
|
- splitLine: {
|
|
|
|
- show: true,
|
|
|
|
- lineStyle: {
|
|
|
|
- color: information.colorArray.lineColor,
|
|
|
|
- width: 2
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- axisLabel: {
|
|
|
|
- margin: 20,
|
|
|
|
- color: information.colorArray.labelColor,
|
|
|
|
- fontSize: 20,
|
|
|
|
- fontWeight: 400
|
|
|
|
- },
|
|
|
|
- axisLine: {
|
|
|
|
- show: true,
|
|
|
|
- lineStyle: {
|
|
|
|
- color: information.colorArray.lineColor,
|
|
|
|
- width: 2
|
|
|
|
|
|
+ methods: {
|
|
|
|
+ getEchart() {
|
|
|
|
+ let myChart = echarts.init(document.getElementById(`cylindrical`))
|
|
|
|
+ this.information = {
|
|
|
|
+ barWidth: 10,
|
|
|
|
+ colorArray: {
|
|
|
|
+ lineColor: `rgba(199,214,242, 0.2)`,
|
|
|
|
+ labelColor: ` #c7d6f2`,
|
|
|
|
+ },
|
|
|
|
+ unit: `公斤/产量`,
|
|
|
|
+ area: this.area,
|
|
|
|
+ dataArray: this.dataArray,
|
|
}
|
|
}
|
|
- }
|
|
|
|
- },
|
|
|
|
- series: [
|
|
|
|
- {
|
|
|
|
- name: '报修数量',
|
|
|
|
- tooltip: {
|
|
|
|
- show: true
|
|
|
|
- },
|
|
|
|
- type: 'bar',
|
|
|
|
- barWidth: information.barWidth, //柱子宽度
|
|
|
|
- label: {
|
|
|
|
- show: true,
|
|
|
|
- position: 'top',
|
|
|
|
- padding: 10,
|
|
|
|
- fontSize: 20,
|
|
|
|
- color: '#00ffff',
|
|
|
|
- fontWeight: 'bold'
|
|
|
|
- },
|
|
|
|
- itemStyle: {
|
|
|
|
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
- {
|
|
|
|
- offset: 0,
|
|
|
|
- color: 'rgba(54,131,241, 0.8)'
|
|
|
|
|
|
+ this.option = {
|
|
|
|
+ // animation: false, //去除加载时缓动动画
|
|
|
|
+ tooltip: {
|
|
|
|
+ trigger: `axis`,
|
|
|
|
+ backgroundColor: `rgba(9,40,84,0.8)`,
|
|
|
|
+ borderColor: `rgba(9,40,84,0.8)`,
|
|
|
|
+ textStyle: {
|
|
|
|
+ fontSize: 20,
|
|
|
|
+ color: `#fff`,
|
|
},
|
|
},
|
|
|
|
+ axisPointer: {
|
|
|
|
+ type: `shadow`,
|
|
|
|
+ },
|
|
|
|
+ formatter: `{b}<br/>{a} <span style='font-weight:bold'>{c}</span>`,
|
|
|
|
+ },
|
|
|
|
+ xAxis: {
|
|
|
|
+ axisLine: {
|
|
|
|
+ lineStyle: {
|
|
|
|
+ color: this.information.colorArray.lineColor,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ axisTick: {
|
|
|
|
+ show: false,
|
|
|
|
+ },
|
|
|
|
+ axisLabel: {
|
|
|
|
+ color: this.information.colorArray.labelColor,
|
|
|
|
+ fontSize: 12,
|
|
|
|
+ margin: 15,
|
|
|
|
+ interval: 0,
|
|
|
|
+ },
|
|
|
|
+ splitLine: {
|
|
|
|
+ show: true,
|
|
|
|
+ interval: this.information.area.length,
|
|
|
|
+ lineStyle: {
|
|
|
|
+ color: this.information.colorArray.lineColor,
|
|
|
|
+ width: 1,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ data: this.information.area,
|
|
|
|
+ },
|
|
|
|
+ grid: {
|
|
|
|
+ left: `6%`,
|
|
|
|
+ right: `6%`,
|
|
|
|
+ bottom: `8%`,
|
|
|
|
+ top: `24%`,
|
|
|
|
+ containLabel: true,
|
|
|
|
+ },
|
|
|
|
+ yAxis: [
|
|
{
|
|
{
|
|
- offset: 1,
|
|
|
|
- color: 'rgba(5,47,121, 0.8)'
|
|
|
|
- }
|
|
|
|
- ])
|
|
|
|
- },
|
|
|
|
- data: information.dataArray,
|
|
|
|
- legendHoverLink: false
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- // 柱子底部椭圆
|
|
|
|
- name: '报修数量',
|
|
|
|
- tooltip: {
|
|
|
|
- show: false
|
|
|
|
- },
|
|
|
|
- type: 'pictorialBar',
|
|
|
|
- itemStyle: {
|
|
|
|
- //未填充部分鼠标移上去颜色
|
|
|
|
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
- {
|
|
|
|
- offset: 0,
|
|
|
|
- color: '#0642a2'
|
|
|
|
|
|
+ type: `value`,
|
|
|
|
+ name: this.information.unit,
|
|
|
|
+ nameTextStyle: {
|
|
|
|
+ color: `#65ABE7`,
|
|
|
|
+ fontSize: 12,
|
|
|
|
+ },
|
|
|
|
+ axisTick: {
|
|
|
|
+ show: false,
|
|
|
|
+ },
|
|
|
|
+ splitLine: {
|
|
|
|
+ show: true,
|
|
|
|
+ lineStyle: {
|
|
|
|
+ color: this.information.colorArray.lineColor,
|
|
|
|
+ width: 2,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ axisLabel: {
|
|
|
|
+ margin: 20,
|
|
|
|
+ color: this.information.colorArray.labelColor,
|
|
|
|
+ fontSize: 12,
|
|
|
|
+ fontWeight: 4,
|
|
|
|
+ },
|
|
|
|
+ axisLine: {
|
|
|
|
+ show: true,
|
|
|
|
+ lineStyle: {
|
|
|
|
+ color: this.information.colorArray.lineColor,
|
|
|
|
+ width: 2,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
},
|
|
},
|
|
|
|
+ ],
|
|
|
|
+ series: [
|
|
{
|
|
{
|
|
- offset: 1,
|
|
|
|
- color: '#073d97'
|
|
|
|
- }
|
|
|
|
- ])
|
|
|
|
- },
|
|
|
|
- symbolRotate: 0,
|
|
|
|
- symbolSize: [information.barWidth, 20],
|
|
|
|
- symbolOffset: [0, 10],
|
|
|
|
- symbolPosition: 'start',
|
|
|
|
- data: information.dataArray,
|
|
|
|
- z: 3
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- // 柱子头部椭圆
|
|
|
|
- name: '报修数量',
|
|
|
|
- tooltip: {
|
|
|
|
- show: false
|
|
|
|
- },
|
|
|
|
- type: 'pictorialBar',
|
|
|
|
- itemStyle: {
|
|
|
|
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
|
+ name: this.information.unit,
|
|
|
|
+ tooltip: {
|
|
|
|
+ show: true,
|
|
|
|
+ },
|
|
|
|
+ type: `bar`,
|
|
|
|
+ barWidth: this.information.barWidth, // 柱子宽度
|
|
|
|
+ label: {
|
|
|
|
+ show: false,
|
|
|
|
+ position: `top`,
|
|
|
|
+ padding: 10,
|
|
|
|
+ fontSize: 20,
|
|
|
|
+ color: `#00ffff`,
|
|
|
|
+ fontWeight: `bold`,
|
|
|
|
+ },
|
|
|
|
+ itemStyle: {
|
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
+ {
|
|
|
|
+ offset: 0,
|
|
|
|
+ color: `#47FEED`,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ offset: 1,
|
|
|
|
+ color: `#0E7E7D`,
|
|
|
|
+ },
|
|
|
|
+ ]),
|
|
|
|
+ },
|
|
|
|
+ data: this.information.dataArray,
|
|
|
|
+ legendHoverLink: false,
|
|
|
|
+ },
|
|
{
|
|
{
|
|
- offset: 0,
|
|
|
|
- color: '#75aefd'
|
|
|
|
|
|
+ // 柱子底部椭圆
|
|
|
|
+ name: `报修数量`,
|
|
|
|
+ tooltip: {
|
|
|
|
+ show: false,
|
|
|
|
+ },
|
|
|
|
+ type: `pictorialBar`,
|
|
|
|
+ itemStyle: {
|
|
|
|
+ // 未填充部分鼠标移上去颜色
|
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
+ {
|
|
|
|
+ offset: 0,
|
|
|
|
+ color: `#1ABFC0`,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ offset: 1,
|
|
|
|
+ color: `#1ABFC0`,
|
|
|
|
+ },
|
|
|
|
+ ]),
|
|
|
|
+ },
|
|
|
|
+ symbolRotate: 0,
|
|
|
|
+ symbolSize: [this.information.barWidth, 5],
|
|
|
|
+ symbolOffset: [0, 3],
|
|
|
|
+ symbolPosition: `start`,
|
|
|
|
+ data: this.information.dataArray,
|
|
|
|
+ z: 3,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- offset: 1,
|
|
|
|
- color: '#74aefc'
|
|
|
|
- }
|
|
|
|
- ])
|
|
|
|
- },
|
|
|
|
- symbolRotate: 0,
|
|
|
|
- symbolSize: [information.barWidth, 20],
|
|
|
|
- symbolOffset: [0, -10],
|
|
|
|
- symbolPosition: 'end',
|
|
|
|
- data: information.dataArray,
|
|
|
|
- z: 3
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
- myChart.setOption(this.option,true);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ // 柱子头部椭圆
|
|
|
|
+ name: `报修数量`,
|
|
|
|
+ tooltip: {
|
|
|
|
+ show: false,
|
|
|
|
+ },
|
|
|
|
+ type: `pictorialBar`,
|
|
|
|
+ itemStyle: {
|
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
+ {
|
|
|
|
+ offset: 0,
|
|
|
|
+ color: `#1ABFC0`,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ offset: 1,
|
|
|
|
+ color: `#1ABFC0`,
|
|
|
|
+ },
|
|
|
|
+ ]),
|
|
|
|
+ },
|
|
|
|
+ symbolRotate: 0,
|
|
|
|
+ symbolSize: [this.information.barWidth, 5],
|
|
|
|
+ symbolOffset: [0, -3],
|
|
|
|
+ symbolPosition: `end`,
|
|
|
|
+ data: this.information.dataArray,
|
|
|
|
+ z: 3,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ }
|
|
|
|
+ myChart.setOption(this.option, true)
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- beforeDestroy() {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-};
|
|
|
|
- </script>
|
|
|
|
|
|
+ beforeDestroy() {},
|
|
|
|
+}
|
|
|
|
+</script>
|
|
|
|
|
|
- <style lang="scss" scoped>
|
|
|
|
|
|
+<style lang="scss" scoped>
|
|
.sn-container {
|
|
.sn-container {
|
|
- width: 486px;
|
|
|
|
|
|
+ width: 526px;
|
|
height: 300px;
|
|
height: 300px;
|
|
|
|
+ .title {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ .titleEn {
|
|
|
|
+ width: 120px;
|
|
|
|
+ font-size: 8px;
|
|
|
|
+ text-align: right;
|
|
|
|
+ word-break: break-all;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
.chartsdom {
|
|
.chartsdom {
|
|
width: 100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- </style>
|
|
|
|
|
|
+</style>
|