generated from feelpp/feelpp-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a93d938
commit 26fd84e
Showing
9 changed files
with
119 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.figure-container { | ||
position: relative; | ||
} | ||
|
||
.subfigure-container { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
transition: opacity 0.2s ease; | ||
} | ||
|
||
.subfigure-container.active { | ||
position: relative; | ||
opacity: 1; | ||
pointer-events: auto; | ||
z-index: 1; | ||
} | ||
|
||
.subfigure-container.inactive { | ||
opacity: 0; | ||
pointer-events: none; | ||
z-index: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,29 @@ | ||
{% for figure in figures %} | ||
++++ | ||
<button id="download-csv-{{parent_catalogs}}-{{loop.index}}" > CSV </button> | ||
<button id="download-pgf-{{parent_catalogs}}-{{loop.index}}" > LaTeX </button> | ||
{{figure}} | ||
++++ | ||
{% endfor %} | ||
{% set figure_i = loop.index %} | ||
<div class='figure-container'> | ||
{% if figure.plot_types | length > 1%} | ||
<div class='tabs-container'> | ||
{% for plot_type in figure.plot_types %} | ||
{% set plot_type_i = loop.index %} | ||
<button class='figure-tab' onclick='switchTab({{figure_i}},{{plot_type_i}})' >{{plot_type}}</button> | ||
{% endfor %} | ||
</div> | ||
{% endif %} | ||
|
||
{% for subfigure in figure.subfigures %} | ||
{% set subfigure_i = loop.index %} | ||
<div class="subfigure-container {% if loop.first %}active{% else %}inactive{% endif %}" id="subfig_{{ figure_i }}_{{ loop.index }}"> | ||
<div class='export-container'> | ||
{% for export in subfigure.exports %} | ||
<button onclick='downloadString(`{{export.data | tojson | stripquotes}}`,"{{export.filename}}","plain/text")' > | ||
{{export.display_text}} | ||
</button> | ||
{% endfor %} | ||
</div> | ||
|
||
++++ | ||
<script> | ||
function downloadString(data, filename, mimeType ) { | ||
const blob = new Blob([data], { type: `${mimeType};charset=utf-8` }); | ||
const url = URL.createObjectURL(blob); | ||
const a = document.createElement('a'); | ||
a.href = url; | ||
a.download = filename; | ||
document.body.appendChild(a); | ||
a.click(); | ||
document.body.removeChild(a); | ||
URL.revokeObjectURL(url); | ||
} | ||
{{subfigure.html}} | ||
</div> | ||
{% endfor %} | ||
</div> | ||
|
||
function addDownloadListener( button_id, data, filename, mimeType = 'text/plain') { | ||
document.getElementById(button_id).addEventListener('click', function() { | ||
downloadString(data,filename,mimeType); | ||
}); | ||
} | ||
{% for csv,pgf in zip(figure_csvs,figure_pgfs) %} | ||
addDownloadListener('download-csv-{{parent_catalogs}}-{{loop.index}}' , `{{csv | tojson | stripquotes}}`, 'data.csv', 'text/csv') | ||
addDownloadListener('download-pgf-{{parent_catalogs}}-{{loop.index}}' , `{{pgf | tojson | stripquotes}}`, 'figure.tex' ) | ||
{% endfor %} | ||
</script> | ||
++++ | ||
{% endfor %} |
26 changes: 26 additions & 0 deletions
26
src/feelpp/benchmarking/report/templates/js/figureHelpers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
function downloadString(data, filename, mimeType ) { | ||
const blob = new Blob([data], { type: `${mimeType};charset=utf-8` }); | ||
const url = URL.createObjectURL(blob); | ||
const a = document.createElement('a'); | ||
a.href = url; | ||
a.download = filename; | ||
document.body.appendChild(a); | ||
a.click(); | ||
document.body.removeChild(a); | ||
URL.revokeObjectURL(url); | ||
} | ||
|
||
function switchTab(figureIndex, tabIndex) { | ||
let subfigures = document.querySelectorAll(`[id^="subfig_${figureIndex}_"]`); | ||
subfigures.forEach(subfig => { | ||
subfig.classList.remove('active'); | ||
subfig.classList.add('inactive'); | ||
}); | ||
|
||
let activeSubfig = document.getElementById(`subfig_${figureIndex}_${tabIndex}`); | ||
if(activeSubfig){ | ||
activeSubfig.classList.remove('inactive'); | ||
activeSubfig.classList.add('active'); | ||
} | ||
} |