LCOV - code coverage report
Current view: top level - lib/charts/painter - column_chart_painter.dart Coverage Total Hit
Test: lcov.info Lines: 0.0 % 20 0
Test Date: 2026-11-14 15:04:37 Functions: - 0 0

            Line data    Source code
       1              : // Copyright 2023 The terCAD team. All rights reserved.
       2              : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file.
       3              : 
       4              : import 'package:app_finance/charts/interface/chart_data.dart';
       5              : import 'package:app_finance/charts/painter/abstract_painter.dart';
       6              : import 'package:material_ui/material_ui.dart';
       7              : 
       8              : class ColumnChartPainter extends AbstractPainter {
       9              :   final List<ChartData> data;
      10              :   late Canvas canvas;
      11              : 
      12            0 :   ColumnChartPainter({
      13              :     required super.indent,
      14              :     required this.data,
      15              :     super.size,
      16              :     super.xMax = 1.0,
      17              :     super.xMin = 0.0,
      18              :     super.yMax = 1.0,
      19              :   });
      20              : 
      21            0 :   @override
      22              :   void paint(Canvas canvas, Size size) {
      23            0 :     if (data.isEmpty) {
      24              :       return;
      25              :     }
      26            0 :     this.size ??= size;
      27            0 :     this.canvas = canvas;
      28            0 :     for (int i = 0; i < data.length; i++) {
      29            0 :       _draw(data[i], i / data.length);
      30              :     }
      31              :   }
      32              : 
      33            0 :   void _draw(ChartData scope, double shift) {
      34            0 :     for (int i = 0; i < scope.data.length; i++) {
      35            0 :       _drawRectangle(scope.data[i], i - shift - 1, scope.color, scope.strokeWidth);
      36              :     }
      37              :   }
      38              : 
      39            0 :   void _drawRectangle(Offset value, double shift, Color color, double stroke) {
      40            0 :     final paint = Paint()
      41            0 :       ..color = color
      42            0 :       ..style = PaintingStyle.fill
      43            0 :       ..strokeWidth = 1;
      44            0 :     final time = value.dx.toDouble();
      45            0 :     final rect = Rect.fromPoints(
      46            0 :       getValue(Offset(time - msDay * shift * 3 * stroke, value.dy), size!),
      47            0 :       getValue(Offset(time - msDay * (shift + 1) * 3 * stroke, 0.0), size!),
      48              :     );
      49            0 :     canvas.drawRect(rect, paint);
      50              :   }
      51              : }
        

Generated by: LCOV version 2.0-1