MainRenderer constructor

MainRenderer({
  1. required MainRendererStyle style,
  2. required Rect chartRect,
  3. required double maxValue,
  4. required double minValue,
  5. MainState state = MainState.NONE,
  6. bool isLine = false,
  7. required double scaleX,
  8. List<int> maDayList = const [5, 10, 20],
  9. String dataFormat(
    1. double value
    )?,
})

Implementation

MainRenderer({
  required this.style,
  required super.chartRect,
  required super.maxValue,
  required super.minValue,
  this.state = MainState.NONE,
  this.isLine = false,
  required this.scaleX,
  this.maDayList = const [5, 10, 20],
  super.dataFormat
}) : super(style: style) {
  mLinePaint = Paint()
    ..isAntiAlias = true
    ..style = PaintingStyle.stroke
    ..strokeWidth = mLineStrokeWidth
    ..color = style.colors.kLine;

  _contentRect = Rect.fromLTRB(chartRect.left, chartRect.top + _contentPadding, chartRect.right, chartRect.bottom - _contentPadding);

  if (maxValue == minValue) {
    maxValue *= 1.5;
    minValue /= 2;
  }

  scaleY = _contentRect.height / (maxValue - minValue);
}