Skip to content
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

Fix for overlapping SideTitles #1033

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/src/chart/base/axis_chart/axis_chart_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ class SideTitles with EquatableMixin {
/// We recommend you to use [SideTitleWidget].
final GetTitleWidgetFunction getTitlesWidget;

/// It determines the maximum space that your titles need,
/// It determines the maximum width that your titles need
final double? reservedWidth;
RobinJespersen marked this conversation as resolved.
Show resolved Hide resolved

/// It determines the maximum height that your titles need,
/// (All titles will stretch using this value)
final double reservedSize;

Expand Down Expand Up @@ -164,6 +167,7 @@ class SideTitles with EquatableMixin {
GetTitleWidgetFunction? getTitlesWidget,
double? reservedSize,
double? interval,
this.reservedWidth,
}) : showTitles = showTitles ?? false,
getTitlesWidget = getTitlesWidget ?? defaultGetTitle,
reservedSize = reservedSize ?? 22,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class SideTitlesWidget extends StatelessWidget {
Utils().getEfficientInterval(
axisViewSize,
axisMax - axisMin,
pixelPerInterval: sideTitles.reservedWidth ?? 40,
);
if (isHorizontal && axisChartData is BarChartData) {
final barChartData = axisChartData as BarChartData;
Expand Down