Skip to content

Commit

Permalink
Fix LineChart width smaller width or height lower than 40, #869, #857.
Browse files Browse the repository at this point in the history
  • Loading branch information
imaNNeo committed Jan 28, 2022
1 parent 4d270fb commit 1d7a2d3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## newVersion
* **BUGFIX** Fix PieChart changing sections issue (we have disabled semantics for pieChart badgeWidgets), #861.
* **BUGFIX** Fix LineChart width smaller width or height lower than 40, #869, #857.

## 0.41.0
* **BUGFIX** Fix getNearestTouchedSpot. Previously it returned the first occurrence of a spot within the threshold, and not the nearest, #641, #645.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class Utils {
/// 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 5000, 10000,...
double getEfficientInterval(double axisViewSize, double diffInYAxis,
{double pixelPerInterval = 40}) {
final allowedCount = axisViewSize ~/ pixelPerInterval;
final allowedCount = math.max(axisViewSize ~/ pixelPerInterval, 1);
final accurateInterval = diffInYAxis / allowedCount;
return roundInterval(accurateInterval);
}
Expand Down
1 change: 1 addition & 0 deletions test/utils/utils_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ void main() {
expect(Utils().getEfficientInterval(200, 0.5, pixelPerInterval: 20), 0.05);
expect(Utils().getEfficientInterval(200, 1.0, pixelPerInterval: 20), 0.1);
expect(Utils().getEfficientInterval(100, 0.5, pixelPerInterval: 20), 0.1);
expect(Utils().getEfficientInterval(10, 10), 10);
});

test('test formatNumber', () {
Expand Down

0 comments on commit 1d7a2d3

Please sign in to comment.