Closed AniketBhadane closed 1 year ago
Lightweight Charts doesn't support time
values in that format.
The supported formats are mentioned here: https://tradingview.github.io/lightweight-charts/docs/api#time
To get your example to work, you should use the native Date
constructor to convert that date string into a timestamp. Lightweight charts expects the timestamp to be in seconds, not milliseconds, so the value will need to be divided by 1000.
function convertDate(dateString) {
return new Date(dateString).valueOf() / 1000;
}
Here is a working example of your code: https://codesandbox.io/s/timestamps-dkqr2w
I get the following error for setData(data) statement:
Argument of type '{ time: number; open: number; high: number; low: number; close: number; }[]' is not assignable to parameter of type '(CandlestickData | WhitespaceData)[]'.
Type '{ time: number; open: number; high: number; low: number; close: number; }' is not assignable to type 'CandlestickData | WhitespaceData'.
Type '{ time: number; open: number; high: number; low: number; close: number; }' is not assignable to type 'CandlestickData'.
Lightweight Charts doesn't support
time
values in that format.The supported formats are mentioned here: https://tradingview.github.io/lightweight-charts/docs/api#time
To get your example to work, you should use the native
Date
constructor to convert that date string into a timestamp. Lightweight charts expects the timestamp to be in seconds, not milliseconds, so the value will need to be divided by 1000.function convertDate(dateString) { return new Date(dateString).valueOf() / 1000; }
Here is a working example of your code: https://codesandbox.io/s/timestamps-dkqr2w
I get the following error for setData(data) statement:
Argument of type '{ time: number; open: number; high: number; low: number; close: number; }[]' is not assignable to parameter of type '(CandlestickData | WhitespaceData)[]'.
Type '{ time: number; open: number; high: number; low: number; close: number; }' is not assignable to type 'CandlestickData | WhitespaceData'.
Type '{ time: number; open: number; high: number; low: number; close: number; }' is not assignable to type 'CandlestickData'.
I'm using Angular 13.2 I wish to plot 5 minute candlestick data. But it shows me only one interval 25 Jun '18 00:00:00 with all data on on this single interval.
I installed using.: npm install --save lightweight-charts --legacy-peer-deps
Lightweight Charts Version: ^3.8.0
Steps/code to reproduce:
Screenshots: