Package org.pepstock.charba.client.data
Class LineDataset
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.commons.AbstractNode
-
- org.pepstock.charba.client.data.Dataset
-
- org.pepstock.charba.client.data.LiningDataset
-
- org.pepstock.charba.client.data.LineDataset
-
- All Implemented Interfaces:
HasCallbackScope
,HasDataPoints
,HasDataset
,HasPointFillStrokeStyles
,IsDefaultAnimationContainer
,IsDefaultAnimationTransition
,IsDefaultFillHandler
,HasAnimationOptions
,HasFill
,HasSpanGaps
- Direct Known Subclasses:
ScatterDataset
,StackedAreaDataset
,TimeSeriesLineDataset
,VerticalLineDataset
public class LineDataset extends LiningDataset implements HasDataPoints
The line chart allows a number of properties to be specified for each data set.
These are used to set display properties for a specific data set.
All point* properties can be specified as an array.
If these are set to an array value, the first value applies to the first point, the second value to the second point, and so on.- Author:
- Andrea "Stock" Stocchero
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.pepstock.charba.client.data.Dataset
Dataset.CanvasObjectProperty, Dataset.CommonProperty
-
-
Field Summary
-
Fields inherited from class org.pepstock.charba.client.data.Dataset
DEFAULT_HIDDEN, DEFAULT_NORMALIZED, DEFAULT_PARSING
-
-
Constructor Summary
Constructors Modifier Constructor Description LineDataset()
Creates a dataset.
It uses the global options has default.LineDataset(boolean hidden)
Creates a dataset.
It uses the global options has default.LineDataset(IsDefaultOptions defaultValues)
Creates the dataset using a default.LineDataset(IsDefaultOptions defaultValues, boolean hidden)
Creates the dataset using a default.protected
LineDataset(Type type, boolean hidden)
Creates the dataset using chart type related to the dataset.protected
LineDataset(Type type, IsDefaultOptions defaultValues, boolean hidden)
Creates the dataset using a default and chart type related to the dataset.
-
Method Summary
All Methods Instance Methods Concrete Methods Default Methods Modifier and Type Method Description CubicInterpolationMode
getCubicInterpolationMode()
Returns algorithm used to interpolate a smooth curve from the discrete data points.CubicInterpolationModeCallback
getCubicInterpolationModeCallback()
Returns the border join style callback, if set, otherwisenull
.List<String>
getDataString()
Returns the data property of a dataset for a chart is specified as an array of strings.List<String>
getDataString(boolean binding)
Returns the data property of a dataset for a chart is specified as an array of strings.IndexAxis
getIndexAxis()
Returns the base axis for the data set.default int
getOrder()
Returns the drawing order of dataset.
Also affects order for stacking, tooltip, and legend.default List<PointStyle>
getPointStyle()
Returns the style of the point.default List<Canvas>
getPointStyleAsCanvas()
Returns the style of the point as canvas.
If property is missing or not an canvas, returnsnull
.default List<Img>
getPointStyleAsImages()
Returns the style of the point as image.
If property is missing or not an image, returnsnull
.default PointStyleCallback
getPointStyleCallback()
Returns the point style callback, if set, otherwisenull
.default PointStyleType
getPointStyleType()
Returns the type of point style.Stepped
getStepped()
Returns if the line is shown as a stepped line.SteppedCallback
getSteppedCallback()
Returns the stepped callback, if set, otherwisenull
.ScaleId
getXAxisID()
Returns the ID of the x axis to plot this data set on.
If not specified, this defaults to the ID ofDefaultScaleId.X
.ScaleId
getYAxisID()
Returns the ID of the y axis to plot this data set on.boolean
isShowLine()
Returns if the line is not drawn for this dataset.void
setCubicInterpolationMode(CubicInterpolationModeCallback cubicInterpolationModeCallback)
Sets the border join style callback.void
setCubicInterpolationMode(NativeCallback cubicInterpolationModeCallback)
Sets the border join style callback.void
setCubicInterpolationMode(CubicInterpolationMode mode)
Sets algorithm used to interpolate a smooth curve from the discrete data points.
The following interpolation modes are supported:
void
setDataString(String... data)
Sets the data property of a dataset for a chart is specified as an array of strings.void
setDataString(List<String> data)
Sets the data property of a dataset for a chart is specified as an array of strings.void
setIndexAxis(IndexAxis indexAxis)
Sets the base axis for the data set.default void
setOrder(int order)
Sets the drawing order of dataset.
Also affects order for stacking, tooltip, and legend.default void
setPointStyle(PointStyleCallback pointStyleCallback)
Sets the point style callback.default void
setPointStyle(Canvas... pointStyle)
Sets the style of the point as canvas.default void
setPointStyle(Img... pointStyle)
Sets the style of the point as image.default void
setPointStyle(PointStyle... pointStyle)
Sets the style of the point.void
setShowLine(boolean showLine)
Sets if the line is not drawn for this dataset.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(NativeCallback steppedCallback)
Sets the stepped callback.void
setStepped(SteppedCallback steppedCallback)
Sets the stepped callback.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
setXAxisID(String xAxisID)
Sets the ID of the x axis to plot this dataset on.void
setXAxisID(ScaleId xAxisID)
Sets the ID of the x axis to plot this data set on.void
setYAxisID(String yAxisID)
Sets the ID of the y axis to plot this data set on.void
setYAxisID(ScaleId yAxisID)
Sets the ID of the y axis to plot this data set on.-
Methods inherited from class org.pepstock.charba.client.data.LiningDataset
getBackgroundColor, getBackgroundColorAsGradient, getBackgroundColorAsPattern, getBackgroundColorAsString, getBorderCapStyle, getBorderCapStyleCallback, getBorderColor, getBorderColorAsGradient, getBorderColorAsString, getBorderDash, getBorderDashCallback, getBorderDashOffset, getBorderDashOffsetCallback, getBorderJoinStyle, getBorderJoinStyleCallback, getBorderWidth, getBorderWidthCallback, getDefaultBackgroundColorAsString, getDefaultBorderColorAsString, getDefaultBorderWidth, getDefaultHoverBackgroundColorAsString, getDefaultHoverBorderColorAsString, getDefaultHoverBorderWidth, getFill, getFillCallback, getFillHandler, getHoverBackgroundColor, getHoverBackgroundColorAsGradient, getHoverBackgroundColorAsPatterns, getHoverBackgroundColorAsString, getHoverBorderCapStyle, getHoverBorderCapStyleCallback, getHoverBorderColor, getHoverBorderColorAsGradient, getHoverBorderColorAsString, getHoverBorderDash, getHoverBorderDashCallback, getHoverBorderDashOffset, getHoverBorderDashOffsetCallback, getHoverBorderJoinStyle, getHoverBorderJoinStyleCallback, getHoverBorderWidth, getHoverBorderWidthCallback, getLabel, getOrderHandler, getPointBackgroundColor, getPointBackgroundColorAsGradient, getPointBackgroundColorAsString, getPointBackgroundColorCallback, getPointBorderColor, getPointBorderColorAsGradient, getPointBorderColorAsString, getPointBorderColorCallback, getPointBorderWidth, getPointBorderWidthCallback, getPointFillStyleProperty, getPointHitRadius, getPointHitRadiusCallback, getPointHoverBackgroundColor, getPointHoverBackgroundColorAsGradient, getPointHoverBackgroundColorAsString, getPointHoverBackgroundColorCallback, getPointHoverBorderColor, getPointHoverBorderColorAsGradient, getPointHoverBorderColorAsString, getPointHoverBorderColorCallback, getPointHoverBorderWidth, getPointHoverBorderWidthCallback, getPointHoverRadius, getPointHoverRadiusCallback, getPointRadius, getPointRadiusCallback, getPointRotation, getPointRotationCallback, getPointStrokeStyleProperty, getPointStyleHandler, getSpanGapHandler, getTension, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBorderCapStyle, setBorderCapStyle, setBorderCapStyle, setBorderColor, setBorderColor, setBorderColor, setBorderDash, setBorderDash, setBorderDash, setBorderDashOffset, setBorderDashOffset, setBorderDashOffset, setBorderJoinStyle, setBorderJoinStyle, setBorderJoinStyle, setBorderWidth, setBorderWidth, setBorderWidth, setFill, setFill, setHoverBackgroundColor, setHoverBackgroundColor, setHoverBackgroundColor, setHoverBackgroundColor, setHoverBorderCapStyle, setHoverBorderCapStyle, setHoverBorderCapStyle, setHoverBorderColor, setHoverBorderColor, setHoverBorderColor, setHoverBorderDash, setHoverBorderDash, setHoverBorderDash, setHoverBorderDashOffset, setHoverBorderDashOffset, setHoverBorderDashOffset, setHoverBorderJoinStyle, setHoverBorderJoinStyle, setHoverBorderJoinStyle, setHoverBorderWidth, setHoverBorderWidth, setHoverBorderWidth, setPointBackgroundColor, setPointBackgroundColor, setPointBackgroundColor, setPointBackgroundColor, setPointBackgroundColor, setPointBorderColor, setPointBorderColor, setPointBorderColor, setPointBorderColor, setPointBorderColor, setPointBorderWidth, setPointBorderWidth, setPointBorderWidth, setPointHitRadius, setPointHitRadius, setPointHitRadius, setPointHoverBackgroundColor, setPointHoverBackgroundColor, setPointHoverBackgroundColor, setPointHoverBackgroundColor, setPointHoverBackgroundColor, setPointHoverBorderColor, setPointHoverBorderColor, setPointHoverBorderColor, setPointHoverBorderColor, setPointHoverBorderColor, setPointHoverBorderWidth, setPointHoverBorderWidth, setPointHoverBorderWidth, setPointHoverRadius, setPointHoverRadius, setPointHoverRadius, setPointRadius, setPointRadius, setPointRadius, setPointRotation, setPointRotation, setPointRotation, setTension
-
Methods inherited from class org.pepstock.charba.client.data.Dataset
createContext, getAnimationContainer, getBackgroundColorCallback, getBorderColorCallback, getClip, getClipAsObject, getData, getData, getDataCount, getDataset, getDataType, getDefaultValues, getHoverBackgroundColorCallback, getHoverBorderColorCallback, getId, getOptions, getOptions, getScope, getType, getTypedDataset, hasOptions, invokeColorCallback, isClip, isHidden, isNormalized, isParsing, removeOptions, setBackgroundColor, setBackgroundColor, setBorderColor, setBorderColor, setClip, setClip, setClip, setData, setData, setHidden, setHoverBackgroundColor, setHoverBackgroundColor, setHoverBorderColor, setHoverBorderColor, setLabel, setNormalized, setOptions, setOptions, setParsing
-
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, 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, 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.HasAnimationOptions
getAnimation, getAnimations, getTransitions, isAnimationEnabled, setAnimationEnabled
-
Methods inherited from interface org.pepstock.charba.client.data.HasDataPoints
getDataPoints, getDataPoints, setDataPoints, setDataPoints
-
Methods inherited from interface org.pepstock.charba.client.data.HasDataset
getDataset
-
Methods inherited from interface org.pepstock.charba.client.options.HasFill
setFill, setFill, setFill, setFill
-
Methods inherited from interface org.pepstock.charba.client.options.HasSpanGaps
getSpanGaps, isSpanGaps, setSpanGaps, setSpanGaps
-
-
-
-
Constructor Detail
-
LineDataset
public LineDataset()
Creates a dataset.
It uses the global options has default.
-
LineDataset
public LineDataset(boolean hidden)
Creates a dataset.
It uses the global options has default.- Parameters:
hidden
- iftrue
, it will be initially hidden.
-
LineDataset
public LineDataset(IsDefaultOptions defaultValues)
Creates the dataset using a default.- Parameters:
defaultValues
- default options
-
LineDataset
public LineDataset(IsDefaultOptions defaultValues, boolean hidden)
Creates the dataset using a default.- Parameters:
defaultValues
- default optionshidden
- iftrue
, it will be initially hidden.
-
LineDataset
protected LineDataset(Type type, boolean hidden)
Creates the dataset using chart type related to the dataset.- Parameters:
type
- chart type related to the datasethidden
- iftrue
, it will be initially hidden.
-
LineDataset
protected LineDataset(Type type, IsDefaultOptions defaultValues, boolean hidden)
Creates the dataset using a default and chart type related to the dataset.- Parameters:
type
- chart type related to the datasetdefaultValues
- default optionshidden
- iftrue
, it will be initially hidden.
-
-
Method Detail
-
setXAxisID
public void setXAxisID(String xAxisID)
Sets the ID of the x axis to plot this dataset on.- Parameters:
xAxisID
- the ID of the x axis to plot this dataset on.
-
setXAxisID
public void setXAxisID(ScaleId xAxisID)
Sets the ID of the x axis to plot this data set on.- Parameters:
xAxisID
- the ID of the x axis to plot this data set on.
-
getXAxisID
public ScaleId getXAxisID()
Returns the ID of the x axis to plot this data set on.
If not specified, this defaults to the ID ofDefaultScaleId.X
.- Returns:
- the ID of the x axis to plot this data set on.
If not specified, this defaults to the ID ofDefaultScaleId.X
-
setYAxisID
public void setYAxisID(String yAxisID)
Sets the ID of the y axis to plot this data set on.- Parameters:
yAxisID
- the ID of the y axis to plot this data set on.
-
setYAxisID
public void setYAxisID(ScaleId yAxisID)
Sets the ID of the y axis to plot this data set on.- Parameters:
yAxisID
- the ID of the y axis to plot this data set on.
-
getYAxisID
public ScaleId getYAxisID()
Returns the ID of the y axis to plot this data set on.
If not specified, this defaults to the ID ofDefaultScaleId.Y
.- Returns:
- the ID of the y axis to plot this data set on.
If not specified, this defaults to the ID ofDefaultScaleId.Y
-
setIndexAxis
public void setIndexAxis(IndexAxis indexAxis)
Sets the base axis for the data set. UseIndexAxis.Y
for vertical line.- Parameters:
indexAxis
- the base axis for the data set
-
getIndexAxis
public IndexAxis getIndexAxis()
Returns the base axis for the data set.- Returns:
- the base axis for the data set
-
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.- Returns:
- algorithm used to interpolate a smooth curve from the discrete data points.
-
setShowLine
public void setShowLine(boolean showLine)
Sets if the line is not drawn for this dataset.- Parameters:
showLine
-false
if the line is not drawn for this dataset.
-
isShowLine
public boolean isShowLine()
Returns if the line is not drawn for this dataset.- Returns:
false
if the line is not drawn for this dataset.
-
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.- Returns:
- If the line is shown as a stepped line.
-
setDataString
public void setDataString(String... data)
Sets the data property of a dataset for a chart is specified as an array of strings. Each point in the data array corresponds to the label at the same index on the x axis.- Parameters:
data
- an array of strings
-
setDataString
public void setDataString(List<String> data)
Sets the data property of a dataset for a chart is specified as an array of strings. Each point in the data array corresponds to the label at the same index on the x axis.- Parameters:
data
- a list of strings
-
getDataString
public List<String> getDataString()
Returns the data property of a dataset for a chart is specified as an array of strings. Each point in the data array corresponds to the label at the same index on the x axis.- Returns:
- a list of strings or an empty list of strings if the data type is not
DataType.STRINGS
.
-
getDataString
public List<String> getDataString(boolean binding)
Returns the data property of a dataset for a chart is specified as an array of strings. Each point in the data array corresponds to the label at the same index on the x axis.- Parameters:
binding
- iftrue
binds the new array list in the container- Returns:
- a list of strings or an empty list of strings if the data type is not
DataType.STRINGS
.
-
getCubicInterpolationModeCallback
public CubicInterpolationModeCallback getCubicInterpolationModeCallback()
Returns the border join style callback, if set, otherwisenull
.- Returns:
- the border join style callback, if set, otherwise
null
.
-
setCubicInterpolationMode
public void setCubicInterpolationMode(CubicInterpolationModeCallback cubicInterpolationModeCallback)
Sets the border join style callback.- Parameters:
cubicInterpolationModeCallback
- the border join style callback.
-
setCubicInterpolationMode
public void setCubicInterpolationMode(NativeCallback cubicInterpolationModeCallback)
Sets the border join style callback.- Parameters:
cubicInterpolationModeCallback
- the border join style callback.
-
getSteppedCallback
public SteppedCallback getSteppedCallback()
Returns the stepped callback, if set, otherwisenull
.- 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.
-
setOrder
public default void setOrder(int order)
Sets the drawing order of dataset.
Also affects order for stacking, tooltip, and legend.- Parameters:
order
- the drawing order of dataset.
-
getOrder
public default int getOrder()
Returns the drawing order of dataset.
Also affects order for stacking, tooltip, and legend.- Returns:
- the drawing order of dataset
-
setPointStyle
public default void setPointStyle(PointStyle... pointStyle)
Sets the style of the point.- Parameters:
pointStyle
- array of the style of the point.
-
getPointStyle
public default List<PointStyle> getPointStyle()
Returns the style of the point.- Returns:
- the style of the point or
null
if point style is set as image
-
setPointStyle
public default void setPointStyle(Img... pointStyle)
Sets the style of the point as image.- Parameters:
pointStyle
- image element of the style of the point as image.
-
getPointStyleType
public default PointStyleType getPointStyleType()
Returns the type of point style.- Returns:
- the type of point style
-
getPointStyleAsImages
public default List<Img> getPointStyleAsImages()
Returns the style of the point as image.
If property is missing or not an image, returnsnull
.- Returns:
- image of the style of the point as image.
If property is missing or not a image, returnsnull
.
-
setPointStyle
public default void setPointStyle(Canvas... pointStyle)
Sets the style of the point as canvas.- Parameters:
pointStyle
- canvas element of the style of the point as canvas.
-
getPointStyleAsCanvas
public default List<Canvas> getPointStyleAsCanvas()
Returns the style of the point as canvas.
If property is missing or not an canvas, returnsnull
.- Returns:
- image of the style of the point as canvas.
If property is missing or not a canvas, returnsnull
.
-
getPointStyleCallback
public default PointStyleCallback getPointStyleCallback()
Returns the point style callback, if set, otherwisenull
.- Returns:
- the point style callback, if set, otherwise
null
.
-
setPointStyle
public default void setPointStyle(PointStyleCallback pointStyleCallback)
Sets the point style callback.- Parameters:
pointStyleCallback
- the point style callback.
-
-