Commit a3cbc335 by 胡悦

添加柱状图

1 parent f92642e2
...@@ -3,16 +3,118 @@ ...@@ -3,16 +3,118 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-06-23 15:05:21 * @Date: 2022-06-23 15:05:21
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:20:44 * @LastEditTime: 2022-06-28 11:33:12
--> -->
<template> <template>
<div> <div>
<div class="title">售后客户价值分析</div> <div class="title">售后客户价值分析</div>
<div class="analyze-content" :style="{ height: height - 4.9 + 'vh' }">
<div class="content-left bg">
<div id="analyzeBar" style="height: 100%"></div>
</div>
<div class="contetn-right bg">右边</div>
</div>
</div> </div>
</template> </template>
<script> <script>
import * as echarts from 'echarts'
import datas from '../../utils/data'
export default { export default {
name: 'Analyze' name: 'Analyze',
props: ['height'],
data() {
return {
yData: datas.Customer.valueType.value.map(item => item.name)
}
},
mounted() {
this.getChart()
},
methods: {
getChart() {
var chartDom = document.getElementById('analyzeBar')
var myChart = echarts.init(chartDom)
var option
option = {
grid: {
left: '3%',
right: '4%',
top: '2%',
bottom: '2%',
containLabel: true
},
yAxis: {
type: 'category',
data: this.yData,
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
show: false
}
},
xAxis: {
type: 'value',
splitLine: {
show: false
},
axisLabel: {
show: false
}
},
series: [
{
data: [120, 200, 150, 80, 70, 110, 130, 300],
type: 'bar',
barWidth: 12,
itemStyle: {
normal: {
label: {
show: true,
position: 'center',
textStyle: {
fontSize: '12',
color: '#fff'
}
},
color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
{
offset: 0,
color: '#F79902'
},
{
offset: 1,
color: '#EB6001'
}
])
}
}
}
]
}
option && myChart.setOption(option)
}
}
} }
</script> </script>
<style lang="scss" scoped>
.analyze-content {
display: flex;
padding: 0 8px 1.8vh;
.bg {
background-color: #262525;
}
.content-left {
flex: 1;
}
.contetn-right {
width: 43%;
margin-left: 8px;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!