sgworld = window.external.createSgworld();
|
window.onload = function () {
|
//获取需要查询的参数
|
|
var parmType = localStorage.getItem("type");
|
var type = getUrlParam("Type");
|
if (type == "All") {
|
//查询当前灾害点
|
var htmlAll = "";
|
$.ajax({
|
url: "../../../Ashx/DataDZZH.ashx",
|
type: "post",
|
data: { Action: "GetDZZH"},//81258c6425be4694af2575731f4e8831
|
dataType: "json",
|
async: true,
|
success: function (result) {
|
try{
|
|
}catch(e){
|
alert(e);
|
}
|
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 dataX = [];
|
var dataY = [];
|
$.each(result, function (index, value) {
|
var html = "";
|
if (value.LEIXING == "B") {
|
dataX.push("崩塌");
|
html = "<td>崩塌</td>";
|
}
|
else if (value.LEIXING == "H") {
|
dataX.push("滑坡");
|
html = "<td>滑坡</td>";
|
}
|
else if (value.LEIXING == "Q") {
|
dataX.push("不稳定点");
|
html = "<td>不稳定点</td>"
|
}
|
dataY.push(value.NUMBER);
|
htmlAll += "<tr>" + html + "<td>" + value.NUMBER + "</td></tr>"
|
|
|
});
|
InitChart(decodeURIComponent(getUrlParam("urlName")), dataX, dataY);
|
$("#dataTable").empty();
|
$("#dataTable").append("<table><tr><td>类型</td><td>数量</td></tr>" + htmlAll + "</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: '15%',
|
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: 30,
|
|
}]
|
};;
|
if (option && typeof option === "object") {
|
myChart.setOption(option, true);
|
}
|
}
|
|
|
|
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");
|
});
|
}
|