groupsSpace property ignored when rotationQuarterTurns is set to 1 in BarChart
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 7.6k
- Forks
- 2k
- Avg merge
- 9d 1h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
The groupsSpace property in BarChartData has no effect when using rotationQuarterTurns: 1 with single-bar groups. The spacing between bar groups remains unchanged regardless of the groupsSpace value, making it impossible to create visual separation between age groups in rotated bar charts like age pyramids.
**To Reproduce**
`import 'package:flutter/material.dart';
import 'package:fl_chart/fl_chart.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('GroupsSpace Bug')),
body: Center(
child: Container(
width: 300,
height: 200,
child: BarChart(
BarChartData(
alignment: BarChartAlignment.start,
rotationQuarterTurns: 1,
groupsSpace: 50, // This should create spacing but doesn't work
maxY: 10,
minY: 0,
barGroups: [
BarChartGroupData(
x: 0,
barRods: [BarChartRodData(toY: 5, width: 15)],
),
BarChartGroupData(
x: 1,
barRods: [BarChartRodData(toY: 8, width: 15)],
),
BarChartGroupData(
x: 2,
barRods: [BarChartRodData(toY: 3, width: 15)],
),
],
titlesData: FlTitlesData(show: false),
borderData: FlBorderData(show: false),
gridData: FlGridData(show: false),
),
),
),
),
),
);
}
}`
Expected behavior
When groupsSpace: 50 is set, there should be visible spacing between the bar groups, even with rotationQuarterTurns: 1.
Actual behavior
The bars remain tightly packed regardless of the groupsSpace value. The only workaround is to manually modify the x values (e.g., x: index * 2 instead of x: index) which breaks the automatic spacing logic.
**Versions**
- which version of the Flutter are you using? 3.41.7
- which version of the FlChart are you using? 1.2.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the sample with BarChart, BarChartData, rotationQuarterTurns: 1, and different groupsSpace values. Trace the BarChart layout code that positions single-bar groups, then verify that changing groupsSpace produces visible separation in the rotated chart without requiring modified x values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100