ChartLineLayer.gradient constructor

ChartLineLayer.gradient({
  1. required List<Point> items,
  2. required Map<double, Color>? colors,
  3. double lineWidth = 1,
  4. List<double>? dashArray,
  5. double? smoothness,
})

Creates a new instance of ChartLineLayer where colors can be defined for y values resulting in a gradient.

The items parameter is required and represents the list of points to connect with lines. The colors define the colors for each supplied y value, this must have at least 2 values. The lineWidth specifies the width of the line (default is 1). The dashArray is an optional list of values defining the dash pattern for the line. The smoothness is an optional value to smooth the line.

Implementation

ChartLineLayer.gradient({
  required super.items,
  required this.colors,
  this.lineWidth = 1,
  this.dashArray,
  this.smoothness,
})  : positiveColor = null,
      negativeColor = null {
  assert(colors!.length >= 2);
}