Commit 184e8453 authored by forevertyler's avatar forevertyler

'charts

parent 4024190e
...@@ -1104,6 +1104,7 @@ var reqApis = function () { ...@@ -1104,6 +1104,7 @@ var reqApis = function () {
var chartOpts = {}; var chartOpts = {};
box.onclick = function (e) { box.onclick = function (e) {
chartOpts.cache = ''
var tag = e.target || e.srcElement; var tag = e.target || e.srcElement;
var divID = document.getElementById("contentbox"); var divID = document.getElementById("contentbox");
if (tag.classList.contains('query')) { if (tag.classList.contains('query')) {
...@@ -1113,6 +1114,7 @@ var reqApis = function () { ...@@ -1113,6 +1114,7 @@ var reqApis = function () {
}; };
that.pageApi.reqchart(query).then((res) => { that.pageApi.reqchart(query).then((res) => {
var body = res.body || []; var body = res.body || [];
chartOpts.cache = Highchart.template.rich.call(that, chartEl, body, chartOpts); chartOpts.cache = Highchart.template.rich.call(that, chartEl, body, chartOpts);
}) })
} else if (tag.classList.contains('cu-btn')) { } else if (tag.classList.contains('cu-btn')) {
...@@ -1120,9 +1122,11 @@ var reqApis = function () { ...@@ -1120,9 +1122,11 @@ var reqApis = function () {
tag.classList.remove('cu-btn-null'); tag.classList.remove('cu-btn-null');
box.tagBtn = tag; box.tagBtn = tag;
query.hours = ~~tag.dataset.id; query.hours = ~~tag.dataset.id;
console.log(query.hours, 'query.hours')
that.pageApi.reqchart(query).then((res) => { that.pageApi.reqchart(query).then((res) => {
var body = res.body || []; var body = res.body || [];
if (query.hours == 1) { if (query.hours) {
// if (query.hours == 1) {
let rainData = body.lists let rainData = body.lists
let valList = rainData.map(item => { let valList = rainData.map(item => {
return Number(item.values.rainfall) return Number(item.values.rainfall)
...@@ -1132,7 +1136,12 @@ var reqApis = function () { ...@@ -1132,7 +1136,12 @@ var reqApis = function () {
return total + value; return total + value;
}, 0); }, 0);
num = num.toFixed(2) 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 { } else {
divID.innerHTML = '' divID.innerHTML = ''
} }
...@@ -1143,6 +1152,7 @@ var reqApis = function () { ...@@ -1143,6 +1152,7 @@ var reqApis = function () {
}; };
}; };
that.pageApi.reqchart(query).then((res) => { that.pageApi.reqchart(query).then((res) => {
console.log(query, '???/')
var body = res.body || []; var body = res.body || [];
chartOpts.cache = Highchart.template.rich.call(that, chartEl, body, chartOpts); 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