Class CjDataPoint

java.lang.Object
com.oorian.chartjs.CjDataPoint
All Implemented Interfaces:
com.oorian.json.Jsonable

public class CjDataPoint extends Object implements com.oorian.json.Jsonable
Represents a data point for scatter and bubble charts.

For scatter charts, use x and y coordinates. For bubble charts, also include r (radius).

Usage:


 // Scatter chart point
 CjDataPoint point = CjDataPoint.of(10, 20);

 // Bubble chart point with radius
 CjDataPoint bubble = CjDataPoint.bubble(10, 20, 15);
 
  • Constructor Details

    • CjDataPoint

      public CjDataPoint(Number x, Number y)
      Creates a data point with x and y coordinates.
      Parameters:
      x - The x-coordinate
      y - The y-coordinate
    • CjDataPoint

      public CjDataPoint(Number x, Number y, Number r)
      Creates a data point with x, y coordinates and radius (for bubble charts).
      Parameters:
      x - The x-coordinate
      y - The y-coordinate
      r - The radius (bubble size)
  • Method Details

    • setX

      public CjDataPoint setX(Number x)
      Sets the x-coordinate.
      Parameters:
      x - The x-coordinate
      Returns:
      This instance for method chaining
    • setY

      public CjDataPoint setY(Number y)
      Sets the y-coordinate.
      Parameters:
      y - The y-coordinate
      Returns:
      This instance for method chaining
    • setR

      public CjDataPoint setR(Number r)
      Sets the radius (for bubble charts).
      Parameters:
      r - The radius
      Returns:
      This instance for method chaining
    • getX

      public Number getX()
      Gets the x-coordinate.
      Returns:
      The x-coordinate
    • getY

      public Number getY()
      Gets the y-coordinate.
      Returns:
      The y-coordinate
    • getR

      public Number getR()
      Gets the radius.
      Returns:
      The radius, or null if not set
    • initFromJson

      public void initFromJson(com.oorian.json.JsonValue json)
      Specified by:
      initFromJson in interface com.oorian.json.Jsonable
    • toJsonValue

      public com.oorian.json.JsonValue toJsonValue()
      Specified by:
      toJsonValue in interface com.oorian.json.Jsonable
    • of

      public static CjDataPoint of(Number x, Number y)
      Creates a scatter chart data point.
      Parameters:
      x - The x-coordinate
      y - The y-coordinate
      Returns:
      A new CjDataPoint
    • bubble

      public static CjDataPoint bubble(Number x, Number y, Number r)
      Creates a bubble chart data point.
      Parameters:
      x - The x-coordinate
      y - The y-coordinate
      r - The radius
      Returns:
      A new CjDataPoint