LCOV - code coverage report
Current view: top level - lib/charts/painter - abstract_painter.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 8 10 80.0 %
Date: 2024-10-04 11:12:13 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/painter/foreground_chart_painter.dart';
       5             : import 'package:flutter/material.dart';
       6             : 
       7             : abstract class AbstractPainter extends CustomPainter {
       8             :   final double indent;
       9             :   final double xMax;
      10             :   final double xMin;
      11             :   final double yMin;
      12             :   final double yMax;
      13             :   Size? size;
      14             : 
      15             :   final double msDay = 86400000;
      16             : 
      17           1 :   AbstractPainter({
      18             :     required this.indent,
      19             :     this.size,
      20             :     this.xMin = 0.0,
      21             :     this.xMax = 1.0,
      22             :     this.yMin = 0.0,
      23             :     this.yMax = 1.0,
      24             :   });
      25             : 
      26           0 :   @override
      27             :   bool shouldRepaint(CustomPainter oldDelegate) => false;
      28             : 
      29           1 :   Offset getValue(Offset point, Size size, [double dy = 0]) {
      30          11 :     double x = (point.dx - xMin) / (xMax - xMin) * size.width + indent;
      31           2 :     if (x > size.width) {
      32           2 :       x = size.width + 0.01;
      33           2 :     } else if (x < indent) {
      34           0 :       x = indent;
      35             :     }
      36          14 :     double y = (1 - (point.dy + dy - yMin) / (yMax - yMin)) * size.height - indent / ForegroundChartPainter.coercion;
      37           3 :     return Offset(x, y < 0 ? -0.01 : y);
      38             :   }
      39             : }

Generated by: LCOV version 1.14