Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
Updating lightweight-charts candlestick series results in Uncaught TypeError: Cannot read properties of undefined (reading 'year')

When running update on candlestick series I'm getting Uncaught TypeError: Cannot read properties of undefined (reading 'year'). Data is prepared the same way it was for setData and look like this: [{time: 1649068320, open: '0.15721000', high: '0.15776000', low: '0.15710000', close: '0.15760000'}].

What am I missing here?

I tried to update with same data as was used with setData and got same error.

Also tried to prepare data this way: var time = moment(item.openTime); time = { year: time.year(), month: time.month(), day: time.day(), hour: time.hour(), minute: time.minute(), second: time.second(), } and var time = new Date(item.openTime)

Minimum steps to reproduce

import { createChart } from 'lightweight-charts';
var container = document.getElementById('price-chart');
const chart = createChart(container, {height:300});
chart.applyOptions({
    timeScale: {
        visible: true,
        timeVisible: true,
    },
});
const candlestick = chart.addCandlestickSeries();
candlestick.setData([{time: 1649102700, open: '3.39110000', high: '3.39130000', low: '3.38610000', close: '3.38670000'}]);
candlestick.update([{time: 1649102700, open: '3.39110000', high: '3.39130000', low: '3.38610000', close: '3.38670000'}]);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

update takes single object. so instead of

candlestick.update([{time: 1649102700, open: '3.39110000', high: '3.39130000', low: '3.38610000', close: '3.38670000'}]);

it should be

candlestick.update({time: 1649102700, open: '3.39110000', high: '3.39130000', low: '3.38610000', close: '3.38670000'});

Also:

  • You cannot use update on past data. So when scrolling backwards, you need to use setData
  • when setting data, array must be in chronological order or you will get Uncaught Error: Value is null.
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!