time format deprecated issue
See original GitHub issueHi, i would like to reopen the issue thats going on in this thread. https://github.com/chartjs/Chart.js/issues/6677
i found out that these warning pops out every 10milisec? when i use the below plugins.
【warnings poping out】
time scale: "time.format" is deprecated. Please use "time.parser" instead
since it pops out in high rate, the memory will be decreased, leading huge lag.
【plugins that makes warning】 ①chart.js 2.9.3 ②chart.js financial plugin ③chart.js streaming plugin 1.8.0
I have made a quick sample html here. http://aifx2.sakura.ne.jp/realtimecharttest2.html
please kindly confirm.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<head>
<script src="https://cdn.jsdelivr.net/npm/moment@2.24.0/min/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3"></script>
<script src="https://www.chartjs.org/chartjs-chart-financial/chartjs-chart-financial.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-streaming@1.8.0"></script>
</head>
<body>
<div>
<canvas id="myChart"></canvas>
</div>
</body>
<script>
var past = {t:Date.now()-20000, o:87, h: 101, l: 78, c: 100};
var past2 = {t:Date.now()-40000, o:87, h: 101, l: 78, c: 100}
console.log(past);
var ask = Math.random();
setInterval(function () {
annotationx= Date.now();
annotationy = 90;
return annotationx;
return annotationy;
}, 10000);
function onRefresh(chart) {
var t = Date.now();
var data2 = chart.data.datasets[0].data;
var last;
t -= t % 1000;
if (data2.length === 0) {
data2.push(past);
data2.push(past2);
}
last = data2[data2.length - 1];
if (t != last.t) {
var c = last.c;
last = { t: t, o: c, h: c, l: c, c: c };
data2.push(last);
}
last.c += Math.random() - 0.5;
last.h = Math.max(last.h, last.c);
last.l = Math.min(last.l, last.c);
}
var config = {
type: 'candlestick',
data: {
datasets: [
{
data: [],
fractionalDigitsCount: 2
},
]
},
options: {
title: {
display: true,
text: 'Financial chart sample'
},
legend: {
display: false,
},
scales: {
xAxes: [{
type: 'realtime',
realtime: {
duration: 120000,
refresh: 100,
delay: 0,
onRefresh: onRefresh
}
}]
},
tooltips: {
position: 'nearest',
intersect: false
},
animation: {
duration: 0
}
}
};
window.onload = function() {
var ctx = document.getElementById('myChart').getContext('2d');
window.myChart = new Chart(ctx, config);
};
</script>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Chartjs error : time scale: "time.format" is deprecated. Please ...
The problem is due to incompatible versions of the different libraries you're using. The documentation of chartjs-plugin-streaming for ...
Read more >Developers - time format deprecated issue - - Bountysource
Hi, i would like to reopen the issue thats going on in this thread. ... i found out that these warning pops out...
Read more >PHP 8.1: strftime and gmstrftime functions are deprecated
In PHP 8.1 and later, strftime and gmstrftime are deprecated, and using them emits a deprecation notice. These functions will be removed in...
Read more >Warning: Date.prototype.toLocaleFormat is deprecated
The JavaScript warning "Date.prototype.toLocaleFormat is deprecated; consider using Intl.DateTimeFormat instead" occurs when the non-standard Date.prototype ...
Read more >DATE TIME DATE STORAGE FORMAT is Deprecated - Drupal
In Drupal 8.5.x and will be removed before Drupal 9.0.x. Use \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::DATE_STORAGE_FORMAT ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey, i found the solution, just change the time.format to time.parser and it will fix your issue, I mean from the chart JS options where it is type: “time”, time: { format: “MM/DD/YY”, tooltipFormat: “ll”, }, change the bold word “format” to parser and that’s it.
I think you can work around this by setting the
time.format
toundefined
.