10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-26 06:14:38 +01:00
QUESTDB_website/content/multipledataset.html

111 lines
3.4 KiB
HTML

---
title: "Multiple dataset"
date: 2019-09-27 16:41
draft: false
---
<script src="/scripts/data.js" type="text/javascript"></script>
<script src="/scripts/loadAllData.js" type="text/javascript"></script>
<script src="/scripts/getFullDataPath.js" type="text/javascript"></script>
<script src="/scripts/getTextFromFile.js" type="text/javascript"></script>
<script src="/scripts/trueTypeOf.js" type="text/javascript"></script>
<script src="/scripts/noNan.js"></script>
<script src="https://cdn.rawgit.com/larsgw/citation.js/archive/citation.js/citation-0.4.0-9.js"
type="text/javascript"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script>
window.onload= async ()=>{
$('#dtypeform input[type=radio]').on('change', async function(event) {
var result = $(this).val();
var files=[];
switch (result) {
case "abs":
files=getAbsFilesName();
break;
case "fluo":
files=getFluoFilesName();
break;
case "zpe":
files=getZPEFilesName();
break;
}
window.dats=await Promise.all(files.map((f) => ZPEDataFile.loadAsync(f)))
reloadSelect()
reloadContent()
})
}
function reloadSelect(){
$('#dat_table > thead > tr > th > select').each(function(){
$(this).find('option[value!=""]').remove()
const vals=new Set(window.dats.map((d)=>{return d[$(this).data("prop")]}))
for (const val of vals){
op=document.createElement("option")
op.value=val
op.innerText=val.toString()
$(this).append(op)
}
})
}
function reloadContent(){
var filt=window.dats
$('#dat_table > thead > tr > th > select').each(function(){
const prop=$(this).data("prop")
const value=$(this).attr("value")
filt=filt.filter((d)=>{
if(value==""){
return true
}
else {
return d[prop]==value
}
})
})
var tb=document.getElementById("ex_table_b");
tb.innerHTML=''
for (const el of filt) {
var row=document.createElement("tr")
var rowd=[]
var e=[d.Molecule,d.Comment,d.Code,d.DOI]
e.forEach((val)=>rowd.push(noNanPrecision(val,3)))
for(d of rowd) {
td=document.createElement("td")
td.innerText=d
row.appendChild(td)
}
tb.appendChild(row)
}
}
</script>
{{< getDataFilesName >}}
<form id="dtypeform" action="" method="post">
<legend>Data type</legend>
<input type="radio" id="abs" value="abs" name="datatype">
<label for="abs">Absorption</label>
<input type="radio" id="fluo" value="fluo" name="datatype">
<label for="Fluorescence">Fluorescence</label>
<input type="radio" id="zpe" value="zpe" name="datatype">
<label for="Fluorescence">\(\Delta \text{ZPE}\)</label>
</form>
<div id="data_div">
<table id="dat_table">
<thead>
<th>Molecule :
<select id="mol_select" onchange="reloadContent()" data-prop="molecule">
<option value="">All</option>
</select>
</th>
<th>Comment</th>
<th>Code :
<select id="code_select" onchange="reloadContent()" data-prop="code">
<option value="">All</option>
</select>
</th>
<th>DOI :
<select id="DOI_select" onchange="reloadContent()" data-prop="DOI">
<option value="">All</option>
</select>
</th>
</thead>
<tbody id="ex_table_b">
</tbody>
</table>
</div>