动态功率图形已经工作

This commit is contained in:
2ndacc
2020-02-21 21:15:01 +08:00
parent 8299ccf823
commit e0056b0e08
4 changed files with 5399 additions and 4563 deletions

View File

@@ -151,9 +151,7 @@
</div>
<div class="page page1 demo-graphs mdl-shadow--2dp mdl-cell mdl-cell--8-col">
<svg fill="currentColor" viewBox="0 0 500 250" class="demo-graph">
<use xlink:href="#chart" />
</svg>
<div class="ct-chart ct-perfect-fourth"></div>
<svg fill="currentColor" viewBox="0 0 500 250" class="demo-graph">
<use xlink:href="#chart" />
</svg>
@@ -310,6 +308,12 @@
alert(re.status);
}
var data = {
series: [
[]
]
};
var t = new Chartist.Line('.ct-chart', data);
var power_idx = 0;
function GetPowerRecord() {
$.ajax({
@@ -320,7 +324,8 @@
re = re.replace(/'/g, '"');
var power = JSON.parse(re);
power_idx = power.idx + 1;
alert(power.powers);
data.series[0].push(power_idx/10);
t.update(data);
window.setTimeout(GetPowerRecord, 3000);
},
error: AjaxErr