Search in sources :

Example 1 with XAxesExtremesChangeEvent

use of com.vaadin.addon.charts.XAxesExtremesChangeEvent in project charts by vaadin.

the class ServerSideEvents method addEventListeners.

private Layout addEventListeners() {
    eventListeners = new VerticalLayout();
    eventListeners.setCaption("Event listeners:");
    final ChartClickListener listener = new ChartClickListener() {

        @Override
        public void onClick(ChartClickEvent event) {
            logEvent(event);
        }
    };
    addToggleForListener("Chart click", "ChartClick", new ListenerToggle() {

        @Override
        public void add() {
            chart.addChartClickListener(listener);
        }

        @Override
        public void remove() {
            chart.removeChartClickListener(listener);
        }
    });
    final PointClickListener pcListener = new PointClickListener() {

        @Override
        public void onClick(PointClickEvent event) {
            logEvent(event);
        }
    };
    addToggleForListener("Point click", "PointClick", new ListenerToggle() {

        @Override
        public void add() {
            chart.addPointClickListener(pcListener);
        }

        @Override
        public void remove() {
            chart.removePointClickListener(pcListener);
        }
    });
    final CheckboxClickListener cbListener = new CheckboxClickListener() {

        @Override
        public void onClick(CheckboxClickEvent event) {
            logEvent(event);
        }
    };
    addToggleForListener("Checkbox click", "CheckboxClick", new ListenerToggle() {

        @Override
        public void add() {
            chart.addCheckBoxClickListener(cbListener);
        }

        @Override
        public void remove() {
            chart.removeCheckBoxClickListener(cbListener);
        }
    });
    final LegendItemClickListener legendItemListener = new LegendItemClickListener() {

        @Override
        public void onClick(LegendItemClickEvent event) {
            logEvent(event);
        }
    };
    addToggleForListener("Legend item click", "LegendItemClick", new ListenerToggle() {

        @Override
        public void add() {
            chart.addLegendItemClickListener(legendItemListener);
            visibilityToggling.setValue(true);
        }

        @Override
        public void remove() {
            chart.removeLegendItemClickListener(legendItemListener);
        }
    });
    final SeriesHideListener hideListener = new SeriesHideListener() {

        @Override
        public void onHide(SeriesHideEvent event) {
            logEvent(event);
        }
    };
    addToggleForListener("Series hide", "SeriesHide", new ListenerToggle() {

        @Override
        public void add() {
            chart.addSeriesHideListener(hideListener);
        }

        @Override
        public void remove() {
            chart.removeSeriesHideListener(hideListener);
        }
    });
    final SeriesShowListener show = new SeriesShowListener() {

        @Override
        public void onShow(SeriesShowEvent event) {
            logEvent(event);
        }
    };
    addToggleForListener("Series show", "SeriesShow", new ListenerToggle() {

        @Override
        public void add() {
            chart.addSeriesShowListener(show);
        }

        @Override
        public void remove() {
            chart.removeSeriesShowListener(show);
        }
    });
    final XAxesExtremesChangeListener xaxesListener = new XAxesExtremesChangeListener() {

        @Override
        public void onXAxesExtremesChange(XAxesExtremesChangeEvent event) {
            logEvent(event);
        }
    };
    addToggleForListener("XAxes extremes change", "XAxesExtremes", new ListenerToggle() {

        @Override
        public void add() {
            chart.addXAxesExtremesChangeListener(xaxesListener);
        }

        @Override
        public void remove() {
            chart.removeXAxesExtremesChangeListener(xaxesListener);
        }
    });
    final YAxesExtremesChangeListener yaxesListener = new YAxesExtremesChangeListener() {

        @Override
        public void onYAxesExtremesChange(YAxesExtremesChangeEvent event) {
            logEvent(event);
        }
    };
    addToggleForListener("Y axes extremes change", "YAxesExtremes", new ListenerToggle() {

        @Override
        public void add() {
            chart.addYAxesExtremesChangeListener(yaxesListener);
        }

        @Override
        public void remove() {
            chart.removeYAxesExtremesChangeListener(yaxesListener);
        }
    });
    final PointSelectListener selectListener = new PointSelectListener() {

        @Override
        public void onSelect(PointSelectEvent event) {
            logEvent(event);
        }
    };
    addToggleForListener("Point select", "PointSelect", new ListenerToggle() {

        @Override
        public void add() {
            chart.addPointSelectListener(selectListener);
        }

        @Override
        public void remove() {
            chart.removePointSelectListener(selectListener);
        }
    });
    final PointUnselectListener unselectListener = new PointUnselectListener() {

        @Override
        public void onUnselect(PointUnselectEvent event) {
            logEvent(event);
        }
    };
    addToggleForListener("Point unselect", "PointUnselect", new ListenerToggle() {

        @Override
        public void add() {
            chart.addPointUnselectListener(unselectListener);
        }

        @Override
        public void remove() {
            chart.removePointUnselectListener(unselectListener);
        }
    });
    return eventListeners;
}
Also used : LegendItemClickListener(com.vaadin.addon.charts.LegendItemClickListener) PointSelectEvent(com.vaadin.addon.charts.PointSelectEvent) PointUnselectListener(com.vaadin.addon.charts.PointUnselectListener) SeriesShowEvent(com.vaadin.addon.charts.SeriesShowEvent) CheckboxClickListener(com.vaadin.addon.charts.CheckboxClickListener) SeriesHideListener(com.vaadin.addon.charts.SeriesHideListener) PointClickEvent(com.vaadin.addon.charts.PointClickEvent) SeriesShowListener(com.vaadin.addon.charts.SeriesShowListener) PointSelectListener(com.vaadin.addon.charts.PointSelectListener) PointUnselectEvent(com.vaadin.addon.charts.PointUnselectEvent) XAxesExtremesChangeListener(com.vaadin.addon.charts.XAxesExtremesChangeListener) ChartClickEvent(com.vaadin.addon.charts.ChartClickEvent) ChartClickListener(com.vaadin.addon.charts.ChartClickListener) YAxesExtremesChangeEvent(com.vaadin.addon.charts.YAxesExtremesChangeEvent) XAxesExtremesChangeEvent(com.vaadin.addon.charts.XAxesExtremesChangeEvent) LegendItemClickEvent(com.vaadin.addon.charts.LegendItemClickEvent) CheckboxClickEvent(com.vaadin.addon.charts.CheckboxClickEvent) PointClickListener(com.vaadin.addon.charts.PointClickListener) VerticalLayout(com.vaadin.ui.VerticalLayout) SeriesHideEvent(com.vaadin.addon.charts.SeriesHideEvent) YAxesExtremesChangeListener(com.vaadin.addon.charts.YAxesExtremesChangeListener)

