refactor chart handling
This commit is contained in:
parent
9e27e8b771
commit
f4b8af721e
|
|
@ -61,28 +61,33 @@ $(function() {
|
||||||
console.log("A new date selection was made: " + start.format() + ' to ' + end.format());
|
console.log("A new date selection was made: " + start.format() + ' to ' + end.format());
|
||||||
s_start = start.utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
s_start = start.utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
||||||
s_end = end.utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
s_end = end.utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
||||||
console.log("Start: " + s_start + ' End: ' + s_end);
|
console.log("Start: " + s_start + ' End: ' + s_end + ' Property: '+ property);
|
||||||
drawGraph(deveui, alias, property, s_start,s_end, false);
|
drawGraph(deveui, alias, property, s_start,s_end, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#btn_w').on("click", function() {
|
$('#btn_w').on("click", function() {
|
||||||
drawGraph(deveui, alias, 'w', s_start,s_end, false);
|
property = 'w';
|
||||||
|
drawGraph(deveui, alias, property, s_start,s_end, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btn_t').on("click", function() {
|
$('#btn_t').on("click", function() {
|
||||||
drawGraph(deveui, alias, 't', s_start,s_end, false);
|
property = 't';
|
||||||
|
drawGraph(deveui, alias, property, s_start,s_end, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btn_h').on("click", function() {
|
$('#btn_h').on("click", function() {
|
||||||
drawGraph(deveui, alias, 'h', s_start,s_end, false);
|
property = 'h';
|
||||||
|
drawGraph(deveui, alias, property, s_start,s_end, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btn_p').on("click", function() {
|
$('#btn_p').on("click", function() {
|
||||||
drawGraph(deveui, alias, 'p', s_start,s_end, false);
|
property = 'p';
|
||||||
|
drawGraph(deveui, alias, property, s_start,s_end, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btn_vp').on("click", function() {
|
$('#btn_vp').on("click", function() {
|
||||||
drawGraph(deveui, alias, 'vp', s_start,s_end, false);
|
property = 'vp';
|
||||||
|
drawGraph(deveui, alias, property, s_start,s_end, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#reportrange').daterangepicker({
|
$('#reportrange').daterangepicker({
|
||||||
|
|
@ -227,8 +232,10 @@ function drawGraph(deveui, alias, property, start, stop, create_graph) {
|
||||||
if (create_graph) {
|
if (create_graph) {
|
||||||
chart = new ApexCharts(document.querySelector("#chart"), options);
|
chart = new ApexCharts(document.querySelector("#chart"), options);
|
||||||
} else {
|
} else {
|
||||||
chart.updateOptions(options);
|
chart.destroy();
|
||||||
chart.updateSeries(mydata);
|
chart = new ApexCharts(document.querySelector("#chart"), options);
|
||||||
|
//chart.updateOptions(options);
|
||||||
|
//chart.updateSeries(mydata);
|
||||||
}
|
}
|
||||||
|
|
||||||
chart.render();
|
chart.render();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue