提交 047d1831 authored 作者: 王鹏飞's avatar 王鹏飞

update

上级 78b5f90b
...@@ -91,8 +91,8 @@ export default { ...@@ -91,8 +91,8 @@ export default {
option() { option() {
return { return {
title: { text: '单位:万', textStyle: { fontSize: 12, color: '#0A7199' }, padding: 0 }, title: { text: '单位:万', textStyle: { fontSize: 12, color: '#0A7199' }, padding: 0 },
// tooltip: { trigger: 'axis', axisPointer: {} }, // tooltip: { trigger: 'axis', axisPointer: { type: 'none' } },
grid: { left: 0, top: '40px', right: 0, bottom: '40px', containLabel: true }, grid: { left: 'left', top: 40, right: 0, bottom: 40, containLabel: true },
legend: { legend: {
bottom: '10px', bottom: '10px',
itemWidth: 10, itemWidth: 10,
......
...@@ -96,7 +96,7 @@ export default { ...@@ -96,7 +96,7 @@ export default {
return { return {
title: { text: '单位:万', textStyle: { fontSize: 12, color: '#0A7199' }, padding: 0 }, title: { text: '单位:万', textStyle: { fontSize: 12, color: '#0A7199' }, padding: 0 },
// tooltip: { trigger: 'axis', axisPointer: { type: 'none' } }, // tooltip: { trigger: 'axis', axisPointer: { type: 'none' } },
grid: { left: 0, top: '40px', right: 0, bottom: '40px', containLabel: true }, grid: { left: 'left', top: 40, right: 0, bottom: 40, containLabel: true },
legend: { legend: {
bottom: '10px', bottom: '10px',
itemWidth: 10, itemWidth: 10,
......
<template> <template>
<v-chart class="chart" :option="option" :autoresize="true" :loading="loading" ref="chart" /> <v-chart
class="chart"
:option="option"
:autoresize="true"
:loading="loading"
@legendselectchanged="legendselectchanged"
ref="chart"
/>
</template> </template>
<script> <script>
...@@ -10,6 +17,7 @@ export default { ...@@ -10,6 +17,7 @@ export default {
return { return {
loading: false, loading: false,
response: [], response: [],
legendselect: {},
height: 0 height: 0
} }
}, },
...@@ -20,7 +28,9 @@ export default { ...@@ -20,7 +28,9 @@ export default {
option() { option() {
let total = 0 let total = 0
const data = this.response.map(item => { const data = this.response.map(item => {
if (this.legendselect[item.project_name] !== false) {
total += item.all_pay_money total += item.all_pay_money
}
const color = this.colors[item.project_name] const color = this.colors[item.project_name]
return { value: item.all_pay_money, name: item.project_name, itemStyle: { color } } return { value: item.all_pay_money, name: item.project_name, itemStyle: { color } }
}) })
...@@ -83,6 +93,9 @@ export default { ...@@ -83,6 +93,9 @@ export default {
this.loading = false this.loading = false
}) })
}, },
legendselectchanged({ selected }) {
this.legendselect = selected
},
getChartHeight() { getChartHeight() {
this.height = this.$refs.chart.$el.offsetHeight this.height = this.$refs.chart.$el.offsetHeight
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论