Chapter 05 · Java + TeaVM

The same chart model, now on Canvas.

Fifty-six samples in two series demonstrate that chart layout is independent of the output backend. Circles are immediate Canvas operations here.

This chapter requires Canvas 2D support.

Starting the TeaVM application…

How it works

ScatterPlot uses exactly the same Series and scales as LineChart. Swap SvgGraphics for CanvasGraphics without changing the data or chart object.

ScatterPlot plot = new ScatterPlot(
    "Throughput samples", series);
plot.render(new CanvasGraphics(canvasElement));