- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.9k
feat: allow titles to overlay on chart area #1959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 the ability to overlay axis titles on the chart area instead of positioning them outside the chart boundaries. This addresses issue #1946 by introducing an optional overlayOnChart boolean property to the AxisTitles class.
- Added overlayOnChartproperty toAxisTitlesclass with default value offalse
- Modified padding calculation logic to exclude reserved space when titles are overlayed
- Added test coverage for the new overlay functionality
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description | 
|---|---|
| lib/src/chart/base/axis_chart/axis_chart_data.dart | Added overlayOnChartboolean property toAxisTitlesclass | 
| lib/src/extensions/fl_titles_data_extension.dart | Updated padding calculation to consider overlay flag | 
| test/chart/base/axis_chart/side_titles/side_titles_test.dart | Added test for overlay functionality | 
| Sorry, I just decided to test the copilot review feature in your branch for the first time. But I liked the result actually xD I also like the feature you added. I think it is needed by some users. And there might be a similar issue. So this way, people have a high level of customization. For example, someone can pass  | 
| Haha no problem! It looks like it did a good job code reviewing my pull requests. I will take a look at adding this tomorrow 😊 | 
| Hi 👋 I have added changes to make the positions of the side titles changeable via the property  SideTitleAlignment.inside   // for displaying inside the chart bounds
SideTitleAlignment.border   // for displaying on the borderline 
SideTitleAlignment.outside  // default, displays outside the chartI am still looking at a different way to do that unit test 😊 | 
| I have pushed a test that finds the left side title labelled  Please let me know if there are any issues 😊 | 
| Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@            Coverage Diff             @@
##             main    #1959      +/-   ##
==========================================
+ Coverage   92.44%   92.47%   +0.02%     
==========================================
  Files          50       50              
  Lines        3681     3693      +12     
==========================================
+ Hits         3403     3415      +12     
  Misses        278      278              
 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
 | 
| Please also add the property to the base_chart.md file (our documentation) After doing that, it looks good to get merged into the main! | 
A simple change to allow the user to set the axis titles to overlay on top of the chart area instead of being pushed off to their appropriate side. Resolves imaNNeo#1946
f92df20    to
    199e4a4      
    Compare
  
    | Hi, @imaNNeo 👋 I have updated the code with your requested changes and rebased for the main branch. Please let me know if there are any other issues 😊 | 
| Thanks for your valuable contribution! | 
Hello! 👋
First of all, thank you for an awesome chart package 😊
This contribution is to resolve #1946.
What I did
I added an optional Boolean property for the
AxisTitlesclass to allow each side title to be overlayed on the chart area if the user so desires.For example, in Line Chart Sample 9, I added the property to the left titles and now it is placed on the chart area.
You can see the example use here:

With the result:
