Skip to content

Commit 0120b40

Browse files
committed
Add link to export timeline charts as PNGs
1 parent 33b2a3d commit 0120b40

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

codespeed/static/css/main.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,12 @@ tbody.commits tr td.date {
409409
overflow: auto;
410410
}
411411

412-
a#permalink { float: right; font-size: small; }
413-
a#permalink:hover { text-decoration: underline; }
412+
a#permalink, a#pnglink {
413+
float: right;
414+
font-size: small;
415+
margin-left: 0.5em;
416+
}
417+
a#permalink:hover, a#pnglink:hover { text-decoration: underline; }
414418

415419
/* Plot styles */
416420
div#plot { text-align: left; height: 500px; width: 100%; }

codespeed/static/js/timeline.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ function renderPlot(data) {
102102
seriesindex = [];
103103
var hiddenSeries = 0;
104104
var median = data['data_type'] === 'M';
105+
$("#pnglink").css("display", "inline");
105106
for (var branch in data.branches) {
106107
// NOTE: Currently, only the "default" branch is shown in the timeline
107108
for (var exe_id in data.branches[branch]) {
@@ -281,6 +282,7 @@ function render(data) {
281282
$("#revisions").attr("disabled", false);
282283
$("#equidistant").attr("disabled", false);
283284
$("span.options.median").css("display", "none");
285+
$("#pnglink").css("display", "none");
284286
$("#plotgrid").html("");
285287
if(data.error !== "None") {
286288
var h = $("#content").height();//get height for error message
@@ -421,6 +423,10 @@ function init(def) {
421423
$("#permalink").click(function() {
422424
window.location = "?" + $.param(getConfiguration());
423425
});
426+
427+
$("#pnglink").click(function() {
428+
window.location = $("#plot").jqplotToImageStr();
429+
});
424430
}
425431

426432
return {

codespeed/templates/codespeed/timeline.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
</span>
9797
{% endif %}
9898
<a id="permalink" href="#">Permalink</a>
99+
<a id="pnglink" href="#" style="display: none">PNG</a>
99100
</div>
100101
<div id="content" class="clearfix">
101102
<div id="plotgrid"></div>

0 commit comments

Comments
 (0)