Class DataPointTooltip


  • public class DataPointTooltip
    extends AbstractDataFormattingPlugin
    A tool tip label appearing next to the mouse cursor when placed over a data point's symbol. If symbols are not created/shown for given plot, the tool tip is shown for the closest data point that is within the pickingDistanceProperty() from the mouse cursor.

    CSS style class name: "chart-datapoint-tooltip-label"

    TODO: extend so that label = new Label(); is a generic object and can also be overwritten with another implementation (<-> advanced interactor) additional add/remove listener are needed to edit/update the custom object based on DataPoint (for the time being private class)

    Author:
    Grzegorz Kruk
    • Field Detail

      • STYLE_CLASS_LABEL

        public static final java.lang.String STYLE_CLASS_LABEL
        Name of the CSS class of the tool tip label.
        See Also:
        Constant Field Values
      • DEFAULT_PICKING_DISTANCE

        public static final int DEFAULT_PICKING_DISTANCE
        The default distance between the data point coordinates and mouse cursor that triggers showing the tool tip label.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DataPointTooltip

        public DataPointTooltip()
        Creates a new instance of DataPointTooltip class with {picking distance initialized to 5.
      • DataPointTooltip

        public DataPointTooltip​(double pickingDistance)
        Creates a new instance of DataPointTooltip class.
        Parameters:
        pickingDistance - the initial value for the pickingDistance property
    • Method Detail

      • getDataLabelSafe

        protected java.lang.String getDataLabelSafe​(de.gsi.dataset.DataSet dataSet,
                                                    int index)
      • getDefaultDataLabel

        protected java.lang.String getDefaultDataLabel​(de.gsi.dataset.DataSet dataSet,
                                                       int index)
        Returns label of a data point specified by the index. The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.
        Parameters:
        dataSet - the given DataSet
        index - data point index within the DataSet
        Returns:
        label of a data point specified by the index or null if none label has been specified for this data point.
      • getPickingDistance

        public final double getPickingDistance()
        Returns the value of the pickingDistanceProperty().
        Returns:
        the current picking distance
      • pickingDistanceProperty

        public final javafx.beans.property.DoubleProperty pickingDistanceProperty()
        Distance of the mouse cursor from the data point (expressed in display units) that should trigger showing the tool tip. By default initialized to 5.
        Returns:
        the picking distance property
      • setPickingDistance

        public final void setPickingDistance​(double distance)
        Sets the value of pickingDistanceProperty().
        Parameters:
        distance - the new picking distance