Refactor charts, BarChart and LineChart layout fixes#7345
Refactor charts, BarChart and LineChart layout fixes#7345henon merged 9 commits intoMudBlazor:devfrom chausner:charts-refactoring
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## dev #7345 +/- ##
==========================================
- Coverage 90.62% 90.59% -0.04%
==========================================
Files 427 427
Lines 15174 15157 -17
==========================================
- Hits 13752 13731 -21
- Misses 1422 1426 +4
☔ View full report in Codecov by Sentry. |
|
Hi. |
I guess we could mark that property and class as deprecated and remove it with version 7. I'd prefer that over deferring this PR until version 7. I wonder if maybe all the interpolation functionality should better not have been made part of the public API. It might be useful if somebody wants to write their own chart control and reuse the interpolation functionality but otherwise, this logic could be seen as an implementation detail of the inbuilt charts, no? |
Yeah, that would be the best way to address it. What do you think @henon? |
|
Sorry for the late reply, but yes, obsoleting and removing in v7 is the way to go. PS: if you like you can even PR the removal against our v7 branch in a separate PR |
* Refactor charts * Fix ComputeUnitsAndNumberOfLines for empty series/data * Fix broken Bar and Line charts * Minor tweaks * Add missing usings * Fix BarChart and LineChart tests * Add NoInterpolation and InterpolationRequired back and mark as obsolete * Fix compilation
Description
This is a refactoring of the chart code with some minor fixes and improvements, continued from #2209. Summary of changes:
OnParametersSetmethod into smaller separate methodsILineInterpolator.InterpolationRequiredandNoInterpolationas obsolete since no longer used((int)(maxY / gridYUnits)) + 1;by(int)Math.Ceiling(maxY / gridYUnits);. The former rounds up even ifmaxYis a multiple ofgridYUnits, which is probably undesired here.numHorizontalLinesandnumVerticalLinesnow really do denote the respective number of lines, before it was number of lines - 1XValuesandYValuesarrays when interpolation is disabledStringBuilderto construct the SVG dataHow Has This Been Tested?
Types of changes
Before:


After (note the y axis range of the bar chart and the x axis range of the line chart):
Checklist:
dev).