fl_chart
fl_chart copied to clipboard
Fix a NAN crash for HTML web renderer
cc @imaNNeoFighT
We are seeing a NAN crash when used it with HTML web renderer. I have tracked it down and found the line of code that is causing the problem. I'm not quite familiar with the code base, so I just made a quick fix for it which is easiest for me. There might be a more elegant way to fix it, in that case, you can just close my PR.
Hi. Can you please send me a stack trace or something like that?

@imaNNeoFighT The stacktrace itself didn't show it's from the fl_chart lib, but I was able to trace down the problem to the lib.
Is there a way to reproduce it?
Codecov Report
Merging #992 (e12ff1d) into master (b0e3027) will increase coverage by
0.94%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #992 +/- ##
==========================================
+ Coverage 85.17% 86.11% +0.94%
==========================================
Files 42 42
Lines 2731 2701 -30
==========================================
Hits 2326 2326
+ Misses 405 375 -30
Impacted Files | Coverage Δ | |
---|---|---|
...ase/axis_chart/side_titles/side_titles_widget.dart | 100.00% <100.00%> (ø) |
|
lib/src/chart/bar_chart/bar_chart_renderer.dart | 100.00% <0.00%> (+22.72%) |
:arrow_up: |
...ib/src/chart/radar_chart/radar_chart_renderer.dart | 100.00% <0.00%> (+22.72%) |
:arrow_up: |
...rc/chart/scatter_chart/scatter_chart_renderer.dart | 100.00% <0.00%> (+22.72%) |
:arrow_up: |
:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more
I have the same issue for mobile browsers, when using SideTitles in a LineChart and all the data in the axis has the same value.
This issue has been fixed in 0.45.0. For more information, check here: https://github.com/imaNNeoFighT/fl_chart/blob/42e9863589072c33c0ae1bd9418da698c98eb075/lib/src/utils/utils.dart#L138-L140