|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:charts_flutter/flutter.dart' as charts;
|
|
|
|
|
|
|
|
class AppBarChart extends StatelessWidget {
|
|
|
|
const AppBarChart({
|
|
|
|
Key key,
|
|
|
|
@required this.seriesList,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final List<charts.Series> seriesList;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
height: 400,
|
|
|
|
//margin: EdgeInsets.only(top: 60),
|
|
|
|
child: charts.BarChart(
|
|
|
|
seriesList,
|
|
|
|
// animate: animate,
|
|
|
|
domainAxis: charts.OrdinalAxisSpec(
|
|
|
|
renderSpec: charts.GridlineRendererSpec(
|
|
|
|
labelAnchor: charts.TickLabelAnchor.after,
|
|
|
|
labelRotation: -30,
|
|
|
|
labelOffsetFromAxisPx: 30,
|
|
|
|
labelOffsetFromTickPx: 15,
|
|
|
|
labelJustification: charts.TickLabelJustification.inside,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
/// Customize the primary measure axis using a small tick renderer.
|
|
|
|
/// Use String instead of num for ordinal domain axis
|
|
|
|
/// (typically bar charts).
|
|
|
|
primaryMeasureAxis: new charts.NumericAxisSpec(
|
|
|
|
renderSpec: new charts.GridlineRendererSpec(
|
|
|
|
// Display the measure axis labels below the gridline.
|
|
|
|
//
|
|
|
|
// 'Before' & 'after' follow the axis value direction.
|
|
|
|
// Vertical axes draw 'before' below & 'after' above the tick.
|
|
|
|
// Horizontal axes draw 'before' left & 'after' right the tick.
|
|
|
|
labelAnchor: charts.TickLabelAnchor.before,
|
|
|
|
|
|
|
|
// Left justify the text in the axis.
|
|
|
|
//
|
|
|
|
// Note: outside means that the secondary measure axis would right
|
|
|
|
// justify.
|
|
|
|
labelJustification: charts.TickLabelJustification.outside,
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|