3

I am currently trying to leverage jsreport to generate a simple PDF report which contains a graph of bpsIn over a time range. The data for now is static, but I have run into issues with a few items:

(1) When I attempt to leverage moment.js to format the data, moment.unix({{this.[1]}}*1000) seems to work fine, however, when you add the .format("YYYY-MM-DD") on 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's playground that illustrates the graph working as a bar chart with the epoch timestamps. Notice how they're completely unreadable..

Converting it to a line chart is simple. I've also tried replacing the mode: "categories" within the xasis of flot to use time, as:

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 appropriate additional includes: //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 the xAsis, but the dates are actually 15minute increments as this data is coming from InfluxDB at the moment as some test data.

Community
  • 1
  • 1
shat
  • 212
  • 2
  • 5
  • 13
  • Also, from the flot docs, I realize it wants the epoch (UTC) time for the xAsis, which is fine. I just want to use timeformat to be able to read them. – shat May 11 '15 at 21:47

1 Answers1

0

I actually ended up answering my own question upon adding the comment to the question about flot wanting the time in UTC (facepalm).

shat
  • 212
  • 2
  • 5
  • 13