import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
class BarChartSample1 extends StatefulWidget {
@override
_BarChartSample1State createState() => _BarChartSample1State();
}
class _BarChartSample1State extends State<BarChartSample1> {
List<BarChartGroupData> rawBarData = [
BarChartGroupData(x: 0, barRods: [
BarChartRodData(
y: 8,
colors: [const Color(0xff04dbff)],
width: 16,
),
]),
BarChartGroupData(x: 1, barRods: [
BarChartRodData(
y: 8,
colors: [const Color(0xff04dbff)],
width: 16,
),
]),
BarChartGroupData(x: 2, barRods: [
BarChartRodData(
y: 8,
colors: [const Color(0xff04dbff)],
width: 16,
),
]),
BarChartGroupData(x: 3, barRods: [
BarChartRodData(
y: 8,
colors: [const Color(0xff04dbff)],
width: 16,
),
]),
BarChartGroupData(x: 4, barRods: [
BarChartRodData(
y: 8,
colors: [const Color(0xff04dbff)],
width: 16,
),
]),
BarChartGroupData(x: 5, barRods: [
BarChartRodData(
y: 8,
colors: [const Color(0xff04dbff)],
width: 16,
),
]),
BarChartGroupData(x: 6, barRods: [
BarChartRodData(
y: 8,
colors: [const Color(0xff04dbff)],
width: 16,
),
]),
BarChartGroupData(x: 7, barRods: [
BarChartRodData(
y: 8,
colors: [const Color(0xff04dbff)],
width: 16,
),
]),
BarChartGroupData(x: 8, barRods: [
BarChartRodData(
y: 8,
colors: [const Color(0xff04dbff)],
width: 16,
),
]),
BarChartGroupData(x: 9, barRods: [
BarChartRodData(
y: 8,
colors: [const Color(0xff04dbff)],
width: 16,
),
]),
];
@override
Widget build(BuildContext context) {
return BarChart(
BarChartData(
groupsSpace: 10,
barGroups: rawBarData,
alignment: BarChartAlignment.center,
barRods: [
BarChartRodData(
评论已关闭