Reputation: 497
The x axis on my flot chart is wrong and I can't for the life of me figure it out, I am multiplying php strtotime*1000
<?php
function timegen($time) {
$gen = strtotime("$time") * 1000;
return $gen;
}
echo("[".timegen("2014-04-16 09:30AM UTC").",".rand(5,50)."],<br>");
echo("[".timegen("2014-04-16 10:00AM UTC").",".rand(5,50)."],<br>");
echo("[".timegen("2014-04-16 11:00AM UTC").",".rand(5,50)."],<br>");
echo("[".timegen("2014-04-16 12:00PM UTC").",".rand(5,50)."],<br>");
echo("[".timegen("2014-04-16 01:00PM UTC").",".rand(5,50)."],<br>");
echo("[".timegen("2014-04-16 02:00PM UTC").",".rand(5,50)."],<br>");
echo("[".timegen("2014-04-16 03:00PM UTC").",".rand(5,50)."],<br>");
echo("[".timegen("2014-04-16 04:00PM UTC").",".rand(5,50)."],<br>");
?>
Which returns something like:
[1397640600000,50],
[1397642400000,5],
[1397646000000,36],
[1397649600000,39],
[1397653200000,35],
[1397656800000,39],
[1397660400000,25],
[1397664000000,50]
9:30-4:00
However the chart displays 06:00 7:00 8:00 9:00 10:00 11:00 12:00
My xaxis settings are:
tickColor: 'transparent',
mode: "time",
tickDecimals: 2,
timeFormat: "%H",
timezone: "America/New York"
I'd really appreciate it if someone could help me sort this out, I don't usually ask for help but I really can't seem to figure it out, new to flot
Upvotes: 2
Views: 371
Reputation: 497
Nevermind, I think it was an error in my converting times, I took UTC out of the strtotime and it fixed time on chart. I only included the UTC bit in the PHP because flot's manual had it.
Upvotes: 1