Record Class LegendConfig

java.lang.Object
java.lang.Record
com.arbergashi.charts.ui.legend.LegendConfig

public record LegendConfig(LegendPlacement placement, LegendPosition overlayPosition, LegendDockSide dockSide) extends Record
Legend configuration for an ArberChartPanel.
Since:
2026-01-01
Version:
1.0.0
Author:
Arber Gashi
  • Field Details

    • DEFAULT

      public static final LegendConfig DEFAULT
      Default legend configuration (overlay, top-left, right dock fallback).
  • Constructor Details

    • LegendConfig

      public LegendConfig(LegendPlacement placement, LegendPosition overlayPosition, LegendDockSide dockSide)
      Creates a legend configuration with null-safe defaults.
      Parameters:
      placement - overlay vs docked placement
      overlayPosition - overlay anchor position
      dockSide - docking side for docked legends
  • Method Details

    • overlay

      public static LegendConfig overlay(LegendPosition position)
      Creates an overlay legend configuration.
      Parameters:
      position - overlay position (defaults to top-left when null)
      Returns:
      legend configuration in overlay mode
    • docked

      public static LegendConfig docked(LegendDockSide side)
      Creates a docked legend configuration.
      Parameters:
      side - docking side (non-null)
      Returns:
      legend configuration in docked mode
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • placement

      public LegendPlacement placement()
      Returns the value of the placement record component.
      Returns:
      the value of the placement record component
    • overlayPosition

      public LegendPosition overlayPosition()
      Returns the value of the overlayPosition record component.
      Returns:
      the value of the overlayPosition record component
    • dockSide

      public LegendDockSide dockSide()
      Returns the value of the dockSide record component.
      Returns:
      the value of the dockSide record component