1
我正在使用dygraph來監視CSV文件並使用動態更新功能。當我將鼠標懸停在圖表上以顯示圖例中的曲線值時,只要圖形更新就會消失,這有點煩人。Dygraph動態更新圖例值消失
<html>
<head>
<script type="text/javascript" src="/static/dygraph-combined.js"></script></head>
<body>
<div id="psu"></div>
<script type="text/javascript">
g = new Dygraph(document.getElementById("psu"), "/data/psu",
{
legend: 'always',
hideOverlayOnMouseOut: false,
ylabel: 'current (A)',
height: 480,
width: 640,
sigFigs: 2,
title: 'power interface monitor',
xValueFormatter: Dygraph.dateString_,
xAxisLabelFormatter: Dygraph.dateString_,
xTicker: Dygraph.dateTicker
});
window.intervalId = setInterval(function(){g.updateOptions({ 'file': "/data/psu" }); }, 1000);
</script>
</html>
所以圖是所有正確顯示和數據更新,只有傳說值消失後刷新圖與g.updateOptions()
。我在想也許我可以在g.updateOptions()
之後重新觸發某種"mouseover"
事件,所以這些值會回來,但可能會有更清晰的方式。
謝謝。