1
0
Fork 0
mirror of synced 2024-09-10 06:26:02 +12:00
This commit is contained in:
Gerard Burns 2024-04-15 08:37:30 +01:00
parent 70ac56522f
commit a806bd87bf
2 changed files with 9 additions and 3 deletions

View file

@ -4,7 +4,7 @@
<Subject heading="Text as Numbers">
<Section>
Text can be used in place of numbers in certain scenarios, but care needs to be taken, as text that doesn't contain a strictly base-ten, non-decimal value may lead to unexpected behavior.
Text can be used in place of numbers in certain scenarios, but care needs to be taken, as text that doesn't contain a strictly base-ten integer or decimal value may lead to unexpected behavior.
</Section>
<Section>
@ -18,7 +18,7 @@
<br />
<Block>"100 million"</Block>{" -> "}<Block>100</Block>
<br />
<Block>"100.9"</Block>{" -> "}<Block>100</Block>
<Block>"100.9"</Block>{" -> "}<Block>100.9</Block>
<br />
<Block>"One hundred"</Block>{" -> "}<Block>Error</Block>
</Section>

View file

@ -80,7 +80,13 @@
.colors(customColor ? colors : null)
// Add data if valid datasource
const series = data.map(row => parseFloat(row[valueColumn]))
const series = data.map(row => {
if (schema[valueColumn].type === 'datetime') {
return Date.parse(row[valueColumn])
}
return parseFloat(row[valueColumn])
})
const labels = data.map(row => row[labelColumn])
builder = builder.series(series).labels(labels)