TinyBarChart.single constructor

TinyBarChart.single({
  1. Key? key,
  2. required double value,
  3. required double max,
  4. Color? color,
  5. double? width,
  6. double? height,
})

Creates a TinyBarChart that represents the percentage of value in relation to max.

Defines a single element to dataPoints based on value and creates a TinyBarChartOptions based on max and color.

color defaults to kDefaultBarChartOptions.colorOdd

See also:

Implementation

factory TinyBarChart.single({
  Key? key,
  required double value,
  required double max,
  Color? color,
  double? width,
  double? height,
}) {
  return TinyBarChart.stackedFromDataVectors(
    key: key,
    dataPoints: <Vector2>[
      Vector2(0, value),
    ],
    options: TinyBarChartOptions(
      max: max,
      colors: <Color>[color ?? kDefaultBarChartOptions.colors.first],
    ),
    width: width,
    height: height,
  );
}