-
Notifications
You must be signed in to change notification settings - Fork 48
Highcharts Feature: Responding to Zoom Events via AJAX
Alexander Nedomansky edited this page Mar 27, 2018
·
1 revision
Supported by:
Highcharts and Wicked Charts support zooming (see ChartOptions.setZoomType()). The user may select a portion of the x or y axis of a chart.
Highcharts provides the selection event to hook into and respond to the selection the user made (see http://api.highcharts.com/highcharts#chart.events.selection). Wicked Charts provides the SelectionFunction to respond to this event on the server side.
The SelectionFunction must be added to the selection Event of the ChartOptions as follows:
chartOptions
.setEvents(new Events()
.setSelection(new SelectionFunction(this) {
@Override
public void onSelect(final SelectionEvent event) {
// do whatever you want with the
// data provided in the event
}
}));
Using Wicket 6, you can also access the Wicket AjaxRequestTarget on the server side to implement partial page updates. You simply have to cast the SelectionEvent to WicketSelectionEvent as follows:
events.setSelection(new SelectionFunction(options){
@Override
public void onSelect(SelectionEvent event) {
WicketSelectionEvent wicketEvent = (WicketSelectionEvent) event;
AjaxRequestTarget target = wicketEvent.getAjaxRequestTarget();
// re-render some component
target.add(...);
}
}