Skip to content

chart: series without values take no span entries in cartesian rendering - #3300

Merged
dylanmtaylor merged 2 commits into
mainfrom
fix/sec-chart-empty-series
Nov 4, 2026
Merged

dylanmtaylor merged 2 commits into
mainfrom
fix/sec-chart-empty-series

Conversation

@dylanmtaylor

@dylanmtaylor dylanmtaylor commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What was wrong: series_spans filled one entry per category for every series, including empty ones; 255 empty series over 20,000 categories is 5.1 million entries (~117 MiB).

What changed: a series with no values gets an empty span row. Rows are read with get(), so consumers already tolerate short rows. Series with values are unchanged.

Blast radius: Cartesian charts (column, bar, line, area and combos) that contain an empty series.

Behavior changes: an empty stacked area/line series no longer draws its zero-thickness line along the stack top.

Checks run: cargo fmt --check; cargo clippy -p gridcraft-chart --all-targets -D warnings; cargo test -p gridcraft-chart (new test).
Not run: workspace tests.

Summary by CodeRabbit

  • Bug Fixes
    • Empty chart series no longer create placeholder spans, while populated series retain their expected spans.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 109c31d and 80c456d.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

series_spans now skips span generation for empty series. A test checks that empty series produce zero spans and populated series retain MAX_CATS spans.

Changes: Series span handling

Layer / File(s) Summary
Skip spans for empty series
crates/chart/src/render/cartesian.rs
series_spans skips the category loop when a series has no values. The test checks zero spans for an empty series and MAX_CATS spans for a populated series.

Estimated code review effort: 2 (Simple) | ~8 minutes

Possibly related issues

  • storytold/gridcraft#1147 reports memory growth from per-point allocations, including stack spans. This change reduces span entries for empty series but does not implement the issue’s point-budget, trendline, or moving-average changes.

Suggested reviewers: neilcawse

Merge Risk: Minimal · previous review 109c3

The empty-series optimization is safe and ready to merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: empty series no longer create span entries during Cartesian rendering.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between df137b8 and 109c31d.

Files selected for processing: 1
  • crates/chart/src/render/cartesian.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.

@dylanmtaylor

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Rate Limit Exceeded

@dylanmtaylor have exceeded the limit for the number of chat messages per hour. Please wait 14 minutes and 33 seconds before sending another message.

@dylanmtaylor
dylanmtaylor merged commit f77ed98 into main Nov 4, 2026
8 of 9 checks passed
@dylanmtaylor
dylanmtaylor deleted the fix/sec-chart-empty-series branch November 4, 2026 03:56
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