Open azamcsc opened 4 years ago
How to change bar's width?
the smaller the parent widget height,the smaller space.
You can changed the width of the bars by adding a FixedPixelOrdinalScaleSpec
to your domain axis:
import 'package:charts_common/common.dart' as commonCharts;
...
final barWidth = 45.0;
return charts.BarChart(
domainAxis: charts.OrdinalAxisSpec(
scaleSpec: commonCharts.FixedPixelOrdinalScaleSpec(barWidth),
),
...
);
Or alternatively you can set the space between the bars by using a FixedPixelSpaceOrdinalScaleSpec
:
import 'package:charts_common/common.dart' as commonCharts;
...
final spaceBetweenBars = 120.0;
return charts.BarChart(
domainAxis: charts.OrdinalAxisSpec(
scaleSpec: commonCharts.FixedPixelOrdinalScaleSpec(spaceBetweenBars),
),
...
);