You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$(document).ready(function() {
var gs = [];
var blockRedraw = false;
for (var i = 1; i <= 4; i++) {
gs.push(
new Dygraph(
document.getElementById("div" + i),
getData(), {
rollPeriod: 7,
labels:['time', 'count1', 'count2'],
}
)
);
}
var sync = Dygraph.synchronize(gs);
function getData() {
var current = new Date();
var data = [];
for (var i = 0; i < 100; i ++){
data.push([new Date(current.getTime() + i * 1000), Math.random() * 100, Math.random() * 100])
}
return data;
}
setInterval(() => {
for (var i = 0; i <= 4; i++) {
var g = gs[i];
g.updateOptions({'file': getData()})
}
}, 3000);
function update() {
var zoom = document.getElementById('chk-zoom').checked;
var selection = document.getElementById('chk-selection').checked;
sync.detach();
sync = Dygraph.synchronize(gs, {
zoom: zoom,
selection: selection
});
}
$('#chk-zoom, #chk-selection').change(update);
}
);
after run 1 min the charts is
The text was updated successfully, but these errors were encountered:
As far as I can tell, the problem here is: when new data comes in, the synchroniser keeps the x axis range static instead of allowing dygraphs to recalculate that.
jsfiddle demo
main code
after run 1 min the charts is
The text was updated successfully, but these errors were encountered: