Chapter 11 : Events

The API triggers events letting you know how some settings of the chart changes due to mouse and keyboard controllers, or animation taking place.

View events

View point changed

One may register a IViewPointListener to get notified by a ViewPointChangedEvent once the viewpoint changes:

chart.getView().addViewPointChangedListener(new IViewPointChangedListener() {
  public void viewPointChanged(ViewPointChangedEvent e) {
    System.out.println("viewpoint changed to " + e.getViewPoint());

View point reached top or bottom

To know that the user moved the chart to a top or bottom view. To get such notification:

chart.getView().addViewOnTopEventListener(new IViewIsVerticalEventListener() {
  public void viewVerticalReached(ViewIsVerticalEvent e) {
    System.out.println("view from top or bottom");

  public void viewVerticalLeft(ViewIsVerticalEvent e) {
    System.out.println("left top or bottom");

Controller events

A mouse controller is able to notify its listeners that it performed a view change. Indeed, adding a ControllerEventListener let you receive events with informations on the kind of changed value, and the new value:

mouse.addControllerEventListener(new ControllerEventListener() {
  public void controllerEventFired(ControllerEvent e) {
    System.out.println(e.getType + " " + e.getValue()); }

Where type is a ControllerType that may either be ROTATE, ZOOM, SCALE, or PAN.

Drawable events

One may receive notifications concerning a drawable object property change.

scatter.addDrawableListener(new IDrawableListener(){
  public void drawableChanged(DrawableChangedEvent e) {
      case DrawableChangedEvent.FIELD_COLOR: ... break;
      case DrawableChangedEvent.FIELD_DATA: ... break;
      case DrawableChangedEvent.FIELD_DISPLAYED: ... break;
      case DrawableChangedEvent.FIELD_METADATA: ... break;
      case DrawableChangedEvent.FIELD_TRANSFORM: ... break;