Lightweight Charts Version: 3.1.3
I am using your chart for the cryptocurrency trade application in Vue project but no matter what I get this error below is a sample code
There is no duplicated or null data.
import {createChart} from "lightweight-charts";
export default {
data() {
return {
chartProperties: {
width: 700,
height: 300,
timeScale: {
timeVisible: true,
secondsVisible: false
},
layout: {
//backgroundColor: '#262C49', //Dark Theme
//textColor: '#80859E',
fontSize: 12,
fontFamily: 'irsans ,Calibri'
}
},
chartData: [],
candleSeries: null,
}
}
mounted() {
let cdata = [
{
close: 22750.76
high: 22759.53
low: 22750.25
open: 22752.8
time: 1608635340
},
....
];
this.chartElement = document.getElementById('chart');
this.chartProperties.width = this.chartElement.offsetWidth;
this.chart = createChart(this.chartElement, this.chartProperties);
this.candleSeries = this.chart.addCandlestickSeries();
this.candleSeries.setData(cdata);
Actual behavior:
The chart is drawn with no candlestick
and repeated error of Uncaught Error: Value is null
jsfiddle
Lightweight Charts Version: 3.1.3
I am using your chart for the cryptocurrency trade application in Vue project but no matter what I get this error below is a sample code
There is no duplicated or null data.
import {createChart} from "lightweight-charts";
export default {
data() {
return {
chartProperties: {
width: 700,
height: 300,
timeScale: {
timeVisible: true,
secondsVisible: false
},
layout: {
//backgroundColor: '#262C49', //Dark Theme
//textColor: '#80859E',
fontSize: 12,
fontFamily: 'irsans ,Calibri'
}
},
chartData: [],
candleSeries: null,
}
}
mounted() {
let cdata = [
{
close: 22750.76
high: 22759.53
low: 22750.25
open: 22752.8
time: 1608635340
},
....
];
this.chartElement = document.getElementById('chart');
this.chartProperties.width = this.chartElement.offsetWidth;
this.chart = createChart(this.chartElement, this.chartProperties);
this.candleSeries = this.chart.addCandlestickSeries();
this.candleSeries.setData(cdata);
Actual behavior:
The chart is drawn with no candlestick
and repeated error of Uncaught Error: Value is null
jsfiddle
Share Improve this question edited Dec 22, 2020 at 12:24 Milad asked Dec 22, 2020 at 12:16 MiladMilad 8591 gold badge12 silver badges33 bronze badges 1- 2 Are you data ordered by time in asc order? – timocov Commented Dec 22, 2020 at 12:51
2 Answers
Reset to default 25If you get this error 99% chance that your data source has one of three problems
- part of the data is null
- there is duplication on data in timestamp
- my problem: data should be ordered by time in ASC order, not in desc.
if you're using an Object structure, aren't you forgetting the commas after adding a new element to the array?
let cdata = [
{ close: 22750.76, high: 22759.53, low: 22750.25, open: 22752.8, time: 1608635340, }, .... ]
because without the commas it seems to be a unique element in the object, which is not correct.