fix bug
This commit is contained in:
parent
53783025e2
commit
78b916c3a7
11
plot_gen.py
11
plot_gen.py
@ -1,5 +1,6 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from datetime import timezone
|
from datetime import timezone
|
||||||
|
import numpy
|
||||||
|
|
||||||
|
|
||||||
class TimeSeriesAccumulator:
|
class TimeSeriesAccumulator:
|
||||||
@ -26,19 +27,15 @@ class TimeSeriesAccumulator:
|
|||||||
result = []
|
result = []
|
||||||
for i in self.data:
|
for i in self.data:
|
||||||
new = f(i)
|
new = f(i)
|
||||||
if new == numpy.nan:
|
if numpy.isnan(new):
|
||||||
result.append(prev)
|
result.append(prev)
|
||||||
else:
|
else:
|
||||||
result.append(new)
|
result.append(new)
|
||||||
prev = new
|
prev = new
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def get_ts(self):
|
||||||
return [f(i) for i in self.data]
|
return [datetime.utcfromtimestamp(self.start_timestamp+(i+1)*self.bin_time) for i in range(self.n_bins)]
|
||||||
|
|
||||||
|
|
||||||
def get_ts(self):
|
|
||||||
return [datetime.utcfromtimestamp(self.start_timestamp+(i+1)*self.bin_time) for i in range(self.n_bins)]
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@ -430,9 +430,9 @@
|
|||||||
<script src="./dist/js/tabler.min.js"></script>
|
<script src="./dist/js/tabler.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$.get("/stat", function (data) {
|
var load_stat = function(){
|
||||||
// @formatter:off
|
$.getJSON("/stat", function (data) {
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
// @formatter:off
|
||||||
window.ApexCharts && (new ApexCharts(document.getElementById('chart-mentions'), {
|
window.ApexCharts && (new ApexCharts(document.getElementById('chart-mentions'), {
|
||||||
chart: {
|
chart: {
|
||||||
type: "line",
|
type: "line",
|
||||||
@ -516,9 +516,10 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})).render();
|
})).render();
|
||||||
});
|
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
load_stat();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user