LinePainter constructor

LinePainter({
  1. required Color bgColor,
  2. required Color xAxisColor,
  3. required double xAxisWidth,
  4. required List<LineChartPoint> points,
  5. Color lineColor = const Color(0xFF1678FF),
  6. Color? xLineTextColor,
  7. double lineWidth = 1,
  8. Color? yAxisColor,
  9. double? yAxisWidth,
  10. bool drawYAxis = false,
  11. int xLineNums = 1,
  12. bool showXLineText = false,
})

Implementation

LinePainter({
  required this.bgColor,
  required this.xAxisColor,
  required this.xAxisWidth,
  required this.points,
  this.lineColor = const Color(0xFF1678FF),
  this.xLineTextColor,
  this.lineWidth = 1,
  this.yAxisColor,
  this.yAxisWidth,
  this.drawYAxis = false,
  this.xLineNums = 1,
  this.showXLineText = false,
}) {
  _bgRectPaint = Paint()..color = bgColor;
  _xAxisPaint = Paint()
    ..color = xAxisColor
    ..strokeWidth = xAxisWidth;
  xLineTextColor = xLineTextColor ?? xAxisColor;

  if (drawYAxis) {
    yAxisColor = yAxisColor ?? xAxisColor;
    yAxisWidth = yAxisWidth ?? xAxisWidth;
    _yAxisPaint = Paint()
      ..color = yAxisColor!
      ..strokeWidth = yAxisWidth!;
  }
}