Aggregations

ChartClickEvent (com.vaadin.addon.charts.ChartClickEvent)1 ChartClickListener (com.vaadin.addon.charts.ChartClickListener)1 CheckboxClickEvent (com.vaadin.addon.charts.CheckboxClickEvent)1 CheckboxClickListener (com.vaadin.addon.charts.CheckboxClickListener)1 LegendItemClickEvent (com.vaadin.addon.charts.LegendItemClickEvent)1 LegendItemClickListener (com.vaadin.addon.charts.LegendItemClickListener)1 PointClickEvent (com.vaadin.addon.charts.PointClickEvent)1 PointClickListener (com.vaadin.addon.charts.PointClickListener)1 PointSelectEvent (com.vaadin.addon.charts.PointSelectEvent)1 PointSelectListener (com.vaadin.addon.charts.PointSelectListener)1 PointUnselectEvent (com.vaadin.addon.charts.PointUnselectEvent)1 PointUnselectListener (com.vaadin.addon.charts.PointUnselectListener)1 SeriesHideEvent (com.vaadin.addon.charts.SeriesHideEvent)1 SeriesHideListener (com.vaadin.addon.charts.SeriesHideListener)1 SeriesShowEvent (com.vaadin.addon.charts.SeriesShowEvent)1 SeriesShowListener (com.vaadin.addon.charts.SeriesShowListener)1 XAxesExtremesChangeEvent (com.vaadin.addon.charts.XAxesExtremesChangeEvent)1 XAxesExtremesChangeListener (com.vaadin.addon.charts.XAxesExtremesChangeListener)1 YAxesExtremesChangeEvent (com.vaadin.addon.charts.YAxesExtremesChangeEvent)1 YAxesExtremesChangeListener (com.vaadin.addon.charts.YAxesExtremesChangeListener)1