wangzhibo
2021-10-06 6b9c1caacc70f678a1cde1e3fc8308b7d6d5d3cd
widgetsTS/widget_detail/view.js
@@ -41,10 +41,12 @@
                        tmp_index++;      
                    }                   
                  }
            }else{
                haoutil.msg("无查询记录,请更换查询条件!");
            }
        },
        error: function (request, textStatus) {
            haoutil.msg("查询错误,请联系管理员!!!")
        }
    });
}
@@ -75,7 +77,10 @@
        $('#echart').removeAttr('_echarts_instance_');
    }
    var backend_url = params.nodejs_url_predix + "dataapi/Bdata?bid=get_" + params.layerid + "_history&datatype=" + params.datatype + "&siteid=" + params.siteid + "&datatime=" + params.datatime + "&count=10";
    var legendData = all_layer_legends[params.layerid];
    // all 1006xx layer has the same legend !!
    var layerid = params.layerid+"";
    var legendData = all_layer_legends[layerid.substring(0,4)];
    var legendData_selected = {};
    legendData.forEach(element => {
        if (element==params.selected_qindex.toUpperCase()){
@@ -147,13 +152,11 @@
                    title: {
                        text: tableData[0]["name"],
                        textStyle: {
                            color: '#fff', //颜色
                            color: '#87CEFA', //颜色
                        },
                        top: '20px',
                        x: 'center'
                    },
                    legend: {
                        // orient 设置布局方式,默认水平布局,可选值:'horizontal'(水平) ¦ 'vertical'(垂直)
                        orient: 'horizontal',
@@ -162,7 +165,7 @@
                        // y 设置垂直安放位置,默认全图顶端,可选值:'top' ¦ 'bottom' ¦ 'center' ¦ {number}(y坐标,单位px)
                        y: 'top',
                        textStyle: { //图例文字的样式
                            color: '#fff',
                            color: '#87CEFA',
                        },
                        data: legendData,
                        selected:legendData_selected,
@@ -182,19 +185,33 @@
                    tooltip: {
                        trigger: 'axis'
                    },
                    toolbox:{
                        feature: {
                            saveAsImage: { type:'jpeg'},
                            dataView: {},
                            magicType: {
                                type: ['line', 'bar'],
                                option: {
                                    // 类型切换时,下述配置项将被merge到对应类型的图表 series 中
                                    line: { smooth: true },
                                    bar: { label: { show: true } }
                                }
                            },
                        }
                    },
                    xAxis: {
                        name: '时间',
                        type: 'category',
                        axisLine: {
                            lineStyle: {
                                // 设置x轴颜色
                                color: '#912CEE'
                                color: '#87CEFA'
                            }
                        },
                        // 设置X轴数据旋转倾斜
                        axisLabel: {
                            rotate: 60, // 旋转角度
                            color: '#fff', //坐标的字体颜色
                            color: '#87CEFA', //坐标的字体颜色
                            interval: 0 //设置X轴数据间隔几个显示一个,为0表示都显示
                        },
                        // boundaryGap值为false的时候,折线第一个点在y轴上
@@ -217,7 +234,7 @@
                            }
                        },
                    },{
                        name: 'CO(μg/m³)',
                        name: 'CO(mg/m³)',
                        type: 'value',
                        axisLine: {
                            lineStyle: {
@@ -233,10 +250,15 @@
                };
                myCharts = echarts.init(document.getElementById('echart'));
                myCharts.setOption(options, true);
                window.onresize = function(){
                    myCharts.resize();
                }
            }else{
                haoutil.msg("无查询记录,请更换查询条件!");
            }
        },
        error: function (request, textStatus) {
            haoutil.msg("查询错误,请联系管理员!!!")
        }
    });
}