湖里大屏:新增 jChart/bar/JBarChart.vue 组件
This commit is contained in:
parent
0c38423785
commit
15d8437e66
@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<div class="j-bar-chart" ref="jBarChart"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from 'echarts4'
|
||||
export default {
|
||||
props: {
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => [{ value: 1, name: '' }]
|
||||
},
|
||||
color: {
|
||||
type: Array,
|
||||
default: () => ['#5181F6', '#61D2B9', '#F67F51', '#7851F6']
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
subTitle: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
radius: {
|
||||
type: Array,
|
||||
default: () => ['65%', '80%']
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.jBarChart = echarts.init(this.$refs.jBarChart)
|
||||
this.createRingChart()
|
||||
},
|
||||
data() {
|
||||
return { jBarChart: null }
|
||||
},
|
||||
methods: {
|
||||
createRingChart() {
|
||||
const option = {
|
||||
color: this.color,
|
||||
title: {
|
||||
show: true,
|
||||
text: this.title,
|
||||
x: '48%',
|
||||
y: '36%',
|
||||
z: 5,
|
||||
textAlign: 'center',
|
||||
textStyle: {
|
||||
color: 'rgba(255, 255, 255, 1)',
|
||||
fontSize: 20
|
||||
},
|
||||
subtext: this.subTitle,
|
||||
subtextStyle: {
|
||||
color: 'rgba(255, 255, 255, 0.8)',
|
||||
fontSize: 13
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
right: 0
|
||||
},
|
||||
legend: {
|
||||
show: false
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '',
|
||||
type: 'pie',
|
||||
radius: this.radius,
|
||||
avoidLabelOverlap: false,
|
||||
hoverAnimation: false,
|
||||
label: {
|
||||
show: false,
|
||||
position: 'center'
|
||||
},
|
||||
labelLine: {
|
||||
show: false
|
||||
},
|
||||
data: this.data
|
||||
}
|
||||
]
|
||||
}
|
||||
this.jBarChart.setOption(option)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.j-bar-chart {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@ -9,7 +9,7 @@
|
||||
<leftCenter title="问题占比" />
|
||||
</div>
|
||||
<div class="leftBottom">
|
||||
<leftCenter title="频发问题" />
|
||||
<leftBottom title="频发问题" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="centerBox">
|
||||
|
||||
@ -1,42 +1,49 @@
|
||||
<template>
|
||||
<!-- 频发问题 -->
|
||||
<div class="container">
|
||||
<div class="titleTxt">{{ title }}</div>
|
||||
|
||||
</div>
|
||||
<!-- 问题占比 -->
|
||||
<div class="frequentProblems">
|
||||
<div class="title">{{ title }}</div>
|
||||
<div class="content">
|
||||
<JBarChart
|
||||
title="3412"
|
||||
subTitle="问题总数"
|
||||
:color="['#557DEE', '#43D7B5']"
|
||||
:data="[{ value: 2314 }, { value: 987 }]"
|
||||
:radius="['55%', '80%']"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import JBarChart from '../jChart/bar/JBarChart.vue'
|
||||
export default {
|
||||
|
||||
components: { JBarChart },
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: "default title"
|
||||
default: 'default title'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
return {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.container {
|
||||
.frequentProblems {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid #0081c3;
|
||||
|
||||
.titleTxt {
|
||||
.title {
|
||||
padding-left: 6px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
font-size: 18px;
|
||||
color: #6ee4f0;
|
||||
margin-top: 5px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
.content {
|
||||
height: calc(100% - 30px);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user