Skip to content
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

Chartviewbase redundant ivar #3045

Merged
merged 18 commits into from
Jan 6, 2018
Merged

Chartviewbase redundant ivar #3045

merged 18 commits into from
Jan 6, 2018

Conversation

jjatie
Copy link
Collaborator

@jjatie jjatie commented Nov 23, 2017

No description provided.

@jjatie
Copy link
Collaborator Author

jjatie commented Nov 23, 2017

This includes #3034

@codecov-io
Copy link

codecov-io commented Nov 24, 2017

Codecov Report

Merging #3045 into 4.0.0 will increase coverage by 2.4%.
The diff coverage is 42.2%.

Impacted file tree graph

@@           Coverage Diff            @@
##           4.0.0    #3045     +/-   ##
========================================
+ Coverage   20.9%   23.31%   +2.4%     
========================================
  Files        111      112      +1     
  Lines      15458    15409     -49     
  Branches     250      265     +15     
========================================
+ Hits        3231     3592    +361     
+ Misses     12187    11778    -409     
+ Partials      40       39      -1
Impacted Files Coverage Δ
...Charts/Data/Implementations/ChartBaseDataSet.swift 21.07% <ø> (ø) ⬆️
Source/Charts/Charts/RadarChartView.swift 0% <0%> (ø) ⬆️
Source/Charts/Renderers/RadarChartRenderer.swift 0% <0%> (ø) ⬆️
Source/Charts/Charts/CandleStickChartView.swift 0% <0%> (ø) ⬆️
Source/Charts/Charts/BubbleChartView.swift 0% <0%> (ø) ⬆️
Source/Charts/Charts/ScatterChartView.swift 0% <0%> (ø) ⬆️
Source/Charts/Charts/PieChartView.swift 0% <0%> (ø) ⬆️
...rce/Charts/Renderers/YAxisRendererRadarChart.swift 0% <0%> (ø) ⬆️
...ts/Renderers/XAxisRendererHorizontalBarChart.swift 0% <0%> (ø) ⬆️
Source/Charts/Charts/PieRadarChartViewBase.swift 0% <0%> (ø) ⬆️
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e126844...310211b. Read the comment docs.

@liuxuan30
Copy link
Member

do we need to close #3034, or it's a dependency

@jjatie
Copy link
Collaborator Author

jjatie commented Dec 14, 2017

#3034 should be done first is what I meant

@liuxuan30
Copy link
Member

sure, I'm taking #3034 first

defranke and others added 5 commits December 18, 2017 17:58
* 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 favour of proper access control

* Moved initialization of axes to their declaration to keep the same optionality exposed.
jjatie and others added 4 commits December 27, 2017 21:29
* 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.
* Refactored ChartUtils method into CGPoint extension

* Replaced ChartUtils.defaultValueFormatter()

