LineChartPainter constructor

LineChartPainter({
  1. required Color bgColor,
  2. required Color xAxisColor,
  3. required double xAxisWidth,
  4. 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,
  13. LineChartPointConfig? config,
  14. Offset? touchOffset,
  15. bool showYLineMark = false,
  16. double topPadding = 10,
  17. double startPadding = 10,
  18. double endPadding = 15,
  19. SelectedCallback? selectedCallback,
  20. List<List<LineChartPoint>>? multipleLinePoints,
  21. List<Color>? multipleLinePointsColor,
  22. List<String>? xLineMarks,
  23. String? yUnit,
  24. bool useUnifyYUnit = false,
  25. bool unSelected = false,
})

Implementation

LineChartPainter({
  required this.bgColor,
  required this.xAxisColor,
  required this.xAxisWidth,
  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,
  this.config,
  this.touchOffset,
  this.showYLineMark = false,
  this.topPadding = 10,
  this.startPadding = 10,
  this.endPadding = 15,
  this.selectedCallback,
  this.multipleLinePoints,
  this.multipleLinePointsColor,
  this.xLineMarks,
  this.yUnit,
  this.useUnifyYUnit = false,
  this.unSelected = 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!;
  }
}