more cleanup
This commit is contained in:
parent
b6fe1841aa
commit
99c9c0d4e5
|
|
@ -40,10 +40,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: RotatedBox(
|
||||
quarterTurns: 1,
|
||||
child: MyBarChart(),
|
||||
),
|
||||
child: MyBarChart(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -91,8 +88,18 @@ class MyBarChart extends StatelessWidget {
|
|||
.map((d) => BarChartGroupData(
|
||||
x: data.indexOf(d),
|
||||
barRods: [
|
||||
BarChartRodData(toY: d.year.toDouble(), color: Colors.orange),
|
||||
BarChartRodData(toY: d.gpa.toDouble(), color: Colors.indigo)
|
||||
BarChartRodData(
|
||||
toY: d.year.toDouble(),
|
||||
width: 40,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||
color: Colors.orange,
|
||||
),
|
||||
BarChartRodData(
|
||||
toY: d.gpa.toDouble(),
|
||||
width: 40,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||
color: Colors.indigo,
|
||||
)
|
||||
],
|
||||
))
|
||||
.toList();
|
||||
|
|
@ -122,7 +129,10 @@ class MyBarChart extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BarChart(_chartData());
|
||||
return RotatedBox(
|
||||
quarterTurns: 1,
|
||||
child: BarChart(_chartData()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -135,6 +145,8 @@ class ChartData {
|
|||
|
||||
static List<ChartData> exampleData() {
|
||||
return [
|
||||
ChartData(name: "John", gpa: 2, year: 1),
|
||||
ChartData(name: "Jane", gpa: 3, year: 2),
|
||||
ChartData(name: "John Doe", gpa: 2, year: 1),
|
||||
ChartData(name: "Jane Doe", gpa: 3, year: 2),
|
||||
ChartData(name: "Doe", gpa: 4, year: 3),
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ class ChartData {
|
|||
return [
|
||||
ChartData(name: "John", gpa: 2, year: 1),
|
||||
ChartData(name: "Jane", gpa: 3, year: 2),
|
||||
ChartData(name: "John Doe", gpa: 2, year: 1),
|
||||
ChartData(name: "Jane Doe", gpa: 3, year: 2),
|
||||
ChartData(name: "Doe", gpa: 4, year: 3),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue