Skip to content

fix(chart) :: align stacked series on their X values - #1370

Draft
81reap wants to merge 3 commits into
sqlpage:mainfrom
81reap:stack/5-chart-stacked
Draft

fix(chart) :: align stacked series on their X values#1370
81reap wants to merge 3 commits into
sqlpage:mainfrom
81reap:stack/5-chart-stacked

Conversation

@81reap

@81reap 81reap commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Addresses #1362

Motivation

  • ApexCharts stacks series by point order, not by x value, so a series missing a point is piled on top of the wrong one.
  • The chart then shows totals that are in nobody's data, without any warning.
  • SQLPage already aligned series on their x values, but only for bar charts on a text axis.

Description

  • Move that alignment into sqlpage/chart_series.js as align_series, which gives every series a point at every x any of them has, and counts a missing one as zero.
  • Order the merged axis by what the series already agree on, falling back to ascending order where they diverge, so one unsorted series cannot reorder the chart.
  • Align whenever a chart is stacked, on top of the existing bar-on-a-text-axis case.
  • Teach build.rs a /* !include ./file.js */ directive, next to the one it already has for CDN scripts, so chart_series.js is inlined ahead of apexcharts.js.
  • Add tests/js/, run by Node's test runner from npm test, since this logic is worth testing without a browser.
  • Document the behaviour on the stacked parameter, and add the stacked area example from stacked area graphs / stacked line graphs #1362.
  • Add a changelog entry.

Testing

  • 13 unit tests cover the merge order, dates compared by value, a null treated as missing, and the input left unmutated.
  • The browser suite passes 33 tests, five of them new, including a stacked area chart whose series do not share their x values.
  • npm test checks 41 files and reports nothing.
  • no console errors on card page fails for the reason described in fix(biome.js) :: fix remaining lint issues #1366, on this branch and on the unmodified base alike.

GitHub cannot base a pull request on a branch that lives in a fork, so all eight target main and each one carries the commits of those above it. Review and merge them in order:

  1. fix(biome.js) :: fix remaining lint issues #1366 :: fix(biome.js) :: fix remaining lint issues
  2. fix(modal) :: give modal component an accessible name #1367 :: fix(modal) :: give modal component an accessible name
  3. fix(map) :: ignore map coordinates that are not a pair of numbers #1368 :: fix(map) :: ignore map coordinates that are not a pair of numbers
  4. feat(chart) :: render column charts as bar charts #1369 :: feat(chart) :: render column charts as bar charts
  5. fix(chart) :: align stacked series on their X values #1370 :: fix(chart) :: align stacked series on their X values ← this PR
  6. fix(chart) :: line series up on a category axis for every chart type #1371 :: fix(chart) :: line series up on a category axis for every chart type
  7. fix(npm) :: install dependencies only once at root level #1372 :: fix(npm) :: install dependencies only once at root level
  8. feat(typescript) :: typecheck browser JavaScript in CI #1373 :: feat(typescript) :: typecheck browser JavaScript in CI

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@lovasoa
lovasoa marked this pull request as draft August 10, 2026 15:21
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