From a54cc31a0ffa4c4d82250239cd1883e161927160 Mon Sep 17 00:00:00 2001 From: Norbert Renner Date: Wed, 8 Jun 2016 18:19:54 +0200 Subject: [PATCH] Add mean cost to stats (+ small refactoring), closes #39 --- js/control/TrackStats.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/control/TrackStats.js b/js/control/TrackStats.js index 216b28e..34f5c79 100644 --- a/js/control/TrackStats.js +++ b/js/control/TrackStats.js @@ -11,14 +11,17 @@ BR.TrackStats = BR.Control.extend({ update: function (polyline, segments) { var stats = this.calcStats(polyline, segments), + length1 = L.Util.formatNum(stats.trackLength/1000,1), + length3 = L.Util.formatNum(stats.trackLength/1000,3), + meanCostFactor = stats.trackLength ? L.Util.formatNum(stats.cost / stats.trackLength, 2) : '', html = ''; html += ''; - html += ''; + html += ''; html += ''; html += ''; html += ''; + html += ''; html += '
Length: ' - + L.Util.formatNum(stats.trackLength/1000,1) + 'km
Length: ' + length1 + 'km
Ascent filtered:' + stats.filteredAscend + 'm
Ascent plain:' + stats.plainAscend + 'm
Cost: ' + stats.cost + '
Mean cost:' + meanCostFactor + '
'; this._content.innerHTML = html;