I am using Chartjs for my project. Different versions I am using are: ChartJS 2.9.3, Chartjs-plugin-streaming 1.8.0, moment.js 2.24.0,chartjs-adapter-moment 0.1.1. I plotting a realtime chart and I get this warning every second which is filling memory very fast.
time scale: "time.format" is deprecated. Please use "time.parser" instead
My code is:
private chartPlotting() {
this.Linecap.push(new Chart('canvas', {
type: 'line',
data: {
datasets: [{
label: 'Flow',
lineTension: 0,
data: [],
borderColor: '#3cb371',
fill: false
},
{
label: 'Height',
lineTension: 0,
data: [],
borderColor: '#FF0000',
fill: false
}
]
},
options: {
responsive: true,
scales: {
xAxes: [{
type: 'realtime',
time: {
parser: 'false'
},
display: true
}],
yAxes: [{
display: true,
ticks: {
beginAtZero: true,
maxTicksLimit: 10,
stepSize: 5,
max: 500
}
}],
},
plugins: {
streaming: {
duration: 300000,
refresh: 1000,
delay: 2000,
pause: false,
ttl: undefined,
frameRate: 48,
onRefresh: function (Linecap) {
///var data = []
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onload = function () {
var data = JSON.parse(xhr.responseText);
Linecap.data.datasets[0].data.push({
x: Date.now(),
y: data[0]["yrData"]
});
Linecap.data.datasets[1].data.push({
x: Date.now(),
y: data[0]["Height"]
});
};
}
}
}
}
}));
}
I tried to find out reason for this and came to know that may be in next version of chartJS i.e. 3.0.0 this problem will be removed. Is there any work around for getting rid of this error in 2.9.3?