123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- <template>
- <div>
- <div id="analysisChartBottomLeft3" @click="dialogVisible = true" style="width:3.4rem;height:2.2rem;"></div>
- <el-dialog title="一周 PH 趋势" :visible.sync="dialogVisible" width="1600px" @open="open" destroy-on-close append-to-body>
- <div id="analysisChartBottomLeft33" style="width:20rem;height:6rem;margin:0.5rem auto;"></div>
- </el-dialog>
- </div>
- </template>
- <script>
- import echartMixins from "@/utils/resizeMixins";
- export default {
- props: ['dashboarddata'],
- data() {
- return {
- chart: null,
- dialogVisible: false
- }
- },
- mixins: [echartMixins],
- mounted() {
- this.init();
- },
- methods: {
- opnenDialg(){
- this.dialogVisible = true
- },
- open(){
- this.$nextTick(() => {
- this.init2()
- })
- },
- init() {
- this.chart = this.echarts.init(document.getElementById("analysisChartBottomLeft3"), 'dark');
- const dateArray = [];
- const wasteArray = [];
- const rainArray = [];
- let data = this.dashboarddata.latest7DayData;
- for (let i = 0; i < data.length; i++) {
- dateArray[i]= data[i].pullDate.toString().substr(5, 5);
- wasteArray[i] = data[i].wastePh;
- rainArray[i] = data[i].rainPh;
- }
- dateArray.reverse();
- wasteArray.reverse();
- rainArray.reverse();
- let option = {
- backgroundColor: 'transparent',
- title: {
- text: '一周 PH 趋势',
- textStyle: {
- fontSize: 12
- }
- },
- tooltip: {
- trigger: 'axis'
- },
- legend: {
- data: ['Waste Water', 'Rain Water'],
- padding: [20, 0, 0, 0]
- },
- grid: {
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- toolbox: {
- feature: {
- }
- },
- xAxis: {
- type: 'category',
- boundaryGap: false,
- // data: [
- // this.c[0].pullDate.toString().substr(5, 5),
- // this.dashboarddata.latest7DayData[1].pullDate.toString().substr(5, 5),
- // this.dashboarddata.latest7DayData[2].pullDate.toString().substr(5, 5),
- // this.dashboarddata.latest7DayData[3].pullDate.toString().substr(5, 5),
- // this.dashboarddata.latest7DayData[4].pullDate.toString().substr(5, 5),
- // this.dashboarddata.latest7DayData[5].pullDate.toString().substr(5, 5),
- // this.dashboarddata.latest7DayData[6].pullDate.toString().substr(5, 5)
- // ],
- data: dateArray,
- axisLabel: {
- color: '#808080'
- },
- },
- yAxis: {
- type: 'value',
- axisLabel: {
- color: '#808080'
- },
- splitLine: {
- show: true,
- lineStyle:{
- color: 'rgba(255,255,255,.7)'
- }
- }
- },
- series: [
- {
- name: 'Waste Water',
- type: 'line',
- smooth: true,
- // data: [
- // this.dashboarddata.latest7DayData[0].wastePh,
- // this.dashboarddata.latest7DayData[1].wastePh,
- // this.dashboarddata.latest7DayData[2].wastePh,
- // this.dashboarddata.latest7DayData[3].wastePh,
- // this.dashboarddata.latest7DayData[4].wastePh,
- // this.dashboarddata.latest7DayData[5].wastePh,
- // this.dashboarddata.latest7DayData[6].wastePh
- // ],
- data: wasteArray,
- symbolSize: 10,
- color: '#5470c6',
- lineStyle: {
- width: 4,
- },
- itemStyle: {
- borderWidth: 3,
- borderColor: '#fff',
- }
- },
- {
- name: 'Rain Water',
- type: 'line',
- smooth: true,
- // data: [
- // this.dashboarddata.latest7DayData[0].rainPh,
- // this.dashboarddata.latest7DayData[1].rainPh,
- // this.dashboarddata.latest7DayData[2].rainPh,
- // this.dashboarddata.latest7DayData[3].rainPh,
- // this.dashboarddata.latest7DayData[4].rainPh,
- // this.dashboarddata.latest7DayData[5].rainPh,
- // this.dashboarddata.latest7DayData[6].rainPh
- // ],
- data: rainArray,
- symbolSize: 10,
- color: '#73c0de',
- lineStyle: {
- width: 4,
- },
- itemStyle: {
- borderWidth: 3,
- borderColor: '#fff',
- }
- },
- ]
- };
- this.chart.setOption(option);
- },
- init2() {
- this.chart2 = this.echarts.init(document.getElementById("analysisChartBottomLeft33"));
- const dateArray = [];
- const wasteArray = [];
- const rainArray = [];
- let data = this.dashboarddata.latest7DayData;
- for (let i = 0; i < data.length; i++) {
- dateArray[i]= data[i].pullDate.toString().substr(5, 5);
- wasteArray[i] = data[i].wastePh;
- rainArray[i] = data[i].rainPh;
- }
- dateArray.reverse();
- wasteArray.reverse();
- rainArray.reverse();
- let option = {
- backgroundColor: 'transparent',
- tooltip: {
- trigger: 'axis'
- },
- legend: {
- data: ['Waste Water', 'Rain Water'],
- padding: [30, 0, 0, 0]
- },
- grid: {
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- toolbox: {
- feature: {
- }
- },
- xAxis: {
- type: 'category',
- boundaryGap: false,
- // data: [
- // this.dashboarddata.latest7DayData[0].pullDate.toString().substr(5, 5),
- // this.dashboarddata.latest7DayData[1].pullDate.toString().substr(5, 5),
- // this.dashboarddata.latest7DayData[2].pullDate.toString().substr(5, 5),
- // this.dashboarddata.latest7DayData[3].pullDate.toString().substr(5, 5),
- // this.dashboarddata.latest7DayData[4].pullDate.toString().substr(5, 5),
- // this.dashboarddata.latest7DayData[5].pullDate.toString().substr(5, 5),
- // this.dashboarddata.latest7DayData[6].pullDate.toString().substr(5, 5)
- // ],
- data: dateArray,
- axisLabel: {
- color: '#808080'
- },
- },
- yAxis: {
- type: 'value',
- axisLabel: {
- color: '#808080'
- }
- },
- series: [
- {
- name: 'Waste Water',
- type: 'line',
- smooth: true,
- // data: [
- // this.dashboarddata.latest7DayData[0].wastePh,
- // this.dashboarddata.latest7DayData[1].wastePh,
- // this.dashboarddata.latest7DayData[2].wastePh,
- // this.dashboarddata.latest7DayData[3].wastePh,
- // this.dashboarddata.latest7DayData[4].wastePh,
- // this.dashboarddata.latest7DayData[5].wastePh,
- // this.dashboarddata.latest7DayData[6].wastePh
- // ],
- data: wasteArray,
- symbolSize: 10,
- color: '#5470c6',
- lineStyle: {
- width: 4,
- },
- itemStyle: {
- borderWidth: 3,
- borderColor: '#fff',
- }
- },
- {
- name: 'Rain Water',
- type: 'line',
- smooth: true,
- // data: [
- // this.dashboarddata.latest7DayData[0].rainPh,
- // this.dashboarddata.latest7DayData[1].rainPh,
- // this.dashboarddata.latest7DayData[2].rainPh,
- // this.dashboarddata.latest7DayData[3].rainPh,
- // this.dashboarddata.latest7DayData[4].rainPh,
- // this.dashboarddata.latest7DayData[5].rainPh,
- // this.dashboarddata.latest7DayData[6].rainPh
- // ],
- data: rainArray,
- symbolSize: 10,
- color: '#73c0de',
- lineStyle: {
- width: 4,
- },
- itemStyle: {
- borderWidth: 3,
- borderColor: '#fff',
- }
- },
- ]
- };
- this.chart2.setOption(option);
- }
- },
- destroyed() {
- window.onresize = null;
- }
- }
- </script>
- <style>
- </style>
|