10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 05:03:53 +01:00

Delete NaN text in table and toString and replace fixed by Precision in toString

This commit is contained in:
Mickaël Véril 2019-09-26 15:08:30 +02:00
parent 6cbe671137
commit 95472c1714
3 changed files with 22 additions and 2 deletions

View File

@ -8,6 +8,7 @@ draft: false
<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://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
@ -128,7 +129,7 @@ draft: false
var rowd=[]
rowd.push(String.raw`${LatexInline[0]} ${el.initial.toLaTeX()} \rightarrow ${el.final.toLaTeX()}${LatexInline[1]}`)
var e=[el.Eabs,el.Efluo,el.EZPE,el.Eadia,el.Ezz]
e.forEach((val)=>rowd.push(val.toFixed(2)))
e.forEach((val)=>rowd.push(noNanPrecision(val,3)))
rowd.forEach((d)=>{
td=document.createElement("td")
td.innerText=d

View File

@ -96,7 +96,7 @@ class excitation extends excitationBase{
return this.Eadia-this.EZPE
}
toString() {
return this.start+ ', ' + this.end +', '+ this.Eabs.toPrecision(3);
return this.start+ ', ' + this.end +', '+ noNanPrecision(this.Eabs,3);
}
}

19
static/scripts/noNan.js Normal file
View File

@ -0,0 +1,19 @@
function noNanPrecision(number,precision)
{
if(Number.isNaN(number)){
return ""
}
else {
return number.toPrecision(precision)
}
}
function noNanFixed(number,precision)
{
if(Number.isNaN(number)){
return ""
}
else {
return number.toFixed(precision)
}
}