Browse Source

waterAnalysisSharingEnginePush water.js 李欣儒 commit at 2021-01-13

李欣儒 4 years ago
parent
commit
3e23fe19c8
1 changed files with 146 additions and 0 deletions
  1. 146 0
      waterAnalysisSharingEnginePush/externalJs/water.js

+ 146 - 0
waterAnalysisSharingEnginePush/externalJs/water.js

@@ -725,3 +725,149 @@ function getListData(queryParam = {}) {
                         },
                         },
                         splitLine: {
                         splitLine: {
                             lineStyle: {
                             lineStyle: {
+                                color: "#012f4a" // 分割线颜色
+                            }
+                        }
+                    },
+                    series: [{
+                            symbol: "none",
+                            name: "喷淋末端",
+                            type: "line",
+                            smooth: true, // true 可以让我们的折线显示带有弧度
+                            areaStyle: {
+                                normal: {
+                                    color: new echarts.graphic.LinearGradient(
+                                        0,
+                                        0,
+                                        0,
+                                        1, [{
+                                                offset: 0,
+                                                color: "rgba(255,156,0, 0.4)"
+                                            },
+                                            {
+                                                offset: 0.8,
+                                                color: "rgba(255,156,0, 0.3)"
+                                            }
+                                        ],
+                                        false
+                                    ),
+                                    shadowColor: "rgba(0, 0, 0, 0.1)"
+                                }
+                            },
+
+
+                            data: sortData[0].data[0]
+                        },
+                        {
+                            symbol: "none",
+                            name: "消防栓",
+                            type: "line",
+                            smooth: true,
+                            areaStyle: {
+                                normal: {
+                                    color: new echarts.graphic.LinearGradient(
+                                        0,
+                                        0,
+                                        0,
+                                        1, [{
+                                                offset: 0,
+                                                color: "rgba(0,150,255,0.5)"
+                                            },
+                                            {
+                                                offset: 0.8,
+                                                color: "rgba(0,150,255, 0.1)"
+                                            }
+                                        ],
+                                        false
+                                    ),
+                                    shadowColor: "rgba(0, 0, 0, 0.1)"
+                                }
+                            },
+
+                            data: sortData[0].data[1]
+                        }
+                    ]
+                };
+
+                myChart.setOption(option);
+                window.addEventListener("resize", function() {
+                    myChart.resize();
+                });
+
+                // 点击切换效果
+                $(".device_association .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];
+
+                    // 重新渲染
+                    myChart.setOption(option);
+
+                });
+            })();
+
+            // 折线图定制 (数据波动关联)
+            (function() {
+
+                let data_fluctuation = result.RESULT[0].data_fluctuation;
+                console.log('data_fluctuation')
+                console.log(data_fluctuation)
+
+                // 结论数据渲染
+                var items = '';
+                var conclusion = data_fluctuation.conclusion
+                for (x in conclusion) {
+                    xIndex = x.substr(x.length - 1, 1);
+                    items += `<p>${xIndex}、${conclusion[x]}</p>`
+                }
+                $('.data_fluctuation .summaryDetail').html(items);
+
+                let position = [];
+                let before_fluctuation = [];
+                let after_fluctuation = [];
+                let volatility_data = data_fluctuation.volatility_data;
+                volatility_data.forEach(function(item, index) {
+
+                    //楼层
+                    position.push(item.position)
+
+                    //开始值
+                    before_fluctuation.push(item.before_fluctuation)
+
+                    //结束值
+                    after_fluctuation.push(item.after_fluctuation)
+                });
+                // 1. 实例化对象
+                var myChart = echarts.init(document.querySelector(".data_fluctuation .chart"));
+                var xData = position;
+
+                // 2.指定配置
+                var option = {
+                    backgroundColor: 'transparent',
+                    color: ['rgba(0,150,255,.5)', 'rgba(255,156,0,.5)'],
+                    tooltip: {
+                        backgroundColor: '#12DFE0',
+                        //提示框组件
+                        trigger: 'axis',
+                        formatter: '{a0}: {c0}<span>Mpa</span><br />{a1}: {c1}<span>Mpa</span><br />时间:' + chooseTime + '',
+                        axisPointer: {
+                            type: 'shadow',
+                        },
+
+                        textStyle: {
+                            fontStyle: 'normal',
+                            fontFamily: '微软雅黑',
+                            align: 'left' //图例左对齐
+                        },
+                    },
+                    grid: {
+                        left: '0',
+                        right: '0',
+                        bottom: '40',
+                        top: '0',
+                        containLabel: true,
+                    },
+
+                    //添加横线滚动条
+                    dataZoom: {