Skip to content

feat: add configurable sparkline baseline#248

Merged
CharlVS merged 2 commits intodevfrom
codex/add-configurable-baseline-for-sparkline-charts
Oct 20, 2025
Merged

feat: add configurable sparkline baseline#248
CharlVS merged 2 commits intodevfrom
codex/add-configurable-baseline-for-sparkline-charts

Conversation

@CharlVS
Copy link
Copy Markdown
Collaborator

@CharlVS CharlVS commented Oct 20, 2025

Summary

  • allow sparkline charts to accept a configurable baseline calculator with an initial-value default
  • update the painter logic to classify segments against the chosen baseline and clamp drawing within range
  • document the change in the package changelog and cover the helpers with tests

Testing

  • flutter test packages/dragon_charts_flutter/test/sparkline_chart_test.dart (fails: Dart SDK 3.9.0 required but 3.8.1 is installed)

https://chatgpt.com/codex/tasks/task_e_68f297f52dac8326a1202fb3dde565ac


Note

Add a configurable baseline calculator to SparklineChart, refactor painter to classify against that baseline (clamped), and add tests plus changelog entry.

  • Sparkline:
    • Configurable baseline: Introduce SparklineBaselineCalculator and SparklineBaselines (initialValue, average).
    • Update SparklineChart to accept baselineCalculator (defaults to initialValue).
    • Refactor painter to compute baseline, clamp within data range, and classify segments/colors and intersections against it.
  • Tests:
    • Add unit tests for SparklineBaselines and widget test for custom baselineCalculator.
  • Docs:
    • Update CHANGELOG.md to note the new sparkline baseline customization.

Written by Cursor Bugbot for commit cade32d. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings October 20, 2025 13:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds configurable baseline calculation for sparkline charts. Instead of using a fixed baseline (the average of all data points), sparkline charts can now accept a custom baseline calculator function, with the initial value as the new default.

Key Changes:

  • Introduced SparklineBaselineCalculator typedef and SparklineBaselines helper class with initialValue (default) and average baseline calculation methods
  • Updated SparklineChart and _CustomSparklinePainter to use the configurable baseline instead of the hardcoded average
  • Added comprehensive test coverage for baseline calculators and custom baseline functionality

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/dragon_charts_flutter/lib/src/sparkline/sparkline_chart.dart Implements configurable baseline with typedef, helper class, and updated painter logic to use baseline instead of average
packages/dragon_charts_flutter/test/sparkline_chart_test.dart Adds unit tests for baseline calculators and integration test for custom baseline parameter
packages/dragon_charts_flutter/CHANGELOG.md Documents the new feature with default baseline behavior

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 20, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/add-configurable-baseline-for-sparkline-charts

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@CharlVS CharlVS self-assigned this Oct 20, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 20, 2025

Visit the preview URL for this PR (updated for commit cade32d):

https://komodo-playground--pr248-codex-add-configurab-rsgg04x1.web.app

(expires Mon, 27 Oct 2025 13:23:42 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 2bfedd77fdea45b25ba7c784416e81f177aa5c47

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 20, 2025

Visit the preview URL for this PR (updated for commit cade32d):

https://kdf-sdk--pr248-codex-add-configurab-e6a7bcc6.web.app

(expires Mon, 27 Oct 2025 13:23:47 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 9c1b6e6c010cf0b965c455ba7a69c4aedafa8a1d

@CharlVS CharlVS merged commit c5e3ad4 into dev Oct 20, 2025
8 of 9 checks passed
@CharlVS CharlVS deleted the codex/add-configurable-baseline-for-sparkline-charts branch October 20, 2025 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants