Skip to content

feat(core): capability-driven field model and visual encodings#14

Merged
nmrtist merged 1 commit into
mainfrom
feat/field-model-and-visual-encoding
Jul 24, 2026
Merged

feat(core): capability-driven field model and visual encodings#14
nmrtist merged 1 commit into
mainfrom
feat/field-model-and-visual-encoding

Conversation

@nmrtist

@nmrtist nmrtist commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces PlotX's domain-keyed chart selection with a domain-neutral field
model and capability-driven visual encodings. A dataset now exposes its
plottable parts as addressable fields, each advertising capabilities (regular
2-D scalar grid, 1-D curve, colored raster, …). Charts and encodings are offered
by what a field can do, not by which domain it belongs to, and colours and
level settings move out of the shared series binding into the concrete encoding
they belong to.

This makes cross-domain visualisation possible — an AFM height map can be drawn
as a contour, an NMR plane as a heatmap — with no new numeric kernels, and gives
contours independent positive/negative styling.

What changed

Field model

  • Datasets expose fields as child resources with stable FieldIds, persisted in
    a per-dataset field catalog. Field identity survives reload and channel
    reordering and is no longer a collection index.
  • A shared set of field.* capability constants (reusing CapabilityId) drives
    applicability across encodings, chart descriptors and resource descriptors.

Visual encoding

  • SeriesSource { resource, field } replaces the dataset-index binding.
    SeriesEncoding (Line/Contour/Heatmap/Image) is a concrete, persisted
    per-series model; color/scale now live inside the encoding that gives them
    meaning.
  • ContourSpec models positive and negative levels independently (base policy,
    count, ratio) with separate colour and style — positive and negative contours
    are no longer forced to share one colour.

Capability-driven applicability

  • The chart gallery offers charts and encodings by field capability;
    recommended_domains is now advisory (ordering and default selection only) and
    no longer gates what is available. A provider that exposes
    field.scalar_grid_2d.regular gets contour and heatmap without touching the
    chart registry.

AFM

  • Channel selection moves from a dataset-level selected_channel to per-series
    SeriesSource.field, fixing channel ownership.

Compatibility

Pre-release: no backward compatibility is kept for older project files. The
persisted series requires field and encoding; the project schema version is
unchanged.

Out of scope

This change establishes the field and encoding model. A unified parameter
catalog with search, and background estimate/geometry caching for contours, are
not part of it.

Testing

cargo pr-check passes: formatting, source-size limit, dependency policy,
Clippy with warnings denied, and the test suite on both the reference and
DataFusion backends. New tests cover capability-driven gallery selection, an
unregistered regular scalar field gaining contour/heatmap, non-uniform grids
being excluded from contour, magnitude-versus-real field rendering, contour
numeric edge cases, field-identity round-trips and channel reordering.

@nmrtist
nmrtist merged commit a11e72b into main Jul 24, 2026
11 checks passed
@nmrtist
nmrtist deleted the feat/field-model-and-visual-encoding branch July 24, 2026 23:23
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant