Class ChartModelBinder

java.lang.Object
com.arbergashi.charts.api.ChartModelBinder

public final class ChartModelBinder extends Object
Utility for binding plain Java objects (POJOs) into chart models.

This helper is intentionally minimal: it maps a collection into a DefaultChartModel by extracting X/Y values via the provided functions. It does not perform aggregation, sorting, or validation beyond iterating the given collection.

Framework note: For large datasets, consider pre-processing your data (e.g., sorting, decimation, filtering) before binding to avoid unnecessary allocations and to keep rendering responsive.

Since:
2026-01-01
Version:
1.0.0
Author:
Arber Gashi
  • Method Details

    • bind

      public static <T> DefaultChartModel bind(Collection<T> data, String name, ToDoubleFunction<T> xExtractor, ToDoubleFunction<T> yExtractor)
      Binds a collection of POJOs to a DefaultChartModel.
      Type Parameters:
      T - The POJO type.
      Parameters:
      data - The collection of POJOs.
      name - The name of the series.
      xExtractor - Function to extract X value.
      yExtractor - Function to extract Y value.
      Returns:
      A DefaultChartModel populated with data.