Search in sources :

Example 1 with AxisRescaledEvent

use of com.vaadin.flow.component.charts.events.internal.AxisRescaledEvent in project flow-components by vaadin.

the class ConfigurationJSONSerializationTest method configurationJSONSerialization_configurationSerializedWithChangeListener_changeListenerNotSerialized.

@Test
public void configurationJSONSerialization_configurationSerializedWithChangeListener_changeListenerNotSerialized() {
    Configuration conf = new Configuration();
    conf.addChangeListener(new ConfigurationChangeListener() {

        @Override
        public void dataAdded(DataAddedEvent event) {
        // TODO Auto-generated method stub
        }

        @Override
        public void dataRemoved(DataRemovedEvent event) {
        // TODO Auto-generated method stub
        }

        @Override
        public void dataUpdated(DataUpdatedEvent event) {
        // TODO Auto-generated method stub
        }

        @Override
        public void itemSliced(ItemSlicedEvent event) {
        // TODO Auto-generated method stub
        }

        @Override
        public void seriesStateChanged(SeriesStateEvent event) {
        // TODO Auto-generated method stub
        }

        @Override
        public void seriesAdded(SeriesAddedEvent event) {
        // TODO Auto-generated method stub
        }

        @Override
        public void seriesChanged(SeriesChangedEvent event) {
        // TODO Auto-generated method stub
        }

        @Override
        public void axisRescaled(AxisRescaledEvent event) {
        // TODO Auto-generated method stub
        }

        @Override
        public void resetZoom(boolean redraw, boolean animate) {
        // TODO Auto-generated method stub
        }
    });
    assertEquals("{\"chart\":{\"styledMode\":false},\"plotOptions\":{},\"series\":[],\"exporting\":{\"enabled\":false}}", toJSON(conf));
}
Also used : AxisRescaledEvent(com.vaadin.flow.component.charts.events.internal.AxisRescaledEvent) SeriesAddedEvent(com.vaadin.flow.component.charts.events.internal.SeriesAddedEvent) SeriesStateEvent(com.vaadin.flow.component.charts.events.internal.SeriesStateEvent) Configuration(com.vaadin.flow.component.charts.model.Configuration) SeriesChangedEvent(com.vaadin.flow.component.charts.events.internal.SeriesChangedEvent) DataRemovedEvent(com.vaadin.flow.component.charts.events.internal.DataRemovedEvent) ConfigurationChangeListener(com.vaadin.flow.component.charts.events.internal.ConfigurationChangeListener) DataUpdatedEvent(com.vaadin.flow.component.charts.events.internal.DataUpdatedEvent) DataAddedEvent(com.vaadin.flow.component.charts.events.internal.DataAddedEvent) ItemSlicedEvent(com.vaadin.flow.component.charts.events.internal.ItemSlicedEvent) Test(org.junit.Test)

Example 2 with AxisRescaledEvent

use of com.vaadin.flow.component.charts.events.internal.AxisRescaledEvent in project flow-components by vaadin.

the class Configuration method fireAxesRescaled.

/**
 * Fires axis rescaled event.
 *
 * @param axis
 *            Axis that is the source of the event.
 * @param minimum
 *            New minimum.
 * @param maximum
 *            New maximum.
 * @param redraw
 *            Whether or not to redraw.
 * @param animate
 *            Whether or not to animate.
 */
@Override
public void fireAxesRescaled(Axis axis, Number minimum, Number maximum, boolean redraw, boolean animate) {
    // determine the dimension of the axis, either x or y
    AxisDimension axisType = getAxisDimension(axis);
    if (axisType != null) {
        int axisIndex = getAxisIndex(axisType, axis);
        AxisRescaledEvent event = new AxisRescaledEvent(axisType.getIndex(), axisIndex, minimum, maximum, redraw, animate);
        for (ConfigurationChangeListener listener : changeListeners) {
            listener.axisRescaled(event);
        }
    }
}
Also used : AxisRescaledEvent(com.vaadin.flow.component.charts.events.internal.AxisRescaledEvent) ConfigurationChangeListener(com.vaadin.flow.component.charts.events.internal.ConfigurationChangeListener)

Aggregations

AxisRescaledEvent (com.vaadin.flow.component.charts.events.internal.AxisRescaledEvent)2 ConfigurationChangeListener (com.vaadin.flow.component.charts.events.internal.ConfigurationChangeListener)2 DataAddedEvent (com.vaadin.flow.component.charts.events.internal.DataAddedEvent)1 DataRemovedEvent (com.vaadin.flow.component.charts.events.internal.DataRemovedEvent)1 DataUpdatedEvent (com.vaadin.flow.component.charts.events.internal.DataUpdatedEvent)1 ItemSlicedEvent (com.vaadin.flow.component.charts.events.internal.ItemSlicedEvent)1 SeriesAddedEvent (com.vaadin.flow.component.charts.events.internal.SeriesAddedEvent)1 SeriesChangedEvent (com.vaadin.flow.component.charts.events.internal.SeriesChangedEvent)1 SeriesStateEvent (com.vaadin.flow.component.charts.events.internal.SeriesStateEvent)1 Configuration (com.vaadin.flow.component.charts.model.Configuration)1 Test (org.junit.Test)1