widgets/weather/weather_chart_sampling library

Data sampling algorithms for weather chart.

Copyright (C) 2026, Software Innovation Institute, ANU.

Licensed under the GNU General Public License, Version 3 (the "License").

License: https://opensource.org/license/gpl-3-0.

Authors: Miduo

Functions

douglasPeucker(List<MapEntry<DateTime, double>> points, int targetCount) List<MapEntry<DateTime, double>>
Ramer-Douglas-Peucker algorithm implementation. Reduces number of points while preserving the overall shape.
perpendicularDistance(MapEntry<DateTime, double> point, MapEntry<DateTime, double> lineStart, MapEntry<DateTime, double> lineEnd, int totalPoints) double
Calculate perpendicular distance from point to line segment.
rdpRecursive(List<MapEntry<DateTime, double>> points, double epsilon) List<MapEntry<DateTime, double>>
Recursive RDP algorithm.
sampleData(Map<DateTime, double> data, int targetCount) Map<DateTime, double>
Sample data using Ramer-Douglas-Peucker algorithm to preserve curve characteristics. This algorithm keeps points that are important for maintaining the shape of the curve.
sampleEntriesForPdf(List<MapEntry<DateTime, double>> entries, int targetCount) List<MapEntry<DateTime, double>>
Sample entries for PDF to reduce clutter.