|
|
@ -5,7 +5,7 @@ |
|
|
|
--> |
|
|
|
|
|
|
|
<template> |
|
|
|
<div class="wrap-container sn-container"> |
|
|
|
<!-- <div class="wrap-container sn-container"> |
|
|
|
<div class="sn-content"> |
|
|
|
<div class="sn-title">双轴柱状图</div> |
|
|
|
<div class="sn-body"> |
|
|
@ -14,6 +14,9 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> --> |
|
|
|
<div class="income-container"> |
|
|
|
<div class="chart" id="chart_bar"></div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
@ -34,7 +37,7 @@ export default { |
|
|
|
methods: { |
|
|
|
getEchart() { |
|
|
|
let myChart = echarts.init(document.getElementById('chart_bar')); |
|
|
|
let barWidth = '10%'; |
|
|
|
let barWidth = '15%'; |
|
|
|
let dataCoord = [ |
|
|
|
{coord: [0, 9]}, |
|
|
|
{coord: [1, 12]}, |
|
|
@ -80,6 +83,22 @@ export default { |
|
|
|
color: 'rgba(40, 103, 168, 0.3)', |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
tooltip: { |
|
|
|
trigger: 'axis', |
|
|
|
showContent: true, |
|
|
|
axisPointer: { |
|
|
|
type: 'shadow', |
|
|
|
shadowStyle: { |
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ |
|
|
|
offset: 1, |
|
|
|
color: '#5d83ff' |
|
|
|
},{ |
|
|
|
offset: 0, |
|
|
|
color: 'rgba(255, 255, 255, 0)' |
|
|
|
}]) |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
yAxis: { |
|
|
|
axisLabel: { |
|
|
@ -116,12 +135,20 @@ export default { |
|
|
|
offset: 1, |
|
|
|
color: 'rgba(0, 0, 0, 0)' |
|
|
|
},{ |
|
|
|
offset: 0.5, |
|
|
|
offset: 0.6, |
|
|
|
color: '#466e71' |
|
|
|
},{ |
|
|
|
offset: 0, |
|
|
|
color: '#eb9b44' |
|
|
|
}]) |
|
|
|
color: '#43FFFF' |
|
|
|
}]), |
|
|
|
label: { |
|
|
|
position:"top", |
|
|
|
show: true, //开启显示 |
|
|
|
textStyle: { //数值样式 |
|
|
|
color: '#fff', |
|
|
|
fontSize: 10 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
barWidth: barWidth, |
|
|
@ -129,51 +156,18 @@ export default { |
|
|
|
symbol: 'circle', |
|
|
|
itemStyle: { |
|
|
|
normal: { |
|
|
|
color: '#eb9b44', |
|
|
|
shadowColor: '#eb9b44', |
|
|
|
color: '#43FFFF', |
|
|
|
shadowColor: '#43FFFF', |
|
|
|
shadowBlur: 20 |
|
|
|
} |
|
|
|
}, |
|
|
|
symbolSize: [10, 10], // 容器大小 |
|
|
|
symbolSize: [5, 5], // 容器大小 |
|
|
|
symbolOffset: [0, 0], // 位置偏移 |
|
|
|
data: dataCoord, |
|
|
|
}, |
|
|
|
data: this.yData1 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '负值柱状图', |
|
|
|
type: 'bar', |
|
|
|
stack: 'one', |
|
|
|
itemStyle: { |
|
|
|
normal: { |
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ |
|
|
|
offset: 0, |
|
|
|
color: 'rgba(0, 0, 0, 0)' |
|
|
|
},{ |
|
|
|
offset: 0.5, |
|
|
|
color: '#774a75' |
|
|
|
},{ |
|
|
|
offset: 1, |
|
|
|
color: '#b34d69' |
|
|
|
}]) |
|
|
|
} |
|
|
|
}, |
|
|
|
barWidth: barWidth, |
|
|
|
markPoint: { |
|
|
|
symbol: 'circle', |
|
|
|
itemStyle: { |
|
|
|
normal: { |
|
|
|
color: '#b34d69', |
|
|
|
shadowColor: '#b34d69', |
|
|
|
shadowBlur: 20 |
|
|
|
} |
|
|
|
}, |
|
|
|
symbolSize: [10, 10], |
|
|
|
symbolOffset: [0, 0], |
|
|
|
data: dataCoord2, |
|
|
|
}, |
|
|
|
data: this.yData2 |
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
}; |
|
|
|
myChart.setOption(this.option, true); |
|
|
@ -190,6 +184,11 @@ export default { |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
.income-container { |
|
|
|
.chart { |
|
|
|
height: 3rem; |
|
|
|
} |
|
|
|
} |
|
|
|
.sn-container { |
|
|
|
left: 975px; |
|
|
|
top: 690px; |
|
|
|