Commit 184e8453 authored by forevertyler's avatar forevertyler

'charts

parent 4024190e
......@@ -1104,6 +1104,7 @@ var reqApis = function () {
var chartOpts = {};
box.onclick = function (e) {
chartOpts.cache = ''
var tag = e.target || e.srcElement;
var divID = document.getElementById("contentbox");
if (tag.classList.contains('query')) {
......@@ -1113,6 +1114,7 @@ var reqApis = function () {
};
that.pageApi.reqchart(query).then((res) => {
var body = res.body || [];
chartOpts.cache = Highchart.template.rich.call(that, chartEl, body, chartOpts);
})
} else if (tag.classList.contains('cu-btn')) {
......@@ -1120,9 +1122,11 @@ var reqApis = function () {
tag.classList.remove('cu-btn-null');
box.tagBtn = tag;
query.hours = ~~tag.dataset.id;
console.log(query.hours, 'query.hours')
that.pageApi.reqchart(query).then((res) => {
var body = res.body || [];
if (query.hours == 1) {
if (query.hours) {
// if (query.hours == 1) {
let rainData = body.lists
let valList = rainData.map(item => {
return Number(item.values.rainfall)
......@@ -1132,7 +1136,12 @@ var reqApis = function () {
return total + value;
}, 0);
num = num.toFixed(2)
divID.innerHTML = "降雨总量:" + num + body.danwei
divID.innerHTML = "降雨总量:" + num + body.danwei;
that.pageApi.reqchart(query).then((res) => {
var body = res.body || [];
chartOpts.cache = Highchart.template.rich.call(that, chartEl, body, chartOpts);
})
} else {
divID.innerHTML = ''
}
......@@ -1143,6 +1152,7 @@ var reqApis = function () {
};
};
that.pageApi.reqchart(query).then((res) => {
console.log(query, '???/')
var body = res.body || [];
chartOpts.cache = Highchart.template.rich.call(that, chartEl, body, chartOpts);
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment