Repository navigation
XYPlot: several numeric series against labelled axes - #484
Merged
Merged
Conversation
A chart for a signal against time or a spectrum against frequency: nice 1-2-5 ticks on both axes with their labels, a light grid, optional axis captions, a legend for labelled series, three styles (line, stem, markers), and a hover readout of the first series' nearest point. The series are a shared mvvm.ObservableList; SetSeries swaps them all. A series longer than the plot is wide is drawn as a per-column min/max envelope, so a 65536-point signal costs one stroke per pixel column and still shows a single-sample spike. NaN/Inf points are gaps, not jumps. Gated in TestMigratedWidgetsHaveNoImperativeState (XLabel/YLabel are config) and swept by TestWidgetsStayWithinBounds. 100% coverage. Wanted by the go-fft WASM playground, which plots signals and spectra and otherwise would have had to draw its axes by hand. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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
A new chart widget,
XYPlot: one or more numeric series drawn against labelled axes.FormatX/FormatY, default%gto four digits; a computed zero prints as0), and a light gridXLabelunder the x ticks,YLabelabove the y axis)PlotLine,PlotStem(from y = 0, as a spectrum is usually shown),PlotMarkersLabel; it is skipped when it would not fit inside the plotx yreadout for the first series' nearest point (Hover()/HoverIndex(), set byOnEventonEventMouseMove, like the other charts)Series()is a sharedmvvm.ObservableList[PlotSeries];SetSeriesreplaces all of themWhy
The existing charts cover one series with no axis text (
LineChart), or one series against time (TimeSeriesChart). The go-fft WASM playground plots a signal against time and its spectrum against frequency, with several curves (real/imag, or the round trip over the input). Without this it would have had to draw its axes by hand, which the fleet's rule forbids.Gates
XYPlotis inmvvmMigratedWidgets(XLabel/YLabelare config; the series and hover state are mvvm handles) and in the bounds sweepA11y:RoleImg, name =YLabel, value = "N series, M points"-race,gofmt,vet, js/wasm buildTests check pixels: each style's ink lands on the surface; each stem reaches the zero row; a one-sample spike in a 20 000-point series survives the envelope; a too-wide legend is not drawn; hover draws its rule at the hovered point.
Not included in the metric-scale run-length audit: the widget draws tick labels, which that audit excludes by design.
🤖 Generated with Claude Code