First use of the charging data from the aux table

For now we just get the maxima for current / voltage and charge rate.

We should also graph those (at least with shorter time frames).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Show data for the last day of the stats page

We didn't add this to the output variables before.

This commit also includes a bug fix where incorrect JS was created if the
first day of a stats range had a distance of 0.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Deliver fewer data points to the browser in energy mode

Previously we delivered all available data, which could be many megabytes
and millions of values - even though the browser window has no way of
actually plotting all these. This made the response times slow and wasted
bandwidth.

With thie commit we summarize the values delivered in the server process
and only deliver up to 10000 values for speed and SOC and 20000 values for
energy (this way we show both maximum energy used and maximum regen).

This also fixes a bug where parsing of the to/from parameter was too
inflexible (when switching from stats to energy we don't get hh-mm-ss).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Make switching between different displays more consistent

Previously we would sometimes create invalid from / to parameters.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix yet another boundary condition

If charging "across" midnight, that last charge of the day wasn't added to
the total for the day.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>