The Problem

Real-time scientific data visualization (e.g., accelerator control systems, signal processing) requires rendering hundreds of thousands to millions of data points at 25 Hz. Standard JavaFX charts choke on this workload due to inefficient event handling and redraw strategies. ChartFx addresses this by re-implementing JavaFX's Chart with a performance-first design, originally developed at GSI for the FAIR facility.

What This Does

ChartFx is a JavaFX-based scientific charting library. It provides DataSet interfaces for XY data with extensions for errors, metadata, and 3D data; a Chart class supporting Euclidean, polar, and 2D projections of 3D data; Axis implementations (linear, logarithmic, time-series) with auto-ranging and SI unit conversion; and a Renderer system covering scatter plots, error bars, heatmaps, contour plots, and hexagon maps. A plugin system (ChartPlugin) handles interactions like zooming, panning, and crosshairs.

The repository is a collection of seven Maven modules: chartfx-chart (core charting, 272 code files), chartfx-dataset (data models, 167 files), chartfx-math (FFT, wavelet, filtering, fitting, 116 files), chartfx-samples (151 files of demos), chartfx-bench (benchmarks), chartfx-acc (a remote-control/UI module), and chartfx-generate (code generation). Core logic lives in chartfx-chart/src/main/java/io/fair_acc/chartfx/, with the main Chart.java and axes/spi/AbstractAxis.java as central hubs.

How It Is Wired

The measured import graph shows 0 internal modules and 0 import edges—this is a static-analysis artifact, not a real dependency map. The actual wiring is via Maven: each module's pom.xml declares dependencies on the others (e.g., chartfx-chart depends on chartfx-dataset and chartfx-math). Execution starts in chartfx-samples, which contains runnable demo classes. These instantiate a Chart, add DataSet objects, and attach ChartPlugin interactors. The chart's render loop, driven by JavaFX's animation timer, calls renderers to draw data and axes handle tick/label generation. The chartfx-acc module adds a remote REST interface for controlling acquisition and chart state, with credentials in chartfx-acc/src/main/resources/DefaultRestUserPasswords.pwd.

The blast radius is concentrated in Chart.java and AbstractAxis.java—both flagged with deep nesting (max indentation depth 13), making control flow hard to follow and changes risky. A refactor toward early returns and extracted methods is the prescribed fix.

How To Use It

  • Setup: Maven multi-module build. From the repo root, run mvn clean install to build all modules and install to local repository.
  • Configuration: No required environment variables. The chartfx-acc module uses DefaultRestUserPasswords.pwd for REST authentication; change these before deployment.
  • Running it: Run any sample class in chartfx-samples, e.g., mvn -pl chartfx-samples exec:java -Dexec.mainClass=io.fair_acc.sample.chart.ChartSample. The README references demos but does not list exact class names; check chartfx-samples/src/main/java/io/fair_acc/sample/ for available entry points.

Real-World Use

A control-room dashboard for a particle accelerator: a Chart displays beam position data from multiple DataSetError instances (with uncertainties), a Histogram shows energy distribution, and a ChartPlugin crosshair lets operators read exact values. The chartfx-math module provides FFT and filtering for on-the-fly signal analysis. Data streams at 25 Hz from a DAQ system; ChartFx's rendering pipeline keeps the UI responsive at 5 million points.

Code Health & Issues

Static analysis (246 findings: 110 high, 120 medium, 16 low) identified deep nesting as the dominant issue, primarily in Chart.java, AbstractAxis.java, and DefaultNumericAxis.java.

Security audit findings, ranked:

  • Critical - Pull request code checked out in privileged workflow - .github/workflows/coverity.yml (untrusted ref execution with secrets). Fix: split into unprivileged build + workflow_run.
  • Critical - Committed private key - chartfx-acc/scripts/keystore.jks and src/main/resources/keystore.jks. Fix: reissue and purge from history.
  • Critical - Secrets (COVERITY_TOKEN) reachable from fork-triggered workflows - .github/workflows/coverity.yml. Fix: move to workflow_run or require review.
  • High - Unpinned GitHub Actions (codecov-action@v3, codacy-coverage-reporter-action@v1). Fix: pin to commit SHA.
  • High - CI runs no tests despite 149 test files. Fix: add test step to existing workflow.
  • High - continue-on-error on a correctness step - .github/workflows/ci.yml line 92. Fix: remove.
  • Medium - No least-privilege GITHUB_TOKEN permissions declared. Fix: add permissions: contents: read.
  • Medium - No pre-commit secret scan. Fix: add hook, enable push protection.
  • Medium - 5.5MB binary tracked - chartfx-samples/.../NQ-201609-GLOBEX.scid. Fix: use Git LFS.
  • Low - No timeout-minutes on CI jobs. Fix: set realistic bounds.

The Bottom Line

ChartFx is a serious, feature-rich scientific charting library with real performance engineering behind it—the math and rendering modules are substantial. The codebase suffers from deep nesting in core files and significant CI/CD security gaps that must be fixed before production use. Suitable for teams needing high-throughput JavaFX visualization; not for casual use or quick integration.