Market charts: calendar folds, candles, fitted axes, direction colour and axis tags - #57
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
scale.Calendarsays which parts of each day count (Workweek,Closed,Weekdays,Dates).scale.Foldsturns it into time-axis folds, andstat.OHLCAtbuckets between the calendar's edges.geom.Orientlays a bar, a histogram or a boxplot on its side. The volume profile uses it.geom.Candleis one mark that reads open/high/low/close and decides each row's direction (SinceOpen/SincePrevious). It supports hollow bodies and OHLC tick style.scale.FitViewfits a value axis to the rows the time axis shows.Stream.ReplaceLastrevises the open candle, andstat.Resamplerfolds ticks into candles.RetrainerandHighWaterlet a scale forget a trained range or keep one.geom.DirectionBycolours any mark by which way its row went, in the candles' colours.geom.LastValueand a crosshair that snaps to a row and tags its values. Addsscale.ValueLabelOf, plusstat.RSI(Wilder's averages) andstat.VWAP.examples/marketputs all of it together in a daily chart and a-livemode.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.mdhad grown too long to scan, so it is now an overview of eight groups, each on its own page underdocs/gallery/. Theqqandlabel-placementfigures 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 inbackend/gggofmt -l .is empty andgo vet ./...is cleango run ./backend/gg/cmd/gallery);-checkis up to dategeom/candle_test.go,geom/direction_test.go,stat/indicator_test.go,stat/ohlc_test.go,examples/market)docs/adr/0084–0093