Ensure candlestick chart works with either our own date formats as well as timestamps
This commit is contained in:
parent
b8ce20ac4c
commit
2cf7f66d9b
|
@ -59,8 +59,9 @@
|
||||||
.xType("datetime")
|
.xType("datetime")
|
||||||
|
|
||||||
// Add data
|
// Add data
|
||||||
|
const parseDate = d => (isNaN(d) ? Date.parse(d).valueOf() : parseInt(d))
|
||||||
const chartData = data.map(row => ({
|
const chartData = data.map(row => ({
|
||||||
x: row[dateColumn],
|
x: parseDate(row[dateColumn]),
|
||||||
y: [row[openColumn], row[highColumn], row[lowColumn], row[closeColumn]],
|
y: [row[openColumn], row[highColumn], row[lowColumn], row[closeColumn]],
|
||||||
}))
|
}))
|
||||||
builder = builder.series([{ data: chartData }])
|
builder = builder.series([{ data: chartData }])
|
||||||
|
|
Loading…
Reference in New Issue