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

Fixed incorrect guard return statement when rendering limit lines #4560

Closed
wants to merge 85 commits into from

Conversation

raytso
Copy link

@raytso raytso commented Jan 22, 2021

Issue Link 🔗

Currently on 4.0.0 the rendering of limit lines has a bug to only render the first one in the limitLines array. This is caused by an incorrect early return in the guard statement instead of continuing through the loop

Goals ⚽

Fixes limit line rendering so it can render multiple lines correctly

Implementation Details 🚧

No architectural changes

Testing Details 🔍

No tests added

jjatie and others added 30 commits December 24, 2017 14:51
Updating 4.0.0 with latest changes in master
* 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 is now a protocol

Renamed Renderers, and organized the Renderer folder.

* DataRenderer is now a protocol

* AxisRenderer is now a protocol
* 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
* 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.
* 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
…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
* 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
* 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

`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
…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
* 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

It is now simply `DefaultValueFomatter()`
Removed unnecessary backing ivars in `DefaultValuetFormatter` in favour of property observers
Deprecated static func constructor in favour of initializer
added a workspace to include all demos with the project to make it easier to test changes
# Conflicts:
#	Charts.xcodeproj/project.pbxproj
#	ChartsDemo/ChartsDemo-iOS.xcodeproj/project.pbxproj
#	ChartsDemo/Objective-C/Demos/LineChartFilledViewController.m
#	ChartsDemo/Objective-C/Demos/RadarChartViewController.m
#	Source/Charts/Charts/BarLineChartViewBase.swift
#	Source/Charts/Charts/ChartViewBase.swift
#	Source/Charts/Charts/HorizontalBarChartView.swift
#	Source/Charts/Components/Legend.swift
#	Source/Charts/Renderers/LegendRenderer.swift
#	Source/Charts/Renderers/YAxisRendererRadarChart.swift
#	Source/Charts/Utils/ChartUtils.swift
#	Source/Charts/Utils/ViewPortHandler.swift
* 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
* 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
jjatie and others added 22 commits December 25, 2018 01:15
Refactored use of `ChartData` to use new `Collection` conformances
to take advantage of collection conformance.
Replaced custom algorithms with built-in ones
Made axis renderer implementations feel "Swift-ier"
Also added remove subrange.
Removed redundancy from min/max logic.
Lots of naming changes.
Cleaner implementations.
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>
@raytso
Copy link
Author

raytso commented Jan 26, 2021

@liuxuan30 I don't know who to tag but is anyone reviewing this?

@jjatie jjatie changed the base branch from 4.0.0 to master January 26, 2021 12:07
@jjatie jjatie changed the base branch from master to 4.0.0 January 26, 2021 12:07
@jjatie jjatie changed the base branch from 4.0.0 to master January 26, 2021 12:15
@jjatie jjatie closed this Jan 26, 2021
@jjatie jjatie deleted the branch ChartsOrg:master January 26, 2021 12:15
@jjatie
Copy link
Collaborator

jjatie commented Jan 26, 2021

Incorrectly targeting 4.0.0. Branch is removed to remove confusion

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.

7 participants