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
142
143
144
145
146
147
148
149
150
151
window.onload = function () {
    GetDataDLJZ();
}
 
function GetDataDLJZ() {
    var type = getUrlParam("Type");
    if (type == "All") {
        $.ajax({
            url: "../../../Ashx/Firstcommon.ashx",
            type: "post",
            data: { Action: "GetAllSumData", tableName: "DTJZ" },//81258c6425be4694af2575731f4e8831
            dataType: "json",
            async: true,
            success: function (result) {
                if (result == null) {
                    $("#container").empty();
                    $("#container").append("<table><tr><td>暂无数据</td></tr></table>");
                    $("#dataTable").empty();
                    $("#dataTable").append("<table><tr><td>暂无数据</td></tr></table>");
                    return false;
                }
                var html = "<tr><td>时间</td><td>变化量</td></tr>";
                var dataX = [];
                var dataY = [];
                $.each(result, function (index, value) {
                    html += "<tr><td>" + (parseInt(value.Year - 1) + "_" + value.Year) + "</td><td>" + value.Area + "</td></tr>"
                    dataX.push(parseInt(value.Year-1)+"_"+value.Year);
                    dataY.push(value.Area);
                });
                InitChart("建筑用地变化量", dataX, dataY);
                $("#dataTable").empty();
                $("#dataTable").append("<table>" + html + "</table>");
            }
        });
    } else if (type == "choose") {
        var objParm = localStorage.getItem("openShp");
        $.ajax({
            url: "../../../Ashx/Firstcommon.ashx",
            type: "post",
            data: { Action: "GetAllChooseData", pathName: objParm, tableName: "DTJZ" },
            dataType: "json",
            async: true,
            success: function (result) {
                if (JSON.stringify(result) ==null) {
                    $("#container").empty();
                    $("#container").append("<table><tr><td>暂无数据</td></tr></table>");
                    $("#dataTable").empty();
                    $("#dataTable").append("<table><tr><td>暂无数据</td></tr></table>");
                    return false;
                }
                var html = "";
                var dataX = [];
                var dataY = [];
                $.each(result, function (index, value) {
                    html += "<tr><td>" + value.Year + "</td><td>" + value.Area + "</td></tr>"
                    dataX.push(value.Year);
                    dataY.push(value.Area);
                });
                InitChart("建筑用地面积变化量", dataX, dataY);
                $("#dataTable").empty();
                $("#dataTable").append("<table>" + html + "</table>");
            }
        });
    }
 
    btnClick();
 
 
}
function InitChart(title, dataX, dataY) {
    var minY = Math.min.apply(null, dataY);
    var maxY = Math.max.apply(null, dataY);
 
    var dom = document.getElementById("container");
    var myChart = echarts.init(dom);
    var app = {};
    option = null;
    option = {
        //title: {
        //    text: title,
        //    left: 'center',
        //    textStyle: {
        //        color: '#fff'
        //    }
 
        //},
        grid: {
            top: '10%',
            left: '13%',
            right: '5%',
            bottom: '12%'
        },
        backgroundColor: '#000000',
        color: ["#1A88C8"],
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        xAxis: {
            type: 'category',
            data: dataX,
            axisLine: {
                lineStyle: {
                    color: '#FFFFFF',
                }
            }
 
        },
        yAxis: {
            type: 'value',
            axisLine: {
                lineStyle: {
                    color: '#FFFFFF',
                }
            },
            splitLine: {
                show: false
            },
            //max: Math.round(maxY + 50),
            //min: ((Math.round(minY - 50) < 0) ? 0 : Math.round(minY - 50))
        },
        series: [{
            data: dataY,
            type: 'bar',
            barMaxWidth: 20,
 
        }]
    };;
    if (option && typeof option === "object") {
        myChart.setOption(option, true);
    }
}
 
 
function btnClick() {
    $(".chartBtn").click(function () {
        $("#container").css("display", "block");
        $("#dataTable").css("display", "none");
        $(".dataBtn").css("background-color", "#000000");
        $(".chartBtn").css("background-color", "#033D73");
    });
 
    $(".dataBtn").click(function () {
        $("#container").css("display", "none");
        $("#dataTable").css("display", "block");
        $(".dataBtn").css("background-color", "#033D73");
        $(".chartBtn").css("background-color", "#000000");
    });
}