diff options
Diffstat (limited to 'site/app/webroot/js/stats/plots.js')
-rwxr-xr-x | site/app/webroot/js/stats/plots.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/site/app/webroot/js/stats/plots.js b/site/app/webroot/js/stats/plots.js index d093744..464b2c3 100755 --- a/site/app/webroot/js/stats/plots.js +++ b/site/app/webroot/js/stats/plots.js @@ -8,6 +8,11 @@ var Plots = { determinePlot: function() { var selected = plotSelection.dropdowns['plot-selector'].selectedItem.value; + // HACK: The group-by selector doesn't exist when the plot-selector is first + // instantiated, but this method is called at that point. + var group_by = (!plotSelection.dropdowns['group-by-selector']) ? null : + plotSelection.dropdowns['group-by-selector'].selectedItem.value; + // Remove current plot selections plotSelection.removeAll(); @@ -47,6 +52,8 @@ var Plots = { 'downloads': new Timeplot.DefaultEventSource(), 'updatepings': new Timeplot.DefaultEventSource() }; + + PlotsTables.addListeners('summary', this.dataSources); this.valueGeometry = { 'downloads': { @@ -151,10 +158,12 @@ var Plots = { if (plotType == 'summary') { $('#summary-legend').show(); $('#summary-options').show(); + $('#group-by-selector').hide(); } else { $('#summary-legend').hide(); $('#summary-options').hide(); + $('#group-by-selector').show(); } }, @@ -219,12 +228,19 @@ var Plots = { initialize: function() { var type = plotSelection.dropdowns['plot-selector'].selectedItem.value; Plots.currentCSV = statsURL + 'csv/' + addonID + '/' + type; + + // If there's a value for the group-by selector, add it as a + // parameter to the CSV URL to invoke it server-side. + var group_by = plotSelection.dropdowns['group-by-selector'].selectedItem.value; + if (group_by) Plots.currentCSV += '?group_by=' + group_by; this.dataSources = { 'count': new Timeplot.DefaultEventSource(), 'events-firefox': new Timeplot.DefaultEventSource(), 'events-addon': new Timeplot.DefaultEventSource() }; + + PlotsTables.addListeners('defined', this.dataSources); this.valueGeometry = { 'gridColor': '#000000', |