From c569756a0c0d923f2e229f2a516cf8e41f7920d2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 12 Dec 2016 16:21:01 -0500 Subject: Make the default time span configurable. --- jarmon/jarmon.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/jarmon/jarmon.js b/jarmon/jarmon.js index 3357864..cef338b 100644 --- a/jarmon/jarmon.js +++ b/jarmon/jarmon.js @@ -1280,7 +1280,10 @@ jarmon.Chart.STACKED_OPTIONS = { /** * A selection of useful time ranges * - * This is an array of `["human description", function]` pairs. + * For the most part, this is an array of `["human description", function]` + * pairs. However, if a third member of a tuple is `===true`, then that tuple + * is used as the default option. If no tuple is identified as the default this + * way, then the default is the first tuple. * * @todo This should probably be a member of jarmon.ChartCoordinator. * @@ -1334,14 +1337,18 @@ jarmon.ChartCoordinator = function(ui, charts) { }; var options = this.ui.find('select[name="from_standard"]'); + var default_index = 0; // Select the first shortcut by default for(var i=0; i').text(jarmon.timeRangeShortcuts[i][0])); + if (jarmon.timeRangeShortcuts[i][2] === true) { + default_index = i; + } } // Append a custom option for when the user selects an area of the graph options.append($('