2

When fire a click on a serie, I get the next error : Uncaught TypeError: Property 'firePointEvent' of object # is not a function.

In Highstock.js v1.3.1 (2013-04-15) on line 9575 :

// the series click event
fireEvent(hoverPoint.series, 'click', extend(e, {
    point: hoverPoint
}));

Until there, hoverPoint exist and have real values, but don't have yet firePointEvent method.

// the point click event
hoverPoint.firePointEvent('click', e);

On this next line, hoverPoint still exist and do have a firePointEvent method, but all its attributes are null. So it throws the error :/

What's the problem here?


@vishal_aim is correct.

The way you'd have two different variables affected is creating two instances of either the PVector class or a wrapper (character) class that serialEvent can see and then passing values you receive from the serialEvent into the two instances.

Also, I'm not totally sure but I don't think you can make serialEvent return a value as it is attached void serialEvent is called from within the serial module of Processing.

4

1 に答える 1

2

この問題を再現できました。この fiddleで確認できます 。

  1. チャートの背景をクリックします (線が削除されます)
  2. 次にシリーズをクリックします(ラインが戻ってきてエラーが発生します)

クリック イベントと更新プロセスが同じ呼び出しで発生しないように、少しタイムアウトを設定する必要があります。

これupdate()により、hoverPointオブジェクトが変更され、firePointEventプロパティがnullプロセスの最後になると思います。

ここで回避策:(JSFiddleはこちら

plotOptions: {
        series: {
            events: {
                click: function(event) {
                    var that = this;
                    setTimeout( function(){
                        that.update({
                            lineWidth: 1,
                        });
                    }, 20);

                }
            }
        }
},
于 2013-05-20T14:21:40.030 に答える