Skip to content

Commit

Permalink
Move legend outside plot area when too many series present
Browse files Browse the repository at this point in the history
  • Loading branch information
tobami committed Jun 1, 2010
1 parent 49b6424 commit 1f935a2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions speedcenter/media/js/codespeed.js
Expand Up @@ -249,6 +249,17 @@ function renderComparisonPlot(plotid, benchmarks, exes, enviros, baseline, chart
}
plotoptions.legend = {show: true, location: 'ne'};
plotoptions.series = series;
if (!horizontal && series.length > 5) {
var labels = new Array();
for (l in series) {
labels.push(series[l]['label'].length)
}

var offset = 55 + Math.max.apply( Math, labels ) * 5.4;
plotoptions.legend.xoffset = -offset;
$("#" + plotid).css("margin-right", offset + 10);
if (w + offset > plotwidth) { w = plotwidth - offset -20; }
}
if (chart == "stacked bars") {
plotoptions.stackSeries = true;
}
Expand Down

0 comments on commit 1f935a2

Please sign in to comment.