Class CrosshairOptionsBuilder

  • All Implemented Interfaces:
    IsBuilder

    public final class CrosshairOptionsBuilder
    extends AbstractBaseBuilder
    Comfortable object to create Crosshair.ID plugin options by a builder.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • create

        public static CrosshairOptionsBuilder create()
        Returns new builder instance.
        Returns:
        new builder instance
      • create

        public static CrosshairOptionsBuilder create​(IsChart chart)
        Returns new builder instance using the chart global options.
        Parameters:
        chart - chart instance related to the plugin options
        Returns:
        new builder instance
      • build

        public CrosshairOptions build()
        Returns a configured plugin options.
        Returns:
        a configured plugin options.
      • setEnabled

        public CrosshairOptionsBuilder setEnabled​(boolean enabled)
        Sets true if plugin is enabled.
        Parameters:
        enabled - true if plugin is enabled.
        Returns:
        new builder instance
      • setGroup

        public CrosshairOptionsBuilder setGroup​(String group)
        Sets the group name used to synchronized more chart instances.
        Parameters:
        group - the group name used to synchronized more chart instances
        Returns:
        new builder instance
      • setLineColor

        public CrosshairOptionsBuilder setLineColor​(IsColor color)
        Sets the color of the line.
        Parameters:
        color - the color of the line.
        Returns:
        new builder instance
      • setLineColor

        public CrosshairOptionsBuilder setLineColor​(String color)
        Sets the color of the line.
        Parameters:
        color - the color of the line.
        Returns:
        new builder instance
      • setLineWidth

        public CrosshairOptionsBuilder setLineWidth​(int lineWidth)
        Sets the width of the line.
        Parameters:
        lineWidth - the width of the line
        Returns:
        new builder instance
      • setLineDash

        public CrosshairOptionsBuilder 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
        Returns:
        new builder instance
      • setLineDashOffset

        public CrosshairOptionsBuilder setLineDashOffset​(double lineDashOffset)
        Sets the line dash pattern offset.
        Parameters:
        lineDashOffset - Offset for line dashes.
        Returns:
        new builder instance
      • setXScaleID

        public CrosshairOptionsBuilder setXScaleID​(String scaleId)
        Sets the ID of the X scale to bind onto.
        Parameters:
        scaleId - the ID of the X scale to bind onto
        Returns:
        new builder instance
      • setXScaleID

        public CrosshairOptionsBuilder setXScaleID​(ScaleId scaleId)
        Sets the ID of the X scale to bind onto.
        Parameters:
        scaleId - the ID of the X scale to bind onto
        Returns:
        new builder instance
      • setYScaleID

        public CrosshairOptionsBuilder setYScaleID​(String scaleId)
        Sets the ID of the Y scale to bind onto.
        Parameters:
        scaleId - the ID of the Y scale to bind onto
        Returns:
        new builder instance
      • setYScaleID

        public CrosshairOptionsBuilder setYScaleID​(ScaleId scaleId)
        Sets the ID of the Y scale to bind onto.
        Parameters:
        scaleId - the ID of the Y scale to bind onto
        Returns:
        new builder instance
      • setModifierKey

        public CrosshairOptionsBuilder setModifierKey​(ModifierKey modifierKey)
        Sets the modifier key to activate the crosshair.
        Parameters:
        modifierKey - the modifier key to activate the crosshair
        Returns:
        new builder instance
      • setXLabelDisplay

        public CrosshairOptionsBuilder setXLabelDisplay​(boolean display)
        Sets, for X label, true if label will be applied in the chart, otherwise false.
        Parameters:
        display - true if label will be applied in the chart, otherwise false
        Returns:
        new builder instance
      • setXLabelColor

        public CrosshairOptionsBuilder setXLabelColor​(String color)
        Sets, for X label, the crosshair label font color.
        Parameters:
        color - the crosshair label font color.
        Returns:
        new builder instance
      • setXLabelColor

        public CrosshairOptionsBuilder setXLabelColor​(IsColor color)
        Set the crosshair label font color.
        Parameters:
        color - the crosshair label font color.
        Returns:
        new builder instance
      • setXLabelPadding

        public CrosshairOptionsBuilder setXLabelPadding​(int padding)
        Sets, for X label, the padding of crosshair label.
        Parameters:
        padding - padding of crosshair label
        Returns:
        new builder instance
      • setXLabelBackgroundColor

        public CrosshairOptionsBuilder setXLabelBackgroundColor​(String color)
        Sets, for X label, the background color.
        Parameters:
        color - the background color.
        Returns:
        new builder instance
      • setXLabelBackgroundColor

        public CrosshairOptionsBuilder setXLabelBackgroundColor​(IsColor color)
        Sets, for X label, the background color.
        Parameters:
        color - the background color.
        Returns:
        new builder instance
      • setXLabelBorderRadius

        public CrosshairOptionsBuilder setXLabelBorderRadius​(int borderRadius)
        Sets, for X label, the label border radius (in pixels).
        Parameters:
        borderRadius - the label border radius (in pixels).
        Returns:
        new builder instance
      • setXLabelFormatter

        public CrosshairOptionsBuilder setXLabelFormatter​(CrosshairFormatterCallback formatterCallback)
        Sets, for X label, the callback which can be implemented to change the text of label.
        Parameters:
        formatterCallback - the callback which can be implemented to change the text of label
        Returns:
        new builder instance
      • setXLabelBorderColor

        public CrosshairOptionsBuilder setXLabelBorderColor​(IsColor borderColor)
        Sets the border color.
        Parameters:
        borderColor - the border color.
        Returns:
        new builder instance
      • setXLabelBorderColor

        public CrosshairOptionsBuilder setXLabelBorderColor​(String borderColor)
        Sets the border color.
        Parameters:
        borderColor - the border color.
        Returns:
        new builder instance
      • setXLabelBorderWidth

        public CrosshairOptionsBuilder setXLabelBorderWidth​(int borderWidth)
        Sets the border width.
        Parameters:
        borderWidth - the border width.
        Returns:
        new builder instance
      • setYLabelDisplay

        public CrosshairOptionsBuilder setYLabelDisplay​(boolean display)
        Sets, for Y label, true if label will be applied in the chart, otherwise false.
        Parameters:
        display - true if label will be applied in the chart, otherwise false
        Returns:
        new builder instance
      • setYLabelColor

        public CrosshairOptionsBuilder setYLabelColor​(String color)
        Sets, for Y label, the crosshair label font color.
        Parameters:
        color - the crosshair label font color.
        Returns:
        new builder instance
      • setYLabelColor

        public CrosshairOptionsBuilder setYLabelColor​(IsColor color)
        Set the crosshair label font color.
        Parameters:
        color - the crosshair label font color.
        Returns:
        new builder instance
      • setYLabelPadding

        public CrosshairOptionsBuilder setYLabelPadding​(int padding)
        Sets, for Y label, the padding of crosshair label.
        Parameters:
        padding - padding of crosshair label
        Returns:
        new builder instance
      • setYLabelBackgroundColor

        public CrosshairOptionsBuilder setYLabelBackgroundColor​(String color)
        Sets, for Y label, the background color.
        Parameters:
        color - the background color.
        Returns:
        new builder instance
      • setYLabelBackgroundColor

        public CrosshairOptionsBuilder setYLabelBackgroundColor​(IsColor color)
        Sets, for Y label, the background color.
        Parameters:
        color - the background color.
        Returns:
        new builder instance
      • setYLabelBorderRadius

        public CrosshairOptionsBuilder setYLabelBorderRadius​(int borderRadius)
        Sets, for Y label, the label border radius (in pixels).
        Parameters:
        borderRadius - the label border radius (in pixels).
        Returns:
        new builder instance
      • setYLabelFormatter

        public CrosshairOptionsBuilder setYLabelFormatter​(CrosshairFormatterCallback formatterCallback)
        Sets, for Y label, the callback which can be implemented to change the text of label.
        Parameters:
        formatterCallback - the callback which can be implemented to change the text of label
        Returns:
        new builder instance
      • setYLabelBorderColor

        public CrosshairOptionsBuilder setYLabelBorderColor​(IsColor borderColor)
        Sets the border color.
        Parameters:
        borderColor - the border color.
        Returns:
        new builder instance
      • setYLabelBorderColor

        public CrosshairOptionsBuilder setYLabelBorderColor​(String borderColor)
        Sets the border color.
        Parameters:
        borderColor - the border color.
        Returns:
        new builder instance
      • setYLabelBorderWidth

        public CrosshairOptionsBuilder setYLabelBorderWidth​(int borderWidth)
        Sets the border width.
        Parameters:
        borderWidth - the border width.
        Returns:
        new builder instance
      • setLabelsDisplay

        public CrosshairOptionsBuilder setLabelsDisplay​(boolean display)
        Sets, for both labels, true if label will be applied in the chart, otherwise false.
        Parameters:
        display - true if label will be applied in the chart, otherwise false
        Returns:
        new builder instance
      • setLabelsColor

        public CrosshairOptionsBuilder setLabelsColor​(String color)
        Sets, for both labels, the crosshair label font color.
        Parameters:
        color - the crosshair label font color.
        Returns:
        new builder instance
      • setLabelsColor

        public CrosshairOptionsBuilder setLabelsColor​(IsColor color)
        Set the crosshair label font color.
        Parameters:
        color - the crosshair label font color.
        Returns:
        new builder instance
      • setLabelsPadding

        public CrosshairOptionsBuilder setLabelsPadding​(int padding)
        Sets, for both labels, the padding of crosshair label.
        Parameters:
        padding - padding of crosshair label
        Returns:
        new builder instance
      • setLabelsBackgroundColor

        public CrosshairOptionsBuilder setLabelsBackgroundColor​(String color)
        Sets, for both labels, the background color.
        Parameters:
        color - the background color.
        Returns:
        new builder instance
      • setLabelsBackgroundColor

        public CrosshairOptionsBuilder setLabelsBackgroundColor​(IsColor color)
        Sets, for both labels, the background color.
        Parameters:
        color - the background color.
        Returns:
        new builder instance
      • setLabelsBorderRadius

        public CrosshairOptionsBuilder setLabelsBorderRadius​(int borderRadius)
        Sets, for both labels, the label border radius (in pixels).
        Parameters:
        borderRadius - the label border radius (in pixels).
        Returns:
        new builder instance
      • setLabelsBorderColor

        public CrosshairOptionsBuilder setLabelsBorderColor​(IsColor borderColor)
        Sets the border color.
        Parameters:
        borderColor - the border color.
        Returns:
        new builder instance
      • setLabelsBorderColor

        public CrosshairOptionsBuilder setLabelsBorderColor​(String borderColor)
        Sets the border color.
        Parameters:
        borderColor - the border color.
        Returns:
        new builder instance
      • setLabelsBorderWidth

        public CrosshairOptionsBuilder setLabelsBorderWidth​(int borderWidth)
        Sets the border width.
        Parameters:
        borderWidth - the border width.
        Returns:
        new builder instance