Reputation: 859
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
Upvotes: 7
Views: 6092
Reputation: 13
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.
Upvotes: -1
Reputation: 859
If you get this error 99% chance that your data source has one of three problems
Upvotes: 25