moving_average 0.1.0-alpha3 moving_average: ^0.1.0-alpha3 copied to clipboard
Calculate moving averages of lists of numbers.
example/moving_average_example.dart
import 'package:moving_average/moving_average.dart';
void main() {
final List<num> values = <num>[1, 2, 3, 4, 5];
print('Values = $values');
print('\nSize = 2, includepartial = false');
final List<num> movingAverage2 = movingAverage(values, 2);
print('Moving Average, size 2 = $movingAverage2');
final List<num> weightedAverage2 = weightedMovingAverage(values, 2);
print('Weighted Moving Average, size 2 = $weightedAverage2');
print('\nSize = 3, includepartial = true');
final List<num> movingAverage3 =
movingAverage(values, 3, includePartial: true);
print('Moving Average, size 3 = $movingAverage3');
final List<num> weightedAverage3 =
weightedMovingAverage(values, 3, includePartial: true);
print('Weighted Moving Average, size 3 = $weightedAverage3');
}