/**
 * 获取选中的监测点信息
 */
var num = 1;
var idea;
var height = $(window).height() - 135;
$("#interval").val("周");
var lineName;
var color;

$(document).ready(function () {
    getThemeColor();
    tltName = "谐波电压含有率";
    queryData(tltName);
    $("#ss").css("maxWidth", parent.picWidth);
    $("#point").css("width", parent.picWidth);
})

function splitTree(num) {
    var data;
    var index = '';
    if (num == 1) {
        data = parent.getTreeSelected(2);
    } else {
        data = parent.getTreeSelected(1);
    }
    for (var i = 0; i < data.length; i++) {
        index += data[i].nodeIndex + ',';

    }
    if (index != '') {
        index = index.substring(0, index.lastIndexOf(','));
    }
    return index;
}

function splitName(num) {
    var data;
    var name = '';
    if (num == 1) {
        data = parent.getTreeSelected(2);
    } else {
        data = parent.getTreeSelected(1);
    }
    for (var i = 0; i < data.length; i++) {
        name = data[i].name;
    }
    return name;
}

var tltName;
var Uarry = $("#qualifiedTab li");//获取所有的li元素
var zongTsV = 0;//用于判断是否为0
var zongTsI = 0;
$("#qualifiedTab li").click(function () {//点击事件
    //测试直接获取值
    var count = $(this).index();//获取li的下标
    var Tresult = Uarry.eq(count).text();
    tltName = Tresult;
    queryData(tltName);
})
$("#query").click(function () {
    queryData(tltName);
})

//获取主题颜色
function getThemeColor() {
    $.ajax({
        type: "POST",
        url: "/pqs9000/theme/getThemeInfo",
        async: false,
        dataType: 'json',
        success: function (data) {
            color = data.body.value;
        }
    })
}

