feat(chartjs): add Bump Chart template#60
Merged
Conversation
Port the Bump template to the Chart.js backend, mirroring the ECharts implementation (ecBumpChartDef): line-with-points per series over a shared x axis, with the rank axis reversed so rank 1 sits on top. Chart.js reverses a linear scale in place (reverse: true), so unlike the ECharts category-index workaround the series keep their real rank values and the config stays pure JSON with no tooltip formatter. Rank detection mirrors the shared rule (Rank/Score/Level semantic on y and not on x); non-rank inputs fall back to a plain value axis with the semantic zero decision, like the Line template. Discrete/temporal/ linear x handling and the continuous-extent pinning follow line.ts. - register in cjsTemplateDefs (Line & Area group, same position as ECharts) - tests: 6 cases (registry, datasets shape, reversed rank axis pinned to [1, maxRank], non-rank fallback, JSON round-trip purity, 3-backend parity) - docs: regenerate reference-chartjs.md; add Bump to the SKILL.md Chart.js coverage list (+ synced bundled asset) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Chenglong-MS
approved these changes
Jul 20, 2026
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
The Vega-Lite and ECharts backends ship a Bump Chart template; Chart.js doesn't —
assembleChartjsthrows onBump Chart. This PR ports the template, mirroring the ECharts implementation.Implementation
Line datasets per series over the shared category (time) axis, with y carrying true rank values and
reverse: trueon the scale — Chart.js supports reversed linear axes natively. That removes the category-index workaround the ECharts template needs. Rank-semantics detection (Rank / Score / Level) and the fallback to a plain value axis for non-rank measures mirror the ECharts template. Registered in theLine & Areagroup, same position as ECharts. The compiled config is plain JSON (no callback functions).One cross-backend observation from verification: on the same input, VL puts rank 3 on top while ECharts puts rank 1 on top. The VL template's own comment intends rank 1 on top ("reverse Y so rank 1 is at top"), so this may be a double reversal — Rank semantics already reverse the axis before the template sets
reverseagain. This PR follows ECharts, which matches the documented Rank behavior; happy to file the VL side separately.Verification
tests/bump-chartjs.test.ts— 6 cases: registry, one dataset per series, reversed rank axis pinned to[1, maxRank], non-rank fallback to a plain value axis, JSON round-trip, 3-backend paritydocs/reference-chartjs.mdregenerated vianpm run gen:referenceserver.test.ts)Side-by-side render vs Vega-Lite and ECharts (same input):
Note: #59 and this PR both append one line to
templates/index.tsand the SKILL.md coverage list; whichever lands second needs a trivial rebase + asset re-sync.🤖 Generated with Claude Code