Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add links to export codespeed charts as PNGs #227

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions codespeed/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,22 @@ p.note {
background-image: url(../images/note.png);
}

div.plotpng a {
background-color: #F1F1F1;
background-repeat: no-repeat;
background-position: 3px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
-moz-box-shadow: 3px 3px 3px #888;
-webkit-box-shadow: 3px 3px 3px #888;
box-shadow: 3px 3px 3px #888;
float: right;
margin-top: 20px;
padding: 1em;
text-decoration: underline;
}

div.footer{
color: white;
font-size: small;
Expand Down
3 changes: 3 additions & 0 deletions codespeed/static/css/timeline.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
select#baseline {
width: 100%;
}
div#plotdescription {
margin-right: 55px;
}
12 changes: 11 additions & 1 deletion codespeed/static/js/comparison.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,19 @@ function refreshContent() {
if (benchmarks.length === 0) { continue; }

var plotid = "plot" + plotcounter;
$("#plotwrapper").append('<div id="' + plotid + '" class="compplot"></div>');
var pngid = "pnglink" + plotcounter;
$("#plotwrapper").append('<div class="plotpng"><a id="' + pngid + '" href="#">PNG</a></div><div id="' + plotid + '" class="compplot"></div>');
plotcounter++;
renderComparisonPlot(plotid, benchmarks, exes, enviros, conf.bas, conf.chart, conf.hor);
$("#" + pngid).data("plot", plotid);
$("#" + pngid).click(function() {
var string = $("#" + $(this).data("plot")).jqplotToImageStr();
var iframe = "<iframe width='100%' height='100%' src='" + string + "'></iframe>"
var x = window.open();
x.document.open();
x.document.write(iframe);
x.document.close();
});
}
});
}
Expand Down
11 changes: 10 additions & 1 deletion codespeed/static/js/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,16 @@ function renderPlot(data) {
digits++;
}
}
$("#plotgrid").html('<div id="plot"></div><div id="plotdescription"></div>');
$("#plotgrid").html('<div id="plot"></div><div class="plotpng"><a id="pnglink" href="#">PNG</a></div><div id="plotdescription"></div>');

$("#pnglink").click(function() {
var string = $("#plot").jqplotToImageStr();
var iframe = "<iframe width='100%' height='100%' src='" + string + "'></iframe>"
var x = window.open();
x.document.open();
x.document.write(iframe);
x.document.close();
});

if (data.benchmark_description) {
$("#plotdescription").html('<p class="note"><i>' + data.benchmark + '</i>: ' + data.benchmark_description + '</p>');
Expand Down