13693261870
2024-04-02 2a1b873b4b78b508d5d53c57992e734c56619df8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
var first = "", second = "";
window.onload = function () {
    second = decodeURI(getUrlParam("second"));
    GetData(second);
    btnClick();
    var title = localStorage.getItem("typeName");
    $(".ttitle").empty();
    $(".ttitle").append(title);
}
 
 
function GetData(second) {
    var color = [];
    var dataLegend = [];
    var dataY = [];
    var TableName = localStorage.getItem("type");
    var TableColor = GetCmpareTable(TableName);
    var html = "";
    $.ajax({
        url: "../../../Ashx/DataQH.ashx",
        type: "post",
        data: { Action: "GetSearchQHData",secondLevel: second, dataTable: TableName, colorTable: TableColor },
        dataType: "json",
        async: false,
        success: function (result) {
           
            $.each(result, function (index, value) {
                html += "<tr style='background-color:rgb(" + value.R + "," + value.G + "," + value.B + ");'><td>" + value.Name + "</td><td>" + parseFloat(value.Area).toFixed(2) + "</td><td>" + parseFloat(value.ZhouChang).toFixed(2) + "</td></tr>";
                color.push("rgb(" + value.R + "," + value.G + "," + value.B + ")");
                dataLegend.push(value.Name);
                dataY.push(parseFloat(value.Area).toFixed(2));
            })
            DanxuanChart(color, dataLegend, dataY);
            $(".scroll_cont1 table").empty();
            $(".scroll_cont1 table").append("<tr><td>名称</td><td>面积</td><td>周长</td></tr>" + html);
 
        }
    });
 
}
 
function DanxuanChart(color, dataLegend, dataY) {
    var dom = document.getElementById("container");
    var myChart = echarts.init(dom);
    option = {
        grid: {
            top: '5%',
            left: '20%',
            bottom: '12%'
        },
        color: color,
        tooltip: {
            trigger: 'axis',
            confine: 'hidden',
            axisPointer: {
                type: 'shadow'
            }
        },
        legend: {
            show: false,
            data: dataLegend
        },
 
        xAxis: [
            {
                type: 'category',
                axisTick: { show: false },
                axisLine: {
                    lineStyle: {
                        color: '#fff'
                    }
                },
                axisLabel: {
                    formatter: '{value}',
                    textStyle: { //改变刻度字体样式
                        color: '#fff'
                    }
                },
                data: dataLegend
            }
        ],
        yAxis: [
            {
                type: 'value',
                splitLine: {
                    show: false,
 
                },
                axisLine: {
                    lineStyle: {
                        color: '#fff'
                    }
                },
                axisLabel: {
                    formatter: '{value}',
                    textStyle: { //改变刻度字体样式
                        color: '#fff'
                    }
                }
            }
        ],
        series: [{
            data: dataY,
            barMaxWidth: 20,
            type: 'bar'
        }]
    };;
    if (option && typeof option === "object") {
        myChart.setOption(option, true);
    }
}
 
 
 
 
function uniq(array) {
    var temp = []; //一个新的临时数组
    for (var i = 0; i < array.length; i++) {
        if (temp.indexOf(array[i]) == -1) {
            temp.push(array[i]);
        }
    }
    return temp;
}
 
 
function btnClick() {
    $(".chartBtn").click(function () {
        $("#container").css("display", "block");
        $("#dataTable").css("display", "none");
        $(".dataBtn").css("color", "#ffffff");
        $(".chartBtn").css("color", "aqua");
    });
 
    $(".dataBtn").click(function () {
        $("#container").css("display", "none");
        $("#dataTable").css("display", "block");
        $(".dataBtn").css("color", "aqua");
        $(".chartBtn").css("color", "#ffffff");
    });
}