Replaced ChartUtils.Math in favour of an extension on FloatingPoint#2993
Replaced ChartUtils.Math in favour of an extension on FloatingPoint#2993liuxuan30 merged 8 commits intoChartsOrg:masterfrom jjatie:deg-rad
ChartUtils.Math in favour of an extension on FloatingPoint#2993Conversation
Increases readability, and in many cases removes a set of parentheses to ensure order of operations.
Improves readability
Codecov Report
@@ Coverage Diff @@
## master #2993 +/- ##
==========================================
+ Coverage 19.41% 19.45% +0.04%
==========================================
Files 113 113
Lines 16064 16044 -20
Branches 247 247
==========================================
+ Hits 3119 3122 +3
+ Misses 12907 12884 -23
Partials 38 38
Continue to review full report at Codecov.
|
|
@liuxuan30 @petester42 This is a quick and easy one. |
| /// NOTE: Value must be in degrees | ||
| var normalizedAngle: Self { | ||
| let angle = truncatingRemainder(dividingBy: 360) | ||
| return (sign == .minus) ? angle + 360 : angle |
There was a problem hiding this comment.
the order is flipped. I need to refresh my mind first to see if they are equivalent. Or you already did that?
| /// NOTE: Value must be in degrees | ||
| var normalizedAngle: Self { | ||
| let angle = truncatingRemainder(dividingBy: 360) | ||
| return (sign == .minus) ? angle + 360 : angle |
Source/Charts/Utils/ChartUtils.swift
Outdated
| #endif | ||
|
|
||
| extension FloatingPoint { | ||
| var deg2rad: Self { |
There was a problem hiding this comment.
Generally it's fine. But do you think we should follow the Camel-Case naming? like deg2Rad
There was a problem hiding this comment.
Up to you. I tried deg2Rad and deg2RAD and they both look silly to me. I also considered inRadians and inDegrees
There was a problem hiding this comment.
OK. How about we keep old FDEG2RAD to keep consitent?
There was a problem hiding this comment.
I'll drop the F since it's implied as it's an extension on FloatingPoint
|
This is the one of the change I like most, indeed make it more swift and simple |
* 'master' of https://github.com/danielgindi/Charts: (23 commits) Update ViewPortHandler.swift (ChartsOrg#3143) add option to build demo projects unit tests on iOS (ChartsOrg#3121) Replaced relevant `ChartUtils` methods with `Double` extensions (ChartsOrg#2994) Update 4.0.0 with master (ChartsOrg#3135) Removed redundant ivars in BarLineChartViewBase (ChartsOrg#3043) fix ChartsOrg#1830. credit from ChartsOrg#2049 (ChartsOrg#2874) Makes ChartsDemo compiling again (ChartsOrg#3117) Fixed using wrong axis (Issue ChartsOrg#2257) Removed methods and properties deprecated in 1.0 (ChartsOrg#2996) for ChartsOrg#3061 revert animationUpdate() and animationEnd() not trigger crash if subclass does nothing The backing var is not necessary. (ChartsOrg#3000) Replaced `ChartUtils.Math` in favour of an extension on `FloatingPoint` (ChartsOrg#2993) Minor logic cleanup (ChartsOrg#3041) Fix a bug may cause infinite loop. (ChartsOrg#3073) for ChartsOrg#2745. chart should be weak. fileprivate -> private (ChartsOrg#3042) Removed `isKind(of:)` Removed @objc from internal properties Fixes for PR Made use of `==` where appropriate to simplify logic ... # Conflicts: # Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift # Source/Charts/Renderers/BarChartRenderer.swift
Increases readability, and in many cases removes a set of parentheses to ensure order of operations. Also can be applied to any
FloatingPointtype, not justDoubleandCGFloat