--- a/ckanext/ga_report/public/scripts/ckanext_ga_reports.js
+++ b/ckanext/ga_report/public/scripts/ckanext_ga_reports.js
@@ -19,6 +19,8 @@
$.each(data, function(i, object) {
object['color'] = palette.color();
});
+ // Rickshaw renders the legend in reverse order...
+ data.reverse();
var graphElement = document.querySelector("#chart_"+css_name);
@@ -43,6 +45,7 @@
graph: graph,
legend: legend
} );
+ myLegend.prepend('
Click on a series below to isolate its graph:
');
graph.render();
};
@@ -92,9 +95,22 @@
}
legend_name = '#legend_'+legend_name;
$('#graph-legend-container > *').hide();
+ $('#graph-legend-container .instructions').show();
$(legend_name).show();
}
);
+};
+
+CKAN.GA_Reports.bind_month_selector = function() {
+ var handler = function(e) {
+ var target = $(e.delegateTarget);
+ var form = target.closest('form');
+ var url = form.attr('action')+'?month='+target.val()+window.location.hash;
+ window.location = url;
+ };
+ var selectors = $('select[name="month"]');
+ assert(selectors.length>0);
+ selectors.bind('change', handler);
};
/*