Class XYPlotBuilder
The builder is deliberately a convenience layer, not a second plotting
model. build() creates the same PlotData, Curve,
PlotCanvas, and PlotPanel objects that an application would
create directly. The resulting panel can therefore be placed in a
PlotDeck, and callers retain access to every existing sPlot API.
Input arrays are defensively copied when a series is registered. A builder
may be reused; each build creates a fresh plot model and fresh curves.
Series style customizers receive the native ACurve, while plot
customizers receive the native PlotParameters. This keeps uncommon
or future MDI options accessible without continually expanding the builder.
Threading
Build plots on Swing's event-dispatch thread when they will immediately become part of a visible UI. The returned curves retain their normal thread-safe data-appending behavior.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets both axis labels.build()Creates a fresh native MDI plot panel.configure(Consumer<PlotParameters> customizer) Adds a native plot-parameter customization applied during each build.decorations(int decorations) Sets thePlotPaneldecoration level.Adds an uncustomized XY series.Adds an XY series with a native MDI curve customizer.
-
Constructor Details
-
XYPlotBuilder
Creates an empty XY plot definition.- Parameters:
title- plot title; must not benull
-
-
Method Details
-
axes
Sets both axis labels.- Parameters:
xLabel- horizontal-axis labelyLabel- vertical-axis label- Returns:
- this builder
-
decorations
Sets thePlotPaneldecoration level.- Parameters:
decorations- one ofPlotPanel.STANDARD,PlotPanel.BARE, orPlotPanel.VERYBARE- Returns:
- this builder
- Throws:
IllegalArgumentException- for an unknown value
-
series
Adds an uncustomized XY series.- Parameters:
name- legend namex- x coordinatesy- y coordinates- Returns:
- this builder
-
series
Adds an XY series with a native MDI curve customizer.The customizer runs during each build after the copied data have been installed and before the canvas is returned. Typical customizations set line color, symbol, width, or drawing method.
- Parameters:
name- legend namex- x coordinatesy- y coordinatescustomizer- curve style/drawing customizer- Returns:
- this builder
- Throws:
IllegalArgumentException- if array lengths differ
-
configure
Adds a native plot-parameter customization applied during each build. Multiple customizers run in registration order.- Parameters:
customizer- parameter customizer- Returns:
- this builder
-
build
Creates a fresh native MDI plot panel.- Returns:
- configured plot panel
- Throws:
IllegalStateException- if no series was registered or native plot construction unexpectedly fails
-