This commit is contained in:
NunoSempere 2021-11-25 16:13:38 +00:00
parent 427bb9b231
commit 530589bbc0

View File

@ -81,6 +81,19 @@ function findDistancesForAllElements({nodes, links}){
return distances
}
function abridgeArrayAndDisplay(array){
let newArray
if(array.length > 10){
newArray = array.slice(0,10)
newArray[11] = "..."
}else{
newArray=array
}
let formatForDisplay= newArray.map(d => formatLargeOrSmall(d))
let result = JSON.stringify(formatForDisplay, null, 2).replaceAll(`"`, "")
return result
}
export function CreateTableWithDistances({isListOrdered, orderedList, listOfElements, links}){
if(!isListOrdered || orderedList.length < listOfElements.length){
return (<div>{""}</div>)
@ -110,7 +123,7 @@ export function CreateTableWithDistances({isListOrdered, orderedList, listOfElem
<td>&nbsp;&nbsp;&nbsp;</td>
<td className="">{row.name}</td>
<td>&nbsp;&nbsp;&nbsp;</td>
<td className="">{JSON.stringify(row.distances.map(d => formatLargeOrSmall(d)), null, 2).replaceAll(`"`, "")}</td>
<td className="">{abridgeArrayAndDisplay(row.distances)}</td>
<td>&nbsp;&nbsp;&nbsp;</td>
<td className="">{formatLargeOrSmall(avg(row.distances))}</td>
</tr>