Correctly recognizing numbers

This commit is contained in:
Henry Cui
2021-02-27 14:30:15 +09:00
parent d7337a14bf
commit 945d6efd13
@@ -30,6 +30,7 @@ const plotCoordinate = (trials: Trial[], objectiveId: number) => {
plotly.react(plotDomId, [])
return
}
const filteredTrials = trials.filter(
(t) => t.state === "Complete" || t.state === "Pruned"
)
@@ -63,7 +64,7 @@ const plotCoordinate = (trials: Trial[], objectiveId: number) => {
return param!.value
})
const isnum = valueStrings.every((v) => {
return /^-?\d+\.\d+$/.test(v)
return !isNaN(parseFloat(v))
})
if (isnum) {
const values: number[] = valueStrings.map((v) => parseFloat(v))