45cc1c44c9
The served trace chart's x-axis no longer plots against raw timestamps by default — non-trading gaps (nights, weekends) left horizontal blanks that dominated the view. The x spine is now ordinal by default: every recorded slot sits at an even position, so gaps collapse and the signal fills the width. A header toggle flips to continuous (real-time-proportional) spacing and back; default ordinal honours the requested "x-axis should not be continuous", with continuous as the one-click option. Comfort, all on the read/render side (the engine and the Rust serve contract are untouched — window.AURA_TRACES still carries the real xs, the ordinal indices are derived client-side): - ordinal mode keeps the axis honest: ticks and the legend value-readout map a collapsed index back to the real xs[i], never the index itself. - wheel-zoom (x, cursor-anchored), drag-pan, double-click-reset on the plot (uPlot's default drag-box-zoom is disabled so drag pans). - panels share a cursor.sync key, so the crosshair lines up across stacked panels. Confined to chart-viewer.js (buildCharts gains an xMode param + a wheelZoomPlugin factory; mount re-renders on the toggle) and render.rs (CHART_HEAD toggle button + a chart-only style). The two twin node guards (build/gaps) re-point to the ordinal default in lockstep; a new x-mode guard pins ordinal-default / continuous / panel-sync / plugin wiring, and a label-honesty guard (gappy-traces fixture, xs far from the index spine) pins that ordinal ticks report the real timestamp. Verified: cargo test --workspace green (incl. the four chart guards + render inline tests), clippy --all-targets -D warnings clean, e2e (aura run --trace + aura chart) emits a self-contained page defaulting to ordinal with the toggle. Spec docs/specs/0057, plan docs/plans/0057 (boss-signed; grounding-check PASS). Derived-fork decision log in the issue comments. closes #103
33 lines
1.3 KiB
Rust
33 lines
1.3 KiB
Rust
//! Integration guard for the `aura chart` viewer's x-mode (ordinal default + continuous
|
|
//! toggle), panel cursor-sync, and interaction-plugin wiring. These live in
|
|
//! `chart-viewer.js` and cannot be checked from Rust; this shells out to `node`, running
|
|
//! `tests/chart_viewer_xmode.mjs`, which drives the pure `buildCharts`. `node` is
|
|
//! REQUIRED: if absent this test FAILS.
|
|
|
|
use std::path::PathBuf;
|
|
use std::process::Command;
|
|
|
|
#[test]
|
|
fn chart_viewer_ordinal_default_continuous_toggle_and_sync() {
|
|
let script = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
|
.join("tests")
|
|
.join("chart_viewer_xmode.mjs");
|
|
assert!(script.exists(), "guard script missing at {}", script.display());
|
|
|
|
let out = match Command::new("node").arg(&script).output() {
|
|
Ok(out) => out,
|
|
Err(e) => panic!(
|
|
"node is required for the chart-viewer x-mode guard but could not be run \
|
|
({e}); install Node.js or ensure `node` is on PATH"
|
|
),
|
|
};
|
|
|
|
let stdout = String::from_utf8_lossy(&out.stdout);
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
assert!(
|
|
out.status.success(),
|
|
"chart-viewer x-mode guard failed (exit {:?}).\n--- node stdout ---\n{stdout}\n--- node stderr ---\n{stderr}",
|
|
out.status.code()
|
|
);
|
|
}
|