Class CrosshairOptions

    • Field Detail

      • DEFAULT_ENABLED

        public static final boolean DEFAULT_ENABLED
        Default enabled options, true.
        See Also:
        Constant Field Values
      • DEFAULT_LINE_COLOR_AS_STRING

        public static final String DEFAULT_LINE_COLOR_AS_STRING
        Default line color as string, HtmlColor.LIGHT_GRAY.
      • DEFAULT_LINE_WIDTH

        public static final int DEFAULT_LINE_WIDTH
        Default line width, 1.
        See Also:
        Constant Field Values
      • DEFAULT_LINE_DASH

        public static final List<Integer> DEFAULT_LINE_DASH
        Default line dash, [2, 2].
      • DEFAULT_LINE_DASH_OFFSET

        public static final double DEFAULT_LINE_DASH_OFFSET
        Default line dash offset, 0.0.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CrosshairOptions

        public CrosshairOptions()
        Builds the object with new java script object setting the default value of plugin.
        The global plugin options is used, if exists, as defaults values.
      • CrosshairOptions

        public CrosshairOptions​(IsChart chart)
        Builds the object with a chart instance in order to get the right defaults.
        If the plugin options have not been set by chart type, it will use the global.
        Parameters:
        chart - chart instance related to the plugin options
    • Method Detail

      • setEvents

        public void setEvents​(Event... events)
        Description copied from interface: HasEvents
        Sets the browser events that the chart should listen to.
        Specified by:
        setEvents in interface HasEvents
        Parameters:
        events - the browser events that the chart should listen to.
      • setEvents

        public void setEvents​(Set<Event> events)
        Description copied from interface: HasEvents
        Sets the browser events that the legend should listen to.
        Specified by:
        setEvents in interface HasEvents
        Parameters:
        events - the browser events that the legend should listen to.
      • getLabels

        public CrosshairLabels getLabels()
        Returns the labels utility to set the same value to all labels.
        Returns:
        the labels utility to set the same value to all labels
      • setEnabled

        public void setEnabled​(boolean enabled)
        Sets true if plugin is enabled.
        Parameters:
        enabled - true if plugin is enabled.
      • isEnabled

        public boolean isEnabled()
        Returns true if plugin is enabled.
        Returns:
        true if plugin is enabled.
      • setMode

        public void setMode​(InteractionAxis mode)
        Sets the interaction axis mode.
        Parameters:
        mode - the interaction axis mode
      • getMode

        public InteractionAxis getMode()
        Returns the interaction axis mode.
        Returns:
        the interaction axis mode
      • setLineColor

        public void setLineColor​(IsColor color)
        Sets the color of the line.
        Parameters:
        color - the color of the line.
      • setLineColor

        public void setLineColor​(String color)
        Sets the color of the line.
        Parameters:
        color - the color of the line.
      • getLineColorAsString

        public String getLineColorAsString()
        Returns the color of the line.
        Returns:
        the color of the line.
      • getLineColor

        public IsColor getLineColor()
        Returns the color of the line.
        Returns:
        the color of the line.
      • setLineWidth

        public void setLineWidth​(int lineWidth)
        Sets the width of the line.
        Parameters:
        lineWidth - the width of the line
      • getLineWidth

        public int getLineWidth()
        Sets the width of the line.
        Returns:
        the width of the line
      • setLineDash

        public void setLineDash​(int... lineDash)
        Sets the line dash pattern used when stroking lines, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.
        Parameters:
        lineDash - the line dash pattern used when stroking lines
      • getLineDash

        public List<Integer> getLineDash()
        Returns the line dash pattern used when stroking lines, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.
        Returns:
        the line dash pattern used when stroking lines
      • setLineDashOffset

        public void setLineDashOffset​(double lineDashOffset)
        Sets the line dash pattern offset.
        Parameters:
        lineDashOffset - Offset for line dashes.
      • getLineDashOffset

        public double getLineDashOffset()
        Returns the line dash pattern offset.
        Returns:
        Offset for line dashes.
      • setXScaleID

        public final void setXScaleID​(String scaleId)
        Sets the ID of the X scale to bind onto.
        Parameters:
        scaleId - the ID of the X scale to bind onto
      • setXScaleID

        public final void setXScaleID​(ScaleId scaleId)
        Sets the ID of the X scale to bind onto.
        Parameters:
        scaleId - the ID of the X scale to bind onto
      • getXScaleID

        public final ScaleId getXScaleID()
        Returns the ID of the X scale to bind onto.
        Returns:
        the ID of the X scale to bind onto
      • setYScaleID

        public final void setYScaleID​(String scaleId)
        Sets the ID of the Y scale to bind onto.
        Parameters:
        scaleId - the ID of the Y scale to bind onto
      • setYScaleID

        public final void setYScaleID​(ScaleId scaleId)
        Sets the ID of the Y scale to bind onto.
        Parameters:
        scaleId - the ID of the Y scale to bind onto
      • getYScaleID

        public final ScaleId getYScaleID()
        Returns the ID of the Y scale to bind onto.
        Returns:
        the ID of the Y scale to bind onto
      • setModifierKey

        public void setModifierKey​(ModifierKey modifierKey)
        Sets the modifier key to activate the crosshair.
        Parameters:
        modifierKey - the modifier key to activate the crosshair
      • getModifierKey

        public ModifierKey getModifierKey()
        Returns the modifier key to activate the crosshair.
        Returns:
        the modifier key to activate the crosshair