Class SemiDonutRenderer

java.lang.Object
com.arbergashi.charts.render.BaseRenderer
com.arbergashi.charts.render.circular.SemiDonutRenderer
All Implemented Interfaces:
ChartRenderer

public final class SemiDonutRenderer extends BaseRenderer

Modern Semi-Donut Renderer

Draws a professional, interactive semi-donut chart, ideal for progress indicators and KPIs. Adheres to strict zero-allocation guidelines.

Features:

  • Progress Display: Shows a single value (0-100%) as a colored arc.
  • Background Track: A subtle background arc indicates the 100% range.
  • Center Value: The percentage value is displayed prominently in the center.
  • Rounded Caps: The arc has rounded ends for a modern aesthetic.
Since:
2024-06-01
Version:
1.0.0
Author:
Arber Gashi
  • Constructor Details

    • SemiDonutRenderer

      public SemiDonutRenderer()
  • Method Details

    • isLegendRequired

      public boolean isLegendRequired()
      Description copied from class: BaseRenderer
      Indicates whether this renderer should appear in the legend.
      Specified by:
      isLegendRequired in interface ChartRenderer
      Overrides:
      isLegendRequired in class BaseRenderer
      Returns:
      true if the renderer should appear in the legend
    • drawData

      protected void drawData(Graphics2D g2, ChartModel model, PlotContext context)
      Description copied from class: BaseRenderer
      Implementation-specific drawing logic. Must follow Zero-Allocation rules.
      Specified by:
      drawData in class BaseRenderer
    • getPointAt

      public Optional<Integer> getPointAt(Point2D pixel, ChartModel model, PlotContext context)
      Description copied from class: BaseRenderer
      Returns the data index nearest to the given pixel coordinate, if supported.
      Specified by:
      getPointAt in interface ChartRenderer
      Overrides:
      getPointAt in class BaseRenderer
      Parameters:
      pixel - mouse/crosshair position in component coordinates
      model - data model for this layer
      context - current plot context
      Returns:
      optional point index
    • setValue

      public SemiDonutRenderer setValue(double value)
      Sets the value to display.
      Parameters:
      value - The value, expected to be in the range [0.0, 1.0].
      Returns:
      This renderer for chaining.