diff --git a/asv/www/graphdisplay.js b/asv/www/graphdisplay.js index 55a465353..0e2c322d9 100644 --- a/asv/www/graphdisplay.js +++ b/asv/www/graphdisplay.js @@ -21,6 +21,8 @@ $(document).ready(function() { var select_reference = false; /* The reference value */ var reference = 1.0; + /* Whether to show the legend */ + var show_legend = true; /* Is even commit spacing being used? */ var even_spacing = false; var even_spacing_revisions = []; @@ -257,6 +259,11 @@ $(document).ready(function() { $('#even-spacing').removeClass('active'); update_state_url({'x-axis-scale': date_scale ? ['date'] : []}); }); + + $('#show-legend').on('click', function(evt) { + show_legend = !show_legend; + update_state_url({'show-legend': show_legend ? [] : [false]}); + }); tooltip = $("
"); tooltip.appendTo("body"); @@ -1178,6 +1185,7 @@ $(document).ready(function() { mode: "x" }, legend: { + show: show_legend, position: "nw", labelFormatter: function(label, series) { // Ensure HTML escaping @@ -1384,6 +1392,22 @@ $(document).ready(function() { } delete params['x-axis-scale']; } + + var show_legend_button = $('#show-legend') + if (params['show-legend']) { + if (params['show-legend'][0] === 'false') { + show_legend = false; + show_legend_button.removeClass('active'); + } + else { + show_legend_button.addClass('active'); + show_legend = true; + } + delete params['show-legend']; + } + else { + show_legend_button.addClass('active'); + } if (Object.keys(params).length > 0) { state_selection = params; diff --git a/asv/www/index.html b/asv/www/index.html index 63d67db3e..d1651ba04 100644 --- a/asv/www/index.html +++ b/asv/www/index.html @@ -141,6 +141,11 @@ title="Space commits by commit date along the x-axis"> date scale + + legend +