//谐波电压含有率
function getXbDy(startTime, endTime, lineId) {
    lineName = splitName(num);
    var type = '0';
    $.ajax({
        type: 'POST',
        url: '/pqs9000/device/getHarmonic',
        data: {
            startTime: startTime,
            endTime: endTime,
            lineId: lineId,
            type: type
        },
        beforeSend: function () {
            idea = ityzl_SHOW_LOAD_LAYER();
        },
        error: function (data) {
            layer.msg("暂无历史谐波含有率", {
                icon: 5,
                time: 3000
            })
            // ***********关闭loading
            ityzl_CLOSE_LOAD_LAYER(idea);
        },
        success: function (data) {
            zongTsV = data.body[0].length;
            var serName = [];
            var gb = [];
            var number = [];
            if (data.code === 500) {
                parent.layer.msg("没有获取到该监测点的谐波电压含有率", {
                    icon: 5,
                    time: 3000
                });
                //25
                if (zongTsV === 25) {
                    $("#point").text("所选监测点：" + lineName + "    2~25次" + tltName + "")
                    $('#example').css("display", "none")
                    $('#example1').css("display", "block")
                    var oTable = $('#example1').DataTable({
                        info: false,
                        paging: false,
                        ScrollY: height * 0.3,
                        lengthChange: false,
                        columns: [
                            {"width": "122px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width ": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"}
                        ],
                        bDestroy: true,
                        ordering: false,
                        autoWidth: true,
                        scrollX: false,
                        data: data.body,
                        searching: false,
                        destroy: true,
                        language: {
                            url: '/pqs9000/json/chine.json',
                            "sEmptyTable": "没有内容"
                        },
                    })
                    for (i = 1; i < 25; i++) {
                        serName.push([parseFloat(null)]);
                        gb.push([parseFloat(null)]);
                        number.push([i + 1])
                    }
                    $("#container").css("height", height * 0.75);
                    //画图
                    var chart = Highcharts.chart('container', {
                        credits: {
                            enabled: false
                        },
                        chart: {
                            type: 'column'
                        },
                        title: {
                            text: ''
                        },
                        exporting: {
                            enabled: true,   // 开启导出按钮
                            filename:'历史谐波频谱',
                        },
                        xAxis: {
                            categories: number
                        },
                        yAxis: [{
                            min: 0,
                            title: {
                                text: '谐波电压含有率(%)'
                            }
                        }, {
                            title: {
                                text: '国标限值(%)'
                            },
                            opposite: true
                        }],
                        legend: {
                            shadow: false
                        },
                        navigation: {
                            menuItemHoverStyle: {
                                background: color,
                                color: "#ffffff"
                            },
                        },
                        tooltip: {
                            shared: true,
                            formatter: function () {
                                var x, y1, y2;
                                if (this.points.length == 1) {
                                    x = "谐波次数：" + this.points[0].x
                                    y2 = this.points[0].series.name + ":" + this.points[0].y + "%"
                                    return x + '<br>' + y2;
                                } else {
                                    x = "谐波次数：" + this.points[0].x
                                    y1 = "国标限值(%):" + this.points[0].y + "%"
                                    y2 = "谐波电压含有率(%):" + this.points[1].y + "%"
                                    return x + '<br>' + y1 + '<br>' + y2;
                                }


                            }
                        },
                        plotOptions: {
                            column: {
                                grouping: false,
                                shadow: false,
                                borderWidth: 0
                            }
                        },
                        series: [{
                            name: '谐波电压含有率(%)',
                            color: yellow,
                            data: gb,
                            tooltip: {
                                valueSuffix: '%'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.1,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }, {
                            name: '国标限值(%)',
                            color: green,
                            data: serName,
                            tooltip: {
                                valueSuffix: '%'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.2,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }]
                    });
                } else {
                    $("#point").text("所选监测点：" + lineName + "    2~50次" + tltName + "")
                    //50
                    $('#example1').css("display", "none")
                    $('#example').css("display", "block")
                    var oTable = $('#example').DataTable({
                        info: false,
                        paging: false,
                        ScrollY: height * 0.3,
                        lengthChange: false,
                        columns: [
                            {"width": "122px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width ": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"}
                        ],
                        bDestroy: true,
                        ordering: false,
                        autoWidth: true,
                        scrollX: false,
                        searching: false,
                        data: data.body,
                        destroy: true,
                        language: {
                            url: '/pqs9000/json/chine.json',
                            "sEmptyTable": "没有内容"
                        },
                    })
                    for (i = 1; i < 50; i++) {
                        serName.push([parseFloat(null)]);
                        gb.push([parseFloat(null)]);
                        number.push([i + 1])
                    }
                    $("#container").css("height", height * 0.75);
                    //画图
                    var chart = Highcharts.chart('container', {
                        credits: {
                            enabled: false
                        },
                        chart: {
                            type: 'column'
                        },
                        title: {
                            text: ''
                        },
                        exporting: {
                            enabled: true,   // 开启导出按钮
                            filename:'历史谐波频谱',
                        },
                        xAxis: {
                            categories: number
                        },
                        yAxis: [{
                            min: 0,
                            title: {
                                text: '谐波电压含有率(%)'
                            }
                        }, {
                            title: {
                                text: '国标限值(%)'
                            },
                            opposite: true
                        }],
                        legend: {
                            shadow: false
                        },
                        navigation: {
                            menuItemHoverStyle: {
                                background: color,
                                color: "#ffffff"
                            },
                        },
                        tooltip: {
                            shared: true,
                            formatter: function () {
                                var x, y1, y2;
                                if (this.points.length == 1) {
                                    x = "谐波次数：" + this.points[0].x
                                    y2 = this.points[0].series.name + ":" + this.points[0].y + "%"
                                    return x + '<br>' + y2;
                                } else {
                                    x = "谐波次数：" + this.points[0].x
                                    y1 = "国标限值(%):" + this.points[0].y + "%"
                                    y2 = "谐波电压含有率(%):" + this.points[1].y + "%"
                                    return x + '<br>' + y1 + '<br>' + y2;
                                }


                            }
                        },
                        plotOptions: {
                            column: {
                                grouping: false,
                                shadow: false,
                                borderWidth: 0
                            }
                        },
                        series: [{
                            name: '谐波电压含有率(%)',
                            color: yellow,
                            data: gb,
                            tooltip: {
                                valueSuffix: '%'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.1,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }, {
                            name: '国标限值(%)',
                            color: green,
                            data: serName,
                            tooltip: {
                                valueSuffix: '%'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.2,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }],
                    });
                }
                // ***********关闭loading
                ityzl_CLOSE_LOAD_LAYER(idea);
            } else {
                //25
                if (zongTsV === 25) {
                    $("#point").text("所选监测点：" + lineName + "    2~25次" + tltName + "")
                    $('#divtable').css("display", "none")
                    $('#divtable1').css("display", "block")
                    var oTable = $('#example1').DataTable({
                        info: false,
                        paging: false,
                        searching: false,
                        scrollY: height * 0.2,
                        lengthChange: false,
                        // columnDefs: [  { width: "122px", "targets": 0 } ],
                        columns: [
                            {"width": "122px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width ": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"}
                        ],
                        ordering: false,
                        // autoWidth:true,
                        scrollX: true,
                        data: data.body,
                        destroy: true,
                        language: {
                            url: '/pqs9000/json/chine.json',
                            "sEmptyTable": "没有内容"
                        },
                    })
                    //处理柱状图数据
                    for (var i = 1; i < 25; i++) {
                        serName.push([parseFloat(data.body[0][i])]);
                        gb.push([parseFloat(data.body[1][i])]);
                        number.push([i + 1])
                    }
                    $("#container").css("height", height * 0.75);
                    //画图
                    var chart = Highcharts.chart('container', {
                        credits: {
                            enabled: false
                        },
                        chart: {
                            type: 'column'
                        },
                        title: {
                            text: ''
                        },
                        xAxis: {
                            categories: number,
                        },
                        exporting: {
                            enabled: true,   // 开启导出按钮
                            filename:'历史谐波频谱',
                        },
                        yAxis: [{
                            min: 0,
                            title: {
                                text: data.body[0][0]
                            }
                        }, {
                            title: {
                                text: data.body[1][0]
                            },
                            opposite: true
                        }],
                        legend: {
                            shadow: false
                        },
                        navigation: {
                            menuItemHoverStyle: {
                                background: color,
                                color: "#ffffff"
                            },
                        },
                        tooltip: {
                            shared: true,
                            formatter: function () {
                                var x, y1, y2;
                                if (this.points.length == 1) {
                                    x = "谐波次数：" + this.points[0].x
                                    y2 = this.points[0].series.name + ":" + this.points[0].y + "%"
                                    return x + '<br>' + y2;
                                } else {
                                    x = "谐波次数：" + this.points[0].x
                                    y1 = "国标限值(%):" + this.points[0].y + "%"
                                    y2 = "谐波电压含有率(%):" + this.points[1].y + "%"
                                    return x + '<br>' + y1 + '<br>' + y2;
                                }


                            }
                        },
                        plotOptions: {
                            column: {
                                grouping: false,
                                shadow: false,
                                borderWidth: 0
                            }
                        },
                        series: [{
                            name: data.body[1][0],
                            color: yellow,
                            data: gb,
                            tooltip: {
                                valueSuffix: '%'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.1,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }, {
                            name: data.body[0][0],
                            color: green,
                            data: serName,
                            tooltip: {
                                valueSuffix: '%'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.2,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }]
                    });
                    // ***********关闭loading
                    ityzl_CLOSE_LOAD_LAYER(idea);
                } else {
                    $("#point").text("所选监测点：" + lineName + "    2~50次" + tltName + "")
                    //50
                    $('#divtable1').css("display", "none")
                    $('#divtable').css("display", "block")
                    var oTable = $('#example').DataTable({
                        info: false,
                        paging: false,
                        scrollY: height * 0.2,
                        searching: false,
                        lengthChange: false,
                        // columnDefs: [  { width: "122px", "targets": 0 } ],
                        columns: [
                            {"width": "122px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"}
                        ],
                        ordering: false,
                        // autoWidth:true,
                        scrollX: true,
                        data: data.body,
                        destroy: true,
                        language: {
                            url: '/pqs9000/json/chine.json',
                            "sEmptyTable": "没有内容"
                        },
                    })
                    for (i = 1; i < 50; i++) {
                        serName.push([parseFloat(data.body[0][i])]);
                        gb.push([parseFloat(data.body[1][i])]);
                        number.push([i + 1])
                    }
                    $("#container").css("height", height * 0.75);
                    //画图
                    var chart = Highcharts.chart('container', {
                        credits: {
                            enabled: false
                        },
                        chart: {
                            type: 'column'
                        },
                        title: {
                            text: ''
                        },
                        exporting: {
                            enabled: true,   // 开启导出按钮
                            filename:'历史谐波频谱',
                        },
                        xAxis: {
                            categories: number,
                        },
                        yAxis: [{
                            min: 0,
                            title: {
                                text: data.body[0][0]
                            }
                        }, {
                            title: {
                                text: data.body[1][0]
                            },
                            opposite: true
                        }],
                        legend: {
                            shadow: false
                        },
                        navigation: {
                            menuItemHoverStyle: {
                                background: color,
                                color: "#ffffff"
                            },
                        },
                        tooltip: {
                            shared: true,
                            formatter: function () {
                                var x, y1, y2;
                                if (this.points.length == 1) {
                                    x = "谐波次数：" + this.points[0].x
                                    y2 = this.points[0].series.name + ":" + this.points[0].y + "%"
                                    return x + '<br>' + y2;
                                } else {
                                    x = "谐波次数：" + this.points[0].x
                                    y1 = "国标限值(%):" + this.points[0].y + "%"
                                    y2 = "谐波电压含有率(%):" + this.points[1].y + "%"
                                    return x + '<br>' + y1 + '<br>' + y2;
                                }


                            }
                        },
                        plotOptions: {
                            column: {
                                grouping: false,
                                shadow: false,
                                borderWidth: 0
                            }
                        },
                        series: [{
                            name: data.body[1][0],
                            color: yellow,
                            data: gb,
                            tooltip: {
                                valueSuffix: '%'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.1,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }, {
                            name: data.body[0][0],
                            color: green,
                            data: serName,
                            tooltip: {
                                valueSuffix: '%'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.2,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }]
                    });
                }
            }
            // ***********关闭loading
            ityzl_CLOSE_LOAD_LAYER(idea);
        }
    })
}

//谐波电流幅值
function getXbDl(startTime, endTime, lineId) {
    lineName = splitName(num);
    var type = '0';
    $.ajax({
        type: 'POST',
        url: '/pqs9000/device/getHarmI',
        data: {
            startTime: startTime,
            endTime: endTime,
            lineId: lineId,
            type: type
        },
        beforeSend: function () {
            idea = ityzl_SHOW_LOAD_LAYER();
        },
        error: function (data) {
            layer.msg("暂无历史谐波电流幅值", {
                icon: 5,
                time: 3000
            })
            // ***********关闭loading
            ityzl_CLOSE_LOAD_LAYER(idea);
        },
        success: function (data) {
            zongTsI = data.body[0].length;
            var serName = [];
            var gb = [];
            var number = [];
            if (data.code === 500) {
                parent.layer.msg("没有获取到该监测点的谐波电流幅值", {
                    icon: 5,
                    time: 3000
                });
                if (zongTsI === 25) {
                    $("#point").text("所选监测点：" + lineName + "    2~25次" + tltName + "")
                    $('#example').css("display", "none")
                    $('#example1').css("display", "block")
                    var oTable = $('#example1').DataTable({
                        info: false,
                        paging: false,
                        scrollY: height * 0.2,
                        searching: false,
                        lengthChange: false,
                        columns: [
                            {"width": "122px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width ": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"}
                        ],
                        bDestroy: true,
                        ordering: false,
                        autoWidth: true,
                        scrollX: false,
                        data: data.body,
                        destroy: true,
                        language: {
                            url: '/pqs9000/json/chine.json',
                            "sEmptyTable": "没有内容"
                        },
                    })
                    for (i = 1; i < 25; i++) {
                        serName.push([parseFloat(null)]);
                        gb.push([parseFloat(null)]);
                        number.push([i + 1])
                    }
                    $("#container").css("height", height * 0.75);
                    //画图
                    var chart = Highcharts.chart('container', {
                        credits: {
                            enabled: false
                        },
                        chart: {
                            type: 'column'
                        },
                        title: {
                            text: ''
                        },
                        xAxis: {
                            categories: number
                        },
                        yAxis: [{
                            min: 0,
                            title: {
                                text: '谐波电流幅值(A)'
                            }
                        }, {
                            title: {
                                text: '国标限值(A)'
                            },
                            opposite: true
                        }],
                        legend: {
                            shadow: false
                        },
                        navigation: {
                            menuItemHoverStyle: {
                                background: color,
                                color: "#ffffff"
                            },
                        },
                        tooltip: {
                            shared: true,
                            formatter: function () {
                                var x, y1, y2;
                                if (this.points.length == 1) {
                                    x = "谐波次数：" + this.points[0].x
                                    y2 = this.points[0].series.name + ":" + this.points[0].y + "A"
                                    return x + '<br>' + y2;
                                } else {
                                    x = "谐波次数：" + this.points[0].x
                                    y1 = "国标限值(A):" + this.points[0].y + "A"
                                    y2 = "谐波电流幅值(A):" + this.points[1].y + "A"
                                    return x + '<br>' + y1 + '<br>' + y2;
                                }


                            }
                        },
                        plotOptions: {
                            column: {
                                grouping: false,
                                shadow: false,
                                borderWidth: 0
                            }
                        },
                        series: [{
                            name: '谐波电流幅值(A)',
                            color: yellow,
                            data: gb,
                            tooltip: {
                                valueSuffix: 'A'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.1,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }, {
                            name: '国标限值(A)',
                            color: green,
                            data: serName,
                            tooltip: {
                                valueSuffix: 'A'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.2,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }]
                    });
                } else {
                    $("#point").text("所选监测点：" + lineName + "    2~50次" + tltName + "")
                    $('#example1').css("display", "none")
                    $('#example').css("display", "block")
                    var oTable = $('#example').DataTable({
                        info: false,
                        paging: false,
                        scrollY: height * 0.2,
                        searching: false,
                        lengthChange: false,
                        columns: [
                            {"width": "122px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"}
                        ],
                        bDestroy: true,
                        ordering: false,
                        autoWidth: true,
                        scrollX: false,
                        data: data.body,
                        destroy: true,
                        language: {
                            url: '/pqs9000/json/chine.json',
                            "sEmptyTable": "没有内容"
                        },
                    })
                    for (i = 1; i < 50; i++) {
                        serName.push([parseFloat(null)]);
                        gb.push([parseFloat(null)]);
                        number.push([i + 1])
                    }
                    $("#container").css("height", height * 0.75);
                    //画图
                    var chart = Highcharts.chart('container', {
                        credits: {
                            enabled: false
                        },
                        chart: {
                            type: 'column'
                        },
                        title: {
                            text: ''
                        },
                        xAxis: {
                            categories: number
                        },
                        yAxis: [{
                            min: 0,
                            title: {
                                text: '谐波电流幅值(A)'
                            }
                        }, {
                            title: {
                                text: '国标限值(A)'
                            },
                            opposite: true
                        }],
                        legend: {
                            shadow: false
                        },
                        navigation: {
                            menuItemHoverStyle: {
                                background: color,
                                color: "#ffffff"
                            },
                        },
                        tooltip: {
                            shared: true,
                            formatter: function () {
                                var x, y1, y2;
                                if (this.points.length == 1) {
                                    x = "谐波次数：" + this.points[0].x
                                    y2 = this.points[0].series.name + ":" + this.points[0].y + "A"
                                    return x + '<br>' + y2;
                                } else {
                                    x = "谐波次数：" + this.points[0].x
                                    y1 = "国标限值(A):" + this.points[0].y + "A"
                                    y2 = "谐波电流幅值(A):" + this.points[1].y + "A"
                                    return x + '<br>' + y1 + '<br>' + y2;
                                }


                            }
                        },
                        plotOptions: {
                            column: {
                                grouping: false,
                                shadow: false,
                                borderWidth: 0
                            }
                        },
                        series: [{
                            name: '谐波电流幅值(A)',
                            color: yellow,
                            data: gb,
                            tooltip: {
                                valueSuffix: 'A'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.1,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }, {
                            name: '国标限值(A)',
                            color: green,
                            data: serName,
                            tooltip: {
                                valueSuffix: 'A'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.2,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况

                        }]
                    });
                }
            } else {
                if (zongTsI === 25) {
                    $("#point").text("所选监测点：" + lineName + "    2~25次" + tltName + "")
                    $('#divtable').css("display", "none")
                    $('#divtable1').css("display", "block")
                    var oTable = $('#example1').DataTable({
                        info: false,
                        paging: false,
                        scrollY: height * 0.2,
                        searching: false,
                        lengthChange: false,
                        // columnDefs: [  { width: "122px", "targets": 0 } ],
                        columns: [
                            {"width": "122px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width ": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"}
                        ],
                        ordering: false,
                        // autoWidth:true,
                        scrollX: true,
                        data: data.body,
                        destroy: true,
                        language: {
                            url: '/pqs9000/json/chine.json',
                            "sEmptyTable": "没有内容"
                        },
                    })
                    for (i = 1; i < 25; i++) {
                        serName.push([parseFloat(data.body[0][i])]);
                        gb.push([parseFloat(data.body[1][i])]);
                        number.push([i + 1])
                    }
                    $("#container").css("height", height * 0.75);
                    //画图
                    var chart = Highcharts.chart('container', {
                        credits: {
                            enabled: false
                        },
                        chart: {
                            type: 'column'
                        },
                        title: {
                            text: ''
                        },
                        xAxis: {
                            categories: number,
                        },
                        yAxis: [{
                            min: 0,
                            title: {
                                text: data.body[0][0]
                            }
                        }, {
                            title: {
                                text: data.body[1][0]
                            },
                            opposite: true
                        }],
                        legend: {
                            shadow: false
                        },
                        navigation: {
                            menuItemHoverStyle: {
                                background: color,
                                color: "#ffffff"
                            },
                        },
                        tooltip: {
                            shared: true,
                            formatter: function () {
                                var x, y1, y2;
                                if (this.points.length == 1) {
                                    x = "谐波次数：" + this.points[0].x
                                    y2 = this.points[0].series.name + ":" + this.points[0].y + "A"
                                    return x + '<br>' + y2;
                                } else {
                                    x = "谐波次数：" + this.points[0].x
                                    y1 = "国标限值(A):" + this.points[0].y + "A"
                                    y2 = "谐波电流幅值(A):" + this.points[1].y + "A"
                                    return x + '<br>' + y1 + '<br>' + y2;
                                }


                            }
                        },
                        plotOptions: {
                            column: {
                                grouping: false,
                                shadow: false,
                                borderWidth: 0
                            }
                        },
                        series: [{
                            name: data.body[1][0],
                            color: yellow,
                            data: gb,
                            tooltip: {
                                valueSuffix: 'A'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.1,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }, {
                            name: data.body[0][0],
                            color: green,
                            data: serName,
                            tooltip: {
                                valueSuffix: 'A'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.2,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }]
                    });
                } else {
                    $("#point").text("所选监测点：" + lineName + "    2~50次" + tltName + "")
                    $('#divtable1').css("display", "none")
                    $('#divtable').css("display", "block")
                    var oTable = $('#example').DataTable({
                        info: false,
                        paging: false,
                        scrollY: height * 0.2,
                        searching: false,
                        lengthChange: false,
                        // columnDefs: [  { width: "122px", "targets": 0 } ],
                        columns: [
                            {"width": "122px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"},
                            {"width": "41px"}
                        ],
                        ordering: false,
                        // autoWidth:true,
                        scrollX: true,
                        data: data.body,
                        destroy: true,
                        language: {
                            url: '/pqs9000/json/chine.json',
                            "sEmptyTable": "没有内容"
                        },
                    })
                    for (i = 1; i < 50; i++) {
                        serName.push([parseFloat(data.body[0][i])]);
                        gb.push([parseFloat(data.body[1][i])]);
                        number.push([i + 1])
                    }
                    $("#container").css("height", height * 0.75);
                    //画图
                    var chart = Highcharts.chart('container', {
                        credits: {
                            enabled: false
                        },
                        chart: {
                            type: 'column'
                        },
                        title: {
                            text: ''
                        },
                        xAxis: {
                            categories: number,
                        },
                        yAxis: [{
                            min: 0,
                            title: {
                                text: data.body[0][0]
                            }
                        }, {
                            title: {
                                text: data.body[1][0]
                            },
                            opposite: true
                        }],
                        legend: {
                            shadow: false
                        },
                        navigation: {
                            menuItemHoverStyle: {
                                background: color,
                                color: "#ffffff"
                            },
                        },
                        tooltip: {
                            shared: true,
                            formatter: function () {
                                var x, y1, y2;
                                if (this.points.length == 1) {
                                    x = "谐波次数：" + this.points[0].x
                                    y2 = this.points[0].series.name + ":" + this.points[0].y + "A"
                                    return x + '<br>' + y2;
                                } else {
                                    x = "谐波次数：" + this.points[0].x
                                    y1 = "国标限值(A):" + this.points[0].y + "A"
                                    y2 = "谐波电流幅值(A):" + this.points[1].y + "A"
                                    return x + '<br>' + y1 + '<br>' + y2;
                                }


                            }
                        },
                        plotOptions: {
                            column: {
                                grouping: false,
                                shadow: false,
                                borderWidth: 0
                            }
                        },
                        series: [{
                            name: data.body[1][0],
                            color: yellow,
                            data: gb,
                            tooltip: {
                                valueSuffix: 'A'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.1,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }, {
                            name: data.body[0][0],
                            color: green,
                            data: serName,
                            tooltip: {
                                valueSuffix: 'A'
                            },
                            barMaxWidth: barMax,
                            pointPadding: 0.2,//每列之间的距离值,默认此值为0.1
                            groupPadding: 0,//每个值之间的间距，其实和poingPadding有一样的效果。不过这个主要是用于对付存在分组的情况
                        }]
                    });
                }
            }
            // ***********关闭loading
            ityzl_CLOSE_LOAD_LAYER(idea);
        }
    })
}

function queryData(tltName) {
    var lineId = splitTree(num);
    var startTime = $("#startTime").val();
    var endTime = $("#endTime").val();
    if (tltName == "谐波电压含有率") {
        getXbDy(startTime, endTime, lineId);
    } else if (tltName == "谐波电流幅值") {
        getXbDl(startTime, endTime, lineId);
    }
}