/*
 * @Author: WuXiangNan
 * @Date: 2021-04-30 11:48:41
 * @LastEditors  : WuWei
 * @LastEditTime : 2022-01-19 09:59:06
 * @FilePath: /wisdom-huiguanjia-app/business_package/lib/src/components/bar_charts.dart
 * @Description: 
 */

// import 'package:business_package/src/models/bill_data_line_chart.dart';
// import 'package:charts_flutter/flutter.dart' as charts;
// import 'package:flutter/material.dart';

// class BarCharts extends StatelessWidget {
//   final List<charts.Series> seriesList;
//   final bool? animate;

//   BarCharts(this.seriesList, {this.animate});

//   factory BarCharts.withSampleData(BillDataLineChart billDataLineChart) {
//     return new BarCharts(
//       _createData(billDataLineChart),
//       animate: false,
//     );
//   }

//   @override
//   Widget build(BuildContext context) {
//     return new Directionality(
//         textDirection: TextDirection.ltr,
//         child: new charts.BarChart(
//           seriesList as List<charts.Series<dynamic, String>>,
//           animate: animate,
//         ));
//   }

//   static List<charts.Series<ChartsData, String?>> _createData(
//       BillDataLineChart billDataLineChart) {
//     List<ChartsData> incomeAmountLine = [];
//     billDataLineChart.incomeAmountLine!.forEach((data) {
//       incomeAmountLine.add(ChartsData(data.x, double.parse(data.y!)));
//     });
//     List<ChartsData> incomeOnlineAmountLine = [];
//     billDataLineChart.incomeOnlineAmountLine!.forEach((data) {
//       incomeOnlineAmountLine.add(ChartsData(data.x, double.parse(data.y!)));
//     });

//     return [
//       new charts.Series<ChartsData, String?>(
//         id: 'incomeAmountLine',
//         domainFn: (ChartsData data, _) => data.x,
//         measureFn: (ChartsData data, _) => data.y,
//         colorFn: (_, __) => charts.ColorUtil.fromDartColor(Color(0xFF47A7FF)),
//         data: incomeAmountLine,
//       ),
//       new charts.Series<ChartsData, String?>(
//         id: 'incomeOnlineAmountLine',
//         domainFn: (ChartsData data, _) => data.x,
//         measureFn: (ChartsData data, _) => data.y,
//         colorFn: (_, __) => charts.ColorUtil.fromDartColor(Color(0xFF54E2EB)),
//         data: incomeOnlineAmountLine,
//       ),
//     ];
//   }
// }

// class ChartsData {
//   final String? x;
//   final double y;

//   ChartsData(this.x, this.y);
// }

// class HiddenTicksAndLabelsAxis extends StatelessWidget {
//   final List<charts.Series> seriesList;
//   final bool? animate;

//   HiddenTicksAndLabelsAxis(this.seriesList, {this.animate});

//   factory HiddenTicksAndLabelsAxis.withSampleData(
//       int? historicalArrearsAmount, int? arrearsAmount) {
//     return new HiddenTicksAndLabelsAxis(
//       _createData(historicalArrearsAmount, arrearsAmount),
//       animate: false,
//     );
//   }

//   @override
//   Widget build(BuildContext context) {
//     return new charts.BarChart(
//       seriesList as List<charts.Series<dynamic, String>>,
//       animate: animate,
//       primaryMeasureAxis:
//           new charts.NumericAxisSpec(renderSpec: new charts.NoneRenderSpec()),
//       domainAxis: new charts.OrdinalAxisSpec(),
//       barRendererDecorator: new charts.BarLabelDecorator<String>(),
//       layoutConfig: new charts.LayoutConfig(
//           leftMarginSpec: new charts.MarginSpec.fixedPixel(10),
//           topMarginSpec: new charts.MarginSpec.fixedPixel(30),
//           rightMarginSpec: new charts.MarginSpec.fixedPixel(10),
//           bottomMarginSpec: new charts.MarginSpec.fixedPixel(20)),
//     );
//   }

//   /// Create series list with single series
//   static List<charts.Series<HiddenTicksData, String>> _createData(
//       int? historicalArrearsAmount, int? arrearsAmount) {
//     final globalSalesData = [
//       new HiddenTicksData('历史欠费', historicalArrearsAmount,
//           charts.ColorUtil.fromDartColor(Color(0xFF2D8CF0))),
//       new HiddenTicksData('本年欠费', arrearsAmount,
//           charts.ColorUtil.fromDartColor(Color(0xFF54E2EB))),
//     ];

//     return [
//       new charts.Series<HiddenTicksData, String>(
//         id: 'Global Revenue',
//         domainFn: (HiddenTicksData data, _) => data.x,
//         measureFn: (HiddenTicksData data, _) => data.y,
//         colorFn: (HiddenTicksData data, _) => data.color,
//         data: globalSalesData,
//         labelAccessorFn: (HiddenTicksData data, _) => '${data.y.toString()}',
//       ),
//     ];
//   }
// }

// class HiddenTicksData {
//   final String x;
//   final int? y;
//   final charts.Color color;

//   HiddenTicksData(this.x, this.y, this.color);
// }
