Class Grid
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.commons.AbstractNode
-
- org.pepstock.charba.client.options.AbstractModel<AbstractScale,D>
-
- org.pepstock.charba.client.options.Grid
-
- All Implemented Interfaces:
IsDefaultGrid
,IsDefaultScaleLines
public final class Grid extends AbstractModel<AbstractScale,D> implements IsDefaultGrid
The grid line configuration defines options for the grid that run perpendicular to the axis.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IsColor
getBorderColor()
If set, used as the color of the border line.
If unset, the first color option is resolved and used.String
getBorderColorAsString()
If set, used as the color of the border line.
If unset, the first color option is resolved and used.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.double
getBorderDashOffset()
Returns the line dash pattern offset.int
getBorderWidth()
If set, used as the width of the border line.List<IsColor>
getColor()
Returns the colors 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.String
getColorAsString()
Returns the color of the grid, if not specified as an array.List<String>
getColorsAsString()
Returns the colors 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.List<Integer>
getLinesWidth()
Returns the stroke widths of grid.int
getLineWidth()
Returns the stroke width of grid.
The first element if set as array.List<Integer>
getTickBorderDash()
Returns the length and spacing of the tick mark line.double
getTickBorderDashOffset()
Returns the offset for the line dash of the tick mark.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.String
getTickColorAsString()
Returns the color of the tick line.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.int
getTickLength()
Returns the length in pixels that the grid will draw in the axis area.List<Integer>
getTicksWidth()
Returns the width of the tick marks in pixels.int
getTickWidth()
Returns the width of the tick mark in pixels.
The first element if set as array.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.boolean
isCircular()
Iftrue
, grid are circular (on radar chart only).boolean
isDisplay()
Iffalse
, do not display grid for this axis.boolean
isDrawBorder()
Iftrue
, draw border at the edge between the axis and the chart area.boolean
isDrawOnChartArea()
Iftrue
, draw lines on the chart area inside the axis lines.boolean
isDrawTicks()
Iftrue
, draw lines beside the ticks in the axis area beside the chart.boolean
isOffset()
Iftrue
, grid will be shifted to be between labels.
This is set totrue
in the bar chart by default.void
setBorderColor(String color)
If set, used as the color of the border line.
If unset, the first color option is resolved and used.void
setBorderColor(IsColor color)
If set, used as the color of the border line.
If unset, the first color option is resolved and used.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.void
setBorderDashOffset(double borderDashOffset)
Sets the line dash pattern offset.void
setBorderWidth(int borderWidth)
If set, used as the width of the border line.void
setCircular(boolean circular)
Iftrue
, grid are circular (on radar chart only).void
setColor(String... color)
Sets 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.void
setColor(IsColor... color)
Sets 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.void
setDisplay(boolean display)
Iffalse
, do not display grid for this axis.void
setDrawBorder(boolean drawBorder)
Iftrue
, draw border at the edge between the axis and the chart area.void
setDrawOnChartArea(boolean drawOnChartArea)
Iftrue
, draw lines on the chart area inside the axis lines.void
setDrawTicks(boolean drawTicks)
Iftrue
, draw lines beside the ticks in the axis area beside the chart.void
setLineWidth(int... lineWidth)
Sets the stroke widths of grid.void
setOffset(boolean offset)
Iftrue
, grid will be shifted to be between labels.
This is set totrue
in the bar chart by default.void
setTickBorderDash(int tickBorderDash)
Sets the length and spacing of the tick mark line.void
setTickBorderDashOffset(double tickBorderDashOffset)
Sets the offset for the line dash of the tick mark.void
setTickColor(String... color)
Sets the color of the tick line.void
setTickColor(IsColor... color)
Sets the color of the tick line.void
setTickLength(int tickLength)
Sets the length in pixels that the grid will draw in the axis area.void
setTickWidth(int... tickWidth)
Sets the width of the tick marks in pixels.void
setZ(int z)
Sets z-index of gridline layer.
Values less than or equals to 0 are drawn under datasets, greater than 0 on top.-
Methods inherited from class org.pepstock.charba.client.options.AbstractModel
getDefaultValues, getParent, loadPadding, setCallbackToModel, setCallbackToModel, setEventToModel
-
Methods inherited from class org.pepstock.charba.client.commons.AbstractNode
checkAndAddToParent, getChildKey, getParentNode, getRootNode, retrieveRoot, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setElementAndAddToParent, setInternalCallbackToModel, setInternalCallbackToModel, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent
-
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainer
checkDefaultValuesArgument, empty, getArrayValue, getElement, getIncrementalId, getNativeChart, getNativeEvent, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, isType, keys, loadNativeObject, remove, remove, setArrayValue, setArrayValue, setArrayValue, setElement, setEmptyValue, setNewIncrementalId, setNewIncrementalId, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pepstock.charba.client.defaults.IsDefaultScaleLines
getBorderDash, getBorderDashOffset
-
-
-
-
Method Detail
-
setDisplay
public void setDisplay(boolean display)
Iffalse
, do not display grid for this axis.- Parameters:
display
- Iffalse
, do not display grid for this axis.
-
isDisplay
public boolean isDisplay()
Iffalse
, do not display grid for this axis.- Specified by:
isDisplay
in interfaceIsDefaultGrid
- Returns:
- If
false
, do not display grid for this axis.
-
setCircular
public void setCircular(boolean circular)
Iftrue
, grid are circular (on radar chart only).- Parameters:
circular
- Iftrue
, grid are circular (on radar chart only).
-
isCircular
public boolean isCircular()
Iftrue
, grid are circular (on radar chart only).- Specified by:
isCircular
in interfaceIsDefaultGrid
- Returns:
- If
true
, grid are circular (on radar chart only).
-
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.- Specified by:
getBorderColorAsString
in interfaceIsDefaultGrid
- 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.
-
setColor
public void setColor(IsColor... color)
Sets 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)
Sets 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 String getColorAsString()
Returns the color of the grid, if not specified as an array.- Specified by:
getColorAsString
in interfaceIsDefaultScaleLines
- Returns:
- the list of colors of the grid.
-
getColorsAsString
public List<String> getColorsAsString()
Returns the colors 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()
Returns the colors 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.
-
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.- Specified by:
getBorderWidth
in interfaceIsDefaultGrid
- Returns:
- if set, used as the width of the border line. If unset, the first lineWidth option is resolved and used.
-
setLineWidth
public void setLineWidth(int... lineWidth)
Sets the stroke widths of grid.- Parameters:
lineWidth
- stroke widths of grid.
-
getLineWidth
public int getLineWidth()
Returns the stroke width of grid.
The first element if set as array.- Specified by:
getLineWidth
in interfaceIsDefaultScaleLines
- Returns:
- stroke width of grid.
The first element if set as array.
-
getLinesWidth
public List<Integer> getLinesWidth()
Returns the stroke widths of grid.- Returns:
- stroke widths of grid.
-
setDrawBorder
public void setDrawBorder(boolean drawBorder)
Iftrue
, draw border at the edge between the axis and the chart area.- Parameters:
drawBorder
- Iftrue
, draw border at the edge between the axis and the chart area.
-
isDrawBorder
public boolean isDrawBorder()
Iftrue
, draw border at the edge between the axis and the chart area.- Specified by:
isDrawBorder
in interfaceIsDefaultGrid
- Returns:
- If
true
, draw border at the edge between the axis and the chart area.
-
setDrawOnChartArea
public void setDrawOnChartArea(boolean drawOnChartArea)
Iftrue
, 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
- Iftrue
, 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()
Iftrue
, 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.- Specified by:
isDrawOnChartArea
in interfaceIsDefaultGrid
- 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)
Iftrue
, draw lines beside the ticks in the axis area beside the chart.- Parameters:
drawTicks
- Iftrue
, draw lines beside the ticks in the axis area beside the chart.
-
isDrawTicks
public boolean isDrawTicks()
Iftrue
, draw lines beside the ticks in the axis area beside the chart.- Specified by:
isDrawTicks
in interfaceIsDefaultGrid
- 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.- Specified by:
getTickLength
in interfaceIsDefaultGrid
- Returns:
- Length in pixels that the grid will draw in the axis area.
-
setOffset
public void setOffset(boolean offset)
Iftrue
, grid will be shifted to be between labels.
This is set totrue
in the bar chart by default.- Parameters:
offset
- iftrue
, grid will be shifted to be between labels.
-
isOffset
public boolean isOffset()
Iftrue
, grid will be shifted to be between labels.
This is set totrue
in the bar chart by default.- Specified by:
isOffset
in interfaceIsDefaultGrid
- Returns:
- if
true
, grid will be shifted to be between labels.
-
setZ
public void setZ(int z)
Sets z-index of gridline layer.
Values less than or equals to 0 are drawn under datasets, greater than 0 on top.- Parameters:
z
- z-index of gridline 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.- Specified by:
getZ
in interfaceIsDefaultGrid
- 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 final 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 final double getTickBorderDashOffset()
Returns the offset for the line dash of the tick mark.- Specified by:
getTickBorderDashOffset
in interfaceIsDefaultGrid
- 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.- Specified by:
getTickColorAsString
in interfaceIsDefaultGrid
- 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.- Specified by:
getTickWidth
in interfaceIsDefaultGrid
- 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.
-
setBorderDash
public final 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 final 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.- Specified by:
getBorderDash
in interfaceIsDefaultScaleLines
- Returns:
- the line dash pattern used when stroking lines
-
setBorderDashOffset
public final void setBorderDashOffset(double borderDashOffset)
Sets the line dash pattern offset.- Parameters:
borderDashOffset
- Offset for line dashes.
-
getBorderDashOffset
public final double getBorderDashOffset()
Returns the line dash pattern offset.- Specified by:
getBorderDashOffset
in interfaceIsDefaultScaleLines
- Returns:
- Offset for line dashes.
-
-