Class ApexSeries

java.lang.Object
com.oorian.apexcharts.ApexSeries

public class ApexSeries extends Object
Represents a data series for ApexCharts. Supports various data formats including simple values, XY points, OHLC candlestick data, boxplot statistics, and range data.
  • Constructor Details

    • ApexSeries

      public ApexSeries()
      Creates a new series with no name.
    • ApexSeries

      public ApexSeries(String name)
      Creates a new series with the specified name.
      Parameters:
      name - The series name.
  • Method Details

    • setName

      public ApexSeries setName(String name)
      Sets the series name.
      Parameters:
      name - The series name.
      Returns:
      This series for method chaining.
    • setType

      public ApexSeries setType(String type)
      Sets the series type (for mixed charts).
      Parameters:
      type - The chart type for this series.
      Returns:
      This series for method chaining.
    • setData

      public ApexSeries setData(Number... values)
      Sets the data values for this series.
      Parameters:
      values - The data values.
      Returns:
      This series for method chaining.
    • setData

      public ApexSeries setData(List<Number> values)
      Sets the data values for this series from a list.
      Parameters:
      values - The data values.
      Returns:
      This series for method chaining.
    • addData

      public ApexSeries addData(Number value)
      Adds a single data value.
      Parameters:
      value - The data value.
      Returns:
      This series for method chaining.
    • addDataPoint

      public ApexSeries addDataPoint(Object x, Number y)
      Adds an x-y data point.
      Parameters:
      x - The x value.
      y - The y value.
      Returns:
      This series for method chaining.
    • addBubblePoint

      public ApexSeries addBubblePoint(Object x, Number y, Number z)
      Adds a bubble data point (x, y, z).
      Parameters:
      x - The x value.
      y - The y value.
      z - The z value (bubble size).
      Returns:
      This series for method chaining.
    • setColor

      public ApexSeries setColor(String color)
      Sets the color for this series.
      Parameters:
      color - The color value.
      Returns:
      This series for method chaining.
    • addCandlestickPoint

      public ApexSeries addCandlestickPoint(Object x, Number open, Number high, Number low, Number close)
      Adds a candlestick (OHLC) data point.
      Parameters:
      x - The x value (typically a date/timestamp or category).
      open - The opening value.
      high - The highest value.
      low - The lowest value.
      close - The closing value.
      Returns:
      This series for method chaining.
    • addBoxPlotPoint

      public ApexSeries addBoxPlotPoint(Object x, Number min, Number q1, Number median, Number q3, Number max)
      Adds a boxplot data point with the five-number summary.
      Parameters:
      x - The x value (category name).
      min - The minimum value.
      q1 - The first quartile (25th percentile).
      median - The median (50th percentile).
      q3 - The third quartile (75th percentile).
      max - The maximum value.
      Returns:
      This series for method chaining.
    • addRangePoint

      public ApexSeries addRangePoint(Object x, Number start, Number end)
      Adds a range data point with start and end values. Used for rangeBar and rangeArea charts.
      Parameters:
      x - The x value (category name).
      start - The starting value.
      end - The ending value.
      Returns:
      This series for method chaining.
    • addTimelinePoint

      public ApexSeries addTimelinePoint(String x, long startTimestamp, long endTimestamp)
      Adds a range data point with timestamps for timeline/Gantt charts.
      Parameters:
      x - The x value (task name).
      startTimestamp - The start timestamp in milliseconds.
      endTimestamp - The end timestamp in milliseconds.
      Returns:
      This series for method chaining.
    • toJsonObject

      public com.oorian.json.JsonObject toJsonObject()
      Converts this series to a JsonObject.
      Returns:
      The JsonObject representation.