Class Series

java.lang.Object
com.jbstrap.ui.components.charts.Series
Direct Known Subclasses:
AxesBaseSeries

public class Series extends Object
An object containing the data series displayed on the chart and all of its settings.
Since:
4.0
Author:
JBStrap
  • Field Details

  • Constructor Details

    • Series

      public Series(String title)
      Creates a generic series for the charts.
      Parameters:
      title - Series title (required)
      Throws:
      NullPointerException - Thrown if the specified title parameter’s value is null
    • Series

      public Series(String title, String dataColumn)
      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 is null
  • Method Details

    • getMarker

      protected Parameters getMarker()
      Gets the series marker settings.
      Returns:
      Series marker settings
    • getTitle

      public String getTitle()
      Gets the series name.
      Returns:
      Series name
    • setDataColumn

      public Series setDataColumn(String dataColumn)
      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

      public String 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

      public Series setLabelColumn(String labelColumn)
      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

      public String getLabelColumn()
      Gets the name of the label column.
      Returns:
      Data label column name or null, if no data label column was specified
    • setColorColumn

      public Series setColorColumn(String colorColumn)
      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

      public String 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

      public Series setMarkerType(MarkerType markerType)
      Sets the type of the marker indicating data points on a chart.
      Parameters:
      markerType - Marker type Available types are listed in the enum MarkerType. If not specified or null, the default marker type MarkerType.CIRCLE is set.
      Returns:
      Series object
    • getMarkerType

      public MarkerType getMarkerType()
      Gets the type of the marker indicating data points on a chart.
      Returns:
      Marker type
    • setMarkerSize

      public Series setMarkerSize(Double size)
      Sets the size of the marker indicating data points on a chart.
      Parameters:
      size - Marker size If null is specified, the marker is not visible.
      Returns:
      Series object
    • getMarkerSize

      public Double getMarkerSize()
      Gets the size of the marker indicating data points on a chart.
      Returns:
      Marker size
    • addData

      protected Series addData(Record record, boolean refreshData)
      Adds a new record to the list grid.
      Parameters:
      record - The record to be added to the series
      refreshData - A Boolean indicating whether the interface should be updated upon adding a new record If true is specified, the interface is automatically updated upon adding a new record. The chart receives all data again. If false 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 is null
      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

      protected Series addData(Object x, Number y, String label, String color, boolean refreshData)
      Adds a new data series to the series object.
      Parameters:
      x - X axis value (required)
      y - Y axis value
      label - Data point label
      color - Custom data point color in CSS3 format
      refreshData - A Boolean indicating whether the interface should be updated upon adding a new record If true is specified, the interface is automatically updated upon adding a new record. The chart receives all data again. If false 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 is null
      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

      public Series addData(Record record)
      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 is null
      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

      public Series addData(Object x, Number y, String label, String color)
      Adds a new data series to the series object.
      Parameters:
      x - X axis value (required)
      y - Y axis value
      label - Data point label
      color - Custom data point color in CSS3 format
      Returns:
      Series object
      Throws:
      NullPointerException - Thrown if the X axis component in the record is null
      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

      protected Series clear()
      Clears all data from the series object.
      Returns:
      Series object
    • getParams

      protected Parameters getParams()
      Gets the series settings.
      Returns:
      Series settings
    • setParams

      protected Series setParams(Parameters params)
      Sets the series based on the specified parameters.
      Parameters:
      params - Parameter object containing series settings
      Returns:
      Series
    • getValues

      protected List<Parameters> 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

      public List<Record> 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

      protected Series setParentChart(BaseChart<?> parent)
      Sets the chart associated with the series. If the series is removed, a null 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), otherwise false
    • removeDataByIndex

      public Series removeDataByIndex(int index)
      Removes a data point with the specified index from the series.
      Parameters:
      index - Index referencing the data point
      Returns:
      Series object
    • removeDataByCategory

      public Series removeDataByCategory(Object category)
      Removes a data point with the specified X value from the series.
      Parameters:
      category - X value associated with the data point
      Returns:
      Series object