-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved ChartUtils drawing methods into CGContext extension #3086
Conversation
@liuxuan30 This looks like a big one, but I didn't change any code, just updated the call sites to reflect the |
Codecov Report
@@ Coverage Diff @@
## 4.0.0 #3086 +/- ##
==========================================
+ Coverage 23.15% 23.24% +0.08%
==========================================
Files 113 113
Lines 15401 15279 -122
Branches 271 271
==========================================
- Hits 3566 3551 -15
+ Misses 11796 11689 -107
Partials 39 39
Continue to review full report at Codecov.
|
sure. I will take this. Just need some time |
Fixed using wrong axis (Issue #2257)
* Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed.
* Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes
* add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test.
fix a small bug
* Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes
jesus, this has 1000+ diff? that gonna take a long time as execuse :) |
Charts.xcodeproj/project.pbxproj
Outdated
@@ -1,1235 +1,1235 @@ | |||
// !$*UTF8*$! | |||
{ | |||
archiveVersion = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I didn't touch any of that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I double checked in BBEdit, and the xcodeproj file is the same. I don't know why those indents happened.
@liuxuan30 1190 of them are all in the xcodeproj file. I don't know why it was changed at all, I'm guessing I just need to pull in recent changes. If you are able to get this one done today I would be able to start getting to work on some bigger changes for 4.0.0 that will take me a long time. |
* Minor cleanup to Highlighter types * Fixes for PR * Pulled master and updated code style
* added DataApproximator+N extension * fixed PR notes
it happens in #3008 as well. Though it's targeted for 4.0 branch |
I checked line by line this morning, and couldn't find any differences. |
any idea why it now has conflicts? I will check 4.0 branch later. eating |
No idea. It's been bugging me |
Much nicer call sites. Renamed some parameter names. Removed `NSAttributedStringKey` where type inference was sufficient. Minor tidy of drawText calls in AxisRenderers
Makes no sense to me. I just rebased, and took the pbxproj file from the master and there are STILL conflicts in it. I still don't see any difference other than white space though. |
NSAttributedStringKey.font: NSUIFont.systemFont(ofSize: 12.0), | ||
NSAttributedStringKey.paragraphStyle: paragraphStyle | ||
], range: NSMakeRange(0, attrString!.length)) | ||
attrString?.setAttributes([.foregroundColor: NSUIColor.black, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we use another line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To follow the code style of the {
and all the other methods it should look like this:
attrString?.setAttributes([
.foregroundColor: NSUIColor.black,
.font: NSUIFont.systemFont(ofSize: 12.0),
.paragraphStyle: paragraphStyle
],
range: NSMakeRange(0, attrString!.length))
Which is very hard to read.
I looked through the framework, and it was very inconsistent for this case. I decided to go with the one I thought was cleanest and started to unify the style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure. NP
y: py, | ||
size: icon.size) | ||
context.drawImage(icon, | ||
atCenter: CGPoint(x: px, y: py), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will it be possible it's not center? just (x, y)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the method implementation, it uses a centre point. The old parameter naming was misleading.
Source/Charts/Utils/ChartUtils.swift
Outdated
x: CGFloat, | ||
y: CGFloat, | ||
size: CGSize) | ||
private static var _defaultValueFormatter: IValueFormatter = generateDefaultValueFormatter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this from another PR? Or should in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just a minor change (ChartUtils.generateDefaultValueFormatter()->
generateDefaultValueFormatter()` because they're both static methods.) Nothing else. I can revert it if you want.
Generally it's green light except for a few code styles or naming questions. you said at first:
Is this better for 4.0 branch or master? |
xcodeproj files have always been spaces though. At least since Xcode 3 |
(And no, I haven't changed my indentation settings. I leave them as default, but with "Include whitespace only lines" checked.) |
Yea, I guess it should be on 4.0.0. I was hoping to get all the ChartUtils in master now, but it makes sense to do it in 4.0.0. |
Yea, I have the same settings. I have no idea why it would have changed. As you can see, it's now all tabs again (I fixed it when I switched it over to 4.0.0 from master) |
And other people filing PR may submit this as well. You have been filed lots of PRs, so this is the first time we met this issue. That's why it's strange. Either you commit this at the very first PR, but it's in the middle.. |
I diffed it in BBEdit, yea. |
What?? You just pulled master and it's tab again? Really what's going on 😂 |
I really don't know haha. But this one is safe again. I'll manually change them to tabs if I have to in the other affected PRs, but I'll wait until you review them. |
sure. I do hope this never happens in the future. I will take a look at this PR again now and merge this, like in 30 mins |
NSAttributedStringKey.font: NSUIFont.systemFont(ofSize: 12.0), | ||
NSAttributedStringKey.paragraphStyle: paragraphStyle | ||
], range: NSMakeRange(0, attrString!.length)) | ||
attrString?.setAttributes([.foregroundColor: NSUIColor.black, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure. NP
if angleRadians != 0.0 | ||
{ | ||
// Move the text drawing rect in a way that it always rotates around its center | ||
rect.origin.x = -knownTextSize.width * 0.5 | ||
rect.origin.y = -knownTextSize.height * 0.5 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any chance this is something wrong with your setup? About deleting some spaces? You intend to do this or ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have remove white space in white space only lines turned on. No point in having a line of empty space.
Just merged. You could move next one(just one lol) to 'In progress' |
I see we don't have more master branch PRs? |
Yea, easier to maintain the 4.0 branch that way. They aren't explicit bug fixes or features so they can all wait until 4.0 |
Then we can make it simple, you could drag several PRs to in progress, I will start from the top one. |
I think we can just bump to 3.0.5 now, unless there's an urgent bug fix lying around. |
* Remove java interface convention (#2997) * Renamed `IMarker` to `Marker` following Swift API guidelines. * Renamed `IAxisValueFormatter` to `AxisValueFormatter` * Renamed `IFillFormatter` to `FillFormatter` * Renamed `IValueFormatter` to `ValueFormatter` * Renamed `IHighlighter` to `Highlighter` * Renamed `I*DataSet` to `*DataSetProtocol` to follow Swift API guidelines * Fixed naming of `LineRadarChartDataSetProtocol` and `RadarChartDataSetProtocol` from previous commit * Renamed "Interfaces" to "DataProviders" for clarity * Updated Demos to for new type naming * Renderer protocols (#3136) * Renderer is now a protocol Renamed Renderers, and organized the Renderer folder. * DataRenderer is now a protocol * AxisRenderer is now a protocol * Chartviewbase redundant ivar (#3045) * Fixed using wrong axis (Issue #2257) * fix #1830. credit from #2049 (#2874) * fix #1830. credit from #2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * ChartViewBase cleanup For the most part, condensing logic and using `guard` where appropriate Removed optionality of many internal variables as they were only optional to allow for deferred initialization. This is now replaced with lazy vars. Removed empty initializer overrides. `fileprivate` is now `private` * Removed redundant ivars In favour of proper access control * Fixes after merge * Renamed `animator` to `chartAnimator` on `ChartViewBase` to no conflict with `NSView`'s `animator()` method. * pulled latest master * Code style fix * Removed AxisRendererBase.swift * Fixed demos * BarChartRenderer Logic cleanup (#3008) * Logic cleanup Mostly using guard where appropriate Few very minor performance improvements * Made use of `==` where appropriate to simplify logic * Returned fatalError message * Replaced `Buffer` class with simple typealias. There was only one instance where reference semantics might have be helpful, but was easily reimplemented with value semantics. * Syncing 4.0.0 with master (#3160) * Fixed using wrong axis (Issue #2257) * fix #1830. credit from #2049 (#2874) * fix #1830. credit from #2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Minor cleanup to Highlighter types (#3003) * Minor cleanup to Highlighter types * Fixes for PR * Pulled master and updated code style * added DataApproximator+N extension (#2848) * added DataApproximator+N extension * fixed PR notes * Readded in missing files * Moved ChartUtils drawing methods into CGContext extension (#3086) * Fixed using wrong axis (Issue #2257) * fix #1830. credit from #2049 (#2874) * fix #1830. credit from #2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Minor cleanup to Highlighter types (#3003) * Minor cleanup to Highlighter types * Fixes for PR * Pulled master and updated code style * added DataApproximator+N extension (#2848) * added DataApproximator+N extension * fixed PR notes * Moved drawing methods into CGContext extension Much nicer call sites. Renamed some parameter names. Removed `NSAttributedStringKey` where type inference was sufficient. Minor tidy of drawText calls in AxisRenderers * Pulled latest master * Pulled master * Fixed code style * Utils Cleanup (#3054) * Cleanup Replaced unnecessary getters with proper access control Replaced unnecessary convenience inits with default parameters Minor refactoring * Pulled latest master * Pulled latest master * Pulled latest master * Fix after pulling master * Fixed using wrong axis (Issue #2257) * fix #1830. credit from #2049 (#2874) * fix #1830. credit from #2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Finished cleanup * Pulled master * Chartdata collection conformance (#3023) * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Updates for PR Also added remove subrange. * PR review fixes * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Relocated `appendEntry(_:todataSet:)` * Removed methods from CombinedChartData * weak -> unowned (#3039) * weak -> unowned `ViewPortJob`s are owned by the Charts that make them. They are guaranteed to only exist while the chart exists. The `Transformer` and `ViewPortHandler` are supplied by the chart, so they will also only exist while the chart exists. Therefor none of them need to be `weak`, but can be `unowned` instead. It's a minor change in the code base (removing some guard statements), but it makes it much easier to discern how the framework is architected. * pulled latest master * Removed optionality from valueFormatter where appropriate (#3106) * Removed optionality from valueFormatter where appropriate In ChartBaseDataSet, `valueFormatter` never returned nil, and escaped early if trying to set it to nil. It appears this was made optional solely to provide lazy initialization. We now use a lazy var instead. In AxisBase, the backing var `_axisValueFormatter` would never be treated as nil, and appears to be made optional solely to provide lazy initialization. We now use a lazy var instead. In `valueFormatter` we can remove the `nil` check, but leave it optional to keep the same functionality. * Pulled 4.0.0 * Pulled latest 4.0.0 * Fixed pro file * Chartdata collection refactor (#3024) * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Removed unnecessary `get` from subscripts. * Removed redundant methods * Relocated `appendEntry(_:todataSet:)` * Removed methods from CombinedChartData * Moved the default value formatter (#3088) * Moved the default value formatter It is now simply `DefaultValueFomatter()` Removed unnecessary backing ivars in `DefaultValuetFormatter` in favour of property observers Deprecated static func constructor in favour of initializer * Add option to rotate value text for line charts * Add value text rotation for bar charts * Add value text rotation for other charts * Fixed misuse/deprecation of "!" operator * Updated projects for Xcode 9.3 and Swift 4.1 added a workspace to include all demos with the project to make it easier to test changes * Pulled master * Moved travis to Xcode 9.3beta temporarily * Updated Rakefile for new project names * Updated demo imports * Rename valueRotationAngle -> valueLabelAngle * Make function private & remove line break * Refactored ChartData (#3169) * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Updates for PR Also added remove subrange. * Refactored ChartData Removed redundancy from min/max logic. Lots of naming changes. Cleaner implementations. * PR review fixes * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Removed redundant methods * Relocated `appendEntry(_:todataSet:)` * pulled latest 4.0.0 * Disabled Collection support for CombinedChartData * Removed methods from CombinedChartData * Pulled latest 4.0 * Fixes after merge * Removed used of dataSet(forIndex:) * Fixed merge conflicts * Fixed merge conflicts * updated demos * Pulled latest 4.0.0 * Fixed demos * Fixed objective c demos * Moved travis to Xcode 9.3 beta temporarily * Fixed macOS demo info.plist and tv demo device name * PR Fixes * Fixed objective-c naming * PR Fixes * fix comment * Remove unnecessary file (#3432) * Dataset logic cleanup (#3001) * Cleaned up `ChartDataSet` logic Added TODOs for areas where simple changes can help improve Swift consistency. * Tidied up logic for `ChartDataSet` subclasses Minor changes to take advantage of Swift features and help improve readability. * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Pulled latest master * Pulled latest master * Updates for PR Also added remove subrange. * Refactored ChartData Removed redundancy from min/max logic. Lots of naming changes. Cleaner implementations. * PR review fixes * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Removed redundant methods * Relocated `appendEntry(_:todataSet:)` * pulled latest 4.0.0 * Disabled Collection support for CombinedChartData * Removed methods from CombinedChartData * Pulled latest 4.0 * Fixes after merge * Removed used of dataSet(forIndex:) * Fixed merge conflicts * Fixed merge conflicts * updated demos * Pulled latest 4.0.0 * Fixed demos * Fixed objective c demos * Moved travis to Xcode 9.3 beta temporarily * Fixed macOS demo info.plist and tv demo device name * PR Fixes * Fixed objective-c naming * PR Fixes * PR Fixes * Added gradient line drawing to LineChartRenderer * Stabilize and clean the code * Extract line drawing into function * Fix macOS build * Move `drawGradientLine` out of `drawLine` method * Remove unused parameters from `drawLine` function * Fix gradient location calculation * Add toggle gradient line into demo options * Improvements after code review * Code cleanup * Remove unnecessary function for generating gradient line - additional code optimizations * Fix: gradient lines peaks are truncated when line width > 1 * Make legendRenderer property public in order to be externally customizable * fix build issue in objc demo * Add minimum slice angle for value labels to PieChartView * Rename drawSliceTextMinimumAngle to sliceTextDrawingThreshold * Fix sliceTextDrawingThreshold renaming in demo * fix build of demos * Add label colors to legend entries (#3558) * add label colors to legend entries * Change interface of LegendEntry * Add Swift version 4.1 to podspec * Turned gradient components and locations into constants (#3775) * Cleaned up `ChartDataSet` logic Added TODOs for areas where simple changes can help improve Swift consistency. * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Pulled latest master * Unified Style Replaced custom algorithms with built-in ones Made axis renderer implementations feel "Swift-ier" * Updates for PR Also added remove subrange. * Refactored ChartData Removed redundancy from min/max logic. Lots of naming changes. Cleaner implementations. * Fixed horizontal barchart bug, * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Relocated `appendEntry(_:todataSet:)` * Disabled Collection support for CombinedChartData * Removed used of dataSet(forIndex:) * Fixed merge conflicts * updated demos * PR Fixes * Fixed axisLabels calculation * Fill rewrite (#3084) close #3140 * Fill is now a protocol Different fill logic is broken up into separate classes. This has a few benefits: 1. It makes the `Fill` types more readable (logic is grouped together) 2. No optionals 3. Most importantly it allows consumers to create new Fill types without looking into the framework. * Added super.init() for objc * Updated Fill access No need to subclass existing fills now that the system is more flexible. If functionality is needed from another fill, user can call it within their own `fillPath(context: CGContext, rect: CGRect)` implementation. * Updated Fill Names * Update Fill.swift update code style Co-authored-by: Jacob Christie <[email protected]> Co-authored-by: Xuan <[email protected]> * update to Swift 5, Xcode 13.5.1, and fix warnings * fix all compile errors and wrong symbols either by git or me. * revert back to convenience init for BarChartDataSet fix ChartDataTests compile errors: use new API dataSet(forLabel:, ignorecase: ) * actually, I compared the old master and find this is a mistake while merging to make init(label:) in BarChartDataSet. It should be in ChartDataSet. * fix -0.0 issue in 4.0 merge. fix func calculateLegendOffsets in BarLineChartViewBase due to mistaking added back offsetBottom += xAxis.labelRotatedHeight. see #4277 for details now bar & horizontal bar chart tests should pass. * fix pie chart UT failures. didSet will no be called in init(), so we call it manually also fix set.valueFormatter in data setter * fix line chart UT failures * Remove `isIndirectValuesCall` * Bump Travis to Xcode 12 * Remove misuse of `count` (#4461) * Remove misuse of `count` * Fix protocol method name * Update ChartColorTemplates.swift use fallbackColor for `colorFromString()` * Revert "Update ChartColorTemplates.swift" This reverts commit b4111fd. Co-authored-by: Xuan <[email protected]> * switch to source compiling swift code * fix Carthage error after changing to source compile. Carthage/Carthage#3019 there is a workaround mentioned [here](Carthage/Carthage#3019 (comment)) making travis to build from carthage.sh until the root issue is fixed. * update project settings * recreate iOS+tvOS images due to iOS14 SDK uncertain changes. * Remove unnecessary ternary in boolean expression (#4435) * Remove internal use of datasets (#4459) * Remove internal use of ChartData.dataSets * Rebased onto ResolveConflicts * Remove duplicated line Co-authored-by: jjatie <[email protected]> Co-authored-by: ctran <[email protected]> Co-authored-by: larryonoff <[email protected]> Co-authored-by: Jacob Christie <[email protected]> Co-authored-by: Katalin Nagy <[email protected]> Co-authored-by: Pierre-Marc Airoldi <[email protected]> Co-authored-by: Marshall Weir <[email protected]> Co-authored-by: Jacob Christie <[email protected]> Co-authored-by: Jacob Christie <[email protected]> Co-authored-by: Jacob Christie <[email protected]> Co-authored-by: BJ Miller <[email protected]>
* Remove java interface convention (ChartsOrg#2997) * Renamed `IMarker` to `Marker` following Swift API guidelines. * Renamed `IAxisValueFormatter` to `AxisValueFormatter` * Renamed `IFillFormatter` to `FillFormatter` * Renamed `IValueFormatter` to `ValueFormatter` * Renamed `IHighlighter` to `Highlighter` * Renamed `I*DataSet` to `*DataSetProtocol` to follow Swift API guidelines * Fixed naming of `LineRadarChartDataSetProtocol` and `RadarChartDataSetProtocol` from previous commit * Renamed "Interfaces" to "DataProviders" for clarity * Updated Demos to for new type naming * Renderer protocols (ChartsOrg#3136) * Renderer is now a protocol Renamed Renderers, and organized the Renderer folder. * DataRenderer is now a protocol * AxisRenderer is now a protocol * Chartviewbase redundant ivar (ChartsOrg#3045) * Fixed using wrong axis (Issue ChartsOrg#2257) * fix ChartsOrg#1830. credit from ChartsOrg#2049 (ChartsOrg#2874) * fix ChartsOrg#1830. credit from ChartsOrg#2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (ChartsOrg#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (ChartsOrg#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (ChartsOrg#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (ChartsOrg#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (ChartsOrg#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (ChartsOrg#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * ChartViewBase cleanup For the most part, condensing logic and using `guard` where appropriate Removed optionality of many internal variables as they were only optional to allow for deferred initialization. This is now replaced with lazy vars. Removed empty initializer overrides. `fileprivate` is now `private` * Removed redundant ivars In favour of proper access control * Fixes after merge * Renamed `animator` to `chartAnimator` on `ChartViewBase` to no conflict with `NSView`'s `animator()` method. * pulled latest master * Code style fix * Removed AxisRendererBase.swift * Fixed demos * BarChartRenderer Logic cleanup (ChartsOrg#3008) * Logic cleanup Mostly using guard where appropriate Few very minor performance improvements * Made use of `==` where appropriate to simplify logic * Returned fatalError message * Replaced `Buffer` class with simple typealias. There was only one instance where reference semantics might have be helpful, but was easily reimplemented with value semantics. * Syncing 4.0.0 with master (ChartsOrg#3160) * Fixed using wrong axis (Issue ChartsOrg#2257) * fix ChartsOrg#1830. credit from ChartsOrg#2049 (ChartsOrg#2874) * fix ChartsOrg#1830. credit from ChartsOrg#2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (ChartsOrg#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (ChartsOrg#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (ChartsOrg#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (ChartsOrg#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (ChartsOrg#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (ChartsOrg#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Minor cleanup to Highlighter types (ChartsOrg#3003) * Minor cleanup to Highlighter types * Fixes for PR * Pulled master and updated code style * added DataApproximator+N extension (ChartsOrg#2848) * added DataApproximator+N extension * fixed PR notes * Readded in missing files * Moved ChartUtils drawing methods into CGContext extension (ChartsOrg#3086) * Fixed using wrong axis (Issue ChartsOrg#2257) * fix ChartsOrg#1830. credit from ChartsOrg#2049 (ChartsOrg#2874) * fix ChartsOrg#1830. credit from ChartsOrg#2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (ChartsOrg#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (ChartsOrg#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (ChartsOrg#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (ChartsOrg#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (ChartsOrg#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (ChartsOrg#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Minor cleanup to Highlighter types (ChartsOrg#3003) * Minor cleanup to Highlighter types * Fixes for PR * Pulled master and updated code style * added DataApproximator+N extension (ChartsOrg#2848) * added DataApproximator+N extension * fixed PR notes * Moved drawing methods into CGContext extension Much nicer call sites. Renamed some parameter names. Removed `NSAttributedStringKey` where type inference was sufficient. Minor tidy of drawText calls in AxisRenderers * Pulled latest master * Pulled master * Fixed code style * Utils Cleanup (ChartsOrg#3054) * Cleanup Replaced unnecessary getters with proper access control Replaced unnecessary convenience inits with default parameters Minor refactoring * Pulled latest master * Pulled latest master * Pulled latest master * Fix after pulling master * Fixed using wrong axis (Issue ChartsOrg#2257) * fix ChartsOrg#1830. credit from ChartsOrg#2049 (ChartsOrg#2874) * fix ChartsOrg#1830. credit from ChartsOrg#2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (ChartsOrg#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (ChartsOrg#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (ChartsOrg#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (ChartsOrg#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (ChartsOrg#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (ChartsOrg#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Finished cleanup * Pulled master * Chartdata collection conformance (ChartsOrg#3023) * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Updates for PR Also added remove subrange. * PR review fixes * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Relocated `appendEntry(_:todataSet:)` * Removed methods from CombinedChartData * weak -> unowned (ChartsOrg#3039) * weak -> unowned `ViewPortJob`s are owned by the Charts that make them. They are guaranteed to only exist while the chart exists. The `Transformer` and `ViewPortHandler` are supplied by the chart, so they will also only exist while the chart exists. Therefor none of them need to be `weak`, but can be `unowned` instead. It's a minor change in the code base (removing some guard statements), but it makes it much easier to discern how the framework is architected. * pulled latest master * Removed optionality from valueFormatter where appropriate (ChartsOrg#3106) * Removed optionality from valueFormatter where appropriate In ChartBaseDataSet, `valueFormatter` never returned nil, and escaped early if trying to set it to nil. It appears this was made optional solely to provide lazy initialization. We now use a lazy var instead. In AxisBase, the backing var `_axisValueFormatter` would never be treated as nil, and appears to be made optional solely to provide lazy initialization. We now use a lazy var instead. In `valueFormatter` we can remove the `nil` check, but leave it optional to keep the same functionality. * Pulled 4.0.0 * Pulled latest 4.0.0 * Fixed pro file * Chartdata collection refactor (ChartsOrg#3024) * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [ChartsOrg#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Removed unnecessary `get` from subscripts. * Removed redundant methods * Relocated `appendEntry(_:todataSet:)` * Removed methods from CombinedChartData * Moved the default value formatter (ChartsOrg#3088) * Moved the default value formatter It is now simply `DefaultValueFomatter()` Removed unnecessary backing ivars in `DefaultValuetFormatter` in favour of property observers Deprecated static func constructor in favour of initializer * Add option to rotate value text for line charts * Add value text rotation for bar charts * Add value text rotation for other charts * Fixed misuse/deprecation of "!" operator * Updated projects for Xcode 9.3 and Swift 4.1 added a workspace to include all demos with the project to make it easier to test changes * Pulled master * Moved travis to Xcode 9.3beta temporarily * Updated Rakefile for new project names * Updated demo imports * Rename valueRotationAngle -> valueLabelAngle * Make function private & remove line break * Refactored ChartData (ChartsOrg#3169) * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [ChartsOrg#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Updates for PR Also added remove subrange. * Refactored ChartData Removed redundancy from min/max logic. Lots of naming changes. Cleaner implementations. * PR review fixes * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Removed redundant methods * Relocated `appendEntry(_:todataSet:)` * pulled latest 4.0.0 * Disabled Collection support for CombinedChartData * Removed methods from CombinedChartData * Pulled latest 4.0 * Fixes after merge * Removed used of dataSet(forIndex:) * Fixed merge conflicts * Fixed merge conflicts * updated demos * Pulled latest 4.0.0 * Fixed demos * Fixed objective c demos * Moved travis to Xcode 9.3 beta temporarily * Fixed macOS demo info.plist and tv demo device name * PR Fixes * Fixed objective-c naming * PR Fixes * fix comment * Remove unnecessary file (ChartsOrg#3432) * Dataset logic cleanup (ChartsOrg#3001) * Cleaned up `ChartDataSet` logic Added TODOs for areas where simple changes can help improve Swift consistency. * Tidied up logic for `ChartDataSet` subclasses Minor changes to take advantage of Swift features and help improve readability. * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [ChartsOrg#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Pulled latest master * Pulled latest master * Updates for PR Also added remove subrange. * Refactored ChartData Removed redundancy from min/max logic. Lots of naming changes. Cleaner implementations. * PR review fixes * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Removed redundant methods * Relocated `appendEntry(_:todataSet:)` * pulled latest 4.0.0 * Disabled Collection support for CombinedChartData * Removed methods from CombinedChartData * Pulled latest 4.0 * Fixes after merge * Removed used of dataSet(forIndex:) * Fixed merge conflicts * Fixed merge conflicts * updated demos * Pulled latest 4.0.0 * Fixed demos * Fixed objective c demos * Moved travis to Xcode 9.3 beta temporarily * Fixed macOS demo info.plist and tv demo device name * PR Fixes * Fixed objective-c naming * PR Fixes * PR Fixes * Added gradient line drawing to LineChartRenderer * Stabilize and clean the code * Extract line drawing into function * Fix macOS build * Move `drawGradientLine` out of `drawLine` method * Remove unused parameters from `drawLine` function * Fix gradient location calculation * Add toggle gradient line into demo options * Improvements after code review * Code cleanup * Remove unnecessary function for generating gradient line - additional code optimizations * Fix: gradient lines peaks are truncated when line width > 1 * Make legendRenderer property public in order to be externally customizable * fix build issue in objc demo * Add minimum slice angle for value labels to PieChartView * Rename drawSliceTextMinimumAngle to sliceTextDrawingThreshold * Fix sliceTextDrawingThreshold renaming in demo * fix build of demos * Add label colors to legend entries (ChartsOrg#3558) * add label colors to legend entries * Change interface of LegendEntry * Add Swift version 4.1 to podspec * Turned gradient components and locations into constants (ChartsOrg#3775) * Cleaned up `ChartDataSet` logic Added TODOs for areas where simple changes can help improve Swift consistency. * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [ChartsOrg#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Pulled latest master * Unified Style Replaced custom algorithms with built-in ones Made axis renderer implementations feel "Swift-ier" * Updates for PR Also added remove subrange. * Refactored ChartData Removed redundancy from min/max logic. Lots of naming changes. Cleaner implementations. * Fixed horizontal barchart bug, * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Relocated `appendEntry(_:todataSet:)` * Disabled Collection support for CombinedChartData * Removed used of dataSet(forIndex:) * Fixed merge conflicts * updated demos * PR Fixes * Fixed axisLabels calculation * Fill rewrite (ChartsOrg#3084) close ChartsOrg#3140 * Fill is now a protocol Different fill logic is broken up into separate classes. This has a few benefits: 1. It makes the `Fill` types more readable (logic is grouped together) 2. No optionals 3. Most importantly it allows consumers to create new Fill types without looking into the framework. * Added super.init() for objc * Updated Fill access No need to subclass existing fills now that the system is more flexible. If functionality is needed from another fill, user can call it within their own `fillPath(context: CGContext, rect: CGRect)` implementation. * Updated Fill Names * Update Fill.swift update code style Co-authored-by: Jacob Christie <[email protected]> Co-authored-by: Xuan <[email protected]> * update to Swift 5, Xcode 13.5.1, and fix warnings * fix all compile errors and wrong symbols either by git or me. * revert back to convenience init for BarChartDataSet fix ChartDataTests compile errors: use new API dataSet(forLabel:, ignorecase: ) * actually, I compared the old master and find this is a mistake while merging to make init(label:) in BarChartDataSet. It should be in ChartDataSet. * fix -0.0 issue in 4.0 merge. fix func calculateLegendOffsets in BarLineChartViewBase due to mistaking added back offsetBottom += xAxis.labelRotatedHeight. see ChartsOrg#4277 for details now bar & horizontal bar chart tests should pass. * fix pie chart UT failures. didSet will no be called in init(), so we call it manually also fix set.valueFormatter in data setter * fix line chart UT failures * Remove `isIndirectValuesCall` * Bump Travis to Xcode 12 * Remove misuse of `count` (ChartsOrg#4461) * Remove misuse of `count` * Fix protocol method name * Update ChartColorTemplates.swift use fallbackColor for `colorFromString()` * Revert "Update ChartColorTemplates.swift" This reverts commit b4111fd. Co-authored-by: Xuan <[email protected]> * switch to source compiling swift code * fix Carthage error after changing to source compile. Carthage/Carthage#3019 there is a workaround mentioned [here](Carthage/Carthage#3019 (comment)) making travis to build from carthage.sh until the root issue is fixed. * update project settings * recreate iOS+tvOS images due to iOS14 SDK uncertain changes. * Remove unnecessary ternary in boolean expression (ChartsOrg#4435) * Remove internal use of datasets (ChartsOrg#4459) * Remove internal use of ChartData.dataSets * Rebased onto ResolveConflicts * Remove duplicated line Co-authored-by: jjatie <[email protected]> Co-authored-by: ctran <[email protected]> Co-authored-by: larryonoff <[email protected]> Co-authored-by: Jacob Christie <[email protected]> Co-authored-by: Katalin Nagy <[email protected]> Co-authored-by: Pierre-Marc Airoldi <[email protected]> Co-authored-by: Marshall Weir <[email protected]> Co-authored-by: Jacob Christie <[email protected]> Co-authored-by: Jacob Christie <[email protected]> Co-authored-by: Jacob Christie <[email protected]> Co-authored-by: BJ Miller <[email protected]>
Much nicer call sites
Removed
NSAttributedStringKey
where type inference was sufficient.Minor tidy of drawText calls in AxisRenderers
It is important to note that this is a breaking change because some of these methods were made public. However, it is extremely unlikely there are direct calls to them so I feel it is safe to merge them into the master. In 4.0.0 I would like to make all of these methods
internal
or at the very least,public
, as our extension points don't need be at such a low level.