commit ef95388185b2c99a002c452907aeaf6a2f614000
parent ad069cb7bf1d90937f21ef00f9d8fa6da518454c
Author: Emily Doherty <git@emily.sh>
Date: Thu, 24 Oct 2024 18:09:21 -0700
Fix live prices being added to the chart with incorrect price
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/index.js b/src/index.js
@@ -15,6 +15,7 @@ let currentRegionSelection = '';
let currentTimeSelection = '';
let currentAggregateSelection = '';
let startYAtZero = false;
+let datum;
let chart;
const currentPriceHash = {
us: 0,
@@ -47,7 +48,7 @@ async function updateRegionalToken(region, data) {
currentPriceHash[region] = data['price_data'][region];
if (region === currentRegionSelection) {
formatToken();
- const datum = new Datum(Date.parse(data['current_time']), data['price_data'][region]);
+ datum = new Datum(Date.parse(data['update_times'][region]), data['price_data'][region]);
if (currentAggregateSelection === 'none' && chart.active()) {
await chart.addDataToChart(datum);
}