瀏覽代碼

efAnalysisSharingEnginePush eleFire.js 朱涛 commit at 2020-11-30

朱涛 4 年之前
父節點
當前提交
ed869b7705
共有 1 個文件被更改,包括 153 次插入0 次删除
  1. 153 0
      efAnalysisSharingEnginePush/externalJs/eleFire.js

+ 153 - 0
efAnalysisSharingEnginePush/externalJs/eleFire.js

@@ -481,3 +481,156 @@ function getListData(queryParam = {}) {
                             show: false // 去除轴线
                         },
                         splitLine: {
+                            lineStyle: {
+                                color: "#012f4a" // 分割线颜色
+                            }
+                        }
+                    },
+                    series: [{
+                            symbol: "none",
+                            name: "方差",
+                            type: "line",
+                            data: a
+                        },
+                        {
+                            symbol: "none",
+                            name: "标准差",
+                            type: "line",
+                            data: b
+                        }, {
+                            symbol: "none",
+                            name: "平均值",
+                            type: "line",
+                            data: c
+                        }
+                    ]
+                };
+
+                myChart.setOption(option);
+                window.addEventListener("resize", function() {
+                    myChart.resize();
+                });
+
+                // 点击切换效果
+                $(".divergence .tab-line").on("click", "a", function() {
+                    $(this).addClass('active').siblings().removeClass('active')
+                    var obj = sortData[$(this).index()];
+                    option.series[0].data = obj.data[0];
+                    option.series[1].data = obj.data[1];
+                    option.series[2].data = obj.data[2];
+
+                    // 重新渲染
+                    myChart.setOption(option);
+
+                });
+            })();
+
+            // 折线图定制 (电老化分析)
+            (function() {
+
+                let electrical_aging = result.RESULT[0].electrical_aging;
+                // console.log(electrical_aging)
+
+                // 结论数据渲染
+                var items = '';
+                var conclusion = electrical_aging.conclusion
+                for (x in conclusion) {
+                    xIndex = x.substr(x.length - 1, 1);
+                    items += `<p>${xIndex}、${conclusion[x]}</p>`
+                }
+                $('.oldAnalysis .summaryDetail').html(items);
+
+
+                // 异常设备监控电缆数据
+                let a = [];
+                let b = [];
+                let data_time = [];
+
+                let abnormal_equipment = electrical_aging.abnormal_equipment;
+                abnormal_equipment.forEach(function(item, index) {
+                    a.push(item.electric_current)
+                    b.push(item.voltage)
+                    data_time.push(item.data_time)
+                });
+                // console.log(data_time)
+
+                // 漏电告警数据
+                let a2 = [];
+                let b2 = [];
+                let data_time2 = [];
+
+                let leakage_alarm = electrical_aging.leakage_alarm;
+                leakage_alarm.forEach(function(item, index) {
+                    a2.push(item.electric_current)
+                    b2.push(item.voltage)
+                    data_time2.push(item.data_time)
+                });
+                // console.log(data_time2)
+
+                var sortData = [{
+                        sortName: "异常设备",
+                        data: [a, b]
+
+                    },
+                    {
+                        sortName: "漏电告警",
+                        data: [a2, b2]
+                    }
+                ];
+
+                var xData = function() {
+                    var data = [];
+                    for (var i = 1; i < leakage_alarm.length + 1; i++) {
+                        data.push(i);
+                    }
+                    return data;
+                }();
+
+                // 1. 实例化对象
+                var myChart = echarts.init(document.querySelector(".oldAnalysis .chart"));
+                // 2.指定配置
+                var option = {
+
+                    color: ["#FF9C00", "#0096FF"], // 通过这个color修改两条线的颜色
+                    tooltip: {
+                        trigger: "axis",
+                        textStyle: {
+                            align: 'left' //图例左对齐
+                        },
+                        backgroundColor: '#12DFE0',
+
+                        formatter: function(params) {
+                            if ($('#active').hasClass('active')) {
+                                var res = params[0].seriesName + ':' + params[0].value + '<br />' + params[1].seriesName + ':' + params[1].value + '<br />时间:' + data_time[params[0].dataIndex];
+                            } else {
+                                var res = params[0].seriesName + ':' + params[0].value + '<br />' + params[1].seriesName + ':' + params[1].value + '<br />时间:' + data_time2[params[0].dataIndex];
+                            }
+                            return res;
+                        },
+                        // formatter: '{a0}: {c0}<br />{a1}: {c1}<br />时间:' + chooseTime + ''
+
+                    },
+                    legend: {
+                        // 如果series 对象有name 值,则 legend可以不用写data
+                        itemGap: 20,
+                        itemHeight: 2,
+                        itemWidth: 15,
+                        icon: 'rect',
+                        textStyle: {
+                            color: "#fff"
+                        },
+                        top: "bottom",
+                    },
+                    grid: {
+                        top: "0%",
+                        left: "1%",
+                        right: "1%",
+                        bottom: "15%",
+                        show: true, // 显示边框
+                        borderWidth: '0', //去除边框
+                        containLabel: true // 包含刻度文字在内
+                    },
+
+                    xAxis: {
+                        type: "category",
+                        boundaryGap: false,