Skip to content

Sparkline

Compact mini trendline and telemetry chart widget with fill gradient and hover data points.

Overview

Sparkline visualizes numerical trend series in a compact space. Features smooth line smoothing, under-curve area fill gradient, interactive cursor hover tooltips, and data point highlighting.

Telemetry Sparkline

Sparkline fpsChart = new Sparkline()
        .values(List.of(60, 58, 59, 62, 60, 55, 60))
        .lineColor(Color.GREEN);

API

API

Method Description
fillColor() Returns mutable under-curve gradient fill color.
lineColor() Returns mutable line stroke color.
pointColor() Returns mutable point marker color.
values(List) Sets numerical data points plotted on the sparkline.
Sparkline() Creates an empty sparkline with its default preferred size.

Sparkline::fillColor()

Fill Color

Returns mutable under-curve gradient fill color.

Returns MutableColor: The mutable RGBA fill color used below the line..

Sparkline::lineColor()

Line Color

Returns mutable line stroke color.

Returns MutableColor: The mutable RGBA line color; changing it overrides the style value..

Sparkline::pointColor()

Point Color

Returns mutable point marker color.

Returns MutableColor: The mutable RGBA color used for data-point markers..

Sparkline::values(List)

Data Values

Sets numerical data points plotted on the sparkline.

Parameter Type Description
values List Values in series order; null clears the series and null entries are treated as zero.

Returns Sparkline: This sparkline for fluent configuration..

Sparkline()

Create a sparkline

Creates an empty sparkline with its default preferred size.

Data

Method Description
values(float[]) Replaces the series without boxing numeric inputs.
values() Returns the current series as an immutable view.

Sparkline::values(float[])

Set sparkline values from floats

Replaces the series without boxing numeric inputs.

Parameter Type Description
data float[] Values in series order; null clears the series and non-finite values create gaps.

Returns Sparkline: This sparkline for fluent configuration..

Sparkline::values()

Get sparkline values

Returns the current series as an immutable view.

Returns List: An unmodifiable view of the current float values..

Appearance

Method Description
hoveredPointColor() Returns the mutable color used for the hovered point.
labelColor() Returns the mutable color used for point value labels.
tooltipBackground() Returns the mutable sparkline tooltip background color.
tooltipBorder() Returns the mutable sparkline tooltip border color.
fillVisible(boolean) Enables or disables the area fill beneath the line.
pointMode(PointMode) Selects which data points are rendered and interactive.
pointMode() Returns the current marker and hit-testing mode.
pointLabelsVisible(boolean) Enables or disables numeric labels beside data points.
pointLabelPlacement(PointLabelPlacement) Sets where point value labels are placed relative to markers.

Sparkline::hoveredPointColor()

Get hovered point color

Returns the mutable color used for the hovered point.

Returns MutableColor: The mutable RGBA hovered-point color..

Sparkline::labelColor()

Get point label color

Returns the mutable color used for point value labels.

Returns MutableColor: The mutable RGBA point-label color..

Sparkline::tooltipBackground()

Get tooltip background color

Returns the mutable sparkline tooltip background color.

Returns MutableColor: The mutable RGBA tooltip background color..

Sparkline::tooltipBorder()

Get tooltip border color

Returns the mutable sparkline tooltip border color.

Returns MutableColor: The mutable RGBA tooltip border color..

Sparkline::fillVisible(boolean)

Show sparkline fill

Enables or disables the area fill beneath the line.

Parameter Type Description
fillVisible boolean True to render the fill; this explicit value overrides the style setting.

Returns Sparkline: This sparkline for fluent configuration..

Sparkline::pointMode(PointMode)

Set point mode

Selects which data points are rendered and interactive.

Parameter Type Description
pointMode PointMode Point mode; null is treated as NONE.

Returns Sparkline: This sparkline for fluent configuration..

Sparkline::pointMode()

Get point mode

Returns the current marker and hit-testing mode.

Returns PointMode: The active point mode..

Sparkline::pointLabelsVisible(boolean)

Show point labels

Enables or disables numeric labels beside data points.

Parameter Type Description
pointLabelsVisible boolean True to render point value labels.

Returns Sparkline: This sparkline for fluent configuration..

Sparkline::pointLabelPlacement(PointLabelPlacement)

Set point label placement

Sets where point value labels are placed relative to markers.

Parameter Type Description
pointLabelPlacement PointLabelPlacement Placement mode; null resets to ABOVE.

Returns Sparkline: This sparkline for fluent configuration..

Custom Rendering

Method Description
pointRenderer(SparkPointRenderer) Installs or clears a custom data-point renderer.
pointLabelRenderer(SparkPointLabelRenderer) Installs or clears a custom point-label renderer.
pointTooltipRenderer(SparkPointTooltipRenderer) Installs or clears a custom tooltip renderer.

Sparkline::pointRenderer(SparkPointRenderer)

Customize point rendering

Installs or clears a custom data-point renderer.

Parameter Type Description
pointRenderer SparkPointRenderer Custom renderer, or null to use built-in point rendering.

Returns Sparkline: This sparkline for fluent configuration..

Sparkline::pointLabelRenderer(SparkPointLabelRenderer)

Customize point labels

Installs or clears a custom point-label renderer.

Parameter Type Description
pointLabelRenderer SparkPointLabelRenderer Custom renderer, or null to use built-in label rendering.

Returns Sparkline: This sparkline for fluent configuration..

Sparkline::pointTooltipRenderer(SparkPointTooltipRenderer)

Customize point tooltips

Installs or clears a custom tooltip renderer.

Parameter Type Description
pointTooltipRenderer SparkPointTooltipRenderer Custom renderer, or null to use built-in tooltip rendering.

Returns Sparkline: This sparkline for fluent configuration..

Layout

Method Description
preferredWidth() Returns the preferred width in UI pixels.
preferredWidth(float) Sets the preferred width in UI pixels.
preferredHeight() Returns the preferred height in UI pixels.
preferredHeight(float) Sets the preferred height in UI pixels.
preferredSize(float, float) Sets preferred width and height in UI pixels.

Sparkline::preferredWidth()

Get preferred sparkline width

Returns the preferred width in UI pixels.

Returns float: Preferred width in UI pixels..

Sparkline::preferredWidth(float)

Set preferred sparkline width

Sets the preferred width in UI pixels.

Parameter Type Description
preferredWidth float Preferred width in UI pixels; non-positive or non-finite values use the default.

Returns Sparkline: This sparkline for fluent configuration..

Sparkline::preferredHeight()

Get preferred sparkline height

Returns the preferred height in UI pixels.

Returns float: Preferred height in UI pixels..

Sparkline::preferredHeight(float)

Set preferred sparkline height

Sets the preferred height in UI pixels.

Parameter Type Description
preferredHeight float Preferred height in UI pixels; non-positive or non-finite values use the default.

Returns Sparkline: This sparkline for fluent configuration..

Sparkline::preferredSize(float, float)

Set preferred sparkline size

Sets preferred width and height in UI pixels.

Parameter Type Description
width float Preferred width in UI pixels.
height float Preferred height in UI pixels.

Returns Sparkline: This sparkline for fluent configuration..

Interaction

Method Description
onPointClick(EventListener) Registers a listener for clicks on data points.

Sparkline::onPointClick(EventListener)

Listen for point clicks

Registers a listener for clicks on data points.

Parameter Type Description
listener EventListener Listener receiving the clicked point event.

Returns EventSubscription: A subscription handle that can be cancelled..