グラフの凡例は、plotpan
イベントが発生するたびにのみ発生します。これが私のupdateLegend
関数で、プログラムはもちろんトレースメッセージを使用して入っていると確信しています
ただし、機能を含めてから凡例が更新されるのは、aが発生plotpan
した直後だけです。plotpan
何が原因なのかわからないので、問題に対処できません。次の分離されたコード セグメントよりも役立つ JSFiddle を次に示します。
var updateLegendTimeout = null;
var latestPosition = null;
function updateLegend(){
var series = (plot.getData())[0];
legends.eq(0).text(series.label ="x: " + (local_x)+" y: "+ (local_y));
}
placeholder.bind("plothover", function (event, pos, item) {
if (item){
local_x = item.datapoint[0].toFixed(2);
local_y = item.datapoint[1].toFixed(2);
console.log("x:" + local_x + ", " + "y:" + local_y);
}
if (!updateLegendTimeout){
updateLegendTimeout = setTimeout(updateLegend, 50);
updateLegendTimeout = null;
}
});