Sparkline
Компактный микрографик трендов и телеметрии с градиентной заливкой и точками при наведении.
Обзор
Sparkline отображает числовые ряды значений в компактном виде. Поддерживает сглаживание линий, градиентную заливку под графиком, интерактивные подсказки при наведении и подсветку точек данных.
График телеметрии
Sparkline fpsChart = new Sparkline()
.values(List.of(60, 58, 59, 62, 60, 55, 60))
.lineColor(Color.GREEN);
API
API
| Метод | Описание |
|---|---|
fillColor() |
Возвращает цвет градиентной заливки под линией графика. |
lineColor() |
Возвращает цвет линии графика. |
pointColor() |
Возвращает цвет маркеров точек данных. |
values(List) |
Устанавливает список числовых значений для построения графика. |
Sparkline() |
Creates an empty sparkline with its default preferred size. |
Sparkline::fillColor()
Цвет заливки
Возвращает цвет градиентной заливки под линией графика.
Возвращает MutableColor: The mutable RGBA fill color used below the line..
Sparkline::lineColor()
Цвет линии
Возвращает цвет линии графика.
Возвращает MutableColor: The mutable RGBA line color; changing it overrides the style value..
Sparkline::pointColor()
Цвет точек данных
Возвращает цвет маркеров точек данных.
Возвращает MutableColor: The mutable RGBA color used for data-point markers..
Sparkline::values(List)
Значения данных
Устанавливает список числовых значений для построения графика.
| Параметр | Тип | Описание |
|---|---|---|
values |
List |
Values in series order; null clears the series and null entries are treated as zero. |
Возвращает Sparkline: This sparkline for fluent configuration..
Sparkline()
Create a sparkline
Creates an empty sparkline with its default preferred size.
Data
| Метод | Описание |
|---|---|
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.
| Параметр | Тип | Описание |
|---|---|---|
data |
float[] |
Values in series order; null clears the series and non-finite values create gaps. |
Возвращает Sparkline: This sparkline for fluent configuration..
Sparkline::values()
Get sparkline values
Returns the current series as an immutable view.
Возвращает List: An unmodifiable view of the current float values..
Appearance
| Метод | Описание |
|---|---|
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.
Возвращает MutableColor: The mutable RGBA hovered-point color..
Sparkline::labelColor()
Get point label color
Returns the mutable color used for point value labels.
Возвращает MutableColor: The mutable RGBA point-label color..
Sparkline::tooltipBackground()
Get tooltip background color
Returns the mutable sparkline tooltip background color.
Возвращает MutableColor: The mutable RGBA tooltip background color..
Sparkline::tooltipBorder()
Get tooltip border color
Returns the mutable sparkline tooltip border color.
Возвращает MutableColor: The mutable RGBA tooltip border color..
Sparkline::fillVisible(boolean)
Show sparkline fill
Enables or disables the area fill beneath the line.
| Параметр | Тип | Описание |
|---|---|---|
fillVisible |
boolean |
True to render the fill; this explicit value overrides the style setting. |
Возвращает Sparkline: This sparkline for fluent configuration..
Sparkline::pointMode(PointMode)
Set point mode
Selects which data points are rendered and interactive.
| Параметр | Тип | Описание |
|---|---|---|
pointMode |
PointMode |
Point mode; null is treated as NONE. |
Возвращает Sparkline: This sparkline for fluent configuration..
Sparkline::pointMode()
Get point mode
Returns the current marker and hit-testing mode.
Возвращает PointMode: The active point mode..
Sparkline::pointLabelsVisible(boolean)
Show point labels
Enables or disables numeric labels beside data points.
| Параметр | Тип | Описание |
|---|---|---|
pointLabelsVisible |
boolean |
True to render point value labels. |
Возвращает Sparkline: This sparkline for fluent configuration..
Sparkline::pointLabelPlacement(PointLabelPlacement)
Set point label placement
Sets where point value labels are placed relative to markers.
| Параметр | Тип | Описание |
|---|---|---|
pointLabelPlacement |
PointLabelPlacement |
Placement mode; null resets to ABOVE. |
Возвращает Sparkline: This sparkline for fluent configuration..
Custom Rendering
| Метод | Описание |
|---|---|
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.
| Параметр | Тип | Описание |
|---|---|---|
pointRenderer |
SparkPointRenderer |
Custom renderer, or null to use built-in point rendering. |
Возвращает Sparkline: This sparkline for fluent configuration..
Sparkline::pointLabelRenderer(SparkPointLabelRenderer)
Customize point labels
Installs or clears a custom point-label renderer.
| Параметр | Тип | Описание |
|---|---|---|
pointLabelRenderer |
SparkPointLabelRenderer |
Custom renderer, or null to use built-in label rendering. |
Возвращает Sparkline: This sparkline for fluent configuration..
Sparkline::pointTooltipRenderer(SparkPointTooltipRenderer)
Customize point tooltips
Installs or clears a custom tooltip renderer.
| Параметр | Тип | Описание |
|---|---|---|
pointTooltipRenderer |
SparkPointTooltipRenderer |
Custom renderer, or null to use built-in tooltip rendering. |
Возвращает Sparkline: This sparkline for fluent configuration..
Layout
| Метод | Описание |
|---|---|
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.
Возвращает float: Preferred width in UI pixels..
Sparkline::preferredWidth(float)
Set preferred sparkline width
Sets the preferred width in UI pixels.
| Параметр | Тип | Описание |
|---|---|---|
preferredWidth |
float |
Preferred width in UI pixels; non-positive or non-finite values use the default. |
Возвращает Sparkline: This sparkline for fluent configuration..
Sparkline::preferredHeight()
Get preferred sparkline height
Returns the preferred height in UI pixels.
Возвращает float: Preferred height in UI pixels..
Sparkline::preferredHeight(float)
Set preferred sparkline height
Sets the preferred height in UI pixels.
| Параметр | Тип | Описание |
|---|---|---|
preferredHeight |
float |
Preferred height in UI pixels; non-positive or non-finite values use the default. |
Возвращает Sparkline: This sparkline for fluent configuration..
Sparkline::preferredSize(float, float)
Set preferred sparkline size
Sets preferred width and height in UI pixels.
| Параметр | Тип | Описание |
|---|---|---|
width |
float |
Preferred width in UI pixels. |
height |
float |
Preferred height in UI pixels. |
Возвращает Sparkline: This sparkline for fluent configuration..
Interaction
| Метод | Описание |
|---|---|
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.
| Параметр | Тип | Описание |
|---|---|---|
listener |
EventListener |
Listener receiving the clicked point event. |
Возвращает EventSubscription: A subscription handle that can be cancelled..