From 732685ec602773f1792315c31d3c47aba4950103 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 5 Nov 2020 13:27:29 +0000 Subject: [PATCH] Ensure candlestick chart works with either our own date formats as well as timestamps --- packages/standard-components/src/Chart/CandleStickChart.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/standard-components/src/Chart/CandleStickChart.svelte b/packages/standard-components/src/Chart/CandleStickChart.svelte index 7854b495f8..c034855e5e 100644 --- a/packages/standard-components/src/Chart/CandleStickChart.svelte +++ b/packages/standard-components/src/Chart/CandleStickChart.svelte @@ -59,8 +59,9 @@ .xType("datetime") // Add data + const parseDate = d => (isNaN(d) ? Date.parse(d).valueOf() : parseInt(d)) const chartData = data.map(row => ({ - x: row[dateColumn], + x: parseDate(row[dateColumn]), y: [row[openColumn], row[highColumn], row[lowColumn], row[closeColumn]], })) builder = builder.series([{ data: chartData }])