moving_average 0.1.0-alpha moving_average: ^0.1.0-alpha copied to clipboard
A starting point for Dart libraries or applications.
example/moving_average_example.dart
import 'package:moving_average/moving_average.dart';
main() {
final values = [1, 2, 3, 4, 5];
print("Values = $values");
print("\nSize = 2, includepartial = false");
final movingAverage2 = movingAverage(values, 2);
print("Moving Average, size 2 = $movingAverage2");
final weightedAverage2 = weightedMovingAverage(values, 2);
print("Weighted Moving Average, size 2 = $weightedAverage2");
print("\nSize = 3, includepartial = true");
final movingAverage3 = movingAverage(values, 3, includePartial: true);
print("Moving Average, size 3 = $movingAverage3");
final weightedAverage3 = weightedMovingAverage(values, 3, includePartial: true);
print("Weighted Moving Average, size 3 = $weightedAverage3");
}