Class ChartUtils

java.lang.Object
com.arbergashi.charts.util.ChartUtils

public final class ChartUtils extends Object
Helper methods for coordinate transformations.
Since:
2026-01-01
Version:
1.0.0
Author:
Arber Gashi
  • Method Details

    • transformX

      public static double transformX(double x, PlotContext ctx)
      Transforms X coordinate to pixels. Uses PlotContext internally.
    • transformY

      public static double transformY(double y, PlotContext ctx)
      Transforms Y coordinate to pixels.
    • mapToPolar

      public static void mapToPolar(double angleDeg, double rValue, PlotContext ctx, Point2D dest)
      Map polar coordinates (angle in degrees, radius in data units) to pixels. Writes result to supplied Point2D (allocation-free).
    • calculateBestBarWidth

      public static double calculateBestBarWidth(int count, double availableWidth, float paddingFactor)
      Heuristic to determine an appropriate bar width for categorical/bar-like renderers. Returns at least 1.0 to avoid zero-width bars.