Skip to content

Add data cursors and pinned datatips #2

Open

Description

@thclark

Add MATLAB-style data cursors.

  • A hover tooltip is viewer state only and is never stored in the IR.
  • A pinned datatip is an IR annotation node anchored to (artist, index) with a pixel offset for its callout, so that it is saved in .fig files, exported to PDF, creatable from the API and editable like any other node.
  • Values are formatted with the same tick formatter as the axis they belong to.
  • Support both snapping to the nearest vertex and interpolating along a segment; arrow keys step the cursor along the series; a modifier moves the cursor to another series; the pinned callout can be dragged.
  • Picking emits an event on the viewer's event queue whose payload holds a set of indices (so that brushing can be added without a protocol change).

The IR additions require a schema review before implementation, as the project rules state. Depends on GPU picking (#1).

Activity

  1. changed the title [-]Add a GPU picking pass[/-] [+]Add data cursors and pinned datatips[/+] on Sep 17, 2026
  2. added
    area: codeLibrary, viewer or tooling source code
    crate: irMostly related to the ironlab-ir figure model crate
    crate: sceneMostly related to the ironlab-scene layout and scene compilation crate
    crate: viewerMostly related to the ironlab-viewer native egui viewer crate
    flow: plan-requiredA plan is required before this can progress to ai-ready
    on Oct 22, 2026
  3. thclark commented on Oct 26, 2026

    @thclark
    OwnerAuthor

    A rudimentary form of datatips for bars, stairs and cells now exists, delivered in the bars and histograms epic (#173). It should be taken into account here, and probably replaced or reworked, so that every artist ends up with consistent datatips.

    What exists

    • Hits. The scene compiler records a rectangle hit for each drawn bar and cell, and a step hit for each bin of a stairs artist (BarHit, CellHit and StepHit in crates/ironlab-scene/src/hit.rs). These sit alongside the existing point samples of series and the inverse transforms of images.
    • Tip variants. The canvas resolves them into three new variants of Tip in crates/ironlab-canvas/src/interaction.rs: Tip::Bar, Tip::Step and Tip::Cell. Each has its own callout text in figure_canvas.rs, mirrored in the web outcome.
      • A bar tip reports the value, the base and the segment from base to end.
      • A step tip reports the bin's edges and value.
      • A cell tip reports its row, column and value, the latter in the same kinds as a pixel (category, index or value).
    • Category names. All three name the category under the pointer when the category axis has text tick labels and the bar's position, or the cell's centre, equals a tick value.
    • Histogram bins. When an artist carries a binning record (ADR 0029), its tip also reports the count and density of the whole bin, recovered from the record.
    • Precedence. Colourbar, then point, then step, then bar, then cell, then pixel.

    Why it should be revisited

    Each artist kind gained its own hit type, its own Tip variant and its own callout format, because no common model of what a datatip reports exists yet. The result works, but it repeats the pattern of the pixel and colourbar tips rather than converging on one design. The precedence order between kinds is a fixed list rather than a rule.

    This issue, together with GPU picking (#1), should define:

    • one model of a picked element: artist, element index and the data it reports;
    • one callout format;
    • one rule for what wins when several elements lie under the pointer.

    Pinned datatips would then be built on that model, and bars, stairs, cells, series and images would move onto it. The category-name lookup and the bin readings from binning records are worth keeping as parts of that model.

    This is recorded for planning only; nothing about it is to be changed in #173.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: codeLibrary, viewer or tooling source codecrate: irMostly related to the ironlab-ir figure model cratecrate: sceneMostly related to the ironlab-scene layout and scene compilation cratecrate: viewerMostly related to the ironlab-viewer native egui viewer crateflow: plan-requiredA plan is required before this can progress to ai-readykind: featureA new capabilitypriority: mediumDo in the normal course of work

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions