I'm sure the fix is already in the pipe, but for those of you who are impatient, here's what you'll have to do :
Original code (in the function nativeRenderChart) :
// Add in GWT interceptor callback functions for the various series point event handlersfor(vartype3inpointEventHandlerFlags){if(type3.indexOf("gwt")<0&&pointEventHandlerFlags[type3]){options.plotOptions=options.plotOptions||{};options.plotOptions.series=options.plotOptions.series||{};options.plotOptions.series.point=options.plotOptions.series.point||{};options.plotOptions.series.point.events=options.plotOptions.series.point.events||{};varpointEventType=type3;options.plotOptions.series.point.events[type3]=function(e){returnself.@org.moxieapps.gwt.highcharts.client.BaseChart::pointEventCallback(Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;)(this,e,pointEventType);}}}
What's wrong with this code is the way the pointEventType is passed to the function. Basically, by the moment the callbacks are called, the pointEventType will be the same for all of them (that is, the last value of the loop). I'm an absolute noob by no means an expert in javascript, so if you wanna understand why this happens, please follow this link.
So here's how it would be fixed in our case :
// Add in GWT interceptor callback functions for the various series point event handlersfor(vartype3inpointEventHandlerFlags){if(type3.indexOf("gwt")<0&&pointEventHandlerFlags[type3]){options.plotOptions=options.plotOptions||{};options.plotOptions.series=options.plotOptions.series||{};options.plotOptions.series.point=options.plotOptions.series.point||{};options.plotOptions.series.point.events=options.plotOptions.series.point.events||{};options.plotOptions.series.point.events[type3]=(function(type){returnfunction(event){returnself.@org.moxieapps.gwt.highcharts.client.BaseChart::pointEventCallback(Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;)(this,event,type);}})(type3);}}
You'll have to make this kind of change at several places in the nativeRenderChart method.
Last edit: Kombucha 2011-09-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to figure out how to add my own PointClickEventHandler onto a series of "flags" which are displayed "onAxis". It appears that this code you provided has been included in V1.4.0 (though I am not sure).
Right now I have the following code and it does NOT work... I haven't made any changes to BaseChart or anything in nativeRenderChart...
Series flagSeries = createSeries().setName("Events");
flagSeries.setPlotOptions(
new SeriesPlotOptions().setPointClickEventHandler( new PointClickEventHandler() {
@Override
public boolean onClick(PointClickEvent pointClickEvent) {
Window.alert("We got a click - yeah ");
return true;
}
})
);
Any idea on what I'm doing wrong??
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm sure the fix is already in the pipe, but for those of you who are impatient, here's what you'll have to do :
Original code (in the function nativeRenderChart) :
What's wrong with this code is the way the pointEventType is passed to the function. Basically, by the moment the callbacks are called, the pointEventType will be the same for all of them (that is, the last value of the loop). I'm
an absolute noobby no means an expert in javascript, so if you wanna understand why this happens, please follow this link.So here's how it would be fixed in our case :
You'll have to make this kind of change at several places in the nativeRenderChart method.
Last edit: Kombucha 2011-09-21
I'm trying to figure out how to add my own PointClickEventHandler onto a series of "flags" which are displayed "onAxis". It appears that this code you provided has been included in V1.4.0 (though I am not sure).
Right now I have the following code and it does NOT work... I haven't made any changes to BaseChart or anything in nativeRenderChart...
Any idea on what I'm doing wrong??