10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-04 02:16:11 +02:00
QUESTDB_website/content/multipledataset.html

107 lines
3.5 KiB
HTML
Raw Normal View History

2019-09-28 15:23:25 +02:00
---
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/uniq.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 ()=>{
$('#form input[type=radio]').on('change', async function(event) {
var result = $(this).val();
2019-09-28 16:04:36 +02:00
var proms=[];
2019-09-28 15:23:25 +02:00
switch (result) {
case "abs":
2019-09-28 16:04:36 +02:00
proms==getAbsFilesName().map((f) => absDataFile.loadAsync(f));
2019-09-28 15:23:25 +02:00
break;
case "fluo":
2019-09-28 16:04:36 +02:00
proms=getFluoFilesName().map((f) => fluoDataFile.loadAsync(f));
2019-09-28 15:23:25 +02:00
break;
case "zpe":
2019-09-28 16:04:36 +02:00
proms=getZPEFilesName().map((f) => ZPEDataFile.loadAsync(f));
2019-09-28 15:23:25 +02:00
break;
}
2019-09-28 16:04:36 +02:00
window.dats=await Promise.all(proms)
2019-09-28 15:23:25 +02:00
reloadSelect()
reloadContent()
})
}
function reloadSelect(){
$('#form > select').each(function(){
$(this).find('option[value!=""]').remove()
const vals=uniq(window.dats.map((d)=>{return d[$(this).attr("name")]}))
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
2019-09-28 16:04:36 +02:00
$('#form > select').each(function(){
const prop=$(this).attr("name")
const values=$(this).val()
2019-09-28 15:23:25 +02:00
filt=filt.filter((d)=>{
2019-09-28 16:04:36 +02:00
if(typeof values=="undefined" || values==null){
return false
2019-09-28 15:23:25 +02:00
}
2019-09-28 16:04:36 +02:00
return values.map((v)=>JSON.stringify(v)).includes(JSON.stringify(d[prop]))
2019-09-28 15:23:25 +02:00
})
})
var tb=document.getElementById("table_b");
tb.innerHTML=''
for (const d of filt) {
var row=document.createElement("tr")
var rowd=[]
var e=[d.molecule,d.comment,d.code,d.method,d.DOI]
for(el of e){
td=document.createElement("td")
td.innerText=el
row.appendChild(td)
}
tb.appendChild(row)
}
}
</script>
{{< getDataFilesName >}}
<form id="form" 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="fluo">Fluorescence</label>
<input type="radio" id="zpe" value="zpe" name="datatype">
<label for="zpe">\(\Delta \text{ZPE}\)</label>
<br/>
2019-09-28 16:04:36 +02:00
<select multiple id="mol_select" onchange="reloadContent()" name="molecule"></select>
2019-09-28 15:23:25 +02:00
<label for="mol_select">Molecule</label>
2019-09-28 16:04:36 +02:00
<select multiple id="code_select" onchange="reloadContent()" name="code"></select>
2019-09-28 15:23:25 +02:00
<label for="code_select">Code</label>
2019-09-28 16:04:36 +02:00
<select multiple id="method_select" onchange="reloadContent()" name="method"></select>
2019-09-28 15:23:25 +02:00
<label for="method_select">Method</label>
2019-09-28 16:04:36 +02:00
<select multiple id="DOI_select" onchange="reloadContent()" name="DOI"></select>
2019-09-28 15:23:25 +02:00
<label for="DOI_select">DOI</label>
</form>
<br/>
<div id="data_div">
<table id="dat_table">
<thead>
<th>Molecule</th>
<th>Comment</th>
<th>Code</th>
<th>Method</th>
<th>DOI</th>
</thead>
<tbody id="table_b">
</tbody>
</table>
</div>