* Codestyle fixes
@jjatie jjatie mentioned this pull request Jan 3, 2018
@jjatie jjatie changed the base branch from master to 4.0.0 January 3, 2018 10:24
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`
In favour of proper access control
on `ChartViewBase` to no conflict with `NSView`'s `animator()` method.
@jjatie
Copy link
Collaborator Author

jjatie commented Jan 3, 2018

@liuxuan30 I rebased this one off of 4.0.0 as I mentioned in #3034.


/// The data for the chart
@objc open var data: ChartData? {
didSet {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does didSet have any advantage over the old setter? Or just didSet describe the job more properly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. The old way had two variables, one stored and one computed. This just has the one stored with a property observer to do the calculations.

Copy link
Member

@liuxuan30 liuxuan30 Jan 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean setter vs. didSet. why you choose didSet over setter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a computed variable... You can only make a custom setter on a computer property. On a stored property you use the property observers willSet and didSet

internal var _indicesToHighlight = [Highlight]()

/// The array of currently highlighted values. This might an empty if nothing is highlighted.
@objc open internal(set) var highlighted = [Highlight]()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A) Can we keep old name, or the new name is more swift favored?
B) If we gonna change the public var names like this, we might need to write them down and when publishing 4.0, users could know what's thre replacement.

Copy link
Collaborator Author

@jjatie jjatie Jan 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The public facing name was highlighted which is why I changed the internal var name. (line 363)

}

/// Highlights the values at the given indices in the given DataSets. Provide
/// null or an empty array to undo all highlighting.
/// This should be used to programmatically highlight values.
/// This method *will not* call the delegate.
@objc open func highlightValues(_ highs: [Highlight]?)
@objc open func highlightValues(_ highs: [Highlight])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks we have a regression here

@@ -448,8 +409,7 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate
/// - parameter callDelegate: Should the delegate be called for this change
@objc open func highlightValue(x: Double, y: Double, dataSetIndex: Int, callDelegate: Bool)
{
guard let data = _data else
{
guard let data = data else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regression code style. Please check #3034 for code style issues and update here? If you can manage to reset hard with #3034, we can merge #3034 so you won't have to do dup work. up to you

@liuxuan30
Copy link
Member

Besides, can you pull master into this PR, so we have the newer CI?

/// if true, units are drawn next to the values in the chart
// TODO: This is used nowhere and can't be used by a consumer. Can we remove this property?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the deal with this variable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is really not used anywhere, we can safely delete, or add @deprecated first.

Copy link
Collaborator Author

@jjatie jjatie Jan 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used anywhere and is internal only so I will delete.

@jjatie
Copy link
Collaborator Author

jjatie commented Jan 4, 2018

If you let me know what the next PR you're going to tackle is, I can stay one ahead of you ; )

@liuxuan30
Copy link
Member

liuxuan30 commented Jan 5, 2018

The review order is up to you. I usually prefer finish off small ones, and then larger one. But if any PR can ease your workflow, I can take that first.

It looks like CI failed because of the demo controllers' chartDescription deprecation. Could you fix it so we can merge?

@jjatie
Copy link
Collaborator Author

jjatie commented Jan 5, 2018

Pushing now

@@ -439,10 +442,12 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate
guard
let h = high,
let entry = data?.entryForHighlight(h)
else {
else
{
Copy link
Member

@liuxuan30 liuxuan30 Jan 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent seems wrong here. @jjatie what you see on your side? should } align with guard?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's what Xcode auto indents to. It lines up with the guard instead of the else. I think it makes sense because in a guard statement the "else" is syntactic sugar. guard is really just a fancy if and in if statements the "{" lines up the same way.

@jjatie
Copy link
Collaborator Author

jjatie commented Jan 5, 2018

#3086 next would be good : )

@liuxuan30
Copy link
Member

all green finally

@liuxuan30 liuxuan30 merged commit 85573ee into ChartsOrg:4.0.0 Jan 6, 2018
@jjatie jjatie deleted the chartviewbase-redundant-ivar branch January 6, 2018 10:48
jjatie added a commit that referenced this pull request Oct 30, 2020
* 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 <jchristie@christie.teamspace.ad>
Co-authored-by: Xuan <liuxuan30@gmail.com>

* 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 <liuxuan30@gmail.com>

* 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 <j.christie@icloud.com>
Co-authored-by: ctran <chinh.tran@mail.de>
Co-authored-by: larryonoff <larryonoff@gmail.com>
Co-authored-by: Jacob Christie <jakechristie@dal.ca>
Co-authored-by: Katalin Nagy <nagy.katalin@codespring.ro>
Co-authored-by: Pierre-Marc Airoldi <pierremarcairoldi@gmail.com>
Co-authored-by: Marshall Weir <marshall.weir@gmail.com>
Co-authored-by: Jacob Christie <jacob.christie@kinduct.com>
Co-authored-by: Jacob Christie <19879272+jjatie@users.noreply.github.com>
Co-authored-by: Jacob Christie <jchristie@christie.teamspace.ad>
Co-authored-by: BJ Miller <2272819+SixFiveSoftware@users.noreply.github.com>
mosaic-engineering pushed a commit to mosaic-io/Charts that referenced this pull request Dec 3, 2020
* 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 <jchristie@christie.teamspace.ad>
Co-authored-by: Xuan <liuxuan30@gmail.com>

* 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 <liuxuan30@gmail.com>

* 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 <j.christie@icloud.com>
Co-authored-by: ctran <chinh.tran@mail.de>
Co-authored-by: larryonoff <larryonoff@gmail.com>
Co-authored-by: Jacob Christie <jakechristie@dal.ca>
Co-authored-by: Katalin Nagy <nagy.katalin@codespring.ro>
Co-authored-by: Pierre-Marc Airoldi <pierremarcairoldi@gmail.com>
Co-authored-by: Marshall Weir <marshall.weir@gmail.com>
Co-authored-by: Jacob Christie <jacob.christie@kinduct.com>
Co-authored-by: Jacob Christie <19879272+jjatie@users.noreply.github.com>
Co-authored-by: Jacob Christie <jchristie@christie.teamspace.ad>
Co-authored-by: BJ Miller <2272819+SixFiveSoftware@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants