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 protectedLine(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 CapStylegetBorderCapStyle()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.doublegetBorderDashOffset()Returns the line dash pattern offset.JoinStylegetBorderJoinStyle()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).CubicInterpolationModegetCubicInterpolationMode()Returns algorithm used to interpolate a smooth curve from the discrete data points.FillHandlergetFillHandler()Returns a fill handler instance to use in the default methods of this interface.SteppedgetStepped()Returns if the line is shown as a stepped line.doublegetTension()Returns the Bézier curve tension (0 for no Bézier curves).booleanisCapBezierPoints()Returnstrueto keep Bézier control inside the chart,falsefor no restriction.voidsetBorderCapStyle(CapStyle borderCapStyle)Sets how the end points of every line are drawn.voidsetBorderDash(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.voidsetBorderDashOffset(double borderDashOffset)Sets the line dash pattern offset.voidsetBorderJoinStyle(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).voidsetCapBezierPoints(boolean capBezierPoints)Setstrueto keep Bézier control inside the chart,falsefor no restriction.voidsetCubicInterpolationMode(CubicInterpolationMode mode)Sets algorithm used to interpolate a smooth curve from the discrete data points.
The following interpolation modes are supported:
voidsetStepped(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.voidsetStepped(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.voidsetTension(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, getUpdateListener, retrieveRoot, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setElementAndAddToParent, setInternalCallbackToModel, setInternalCallbackToModel, setUpdateListener, setValueAndAddToParent, 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
checkAndGetColor, 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, 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, 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, getFillBaseline, getFillColors, setFill, setFill, setFill, setFill, setFillBaseline, setFillBaseline, setFillColors
-
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:HasFillReturns a fill handler instance to use in the default methods of this interface.- Specified by:
getFillHandlerin 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:
getTensionin 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:
getBorderCapStylein 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:
getBorderDashOffsetin 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:
getBorderJoinStylein 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)
Setstrueto keep Bézier control inside the chart,falsefor no restriction.- Parameters:
capBezierPoints-trueto keep Bézier control inside the chart,falsefor no restriction.
-
isCapBezierPoints
public boolean isCapBezierPoints()
Returnstrueto keep Bézier control inside the chart,falsefor no restriction.- Specified by:
isCapBezierPointsin interfaceIsDefaultLine- Returns:
trueto keep Bézier control inside the chart,falsefor 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:
getCubicInterpolationModein 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.falseis 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:
getSteppedin interfaceIsDefaultLine- Returns:
- If the line is shown as a stepped line.
-
-