feat: add configurable sparkline baseline#248
Conversation
There was a problem hiding this comment.
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
SparklineBaselineCalculatortypedef andSparklineBaselineshelper class withinitialValue(default) andaveragebaseline calculation methods - Updated
SparklineChartand_CustomSparklinePainterto 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.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit 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)
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. Comment |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
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 |
|
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 |
Summary
Testing
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.SparklineBaselineCalculatorandSparklineBaselines(initialValue,average).SparklineChartto acceptbaselineCalculator(defaults toinitialValue).baseline, clamp within data range, and classify segments/colors and intersections against it.SparklineBaselinesand widget test for custombaselineCalculator.CHANGELOG.mdto note the new sparkline baseline customization.Written by Cursor Bugbot for commit cade32d. This will update automatically on new commits. Configure here.