charting-library-tutorial
charting-library-tutorial copied to clipboard
npx serve fail to load data correctly: Cannot read property 'time' of undefined
I tried to complete the tutorial.
First of all, I need to change container to container_id in main.js to avoid an error.
When I run npx serve, I see graph to be build, but no candles data to load.
In a console I see an error
Uncaught TypeError: Cannot read property 'time' of undefined
at Socket.
When I try to find out what is happening, I see that lastDailyBar is undefined, and those lines
if (firstDataRequest) {
lastBarsCache.set(symbolInfo.full_name, {
...bars[bars.length - 1],
});
}
didn't fire because firstDataRequest is undefined, too. So never get the first candle and all others are undefined
I need to change container to container_id in main.js to avoid an error.
That's because tutorial is adapted to be used with the latest unstable charting library version (which is v19 at the time), I think we need to mark it somewhere in the docs...
When I try to find out what is happening, I see that lastDailyBar is undefined, and those lines
Can you please try with the latest unstable version? I think it's related because we've changed the API in v19 for requesting bars.
Thanks a lot! Seems working with unstable version. If I find other issues I will update.
@timocov could you please help: I added 1H and 4H to supported_resolutions, but they didn't work. Resolutions are added to the dropdown, but when I click it dropped back to 1D. Day, week and month resolution works ok. Did I do something wrong or do I need external conditions (like paid plan) to enable resolutions less than 1D? I checked that in tradingview chart demo 1h interval could be enabled, but I can't do this in my project.
Day, week and month resolution works ok. Did I do something wrong or do I need external conditions (like paid plan) to enable resolutions less than 1D?
Your symbols should support such resolutions, see https://github.com/tradingview/charting_library/wiki/Symbology#supported_resolutions