Class Line


  • public class Line
    extends Object
    Line elements are used to represent the line in a line chart.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • getElement

        protected AbstractElement<IsDefaultLine> getElement()
        Returns the element instance to be managed.
        Returns:
        the element instance to be managed
      • getDefaultElement

        protected IsDefaultLine getDefaultElement()
        Returns the element instance to be managed.
        Returns:
        the element instance to be managed
      • setTension

        public void setTension​(double tension)
        Returns the Bézier curve tension (0 for no Bézier curves).
        Parameters:
        tension - the Bézier curve tension (0 for no Bézier curves).
      • getTension

        public double getTension()
        Returns the Bézier curve tension (0 for no Bézier curves).
        Returns:
        the Bézier curve tension (0 for no Bézier curves).
      • setBorderCapStyle

        public void setBorderCapStyle​(CapStyle borderCapStyle)
        Sets how the end points of every line are drawn.
        Parameters:
        borderCapStyle - how the end points of every line are drawn.
      • getBorderCapStyle

        public CapStyle getBorderCapStyle()
        Returns how the end points of every line are drawn.
        Returns:
        how the end points of every line are drawn.
      • setBorderDash

        public void setBorderDash​(int... borderDash)
        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:
        borderDash - 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.
      • getBorderDash

        public List<Integer> getBorderDash()
        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, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.
      • setBorderDashOffset

        public void setBorderDashOffset​(double borderDashOffset)
        Sets the line dash pattern offset.
        Parameters:
        borderDashOffset - the line dash pattern offset.
      • getBorderDashOffset

        public double getBorderDashOffset()
        Returns the line dash pattern offset.
        Returns:
        the line dash pattern offset
      • setBorderJoinStyle

        public void setBorderJoinStyle​(JoinStyle borderJoinStyle)
        Sets how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together (degenerate segments with zero lengths, whose specified end points and control points are exactly at the same position, are skipped).
        Parameters:
        borderJoinStyle - how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together
      • getBorderJoinStyle

        public JoinStyle getBorderJoinStyle()
        Returns how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together (degenerate segments with zero lengths, whose specified end points and control points are exactly at the same position, are skipped).
        Returns:
        how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together
      • setCapBezierPoints

        public void setCapBezierPoints​(boolean capBezierPoints)
        Sets true to keep Bézier control inside the chart, false for no restriction.
        Parameters:
        capBezierPoints - true to keep Bézier control inside the chart, false for no restriction.
      • isCapBezierPoints

        public boolean isCapBezierPoints()
        Returns true to keep Bézier control inside the chart, false for no restriction.
        Returns:
        true to keep Bézier control inside the chart, false for no restriction.
      • setCubicInterpolationMode

        public void setCubicInterpolationMode​(CubicInterpolationMode mode)
        Sets algorithm used to interpolate a smooth curve from the discrete data points.
        The following interpolation modes are supported:

         'default'
         'monotone'
         

        The 'default' algorithm uses a custom weighted cubic interpolation, which produces pleasant curves for all types of data sets.
        The 'monotone' algorithm is more suited to y = f(x) data sets : it preserves monotonicity (or piecewise monotonicity) of the data set being interpolated, and ensures local extremums (if any) stay at input data points.
        Parameters:
        mode - algorithm used to interpolate a smooth curve from the discrete data points
      • getCubicInterpolationMode

        public CubicInterpolationMode getCubicInterpolationMode()
        Returns algorithm used to interpolate a smooth curve from the discrete data points.
        Returns:
        algorithm used to interpolate a smooth curve from the discrete data points.
      • setFill

        public void setFill​(boolean fill)
        Sets how to fill the area under the line.
        Parameters:
        fill - true to fill, otherwise false.
      • setFill

        public void setFill​(int index)
        Sets how to fill the area under the line, by absolute data set index.
        Parameters:
        index - absolute data set index of the chart.
      • setFill

        public void setFill​(String index)
        Sets how to fill the area under the line, by relative data set index.
        Parameters:
        index - relative data set index of the chart.
      • setFill

        public void setFill​(IsFill fill)
        Sets how to fill the area under the line.
        Parameters:
        fill - how to fill the area under the line.
      • getFill

        public IsFill getFill()
        Returns how to fill the area under the line.
        Returns:
        how to fill the area under the line.
      • setFillBaseline

        public void setFillBaseline​(double baseline)
        Sets the baseline value to use for filling.
        Parameters:
        baseline - the baseline value to use for filling
      • setFillBaseline

        public void setFillBaseline​(FillBaseline baseline)
        Sets the baseline value to use for filling.
        Parameters:
        baseline - the baseline value to use for filling
      • getFillBaseline

        public FillBaseline getFillBaseline()
        Returns the baseline value to use for filling.
        Returns:
        the baseline value to use for filling
      • setFillColors

        public void setFillColors​(FillColors colors)
        Sets the above and below color of baseline to use for filling.
        Parameters:
        colors - the above and below color of baseline to use for filling.
      • getFillColors

        public FillColors getFillColors()
        Returns the above and below color of baseline to use for filling.
        Returns:
        the above and below color of baseline to use for filling.
      • setStepped

        public void setStepped​(boolean stepped)
        Sets if the line is shown as a stepped line.
        If the stepped value is set to anything other than false, tension will be ignored.
        Parameters:
        stepped - if the line is shown as a stepped line. false is no step interpolation
      • setStepped

        public void setStepped​(Stepped stepped)
        Sets if the line is shown as a stepped line.
        If the stepped value is set to anything other than false, tension will be ignored.
        Parameters:
        stepped - if the line is shown as a stepped line.
      • getStepped

        public Stepped getStepped()
        Returns if the line is shown as a stepped line.
        Returns:
        If the line is shown as a stepped line.
      • getBorderCapStyleCallback

        public CapStyleCallback<DatasetContext> getBorderCapStyleCallback()
        Returns the border capstyle callback, if set, otherwise null.
        Returns:
        the border capstyle callback, if set, otherwise null.
      • setBorderCapStyle

        public void setBorderCapStyle​(CapStyleCallback<DatasetContext> borderCapStyleCallback)
        Sets the border capstyle callback.
        Parameters:
        borderCapStyleCallback - the border capstyle callback.
      • setBorderCapStyle

        public void setBorderCapStyle​(NativeCallback borderCapStyleCallback)
        Sets the border capstyle callback.
        Parameters:
        borderCapStyleCallback - the border capstyle callback.
      • getBorderDashCallback

        public BorderDashCallback<DatasetContext> getBorderDashCallback()
        Returns the border dash callback, if set, otherwise null.
        Returns:
        the border dash callback, if set, otherwise null.
      • setBorderDash

        public void setBorderDash​(BorderDashCallback<DatasetContext> borderDashCallback)
        Sets the border dash callback.
        Parameters:
        borderDashCallback - the border dash callback.
      • setBorderDash

        public void setBorderDash​(NativeCallback borderDashCallback)
        Sets the border dash callback.
        Parameters:
        borderDashCallback - the border dash callback.
      • getBorderDashOffsetCallback

        public BorderDashOffsetCallback<DatasetContext> getBorderDashOffsetCallback()
        Returns the border dash offset callback, if set, otherwise null.
        Returns:
        the border dash offset callback, if set, otherwise null.
      • setBorderDashOffset

        public void setBorderDashOffset​(BorderDashOffsetCallback<DatasetContext> borderDashOffsetCallback)
        Sets the border dash offset callback.
        Parameters:
        borderDashOffsetCallback - the border dash offset callback.
      • setBorderDashOffset

        public void setBorderDashOffset​(NativeCallback borderDashOffsetCallback)
        Sets the border dash offset callback.
        Parameters:
        borderDashOffsetCallback - the border dash offset callback.
      • getBorderJoinStyleCallback

        public JoinStyleCallback<DatasetContext> getBorderJoinStyleCallback()
        Returns the border join style callback, if set, otherwise null.
        Returns:
        the border join style callback, if set, otherwise null.
      • setBorderJoinStyle

        public void setBorderJoinStyle​(JoinStyleCallback<DatasetContext> borderJoinStyleCallback)
        Sets the border join style callback.
        Parameters:
        borderJoinStyleCallback - the border join style callback.
      • setBorderJoinStyle

        public void setBorderJoinStyle​(NativeCallback borderJoinStyleCallback)
        Sets the border join style callback.
        Parameters:
        borderJoinStyleCallback - the border join style callback.
      • getCubicInterpolationModeCallback

        public CubicInterpolationModeCallback getCubicInterpolationModeCallback()
        Returns the cubic interpolation mode callback, if set, otherwise null.
        Returns:
        the cubic interpolation mode callback, if set, otherwise null.
      • setCubicInterpolationMode

        public void setCubicInterpolationMode​(CubicInterpolationModeCallback cubicInterpolationModeCallback)
        Sets the cubic interpolation mode callback.
        Parameters:
        cubicInterpolationModeCallback - the cubic interpolation mode callback.
      • setCubicInterpolationMode

        public void setCubicInterpolationMode​(NativeCallback cubicInterpolationModeCallback)
        Sets the cubic interpolation mode callback.
        Parameters:
        cubicInterpolationModeCallback - the cubic interpolation mode callback.
      • getFillCallback

        public FillCallback getFillCallback()
        Returns the fill callback, if set, otherwise null.
        Returns:
        the fill callback, if set, otherwise null.
      • setFill

        public void setFill​(FillCallback fillCallback)
        Sets the fill callback.
        Parameters:
        fillCallback - the fill callback.
      • setFill

        public void setFill​(NativeCallback fillCallback)
        Sets the fill callback.
        Parameters:
        fillCallback - the fill callback.
      • getSteppedCallback

        public SteppedCallback getSteppedCallback()
        Returns the stepped callback, if set, otherwise null.
        Returns:
        the stepped callback, if set, otherwise null.
      • setStepped

        public void setStepped​(SteppedCallback steppedCallback)
        Sets the stepped callback.
        Parameters:
        steppedCallback - the stepped callback.
      • setStepped

        public void setStepped​(NativeCallback steppedCallback)
        Sets the stepped callback.
        Parameters:
        steppedCallback - the stepped callback.
      • setBackgroundColor

        public void setBackgroundColor​(IsColor backgroundColor)
        Sets the background color.
        Parameters:
        backgroundColor - the background color.
      • setBackgroundColor

        public void setBackgroundColor​(String backgroundColor)
        Sets the background color.
        Parameters:
        backgroundColor - the background color.
      • getBackgroundColorAsString

        public String getBackgroundColorAsString()
        Returns the background color.
        Returns:
        the background color.
      • getBackgroundColor

        public IsColor getBackgroundColor()
        Returns the background color.
        Returns:
        the background color.
      • setBorderWidth

        public void setBorderWidth​(int borderWidth)
        Sets the border width.
        Parameters:
        borderWidth - the border width.
      • getBorderWidth

        public int getBorderWidth()
        Returns the border width.
        Returns:
        the border width.
      • setBorderColor

        public void setBorderColor​(IsColor borderColor)
        Sets the border color.
        Parameters:
        borderColor - the border color.
      • setBorderColor

        public void setBorderColor​(String borderColor)
        Sets the border color.
        Parameters:
        borderColor - the border color.
      • getBorderColorAsString

        public String getBorderColorAsString()
        Returns the border color.
        Returns:
        the border color.
      • getBorderColor

        public IsColor getBorderColor()
        Returns the border color.
        Returns:
        the border color.
      • setHoverBackgroundColor

        public void setHoverBackgroundColor​(IsColor backgroundColor)
        Sets the background color when hovered.
        Parameters:
        backgroundColor - the background color when hovered.
      • setHoverBackgroundColor

        public void setHoverBackgroundColor​(String backgroundColor)
        Sets the background color when hovered.
        Parameters:
        backgroundColor - the background color when hovered.
      • getHoverBackgroundColorAsString

        public String getHoverBackgroundColorAsString()
        Returns the background color when hovered.
        Returns:
        the background color when hovered.
      • getHoverBackgroundColor

        public IsColor getHoverBackgroundColor()
        Returns the background color when hovered.
        Returns:
        the background color when hovered.
      • setHoverBorderWidth

        public void setHoverBorderWidth​(int borderWidth)
        Sets the border width when hovered.
        Parameters:
        borderWidth - the border width when hovered.
      • getHoverBorderWidth

        public int getHoverBorderWidth()
        Returns the border width when hovered.
        Returns:
        the border width when hovered.
      • setHoverBorderColor

        public void setHoverBorderColor​(IsColor borderColor)
        Sets the border color when hovered.
        Parameters:
        borderColor - the border color when hovered.
      • setHoverBorderColor

        public void setHoverBorderColor​(String borderColor)
        Sets the border color when hovered.
        Parameters:
        borderColor - the border color when hovered.
      • getHoverBorderColorAsString

        public String getHoverBorderColorAsString()
        Returns the border color when hovered.
        Returns:
        the border color when hovered.
      • getHoverBorderColor

        public IsColor getHoverBorderColor()
        Returns the border color when hovered.
        Returns:
        the border color when hovered.
      • getBackgroundColorCallback

        public ColorCallback<DatasetContext> getBackgroundColorCallback()
        Returns the background color callback, if set, otherwise null.
        Returns:
        the background color callback, if set, otherwise null.
      • setBackgroundColor

        public void setBackgroundColor​(ColorCallback<DatasetContext> backgroundColorCallback)
        Sets the background color callback.
        Parameters:
        backgroundColorCallback - the background color callback.
      • setBackgroundColor

        public void setBackgroundColor​(NativeCallback backgroundColorCallback)
        Sets the background color callback.
        Parameters:
        backgroundColorCallback - the background color callback.
      • getBorderColorCallback

        public ColorCallback<DatasetContext> getBorderColorCallback()
        Returns the border color callback, if set, otherwise null.
        Returns:
        the border color callback, if set, otherwise null.
      • setBorderColor

        public void setBorderColor​(ColorCallback<DatasetContext> borderColorCallback)
        Sets the border color callback.
        Parameters:
        borderColorCallback - the border color callback.
      • setBorderColor

        public void setBorderColor​(NativeCallback borderColorCallback)
        Sets the border color callback.
        Parameters:
        borderColorCallback - the border color callback.
      • getBorderWidthCallback

        public WidthCallback<DatasetContext> getBorderWidthCallback()
        Returns the border width callback, if set, otherwise null.
        Returns:
        the border width callback, if set, otherwise null.
      • setBorderWidth

        public void setBorderWidth​(WidthCallback<DatasetContext> borderWidthCallback)
        Sets the border width callback.
        Parameters:
        borderWidthCallback - the border width callback.
      • setBorderWidth

        public void setBorderWidth​(NativeCallback borderWidthCallback)
        Sets the border width callback.
        Parameters:
        borderWidthCallback - the border width callback.
      • getHoverBackgroundColorCallback

        public ColorCallback<DatasetContext> getHoverBackgroundColorCallback()
        Returns the background color callback, if set, otherwise null.
        Returns:
        the background color callback, if set, otherwise null.
      • setHoverBackgroundColor

        public void setHoverBackgroundColor​(ColorCallback<DatasetContext> hoverBackgroundColorCallback)
        Sets the background color callback, as hovered.
        Parameters:
        hoverBackgroundColorCallback - the background color callback, as hovered
      • setHoverBackgroundColor

        public void setHoverBackgroundColor​(NativeCallback hoverBackgroundColorCallback)
        Sets the background color callback, as hovered.
        Parameters:
        hoverBackgroundColorCallback - the background color callback, as hovered
      • getHoverBorderColorCallback

        public ColorCallback<DatasetContext> getHoverBorderColorCallback()
        Returns the border color callback, if set, otherwise null.
        Returns:
        the border color callback, if set, otherwise null.
      • setHoverBorderColor

        public void setHoverBorderColor​(ColorCallback<DatasetContext> hoverBorderColorCallback)
        Sets the border color callback, as hovered.
        Parameters:
        hoverBorderColorCallback - the border color callback, as hovered
      • setHoverBorderColor

        public void setHoverBorderColor​(NativeCallback hoverBorderColorCallback)
        Sets the border color callback, as hovered.
        Parameters:
        hoverBorderColorCallback - the border color callback, as hovered
      • getHoverBorderWidthCallback

        public WidthCallback<DatasetContext> getHoverBorderWidthCallback()
        Returns the border width callback, if set, otherwise null.
        Returns:
        the border width callback, if set, otherwise null.
      • setHoverBorderWidth

        public void setHoverBorderWidth​(WidthCallback<DatasetContext> hoverBorderWidthCallback)
        Sets the border width callback, as hovered.
        Parameters:
        hoverBorderWidthCallback - the border width callback, as hovered
      • setHoverBorderWidth

        public void setHoverBorderWidth​(NativeCallback hoverBorderWidthCallback)
        Sets the border width callback, as hovered.
        Parameters:
        hoverBorderWidthCallback - the border width callback, as hovered
      • getOptions

        protected final ConfigurationOptions getOptions()
        Returns the configuration options.
        Returns:
        the configuration options.
      • getConfiguration

        protected final ExtendedOptions getConfiguration()
        Returns the configuration element.
        Returns:
        the configuration element.
      • getChart

        public final IsChart getChart()
        Returns the chart instance
        Returns:
        the chart