10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-23 03:07:44 +02:00

Add graph to multipledataset and fix problem on plotly

This commit is contained in:
Mickaël Véril 2019-10-04 11:03:30 +02:00
parent a4f74b7f89
commit ec625429ad
2 changed files with 36 additions and 28 deletions

View File

@ -13,7 +13,6 @@ draft: false
<script src="/scripts/websiteFile.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 src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
<script>
window.onload= async ()=>{
@ -76,6 +75,7 @@ draft: false
}
async function reloadStat(){
var stb=document.getElementById("stat_table_b");
document.getElementById("graph_div").inerrHTML=""
stb.innerHTML=''
const sel_ref=document.getElementById("sel_ref")
const refstr=((sel_ref.selectedIndex>=0) ? sel_ref.options[sel_ref.selectedIndex].value : null)
@ -104,6 +104,7 @@ draft: false
sdic.get(key).push(exval-((sdatdic.has(refstr)) ? sdatdic.get(refstr).get(key2) : NaN))
}
}
var graphdat=[]
for(const[keystr,vals] of sdic){
row=document.createElement("tr")
key=JSON.parse(keystr)
@ -137,7 +138,37 @@ draft: false
row.appendChild(td)
}
stb.appendChild(row)
var box = {
x: noNanVals,
amean: ss.mean(avals).toFixed(3),
name: key.map(k=>k.toString()).join(" ") + " MAD : " + ss.mean(avals).toPrecision(4),
type: 'box',
boxmean: 'sd'
};
graphdat.push(box)
}
var layout = {
paper_bgcolor: 'rgba(0,0,0,0)',
plot_bgcolor: 'rgba(0,0,0,0)',
gap: 0,
legend: {
traceorder: 'reversed',
},
bgcolor:'#E2E2E2',
bordercolor:'#FFFFFF',
borderwidth: 2,
// autosize: false,
width: 850,
height: 500,
margin: {
l: 0,
r: 10,
b: 15,
t: 20,
pad: 0,
},
}
Plotly.newPlot('graph_div', graphdat, layout);
}
async function reloadContent(){
const LatexInline=['\\(','\\)']
@ -270,5 +301,6 @@ draft: false
</thead>
<tbody id="stat_table_b">
</tbody>
<div id="graph_div"></div>
</table>
</div>

View File

@ -1,28 +1,4 @@
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
<script type="text/javascript" async
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [['$','$'], ['\\(','\\)']],
displayMath: [['$$','$$'], ['\[','\]']],
processEscapes: true,
processEnvironments: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
TeX: { equationNumbers: { autoNumber: "AMS" },
extensions: ["AMSmath.js", "AMSsymbols.js"] }
}
});
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function() {
// Fix <code> tags after MathJax finishes running. This is a
// hack to overcome a shortcoming of Markdown. Discussion at
// https://github.com/mojombo/jekyll/issues/199
var all = MathJax.Hub.getAllJax(), i;
for(i = 0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
</script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>