Class ChartUtils
java.lang.Object
com.arbergashi.charts.util.ChartUtils
Helper methods for coordinate transformations.
- Since:
- 2026-01-01
- Version:
- 1.0.0
- Author:
- Arber Gashi
-
Method Summary
Modifier and TypeMethodDescriptionstatic doublecalculateBestBarWidth(int count, double availableWidth, float paddingFactor) Heuristic to determine an appropriate bar width for categorical/bar-like renderers.static voidmapToPolar(double angleDeg, double rValue, PlotContext ctx, Point2D dest) Map polar coordinates (angle in degrees, radius in data units) to pixels.static doubletransformX(double x, PlotContext ctx) Transforms X coordinate to pixels.static doubletransformY(double y, PlotContext ctx) Transforms Y coordinate to pixels.
-
Method Details
-
transformX
Transforms X coordinate to pixels. Uses PlotContext internally. -
transformY
Transforms Y coordinate to pixels. -
mapToPolar
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.
-