|
@@ -1,6 +1,8 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="chart-wrap">
|
|
<div class="chart-wrap">
|
|
|
- <v-chart autoresize :option="option"/>
|
|
|
|
|
|
|
+ <div class="wrap-fix">
|
|
|
|
|
+ <v-chart autoresize :option="option"/>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -15,6 +17,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
|
|
+ window['is'] = this
|
|
|
this.getOption()
|
|
this.getOption()
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -26,7 +29,7 @@ export default {
|
|
|
[100, 100, 100],
|
|
[100, 100, 100],
|
|
|
[80, 80, 80]
|
|
[80, 80, 80]
|
|
|
]
|
|
]
|
|
|
- const sealingData = []
|
|
|
|
|
|
|
+ let sealingData = []
|
|
|
const gapPerSize = 10
|
|
const gapPerSize = 10
|
|
|
const gapData = data.map(() => [gapPerSize, gapPerSize, gapPerSize])
|
|
const gapData = data.map(() => [gapPerSize, gapPerSize, gapPerSize])
|
|
|
|
|
|
|
@@ -49,9 +52,17 @@ export default {
|
|
|
// })
|
|
// })
|
|
|
// gapData.push(gapItem)
|
|
// gapData.push(gapItem)
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ // 三条数据变两条
|
|
|
|
|
+ sealingData = JSON.parse(JSON.stringify(sealingData))
|
|
|
|
|
+ sealingData.forEach((item, index) => {
|
|
|
|
|
+ const start = item[0].splice(0, 2)
|
|
|
|
|
+ const end = item[1].splice(0, 2)
|
|
|
|
|
+ sealingData[index] = [start, end]
|
|
|
|
|
+ })
|
|
|
window['sealingData'] = sealingData
|
|
window['sealingData'] = sealingData
|
|
|
const gapWidth = this.EchartfontSize(125)
|
|
const gapWidth = this.EchartfontSize(125)
|
|
|
- const barWidth = this.EchartfontSize(15)
|
|
|
|
|
|
|
+ const barWidth = this.EchartfontSize(10)
|
|
|
const symbolOffsetWidth = this.EchartfontSize(5)
|
|
const symbolOffsetWidth = this.EchartfontSize(5)
|
|
|
const symbolSizeWidth = this.EchartfontSize(8)
|
|
const symbolSizeWidth = this.EchartfontSize(8)
|
|
|
this.option = {
|
|
this.option = {
|
|
@@ -68,7 +79,7 @@ export default {
|
|
|
// orient: 'vertical',
|
|
// orient: 'vertical',
|
|
|
textStyle: {
|
|
textStyle: {
|
|
|
color: '#ffffff',
|
|
color: '#ffffff',
|
|
|
- fontSize: this.EchartfontSize(20)
|
|
|
|
|
|
|
+ fontSize: this.EchartfontSize(16)
|
|
|
},
|
|
},
|
|
|
data: [
|
|
data: [
|
|
|
{
|
|
{
|
|
@@ -103,10 +114,12 @@ export default {
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
grid: {
|
|
grid: {
|
|
|
- right: '20%',
|
|
|
|
|
- left: '20%',
|
|
|
|
|
- bottom: '10%',
|
|
|
|
|
- // height: '50%',
|
|
|
|
|
|
|
+ right: '10%',
|
|
|
|
|
+ left: '5%',
|
|
|
|
|
+ height: '80%',
|
|
|
|
|
+ top: '30%',
|
|
|
|
|
+ containLabel: true
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
xAxis: {
|
|
xAxis: {
|
|
|
show: false,
|
|
show: false,
|
|
@@ -119,6 +132,14 @@ export default {
|
|
|
},
|
|
},
|
|
|
axisLine: {
|
|
axisLine: {
|
|
|
show: false
|
|
show: false
|
|
|
|
|
+ },
|
|
|
|
|
+ axisLabel: {
|
|
|
|
|
+ show: true,
|
|
|
|
|
+ fontSize: this.EchartfontSize(16),
|
|
|
|
|
+ color: '#ffffff',
|
|
|
|
|
+ formatter: (name) => {
|
|
|
|
|
+ return name + ' '
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
yAxis: {
|
|
yAxis: {
|
|
@@ -134,7 +155,7 @@ export default {
|
|
|
show: false
|
|
show: false
|
|
|
},
|
|
},
|
|
|
axisLabel: {
|
|
axisLabel: {
|
|
|
- fontSize: this.EchartfontSize(20),
|
|
|
|
|
|
|
+ fontSize: this.EchartfontSize(16),
|
|
|
color: '#ffffff',
|
|
color: '#ffffff',
|
|
|
formatter: (name) => {
|
|
formatter: (name) => {
|
|
|
return name + ' '
|
|
return name + ' '
|
|
@@ -147,10 +168,12 @@ export default {
|
|
|
name: '一级',
|
|
name: '一级',
|
|
|
type: 'bar',
|
|
type: 'bar',
|
|
|
stack: 'total',
|
|
stack: 'total',
|
|
|
|
|
+ barGap: 10, /* 多个并排柱子设置柱子之间的间距*/
|
|
|
|
|
+ barCategoryGap: 10, /* 多个并排柱子设置柱子之间的间距*/
|
|
|
barWidth: barWidth,
|
|
barWidth: barWidth,
|
|
|
itemStyle: { // lenged文本
|
|
itemStyle: { // lenged文本
|
|
|
opacity: 1,
|
|
opacity: 1,
|
|
|
- color: function(params) {
|
|
|
|
|
|
|
+ color: () => {
|
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
|
offset: 0,
|
|
offset: 0,
|
|
|
color: 'rgba(231, 73, 2, 0.30)' // 0% 处的颜色
|
|
color: 'rgba(231, 73, 2, 0.30)' // 0% 处的颜色
|
|
@@ -163,12 +186,12 @@ export default {
|
|
|
label: {
|
|
label: {
|
|
|
show: true,
|
|
show: true,
|
|
|
position: ['50%', -barWidth - 10],
|
|
position: ['50%', -barWidth - 10],
|
|
|
- fontSize: this.EchartfontSize(20),
|
|
|
|
|
- color: '#fffff'
|
|
|
|
|
|
|
+ fontSize: this.EchartfontSize(16),
|
|
|
|
|
+ color: '#ffffff'
|
|
|
},
|
|
},
|
|
|
data: data[0]
|
|
data: data[0]
|
|
|
},
|
|
},
|
|
|
- { //
|
|
|
|
|
|
|
+ { // gap
|
|
|
name: '',
|
|
name: '',
|
|
|
type: 'bar',
|
|
type: 'bar',
|
|
|
barWidth: gapWidth,
|
|
barWidth: gapWidth,
|
|
@@ -187,7 +210,7 @@ export default {
|
|
|
barWidth: barWidth,
|
|
barWidth: barWidth,
|
|
|
itemStyle: { // lenged文本
|
|
itemStyle: { // lenged文本
|
|
|
opacity: 1,
|
|
opacity: 1,
|
|
|
- color: function(params) {
|
|
|
|
|
|
|
+ color: function (params) {
|
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
|
offset: 0,
|
|
offset: 0,
|
|
|
color: 'rgba(231, 203, 2, 0.30)' // 0% 处的颜色
|
|
color: 'rgba(231, 203, 2, 0.30)' // 0% 处的颜色
|
|
@@ -200,12 +223,12 @@ export default {
|
|
|
label: {
|
|
label: {
|
|
|
show: true,
|
|
show: true,
|
|
|
position: ['50%', -barWidth - 10],
|
|
position: ['50%', -barWidth - 10],
|
|
|
- fontSize: this.EchartfontSize(20),
|
|
|
|
|
|
|
+ fontSize: this.EchartfontSize(16),
|
|
|
color: '#fffff'
|
|
color: '#fffff'
|
|
|
},
|
|
},
|
|
|
data: data[1]
|
|
data: data[1]
|
|
|
},
|
|
},
|
|
|
- { //
|
|
|
|
|
|
|
+ { // gap
|
|
|
name: '',
|
|
name: '',
|
|
|
type: 'bar',
|
|
type: 'bar',
|
|
|
barWidth: gapWidth,
|
|
barWidth: gapWidth,
|
|
@@ -224,7 +247,7 @@ export default {
|
|
|
barWidth: barWidth,
|
|
barWidth: barWidth,
|
|
|
itemStyle: { // lenged文本
|
|
itemStyle: { // lenged文本
|
|
|
opacity: 1,
|
|
opacity: 1,
|
|
|
- color: function(params) {
|
|
|
|
|
|
|
+ color: function (params) {
|
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
|
offset: 0,
|
|
offset: 0,
|
|
|
color: 'rgba(78, 231, 255, 0.30)' // 0% 处的颜色
|
|
color: 'rgba(78, 231, 255, 0.30)' // 0% 处的颜色
|
|
@@ -237,7 +260,7 @@ export default {
|
|
|
label: {
|
|
label: {
|
|
|
show: true,
|
|
show: true,
|
|
|
position: ['50%', -barWidth - 10],
|
|
position: ['50%', -barWidth - 10],
|
|
|
- fontSize: this.EchartfontSize(20),
|
|
|
|
|
|
|
+ fontSize: this.EchartfontSize(16),
|
|
|
color: '#fffff'
|
|
color: '#fffff'
|
|
|
},
|
|
},
|
|
|
data: data[2]
|
|
data: data[2]
|
|
@@ -262,7 +285,7 @@ export default {
|
|
|
'symbolOffset': [symbolOffsetWidth, 0],
|
|
'symbolOffset': [symbolOffsetWidth, 0],
|
|
|
itemStyle: {
|
|
itemStyle: {
|
|
|
opacity: 1,
|
|
opacity: 1,
|
|
|
- color: function(params) {
|
|
|
|
|
|
|
+ color: function (params) {
|
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
|
offset: 0,
|
|
offset: 0,
|
|
|
color: 'rgba(237, 118, 101,.4)' // 0% 处的颜色
|
|
color: 'rgba(237, 118, 101,.4)' // 0% 处的颜色
|
|
@@ -272,10 +295,9 @@ export default {
|
|
|
}], false)
|
|
}], false)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- label: {
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ label: {},
|
|
|
'symbolPosition': 'start',
|
|
'symbolPosition': 'start',
|
|
|
- 'data': sealingData[0][0]
|
|
|
|
|
|
|
+ 'data': [sealingData[0][0][0], sealingData[0][0][0]]
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
{ // 封口2
|
|
{ // 封口2
|
|
@@ -288,7 +310,7 @@ export default {
|
|
|
'z': 12,
|
|
'z': 12,
|
|
|
itemStyle: {
|
|
itemStyle: {
|
|
|
opacity: 1,
|
|
opacity: 1,
|
|
|
- color: function(params) {
|
|
|
|
|
|
|
+ color: function (params) {
|
|
|
return new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
|
return new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
|
|
offset: 0,
|
|
offset: 0,
|
|
|
color: 'rgba(237, 118, 101,1)' // 0% 处的颜色
|
|
color: 'rgba(237, 118, 101,1)' // 0% 处的颜色
|
|
@@ -310,7 +332,7 @@ export default {
|
|
|
'z': 12,
|
|
'z': 12,
|
|
|
itemStyle: {
|
|
itemStyle: {
|
|
|
opacity: 1,
|
|
opacity: 1,
|
|
|
- color: function(params) {
|
|
|
|
|
|
|
+ color: function (params) {
|
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
|
offset: 0,
|
|
offset: 0,
|
|
|
color: 'rgba(255, 238, 91,.1)' // 0% 处的颜色
|
|
color: 'rgba(255, 238, 91,.1)' // 0% 处的颜色
|
|
@@ -343,7 +365,7 @@ export default {
|
|
|
'z': 12,
|
|
'z': 12,
|
|
|
itemStyle: {
|
|
itemStyle: {
|
|
|
opacity: 1,
|
|
opacity: 1,
|
|
|
- color: function(params) {
|
|
|
|
|
|
|
+ color: function (params) {
|
|
|
return new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
|
return new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
|
|
offset: 1,
|
|
offset: 1,
|
|
|
color: 'rgba(255, 238, 91, 1)' // 0% 处的颜色
|
|
color: 'rgba(255, 238, 91, 1)' // 0% 处的颜色
|
|
@@ -366,7 +388,7 @@ export default {
|
|
|
'z': 12,
|
|
'z': 12,
|
|
|
itemStyle: {
|
|
itemStyle: {
|
|
|
opacity: 1,
|
|
opacity: 1,
|
|
|
- color: function(params) {
|
|
|
|
|
|
|
+ color: function (params) {
|
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
|
offset: 0,
|
|
offset: 0,
|
|
|
color: 'rgba(162, 237, 255,.1)' // 0% 处的颜色
|
|
color: 'rgba(162, 237, 255,.1)' // 0% 处的颜色
|
|
@@ -399,7 +421,7 @@ export default {
|
|
|
'z': 12,
|
|
'z': 12,
|
|
|
itemStyle: {
|
|
itemStyle: {
|
|
|
opacity: 1,
|
|
opacity: 1,
|
|
|
- color: function(params) {
|
|
|
|
|
|
|
+ color: function (params) {
|
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
|
offset: 0,
|
|
offset: 0,
|
|
|
color: 'rgba(162, 237, 255,1)' // 0% 处的颜色
|
|
color: 'rgba(162, 237, 255,1)' // 0% 处的颜色
|
|
@@ -410,6 +432,41 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
'data': sealingData[2][1]
|
|
'data': sealingData[2][1]
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ { // right-value
|
|
|
|
|
+ 'name': '',
|
|
|
|
|
+ 'type': 'pictorialBar',
|
|
|
|
|
+ 'symbolSize': [symbolSizeWidth, barWidth],
|
|
|
|
|
+ 'symbolRotate': 180,
|
|
|
|
|
+ 'symbolOffset': [symbolOffsetWidth, 0],
|
|
|
|
|
+ 'symbolPosition': 'end',
|
|
|
|
|
+ 'z': 12,
|
|
|
|
|
+ itemStyle: {
|
|
|
|
|
+ opacity: 1,
|
|
|
|
|
+ color: function (params) {
|
|
|
|
|
+ return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
|
|
|
|
|
+ offset: 0,
|
|
|
|
|
+ color: 'rgba(162, 237, 255,0)' // 0% 处的颜色
|
|
|
|
|
+ }, {
|
|
|
|
|
+ offset: 1,
|
|
|
|
|
+ color: 'rgba(162, 237, 255,0)' // 100% 处的颜色
|
|
|
|
|
+ }], false)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ 'data': sealingData[2][1].map(value => value + 10),
|
|
|
|
|
+ label: {
|
|
|
|
|
+ show: true,
|
|
|
|
|
+
|
|
|
|
|
+ distance: 10,
|
|
|
|
|
+ color: '#fff',
|
|
|
|
|
+ fontSize: this.EchartfontSize(14),
|
|
|
|
|
+ // position: [-baseWidth - offsetWidth / this.EchartfontSize(10), -this.EchartfontSize(20)]
|
|
|
|
|
+ position: 'right',
|
|
|
|
|
+ formatter: (item) => {
|
|
|
|
|
+ return '-/-'
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
]
|
|
]
|
|
@@ -423,9 +480,15 @@ export default {
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
|
|
|
|
|
.chart-wrap {
|
|
.chart-wrap {
|
|
|
- width: 25%;
|
|
|
|
|
- height: 160px;
|
|
|
|
|
- background: teal;
|
|
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ background: rgb(40, 42, 54, 0);
|
|
|
|
|
+
|
|
|
|
|
+ .wrap-fix {
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|