Skip to content

Hover a chart to read the values at that instant #31

Description

@evandhoffman

A chart shows what happened; it does not let you ask what happened then. The legend carries the latest value of every series, so the moment you want a number from is the only moment you cannot read.

Hover anywhere on a chart and get the values at that point in time.

Sketch

  • A vertical rule follows the pointer, snapped to the nearest sample rather than to the pixel — there is a sample every half second and nothing exists between them.
  • Every series on the card reports its value at that instant, including a stacked card's bands and a mirrored card's two directions.
  • Move off the chart and it returns to the latest values.

Open question — where do the numbers appear?

  1. In the legend that is already there. The header reserves a fixed-width slot per series for exactly this kind of number (see "A legend that does not shuffle" in docs/ui.md), so hovering could swap "current" for "at the cursor" and add no chrome at all. The time would need somewhere to go — probably the title's line.
  2. A floating tooltip beside the pointer. The conventional answer. It covers the trace it is describing, and on a 260 pt card there is not much room to be covered.

Option 1 looks better here and is cheaper. Worth deciding before any code.

Notes

  • A mirrored card must report the magnitude, not the plotted value. Below the baseline is a direction, not a negative quantity — same rule the axis labels follow.
  • A stacked card should report each band's own value, not its cumulative height. The height is an artefact of the drawing; the value is the metric.
  • The tile already carries a left-drag (reorder) and a right-click (copy). A hover must not interfere with either, and the rule must not appear while a drag is in flight.
  • chartOverlay with a DragGesture of minimumDistance: 0 is the usual route, which is exactly the gesture the reorder drag uses. Check the two do not fight, in swift run monitor and not only in tests.
  • Nothing here should touch what is stored. It is view state, like the zoom in Double-click a card to zoom it #29.

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions