Package edu.cnu.mdi.splot.pdata
splot plotting library.
This package contains the core data abstractions that back all plots in
splot, including:
ACurve– the abstract base class for all curvesCurve– standard XY curves with optional Y-errorsHistoCurve– histogram-backed curves- Supporting data containers such as
DataColumnandHistoData
Responsibilities
Classes in this package are responsible for:
- Storing and managing curve and histogram data
- Providing consistent snapshots for rendering
- Managing cached derived artifacts such as fit results and splines
- Notifying listeners when data or style changes occur
Threading Model
splot is built on Swing. As a result, all notifications that may lead
to UI updates (such as repaint requests) must occur on the Swing Event
Dispatch Thread (EDT).
To support modern streaming and data-acquisition use cases,
Curve and
HistoCurve provide thread-safe data addition
methods:
add(...)andaddAll(...)may be called from any thread- Off-EDT calls enqueue data into lock-free staging queues
- Queued data are later applied on the EDT in bounded batches
- A single consolidated data-change notification is fired per batch
This design prevents repaint storms while preserving strict Swing correctness.
Explicit Streaming Control
For advanced use cases, curves also expose an explicit staging API:
enqueue(...)– thread-safe, no immediate mutation or notificationdrainPendingOnEDT(...)– EDT-only, applies queued data in bulk
This allows applications to centralize draining (for example, via a single Swing timer) or implement custom backpressure strategies.
Fitting and Derived Artifacts
Fit results, spline caches, and other derived artifacts are invalidated when
data or relevant style parameters change. Re-computation is typically
triggered lazily during rendering via doFit(...).
All fitting and artifact management follows the same EDT discipline as data updates.
Design Philosophy
This package deliberately separates:
- Data ownership and consistency (this package)
- Rendering and interaction (view and canvas layers)
While some implementation details intentionally blur strict MVC boundaries for performance and simplicity, the overall design favors robustness, predictability, and ease of use in interactive scientific applications.
-
ClassDescriptionBase class for all plottable curves (XY curves, histogram curves, strip-chart curves, etc.).A reusable pending-queue helper for streaming/DAQ scenarios.A standard XY curve consisting of X, Y, and an optional Y-error column (E).Listener for changes to an
ACurve.Types of changes that can occur to a curve.A listener for changes to the data.A named numeric column used by sPlot datasets.Named list ofDoublevalues with cached min/max tracking.Immutable fit vectors (x, y, optional weights) used by the Apache least-squares fitters.Container class for 2D histogram (heatmap) data.Container for 1D histogram data.Stateless utility class for rendering-related histogram helpers.Stateless utility class for histogram fit preparation.AFitVectorsthat also records which peak bin and window were actually used.A lightweight, UI-agnostic container for the data backing a plot.Checked exception raised when a plot dataset cannot be constructed.Types of data setsA snapshot of data points.Backing data model for a strip chart / time-series plot.