Class Grid


  • public class Grid
    extends Object
    The grid line configuration defines options for the grid that run perpendicular to the axis.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • setDisplay

        public void setDisplay​(boolean display)
        If false, do not display grid for this axis.
        Parameters:
        display - If false, do not display grid for this axis.
      • isDisplay

        public boolean isDisplay()
        If false, do not display grid for this axis.
        Returns:
        If false, do not display grid for this axis.
      • setCircular

        public void setCircular​(boolean circular)
        If true, grid are circular (on radar chart only).
        Parameters:
        circular - If true, grid are circular (on radar chart only).
      • isCircular

        public boolean isCircular()
        If true, grid are circular (on radar chart only).
        Returns:
        If true, grid are circular (on radar chart only).
      • setColor

        public void setColor​(IsColor... color)
        The color of the grid.
        If specified as an array, the first color applies to the first grid line, the second to the second grid line and so on.
        Parameters:
        color - The color of the grid.
        If specified as an array, the first color applies to the first grid line, the second to the second grid line and so on.
      • setColor

        public void setColor​(String... color)
        The color of the grid.
        If specified as an array, the first color applies to the first grid line, the second to the second grid line and so on.
        Parameters:
        color - The color of the grid.
        If specified as an array, the first color applies to the first grid line, the second to the second grid line and so on.
      • getColorAsString

        public List<String> getColorAsString()
        The color of the grid.
        If specified as an array, the first color applies to the first grid line, the second to the second grid line and so on.
        Returns:
        the list of colors of the grid.
      • getColor

        public List<IsColor> getColor()
        The color of the grid.
        If specified as an array, the first color applies to the first grid line, the second to the second grid line and so on.
        Returns:
        the list of colors of the grid.
      • setBorderColor

        public void setBorderColor​(IsColor color)
        If set, used as the color of the border line.
        If unset, the first color option is resolved and used.
        Parameters:
        color - if set, used as the color of the border line.
        If unset, the first color option is resolved and used.
      • setBorderColor

        public void setBorderColor​(String color)
        If set, used as the color of the border line.
        If unset, the first color option is resolved and used.
        Parameters:
        color - if set, used as the color of the border line.
        If unset, the first color option is resolved and used.
      • getBorderColorAsString

        public String getBorderColorAsString()
        If set, used as the color of the border line.
        If unset, the first color option is resolved and used.
        Returns:
        if set, used as the color of the border line.
        If unset, the first color option is resolved and used.
      • getBorderColor

        public IsColor getBorderColor()
        If set, used as the color of the border line.
        If unset, the first color option is resolved and used.
        Returns:
        if set, used as the color of the border line.
        If unset, the first color option is resolved and used.
      • setBorderWidth

        public void setBorderWidth​(int borderWidth)
        If set, used as the width of the border line.
        If unset, the first lineWidth option is resolved and used.
        Parameters:
        borderWidth - if set, used as the width of the border line.
        If unset, the first lineWidth option is resolved and used.
      • getBorderWidth

        public int getBorderWidth()
        If set, used as the width of the border line.
        If unset, the first lineWidth option is resolved and used.
        Returns:
        if set, used as the width of the border line.
        If unset, the first lineWidth option is resolved and used.
      • 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
      • 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.
      • setBorderDashOffset

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

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

        public void setLineWidth​(int... lineWidth)
        Sets the stroke widths of grid.
        Parameters:
        lineWidth - stroke widths of grid.
      • getLineWidth

        public List<Integer> getLineWidth()
        Returns the stroke widths of grid.
        Returns:
        lineWidth stroke widths of grid.
      • setDrawBorder

        public void setDrawBorder​(boolean drawBorder)
        If true, draw border at the edge between the axis and the chart area.
        Parameters:
        drawBorder - If true, draw border at the edge between the axis and the chart area.
      • isDrawBorder

        public boolean isDrawBorder()
        If true, draw border at the edge between the axis and the chart area.
        Returns:
        If true, draw border at the edge between the axis and the chart area.
      • setDrawOnChartArea

        public void setDrawOnChartArea​(boolean drawOnChartArea)
        If true, draw lines on the chart area inside the axis lines.
        This is useful when there are multiple axes and you need to control which grid are drawn.
        Parameters:
        drawOnChartArea - If true, draw lines on the chart area inside the axis lines.
        This is useful when there are multiple axes and you need to control which grid are drawn.
      • isDrawOnChartArea

        public boolean isDrawOnChartArea()
        If true, draw lines on the chart area inside the axis lines.
        This is useful when there are multiple axes and you need to control which grid are drawn.
        Returns:
        If true, draw lines on the chart area inside the axis lines.
        This is useful when there are multiple axes and you need to control which grid are drawn.
      • setDrawTicks

        public void setDrawTicks​(boolean drawTicks)
        If true, draw lines beside the ticks in the axis area beside the chart.
        Parameters:
        drawTicks - If true, draw lines beside the ticks in the axis area beside the chart.
      • isDrawTicks

        public boolean isDrawTicks()
        If true, draw lines beside the ticks in the axis area beside the chart.
        Returns:
        If true, draw lines beside the ticks in the axis area beside the chart.
      • setTickLength

        public void setTickLength​(int tickLength)
        Sets the length in pixels that the grid will draw in the axis area.
        Parameters:
        tickLength - Length in pixels that the grid will draw in the axis area.
      • getTickLength

        public int getTickLength()
        Returns the length in pixels that the grid will draw in the axis area.
        Returns:
        Length in pixels that the grid will draw in the axis area.
      • setOffset

        public void setOffset​(boolean offset)
        If true, grid will be shifted to be between labels.
        This is set to true in the bar chart by default.
        Parameters:
        offset - If true, grid will be shifted to be between labels.
      • isOffset

        public boolean isOffset()
        If true, grid will be shifted to be between labels.
        This is set to true in the bar chart by default.
        Returns:
        If true, grid will be shifted to be between labels.
      • setZ

        public void setZ​(int z)
        Sets z-index of grid line layer.
        Values less than or equals to 0 are drawn under datasets, greater than 0 on top.
        Parameters:
        z - z-index of grid line layer.
        Values less than or equals to 0 are drawn under datasets, greater than 0 on top.
      • getZ

        public int getZ()
        Returns z-index of grid line layer.
        Values less than or equals to 0 are drawn under datasets, greater than 0 on top.
        Returns:
        z-index of grid line layer.
        Values less than or equals to 0 are drawn under datasets, greater than 0 on top.
      • setTickBorderDash

        public void setTickBorderDash​(int tickBorderDash)
        Sets the length and spacing of the tick mark line.
        Parameters:
        tickBorderDash - the length and spacing of the tick mark line.
      • getTickBorderDash

        public List<Integer> getTickBorderDash()
        Returns the length and spacing of the tick mark line.
        Returns:
        the length and spacing of the tick mark line.
      • setTickBorderDashOffset

        public void setTickBorderDashOffset​(double tickBorderDashOffset)
        Sets the offset for the line dash of the tick mark.
        Parameters:
        tickBorderDashOffset - the offset for the line dash of the tick mark
      • getTickBorderDashOffset

        public double getTickBorderDashOffset()
        Returns the offset for the line dash of the tick mark.
        Returns:
        the offset for the line dash of the tick mark
      • setTickColor

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

        public void setTickColor​(String... color)
        Sets the color of the tick line.
        Parameters:
        color - the color of the tick line.
      • getTickColorAsString

        public String getTickColorAsString()
        Returns the color of the tick line.
        Returns:
        the color of the tick line.
      • getTickColorsAsString

        public List<String> getTickColorsAsString()
        The color of the grid.
        If specified as an array, the first color applies to the first grid line, the second to the second grid line and so on.
        Returns:
        the list of colors of the grid.
      • getTickColor

        public List<IsColor> getTickColor()
        The color of the grid.
        If specified as an array, the first color applies to the first grid line, the second to the second grid line and so on.
        Returns:
        the list of colors of the grid.
      • setTickWidth

        public void setTickWidth​(int... tickWidth)
        Sets the width of the tick marks in pixels.
        Parameters:
        tickWidth - the width of the tick mark in pixels
      • getTickWidth

        public int getTickWidth()
        Returns the width of the tick mark in pixels.
        The first element if set as array.
        Returns:
        stroke width of grid.
        The first element if set as array.
      • getTicksWidth

        public List<Integer> getTicksWidth()
        Returns the width of the tick marks in pixels.
        Returns:
        stroke widths of grid.
      • getTickColorCallback

        public ColorCallback<ScaleContext> getTickColorCallback()
        Returns the tick color callback instance.
        Returns:
        the tick color callback instance
      • setTickColor

        public void setTickColor​(ColorCallback<ScaleContext> tickColorCallback)
        Sets the tick color callback instance.
        Parameters:
        tickColorCallback - the tick color callback instance
      • setTickColor

        public void setTickColor​(NativeCallback tickColorCallback)
        Sets the tick color callback instance.
        Parameters:
        tickColorCallback - the tick color callback instance
      • getTickWidthCallback

        public WidthCallback<ScaleContext> getTickWidthCallback()
        Returns the tick width callback instance.
        Returns:
        the tick width callback instance
      • setTickWidth

        public void setTickWidth​(WidthCallback<ScaleContext> tickWidthCallback)
        Sets the tick width callback instance.
        Parameters:
        tickWidthCallback - the tick width callback instance.
      • setTickWidth

        public void setTickWidth​(NativeCallback tickWidthCallback)
        Sets the tick width callback instance.
        Parameters:
        tickWidthCallback - the tick width callback instance.
      • getTickBorderDashOffsetCallback

        public BorderDashOffsetCallback<ScaleContext> getTickBorderDashOffsetCallback()
        Returns the tick border dash offset callback instance.
        Returns:
        the tick border dash offset callback instance
      • setTickBorderDashOffset

        public void setTickBorderDashOffset​(BorderDashOffsetCallback<ScaleContext> tickBorderDashOffsetCallback)
        Sets the tick border dash offset callback instance.
        Parameters:
        tickBorderDashOffsetCallback - the tick border dash offset callback instance
      • setTickBorderDashOffset

        public void setTickBorderDashOffset​(NativeCallback tickBorderDashOffsetCallback)
        Sets the tick border dash offset callback instance.
        Parameters:
        tickBorderDashOffsetCallback - the tick border dash offset callback instance
      • getColorCallback

        public ColorCallback<ScaleContext> getColorCallback()
        Returns the color callback instance.
        Returns:
        the color callback instance
      • setColor

        public void setColor​(ColorCallback<ScaleContext> colorCallback)
        Sets the color callback instance.
        Parameters:
        colorCallback - the color callback instance
      • setColor

        public void setColor​(NativeCallback colorCallback)
        Sets the color callback instance.
        Parameters:
        colorCallback - the color callback instance
      • getLineWidthCallback

        public WidthCallback<ScaleContext> getLineWidthCallback()
        Returns the line width callback instance.
        Returns:
        the line width callback instance
      • setLineWidth

        public void setLineWidth​(WidthCallback<ScaleContext> lineWidthCallback)
        Sets the line width callback instance.
        Parameters:
        lineWidthCallback - the line width callback instance.
      • setLineWidth

        public void setLineWidth​(NativeCallback lineWidthCallback)
        Sets the line width callback instance.
        Parameters:
        lineWidthCallback - the line width callback instance.
      • getBorderDashOffsetCallback

        public BorderDashOffsetCallback<ScaleContext> getBorderDashOffsetCallback()
        Returns the border dash offset callback instance.
        Returns:
        the border dash offset callback instance
      • setBorderDashOffset

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

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

        public final Axis getAxis()
        Returns the axis instance.
        Returns:
        the axis