Hi guys, thanks for the hard work.
I am setting up a realtime graph based on the simple example I found on the web.
It used random data for y. A few hassles I am having is how to get the current system time on the xaxis.
I have tried %X, but it gives nothing close to actual system time. Also tried other combos but get really wierd outputs from 01/01/1970 repeated over and over again, to incrementing percentages, etc.
function getData() {
return Math.random();
}
var layout = {
xaxis: {
text: 'x Axis',
//autotick: true,
//tickformat: '%b %d %Y %H:%M:%S',
//tickformat: '%H:%M:%S',
type: "datetime",
},
//to display time formatted as hh:mm:ss}
yaxis: {
text: 'y Axis',
range: [0, 100],
},
};
Plotly.plot('chart',[{
y:[getData()],
type:'line'
}], layout);
var cnt = 0;
var rangecap = 500;
setInterval(function(){
Plotly.extendTraces('chart',{ y:[[getData()]]}, [0]);
cnt++;
},15);
<!-- 3600000 = 1 hour , 60000 - 1 minute-->
What I need is the xaxis to show the current system/device time, each hour marked out, each day marked out.
What am I doing incorrectly?
Also how can I add a second realtime data source to getData()? Siuch as…
function getData() {
return window.val0, window.val1;
}