Package com.jbstrap.ui.components.charts
Class Series
java.lang.Object
com.jbstrap.ui.components.charts.Series
- Direct Known Subclasses:
AxesBaseSeries
An object containing the data series displayed on the chart and all of its settings.
- Since:
- 4.0
- Author:
- JBStrap
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a record to the series object.protected Series
Adds a new record to the list grid.Adds a new data series to the series object.protected Series
Adds a new data series to the series object.protected Series
clear()
Clears all data from the series object.Gets the name of the data point color column.getData()
Gets all data point settings from a series.Gets the name of the series data column.Gets the name of the label column.protected Parameters
Gets the series marker settings.Gets the size of the marker indicating data points on a chart.Gets the type of the marker indicating data points on a chart.protected Parameters
Gets the series settings.getTitle()
Gets the series name.protected List<Parameters>
Gets all data point settings from a series.protected boolean
isEmpty()
Checks if the series is empty (contains no data).protected void
Updates marker settings.removeDataByCategory
(Object category) Removes a data point with the specified X value from the series.removeDataByIndex
(int index) Removes a data point with the specified index from the series.setColorColumn
(String colorColumn) Sets the name of the data point color column.setDataColumn
(String dataColumn) Sets the name of the data column to be displayed.setLabelColumn
(String labelColumn) Sets the name of the column containing data labels.setMarkerSize
(Double size) Sets the size of the marker indicating data points on a chart.setMarkerType
(MarkerType markerType) Sets the type of the marker indicating data points on a chart.protected Series
setParams
(Parameters params) Sets the series based on the specified parameters.protected Series
setParentChart
(BaseChart<?> parent) Sets the chart associated with the series.
-
Field Details
-
DATA_COLUMN
- See Also:
-
CATEGORY_COLUMN
- See Also:
-
LABEL_COLUMN
- See Also:
-
COLOR_COLUMN
- See Also:
-
MARKER_TYPE
- See Also:
-
MARKER_SIZE
- See Also:
-
parentChart
-
param
-
dataColumn
-
labelColumn
-
colorColumn
-
-
Constructor Details
-
Series
Creates a generic series for the charts.- Parameters:
title
- Series title (required)- Throws:
NullPointerException
- Thrown if the specified title parameter’s value isnull
-
Series
Creates a generic series for the charts and sets the name of the displayed data column.- Parameters:
title
- Series title (required)dataColumn
- Data column name- Throws:
NullPointerException
- Thrown if the specified title parameter’s value isnull
-
-
Method Details
-
getMarker
Gets the series marker settings.- Returns:
- Series marker settings
-
getTitle
Gets the series name.- Returns:
- Series name
-
setDataColumn
Sets the name of the data column to be displayed. The chart uses this column as a source for displayed data points.- Parameters:
dataColumn
- Data column name- Returns:
- Series object
-
getDataColumn
Gets the name of the series data column.- Returns:
- Data column name or
null
, if no data columns were specified for the series
-
setLabelColumn
Sets the name of the column containing data labels. The chart uses this column as a source for displayed data labels.- Parameters:
labelColumn
- Data label column name- Returns:
- Series object
-
getLabelColumn
Gets the name of the label column.- Returns:
- Data label column name or
null
, if no data label column was specified
-
setColorColumn
Sets the name of the data point color column. The chart uses this column as a source for displayed data point color. If left unspecified, data point are displayed according to the series color.- Parameters:
colorColumn
- The name of the column containing the color for each data point- Returns:
- Series object
-
getColorColumn
Gets the name of the data point color column.- Returns:
- Data point color column name or
null
, if no data point color column was specified
-
refreshMarker
protected void refreshMarker()Updates marker settings. -
setMarkerType
Sets the type of the marker indicating data points on a chart.- Parameters:
markerType
- Marker type Available types are listed in the enumMarkerType
. If not specified ornull
, the default marker typeMarkerType.CIRCLE
is set.- Returns:
- Series object
-
getMarkerType
Gets the type of the marker indicating data points on a chart.- Returns:
- Marker type
-
setMarkerSize
Sets the size of the marker indicating data points on a chart.- Parameters:
size
- Marker size Ifnull
is specified, the marker is not visible.- Returns:
- Series object
-
getMarkerSize
Gets the size of the marker indicating data points on a chart.- Returns:
- Marker size
-
addData
Adds a new record to the list grid.- Parameters:
record
- The record to be added to the seriesrefreshData
- A Boolean indicating whether the interface should be updated upon adding a new record Iftrue
is specified, the interface is automatically updated upon adding a new record. The chart receives all data again. Iffalse
is specified, the update does not take place. It is advisable to use this method when adding multiple records to the chart consecutively and perform an update only after adding the last record.- Returns:
- Series object
- Throws:
NullPointerException
- Thrown if the X axis component in the record isnull
NullPointerException
- Thrown if the Y axis component in the record is not a number or the type of the X axis component does not correspond to the chart’s specified axis type
-
addData
Adds a new data series to the series object.- Parameters:
x
- X axis value (required)y
- Y axis valuelabel
- Data point labelcolor
- Custom data point color in CSS3 formatrefreshData
- A Boolean indicating whether the interface should be updated upon adding a new record Iftrue
is specified, the interface is automatically updated upon adding a new record. The chart receives all data again. Iffalse
is specified, the update does not take place. It is advisable to use this method when adding multiple records to the chart consecutively and perform an update only after adding the last record.- Returns:
- Series object
- Throws:
NullPointerException
- Thrown if the X axis component in the record isnull
NullPointerException
- Thrown if the Y axis component in the record is not a number or the type of the X axis component does not correspond to the chart’s specified axis type
-
addData
Adds a record to the series object.- Parameters:
record
- The record to be added to the chart- Returns:
- Series object
- Throws:
NullPointerException
- Thrown if the X axis component in the record isnull
NullPointerException
- Thrown if the Y axis component in the record is not a number or the type of the X axis component does not correspond to the chart’s specified axis type
-
addData
Adds a new data series to the series object.- Parameters:
x
- X axis value (required)y
- Y axis valuelabel
- Data point labelcolor
- Custom data point color in CSS3 format- Returns:
- Series object
- Throws:
NullPointerException
- Thrown if the X axis component in the record isnull
NullPointerException
- Thrown if the Y axis component in the record is not a number or the type of the X axis component does not correspond to the chart’s specified axis type
-
clear
Clears all data from the series object.- Returns:
- Series object
-
getParams
Gets the series settings.- Returns:
- Series settings
-
setParams
Sets the series based on the specified parameters.- Parameters:
params
- Parameter object containing series settings- Returns:
- Series
-
getValues
Gets all data point settings from a series.- Returns:
- A list of all data point settings contained in a series If the series does not contain any data points, the method returns an empty list.
-
getData
Gets all data point settings from a series.- Returns:
- A list of records contained in a series If the series does not contain any records, the method returns an empty list.
-
setParentChart
Sets the chart associated with the series. If the series is removed, anull
is specified.- Parameters:
parent
- Chart instance associated with the series- Returns:
- Series object
-
isEmpty
protected boolean isEmpty()Checks if the series is empty (contains no data).- Returns:
- If
true
, the series is empty (contains no data), otherwisefalse
-
removeDataByIndex
Removes a data point with the specified index from the series.- Parameters:
index
- Index referencing the data point- Returns:
- Series object
-
removeDataByCategory
Removes a data point with the specified X value from the series.- Parameters:
category
- X value associated with the data point- Returns:
- Series object
-