Compare commits

...

2 Commits

Author SHA1 Message Date
luoshiwen 847054715e 代码提交 2023-02-21 15:22:05 +08:00
luoshiwen 2504c52cd3 代码提交 2023-02-21 15:06:16 +08:00
9 changed files with 72 additions and 58 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@ export default {
props: { props: {
list: Array, list: Array,
default() { default() {
return []; return []
}, },
pageType: { pageType: {
type: String type: String
@ -33,15 +33,16 @@ export default {
return { return {
xData: [], xData: [],
yData: [] yData: []
}; }
},
created() {
}, },
created() {},
methods: { methods: {
drawBar() { drawBar() {
console.log(this.yData, 222);
let myChart = this.$echarts.getInstanceByDom(this.$refs.barChart); let myChart = this.$echarts.getInstanceByDom(this.$refs.barChart)
if (myChart == null) { if (myChart == null) {
myChart = this.$echarts.init(this.$refs.barChart); myChart = this.$echarts.init(this.$refs.barChart)
} }
let option = { let option = {
color: ['#7262FD', '#FC5A5A'], color: ['#7262FD', '#FC5A5A'],
@ -49,34 +50,34 @@ export default {
show: true, show: true,
text: this.componentName + '-' + this.chartName + '-' + '柱状图', text: this.componentName + '-' + this.chartName + '-' + '柱状图',
textStyle: { textStyle: {
lineHeight: '30' lineHeight: '30',
} }
}, },
tooltip: { tooltip: {
confine: true confine: true,
}, },
grid: { grid: {
left: '2%', left: '2%',
right: '4%', right: '4%',
bottom: '10%', bottom: '10%',
top: '20%', top: '20%',
containLabel: true containLabel: true,
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: this.xData, data: this.xData,
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: '#000' color: '#000',
} },
}, },
axisLabel: { axisLabel: {
fontSize: 12, fontSize: 12,
color: '#000' color: '#000',
}, },
axisTick: { axisTick: {
show: false show: false,
} },
}, },
yAxis: [ yAxis: [
{ {
@ -84,64 +85,70 @@ export default {
min: 0, min: 0,
minInterval: 1, minInterval: 1,
splitArea: { splitArea: {
show: false show: false,
}, },
axisLine: { axisLine: {
show: true show: true,
}, },
axisTick: { axisTick: {
show: false show: false,
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: '#eeebeb', color: '#eeebeb',
type: 'dashed' // dotted 线 type: 'dashed', // dotted 线
} },
}, },
axisLabel: { axisLabel: {
fontSize: 12, fontSize: 12,
color: '#000', color: '#000',
fontFamily: 'Bebas' fontFamily: 'Bebas',
} },
} }],
], series: [{
series: [
{
type: 'bar', type: 'bar',
barWidth: 20, barWidth: 20,
itemStyle: { barBorderRadius: [5, 5, 0, 0] }, itemStyle: { barBorderRadius: [5, 5, 0, 0], },
name: '时间', name: '时间',
data: this.yData data: this.yData
} },
] ],
}; };
myChart.setOption(option); myChart.setOption(option)
// window.onresize = () => { // // window.onresize = () => { //
// myChart.resize(); // myChart.resize();
// }; // };
window.addEventListener('resize', function () { window.addEventListener('resize', function () {
myChart.resize(); myChart.resize()
});
} }
)
},
}, },
mounted() { mounted() {
this.drawBar(); this.xData = this.typeValue.type_data.map(ele => {
return ele.name
})
this.yData = this.typeValue.type_data.map(ele => {
return ele.quantity
})
this.drawBar()
}, },
watch: { watch: {
typeValue: { typeValue: {
handler(newVal) { handler(newVal) {
if (newVal) { if (newVal) {
this.xData = newVal.type_data.map(ele => { this.xData = newVal.type_data.map(ele => {
return ele.name; return ele.name
}); })
this.yData = newVal.type_data.map(ele => { this.yData = newVal.type_data.map(ele => {
return ele.quantity; return ele.quantity
}); })
this.drawBar(); this.drawBar()
}
}
} }
} }
} }
}
};
</script> </script>

View File

@ -111,9 +111,18 @@ export default {
} }
}, },
mounted() { mounted() {
// if (this.typeValue) {
// this.typeValue.type_data.forEach(ele => {
// this.seriesData.push({
// name: ele.name,
// value: ele.quantity
// });
// });
// }
this.drawPie(); this.drawPie();
}, },
watch: { watch: {
//
typeValue: { typeValue: {
handler(newVal) { handler(newVal) {
if (newVal) { if (newVal) {

View File

@ -71,10 +71,11 @@
<div v-show="echartArr.includes('表格')"> <div v-show="echartArr.includes('表格')">
<div class="tableTitle"> <div class="tableTitle">
<div class=""> <div class="">
<span style="width: 10px;height:10px;border-radius: 50%;background-color: #3297ff;display: inline-block;vertical-align: middle;"></span>
<span>{{ this.chartName+ '-' + this.componentName + '-' + '表格'}}</span>
</div> </div>
<div class="tableTime"> <div class="tableTime">
{{ typeValue.time }}
</div> </div>
</div> </div>
<div v-if="pageType == '断面'" style="margin-bottom: 20px; border: 1px solid #e4e7ed"> <div v-if="pageType == '断面'" style="margin-bottom: 20px; border: 1px solid #e4e7ed">
@ -146,9 +147,6 @@ export default {
}, },
methods: { methods: {
// //
}, },
computed: { computed: {