com.vaadin.flow.component.charts.events.

Class PointDropEvent

java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ComponentEvent<Chart>
com.vaadin.flow.component.charts.events.PointDropEvent

All Implemented Interfaces:

HasItem, HasSeries, Serializable

@DomEvent("point-drop") public class PointDropEvent extends ComponentEvent<Chart> implements HasItem

Fired when the point is dropped.

See Also:

  • Constructor Details

    • PointDropEvent

      public PointDropEvent(Chart source, boolean fromClient, @EventData("event.detail.originalEvent.target.series.index") int seriesIndex, @EventData("event.detail.originalEvent.target.index") int pointIndex, @EventData("event.detail.originalEvent.target.id") String pointId, @EventData("event.detail.originalEvent.target.category") String category, @EventData("event.detail.originalEvent.target.start") Double start, @EventData("event.detail.originalEvent.target.end") Double end, @EventData("event.detail.originalEvent.target.parent") String parent, @EventData("event.detail.originalEvent.target.x") Double x, @EventData("event.detail.originalEvent.target.y") Double y)
  • Method Details

    • getCategory

      public String getCategory()

      Specified by:

      getCategory in interface HasItem

    • getItemIndex

      public int getItemIndex()

      Description copied from interface: HasItem

      Returns the index of the series item, that is associated with this event, in HasSeries.getSeries(). Can be used to identify the item within the series.

      Example for ListSeries:

       int itemIndex = event.getItemIndex();
       ListSeries series = (ListSeries) event.getSeries();
       Number datum = series.getData()[itemIndex];
       

      Specified by:

      getItemIndex in interface HasItem

      Returns:

      the index of the item in the series

      See Also:

    • getItemId

      public String getItemId()

      Description copied from interface: HasItem

      The ID of the series item that is associated with the event. Can be used to identify the item within the series.

      Example for NodeSeries:

       String id = this.getItemId();
       NodeSeries series = (NodeSeries) this.getSeries();
       Optional<Node> nodeForId = series.getNodes().stream()
               .filter(node -> node.getId().equals(id)).findFirst();
       

      Only AbstractSeriesItem and Node support setting an ID. For other types of series items this property will always return null. For AbstractSeriesItem the ID is optional. Unless the developer has explicitly set an ID for the item associated with the event, this property will be null. See HasItem.getItem() or HasItem.getItemIndex() for alternatives.

      Specified by:

      getItemId in interface HasItem

      Returns:

      the ID of the series item associated with the event, or null if the series item has no ID

      See Also:

    • getSeriesItemIndex

      public int getSeriesItemIndex()

      Description copied from interface: HasSeries

      Returns the index of the series

      Specified by:

      getSeriesItemIndex in interface HasSeries

      Returns:

    • getStart

      public Instant getStart()

      Returns:

      Supported only in Gantt charts: Returns the start date of the point at the moment the point was dropped.

    • getEnd

      public Instant getEnd()

      Returns:

      Supported only in Gantt charts: Returns the end date of the point at the moment the point was dropped.

    • getParent

      public String getParent()

      Returns:

      Returns the parent id of the point at the moment the Drag event was fired.

    • getxValue

      public Double getxValue()

      Returns:

      Returns the x value of the point at the moment the dragging started.

    • getyValue

      public Double getyValue()

      Returns:

      Returns the y value of the point at the moment the dragging started.