Enum Class LegendPosition
- All Implemented Interfaces:
Serializable, Comparable<LegendPosition>, Constable
Standard positions for overlay legends.
This enum is used by legend overlays to compute their anchor point and apply padding.
The default position is typically TOP_LEFT.
- Since:
- 2026-01-01
- Version:
- 1.0.0
- Author:
- Arber Gashi
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionBottom-center of the chart area.Bottom-left corner of the chart area.Bottom-right corner of the chart area.Center of the chart area.Middle-left of the chart area.Middle-right of the chart area.Top-center of the chart area.Top-left corner of the chart area.Top-right corner of the chart area. -
Method Summary
Modifier and TypeMethodDescriptionstatic LegendPositionparse(String raw, LegendPosition fallback) Parses common string tokens (used by theme/property-based configuration).Computes a legend rectangle anchored within the given bounds.static LegendPositionReturns the enum constant of this class with the specified name.static LegendPosition[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TOP_LEFT
Top-left corner of the chart area. -
TOP_CENTER
Top-center of the chart area. -
TOP_RIGHT
Top-right corner of the chart area. -
MIDDLE_LEFT
Middle-left of the chart area. -
CENTER
Center of the chart area. Use with care; may cover data. -
MIDDLE_RIGHT
Middle-right of the chart area. -
BOTTOM_LEFT
Bottom-left corner of the chart area. -
BOTTOM_CENTER
Bottom-center of the chart area. -
BOTTOM_RIGHT
Bottom-right corner of the chart area.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
parse
Parses common string tokens (used by theme/property-based configuration).- Parameters:
raw- string token such as "top-left" or "BOTTOM_RIGHT"fallback- fallback when the token is null/blank or cannot be parsed- Returns:
- parsed position
-
place
Computes a legend rectangle anchored within the given bounds.The returned rectangle is clamped so it always stays fully inside
bounds.- Parameters:
bounds- the available area (typically the component bounds)size- the preferred legend sizepadding- padding from the edges (applied relative to the anchor)- Returns:
- legend rectangle, clamped to bounds
-