Fleet mapping with jsreport and epoch time on xasis
I am currently trying to use jsreport to generate a simple PDF report that contains a bpsIn graph over a period of time. The data is static at the moment, but I ran into problems with several items:
(1) When I try to use the moment.js file to format the data, moment.unix({{this.[1]}}*1000)
it seems to work fine, however, when you add .format("YYYY-MM-DD")
to the end to format the epoch time as human readable, the content disappears from the graph.
I have a playground version setup on jsreport playground that illustrates a graph that works like a histogram with epoch time stamps. Note that they are completely unreadable.
Converting it to a line chart is simple. I also tried replacing mode: "categories"
in xasis
with navy to use the time, for example:
xaxis: {
mode: "time",
minTickSize: [15, "minute"],
min: (new Date(data.points[0][1])).getTime(),
max: (new Date(data.points[0][29])).getTime(),
timeformat: "%y/%m/%d"
},
"lines": {"show": "true"},
"points": {"show": "true"},
clickable:true, hoverable: true
with the corresponding additional inclusion: //cdnjs.cloudflare.com/ajax/libs/flot/0.8.3/jquery.flot.min.js
//cdnjs.cloudflare.com/ajax/libs/flot/0.8.3/jquery.flot.categories.min.js
//cdnjs.cloudflare.com/ajax/libs/flot/0.8.3/jquery.flot.time.min.js
//cdnjs.cloudflare.com/ajax/libs/flot/0.8.3/jquery.flot.symbol.min.js
The end goal is to have a report with human readable dates as xAsis, but the dates are actually 15 minutes since this data is coming from InfluxDB at the moment as some test data.
I did answer my own question by adding a comment to the question about the fleet that wants the time in UTC (facepalm).