LowPowerLab Forum

Software support => Pi Gateway => Topic started by: CallOne_Phil on August 09, 2016, 11:32:54 PM

Title: Displaying gateway graphs with 12hour time?
Post by: CallOne_Phil on August 09, 2016, 11:32:54 PM
I took a quick peek around the forum without any luck(unless I missed it) and was wondering if there is a setting to change how the gateway displays time.  I didn't notice anything in the gateway configuration files to change from 24 hour time to 12, so I assume it's a code edit somewhere in a javascript file?

-Phil
Title: Re: Displaying gateway graphs with 12hour time?
Post by: Felix on August 10, 2016, 07:51:41 AM
Actually it's in the html file here (https://github.com/LowPowerLab/RaspberryPi-Gateway/blob/master/www/index.html#L262).
This is how it's done for 24hrs:

<a class="graphControl" href="#" data-role="button" hours="24" data-icon="calendar" data-theme="b" title="last day">D</a>
Title: Re: Displaying gateway graphs with 12hour time (scale)?
Post by: CallOne_Phil on August 10, 2016, 11:38:02 AM
100% my fault for posting before bed and not being clear enough in my question.  I was referring to the time scale at the bottom of the graph and having it display 11am, 12pm, 1pm instead of 11:00, 12:00, 13:00.


Title: Re: Displaying gateway graphs with 12hour time?
Post by: Felix on August 10, 2016, 03:48:07 PM
Ohh i see.
There are different formats you can use for the xaxis. But depending on the zoom level you might want different behavior.
The way it's done today is:

xaxis: { mode: "time", timezone: "browser", min:graphView.start, max:graphView.end},
Here's the documentation for the time series in the flot api (https://github.com/flot/flot/blob/master/API.md#time-series-data). Also a stackoverflow topic about this (http://stackoverflow.com/questions/2507235/jquery-flot-xaxis-time).

FWIW I put it on my TODO to research how the xaxis can be changed according to zoom level and include it in a future version.
Title: Re: Displaying gateway graphs with 12hour time?
Post by: CallOne_Phil on August 10, 2016, 05:02:48 PM
I will checked into those docs and see how I make out.  Thanks for the speedy reply as always and keep up the great work you are doing on the gateway with these updates :)