Class Line
-
- All Implemented Interfaces:
IsDefaultFillHandler
,IsDefaultLine
,IsDefaultOptionsElement
,HasFill
public class Line extends AbstractElement<IsDefaultLine> implements IsDefaultLine, HasFill
Line elements are used to represent the line in a line chart.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Line(Elements elements, Key childKey, IsDefaultLine defaultValues, NativeObject nativeObject)
Creates the object with the parent, the key of this element, default values and native object to map java script properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CapStyle
getBorderCapStyle()
Returns how the end points of every line are drawn.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.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).CubicInterpolationMode
getCubicInterpolationMode()
Returns algorithm used to interpolate a smooth curve from the discrete data points.FillHandler
getFillHandler()
Returns a fill handler instance to use in the default methods of this interface.Stepped
getStepped()
Returns if the line is shown as a stepped line.double
getTension()
Returns the Bézier curve tension (0 for no Bézier curves).boolean
isCapBezierPoints()
Returnstrue
to keep Bézier control inside the chart,false
for no restriction.void
setBorderCapStyle(CapStyle borderCapStyle)
Sets how the end points of every line are drawn.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
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).void
setCapBezierPoints(boolean capBezierPoints)
Setstrue
to keep Bézier control inside the chart,false
for no restriction.void
setCubicInterpolationMode(CubicInterpolationMode mode)
Sets algorithm used to interpolate a smooth curve from the discrete data points.
The following interpolation modes are supported:
void
setStepped(boolean line)
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.void
setStepped(Stepped line)
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.void
setTension(double tension)
Returns the Bézier curve tension (0 for no Bézier curves).-
Methods inherited from class org.pepstock.charba.client.options.AbstractElement
getBackgroundColor, getBackgroundColorAsString, getBorderColor, getBorderColorAsString, getBorderWidth, getHoverBackgroundColor, getHoverBackgroundColorAsString, getHoverBorderColor, getHoverBorderColorAsString, getHoverBorderWidth, setBackgroundColor, setBackgroundColor, setBorderColor, setBorderColor, setBorderWidth, setHoverBackgroundColor, setHoverBackgroundColor, setHoverBorderColor, setHoverBorderColor, setHoverBorderWidth
-
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.options.HasFill
getFill, setFill, setFill, setFill, setFill
-
Methods inherited from interface org.pepstock.charba.client.defaults.IsDefaultOptionsElement
getBackgroundColorAsString, getBorderColorAsString, getBorderWidth, getHoverBackgroundColorAsString, getHoverBorderColorAsString, getHoverBorderWidth
-
-
-
-
Constructor Detail
-
Line
protected Line(Elements elements, Key childKey, IsDefaultLine defaultValues, NativeObject nativeObject)
Creates the object with the parent, the key of this element, default values and native object to map java script properties.- Parameters:
elements
- parent node to use to add this element where changedchildKey
- the property name of this element to use to add it to the parent.defaultValues
- default providernativeObject
- native object to map java script properties
-
-
Method Detail
-
getFillHandler
public FillHandler getFillHandler()
Description copied from interface:HasFill
Returns a fill handler instance to use in the default methods of this interface.- Specified by:
getFillHandler
in interfaceHasFill
- Returns:
- a fill handler instance
-
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).- Specified by:
getTension
in interfaceIsDefaultLine
- 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.- Specified by:
getBorderCapStyle
in interfaceIsDefaultLine
- 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.- Specified by:
getBorderDashOffset
in interfaceIsDefaultLine
- 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).- Specified by:
getBorderJoinStyle
in interfaceIsDefaultLine
- 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)
Setstrue
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()
Returnstrue
to keep Bézier control inside the chart,false
for no restriction.- Specified by:
isCapBezierPoints
in interfaceIsDefaultLine
- 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 datasets.
The 'monotone' algorithm is more suited to y = f(x) datasets : it preserves monotonicity (or piecewise monotonicity) of the dataset 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.- Specified by:
getCubicInterpolationMode
in interfaceIsDefaultLine
- Returns:
- algorithm used to interpolate a smooth curve from the discrete data points.
-
setStepped
public void setStepped(boolean line)
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:
line
- if the line is shown as a stepped line.false
is no step interpolation
-
setStepped
public void setStepped(Stepped line)
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:
line
- if the line is shown as a stepped line.
-
getStepped
public Stepped getStepped()
Returns if the line is shown as a stepped line.- Specified by:
getStepped
in interfaceIsDefaultLine
- Returns:
- If the line is shown as a stepped line.
-
-