Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

HanSolo Charts Usage Guide

HanSolo Charts adds a large set of JavaFX chart and visualization controls to Aussom under fx.hansolo.charts. It is useful when the standard JavaFX chart set is too limited and you need richer visualizations such as Sankey diagrams, polar charts, radial charts, comparison charts, or custom XY plots.

The wrappers are AJI-first. That means the common controls are wrapped for direct use in Aussom, but you can still drop down to raw AJI if you need a less common constructor or Java method.

What It Is Good For

  • dashboards with custom visualizations
  • charts that need richer styling than the standard JavaFX charts
  • flow diagrams such as Sankey plots
  • XY plots where you want HanSolo pane, axis, and grid objects

Main Building Blocks

These are the classes most people will start with:

Class Use For
HsBarChart Simple value-by-name bar charts.
HsXYChart Axis-based XY charts with one or more HsXYPane layers.
HsSankeyPlot Flow diagrams between source and target nodes.
HsAxis HanSolo axis objects for XY-style charts.
HsGrid Grid lines paired with HanSolo axes.
HsChartItem Named numeric items for simple charts.
HsXYChartItem X/Y points for XY charts.
HsPlotItem Node items used by Sankey plots.

Getting Started

Include the chart module and the JavaFX pieces you need:

include fx;
include fx.Color;
include fx.VBox;
include fx.hansolo.charts.charts;

Example 1: Simple Bar Chart

This example creates a bar chart with two items.

include fx;
include fx.Color;
include fx.VBox;
include fx.hansolo.charts.charts;

app = fx.fxApp("HanSolo Bar Chart", 600, 400);

green = new Color("#37A169");
blue = new Color("#3182CE");

itemA = new HsChartItem("Alpha", 3.0);
itemA.setFill(green);

itemB = new HsChartItem("Beta", 6.0);
itemB.setFill(blue);

chart = new HsBarChart();
chart.setId("salesChart");
chart.setItems([itemA, itemB]);
chart.setPrefSize(560.0, 320.0);
chart.setAnimated(false);

root = new VBox();
root.add(chart);

app.setLayout(root);
app.show(true);
fx.shutdown();

Example 2: XY Chart With HanSolo Axis and Grid

This example uses HsAxis, HsGrid, HsXYPane, and HsXYChart together.

include fx;
include fx.Color;
include fx.hansolo.charts.charts;

app = fx.fxApp("HanSolo XY Chart", 700, 500);

red = new Color("#E53E3E");

xAxis = new HsAxis();
xAxis.setTitle("Time");
xAxis.setMinMax(0.0, 10.0);
xAxis.setPosition("BOTTOM");

yAxis = new HsAxis();
yAxis.setTitle("Value");
yAxis.setMinMax(0.0, 10.0);
yAxis.setPosition("LEFT");

grid = new HsGrid(xAxis, yAxis);
grid.setGridOpacity(0.35);

p1 = new HsXYChartItem(1.0, 3.0, "P1", red);
p2 = new HsXYChartItem(4.0, 6.0, "P2", red);
p3 = new HsXYChartItem(8.0, 5.0, "P3", red);

pane = new HsXYPane([p1, p2, p3], "LINE", "Series A");
pane.setBounds(0.0, 10.0, 0.0, 10.0);

chart = new HsXYChart(pane, [xAxis, yAxis], grid);
chart.setTitle("Trend");
chart.setSubTitle("Sample Data");
chart.setPrefSize(640.0, 420.0);

app.setLayout(chart);
app.show(true);
fx.shutdown();

Example 3: Sankey Plot

This example creates a small Sankey flow from one node to another.

include fx;
include fx.Color;
include fx.hansolo.charts.charts;

app = fx.fxApp("HanSolo Sankey", 700, 500);

green = new Color("#37A169");
blue = new Color("#3182CE");

src = new HsPlotItem("Source", 10.0, green);
src.setLevel(0);

dst = new HsPlotItem("Target", 10.0, blue);
dst.setLevel(1);

src.addOutgoing(dst, 10.0);

plot = new HsSankeyPlot();
plot.setItems([src, dst]);
plot.setStreamFillMode("COLOR");
plot.setUseItemColor(true);
plot.setPrefSize(640.0, 420.0);

app.setLayout(plot);
app.show(true);
fx.shutdown();

Tips and Gotchas

  • HsXYPane is built around HanSolo XYSeries objects internally. The wrapper hides that, so prefer new HsXYPane([items], "LINE", "Series") instead of trying to build the Java series yourself first.
  • HsSankeyPlot needs valid HsPlotItem levels. Set them with setLevel() before calling setItems(...).
  • The chart module is broad, but the wrappers are intentionally thin. If you need a less common method, use the wrapped Java object through .obj and AJI.
  • For test code, create your chart objects after JavaFX is initialized with fx.fxApp(...).
  • HanSolo Charts 21.0.27 currently logs a malformed nested jar reference during Maven compile in this repo, but the packaged app and tests still run.