Skip to content

Market charts: calendar folds, candles, fitted axes, direction colour and axis tags - #57

Merged
timzifer merged 1 commit into
mainfrom
feat/market-charts
Sep 29, 2026
Merged

timzifer merged 1 commit into
mainfrom
feat/market-charts

Conversation

@timzifer

Copy link
Copy Markdown
Owner

What this changes

Everything a trading screen needs, built as general features rather than a market-only chart type. It follows the catalogue in ADR 0085, one ADR at a time:

  • ADR 0086: calendar. scale.Calendar says which parts of each day count (Workweek, Closed, Weekdays, Dates). scale.Folds turns it into time-axis folds, and stat.OHLCAt buckets between the calendar's edges.
  • ADR 0087: orientation. geom.Orient lays a bar, a histogram or a boxplot on its side. The volume profile uses it.
  • ADR 0088: candles. geom.Candle is one mark that reads open/high/low/close and decides each row's direction (SinceOpen/SincePrevious). It supports hollow bodies and OHLC tick style.
  • ADR 0089: fitted value axis. scale.FitView fits a value axis to the rows the time axis shows. Stream.ReplaceLast revises the open candle, and stat.Resampler folds ticks into candles.
  • ADR 0090: retraining. Every render derives its trained ranges again. Retrainer and HighWater let a scale forget a trained range or keep one.
  • ADR 0091: direction colour. geom.DirectionBy colours any mark by which way its row went, in the candles' colours.
  • ADR 0092: axis tags. Axis tags, geom.LastValue and a crosshair that snaps to a row and tags its values. Adds scale.ValueLabelOf, plus stat.RSI (Wilder's averages) and stat.VWAP.
  • ADR 0093 (proposed only): faceted tracks and relative series for several symbols.

examples/market puts all of it together in a daily chart and a -live mode.

ADR 0084 (what v1.0 promises) and some docs catch-up (§14, features.md, milestones.md) are also on this branch.

The gallery now shows the market charts: the daily chart, the live frame with its crosshair, OHLC bars, and hollow candles under redundant encoding. docs/gallery.md had grown too long to scan, so it is now an overview of eight groups, each on its own page under docs/gallery/. The qq and label-placement figures were rendered before but not listed; they are listed now.

Why

A price chart built from the existing marks got the calendar, the direction colouring and the indicators wrong, or needed columns computed only for the chart. ADR 0085 lists what was missing. Each gap is closed by a feature that other charts can use too.

How it was checked

  • go test ./... passes in the core module and in backend/gg
  • gofmt -l . is empty and go vet ./... is clean
  • The core module still depends on nothing but the standard library
  • Documentation figures regenerated (go run ./backend/gg/cmd/gallery); -check is up to date
  • Behaviour changes are covered by tests (geom/candle_test.go, geom/direction_test.go, stat/indicator_test.go, stat/ohlc_test.go, examples/market)
  • Decisions are recorded in docs/adr/ 0084–0093

The gallery renders the market example's daily chart, the frame its live
chart ends on, and the same thirty days as OHLC bars and as hollow
candles. docs/gallery.md is now an overview of eight groups, each on its
own page under docs/gallery/, and lists qq and label-placement, which
were rendered but not shown.
@timzifer
timzifer merged commit 1da49c5 into main Sep 29, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant