Flag to position labels at the beginning of each interval #2369
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As an alternative to the dynamic placing of labels for DateTimeIntervalType.months and DateTimeIntervalType.years, the flag labelsAtBeginning can be set to true for DateTimeAxis to force the label position to the beginning of each month or year, respectively. Lower interval types already place the labels at the beginning of the corresponding intervals, so they are not affected by the flag. Similarly, auto is not based on any interval, so there's no effect as well.
See the difference in the video:
labelsAtBeginning.mp4
The upper charts show the updated behavior with the flag set while the lower charts show the legacy behavior without the flag set. The example is available here: https://github.com/DrNiels/flutter-widgets/blob/example/fixed-axis-ticks/packages/syncfusion_flutter_charts/example/lib/main.dart
I tried my best, but I'm still foreign to your personal coding practices, so feel free to remark anything and I will adjust the code accordingly.
In response to the feature request: https://www.syncfusion.com/feedback/36499/instead-of-recalculating-the-axis-labels-keep-them-stable-on-panning
And the issue: #2130