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

Minor updates for Swift 5 #3874

Merged
merged 8 commits into from
Apr 11, 2019
Merged

Minor updates for Swift 5 #3874

merged 8 commits into from
Apr 11, 2019

Conversation

jjatie
Copy link
Collaborator

@jjatie jjatie commented Feb 28, 2019

Need FBSnapshotTestCase to be updated
Travis script needs to be updated

@liuxuan30
Copy link
Member

I sincerely hope we will have an ABI stable swift asap 😂

@jjatie
Copy link
Collaborator Author

jjatie commented Mar 5, 2019

Module stability isn't until 5.1

@alanzeino
Copy link

Need FBSnapshotTestCase to be updated
Travis script needs to be updated

Heads up I'm the maintainer of FBSnapshotTestCase (now iOSSnapshotTestCase) and I added support for full Carthage releases in uber/ios-snapshot-test-case#68 so you don't need to use git refs.

@liuxuan30
Copy link
Member

since swift 5 is released today, adding this PR to 3.3

@liuxuan30
Copy link
Member

@jjatie any idea when we can merge this?

@RAGOpoR
Copy link

RAGOpoR commented Apr 1, 2019

I still waiting please merge it :)

@jjatie
Copy link
Collaborator Author

jjatie commented Apr 7, 2019

@liuxuan30 Code is all updated now. Tests are failing because they can't load the images. I don't have time to look into this soon, can you please take a look?

@jjatie
Copy link
Collaborator Author

jjatie commented Apr 7, 2019

@alanzeino Thanks for the full Carthage support! We should be doing this soon too.

@liuxuan30 liuxuan30 marked this pull request as ready for review April 8, 2019 01:26
@liuxuan30
Copy link
Member

@jjatie

error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'ChartsDemo-iOS')

just like I guess, it's not using swift 5 compiler. I could take a look tomorrow, have to run errands today.

@jjatie
Copy link
Collaborator Author

jjatie commented Apr 8, 2019

@liuxuan30 If that's Travis, I just bumped the Xcode version. If that's your machine, make sure you've installed Xcode 10.2

@liuxuan30
Copy link
Member

liuxuan30 commented Apr 9, 2019

I have checked the failures, basically two issues:

  1. the image file name pattern has been changed, such as from testDefaultValues_iOS_375.0_667.0@2x.png to testDefaultValues_iOS_375_0_667_0@2x.png

note 375.0_667.0 to 375_0_667_0

  1. there is a ReferenceImages_32 folder added, while we only have ReferenceImages_64.

Since this seems caused by the test case framework update itself, I'm going to ask @alanzeino for a quick help: is it configurable so we don't have to change the name pattern? Can we disable 32bit images? I don't think we need a 32bit arch, iPhone 5 is long dead now. Basically I don't want to touch the images, it should work by itself.

I'm unable to find the information from release notes from https://github.com/uber/ios-snapshot-test-case/

@samjarman
Copy link

How far away is this @liuxuan30? :)

@alanzeino
Copy link

@liuxuan30 sorry Xuan but I can't provide help with that library anymore as I no longer work at Uber

@liuxuan30
Copy link
Member

@liuxuan30 sorry Xuan but I can't provide help with that library anymore as I no longer work at Uber

😂 fine, I can take a look later. but you don't know the answer of my questions at all? I assume should be easy for you

@liuxuan30
Copy link
Member

liuxuan30 commented Apr 11, 2019

How far away is this @liuxuan30? :)

I think code is ready, the CI fails due to unable to find the image path. I'm evaluating what's the lowest cost to fix. Bottom line is I can manually rename the files and add 32bit images, but I don't want to in the first place, as this is not our fault.

@liuxuan30
Copy link
Member

liuxuan30 commented Apr 11, 2019

I'm hooking into the testcase framework, and find out the file name logic is changed due to

    NSMutableCharacterSet *invalidCharacters = [NSMutableCharacterSet new];
    [invalidCharacters formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]];
    [invalidCharacters formUnionWithCharacterSet:[NSCharacterSet punctuationCharacterSet]];
    NSArray *validComponents = [fileName componentsSeparatedByCharactersInSet:invalidCharacters];
    fileName = [validComponents componentsJoinedByString:@"_"];
    
    if ((option & FBSnapshotTestCaseFileNameIncludeOptionScreenScale) == FBSnapshotTestCaseFileNameIncludeOptionScreenScale) {
        CGFloat screenScale = [[UIScreen mainScreen] scale];
        fileName = [fileName stringByAppendingFormat:@"@%.fx", screenScale];
    }

We have our own Snapshot.Identifier, whose pattern is return "\(identifier)_\(size.width)_\(size.height)"
so basically it replaces every symbol with _, even the . symbol. This is a breaking change I suppose. So looks like I have to rename the images anyway.

the 32bit images can be ignored, but we are calling a macro function that will use default suffixes:

extension FBSnapshotTestCase {

    public func FBSnapshotVerifyView(_ view: UIView, identifier: String = "", suffixes: NSOrderedSet = FBSnapshotTestCaseDefaultSuffixes(), perPixelTolerance: CGFloat = 0, overallTolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line)
NSOrderedSet *FBSnapshotTestCaseDefaultSuffixes(void)
{
    NSMutableOrderedSet *suffixesSet = [[NSMutableOrderedSet alloc] init];
    [suffixesSet addObject:@"_32"];
    [suffixesSet addObject:@"_64"];
    if (FBSnapshotTestCaseIs64Bit()) {
        return [suffixesSet reversedOrderedSet];
    }
    return [suffixesSet copy];
}

So seems if we use other functions or env variables, we can ignore 32bit. But it took more time to choose a proper way to do it.

@liuxuan30
Copy link
Member

liuxuan30 commented Apr 11, 2019

I'm seeing different images. Holding this PR. will manual check
I see new recorded image in testHidesValues_iOS_375_0_667_0 is missing the first entry's circle, while the old one have.
image
vs.
image
which made me nervous that will cause test failures.
Decided to do the heavy lifting to manually delete and rename all images. And it turned out the test still passed. weird...

@liuxuan30 liuxuan30 changed the title Minor updates for Swift 5 WIP: Minor updates for Swift 5 Apr 11, 2019
@liuxuan30
Copy link
Member

liuxuan30 commented Apr 11, 2019

changing tolerance to 0.001 from 0.01 indicate multiple test failures. Looks like we have trouble. Some recent changes break the boundary check.
for example, bar chart test testPositiveValuesWithCustomAxisMaximum:
note the value labels, the new image shows out of bound value labels
image

@liuxuan30
Copy link
Member

I will try to fix some obvious ones in this PR first.

Need FBSnapshotTestCase to be updated
bumped minimum deployment version to 8.4
…s the companion commit that only has code change regards fixing test failures.
make clipValuesToContentEnabled to true to fix BarTests:testPositiveValuesWithCustomAxisMaximum() failure
…tride(from: _xBounds.min, through: _xBounds.range + _xBounds.min, by: 1)`

this fix issues from 2a1ecb4

2. revert clipValuesToContentEnabled to false by default. but enable it for bar chart test - testPositiveValuesWithCustomAxisMaximum()

3. update tvOS test image for testPositiveValuesWithCustomAxisMaximum. After changing tolerance to 0.001, it fails while the same iOS test pass.
I looked into the image diff, it shows the intersect of bar top edge and axis line at value 50 has diff, but I suppose the image is the same. safe to merge.
@liuxuan30
Copy link
Member

liuxuan30 commented Apr 11, 2019

it turned out that the XBounds() that leads to test failures with tolerance 0.001. After using my way to fix, I found that there is a conflict in master, and it already fixed in master. So I merged master into this branch and rebased on master and force push again. Not interfering the commit log and makes it clear.

seems safe to merge now.

Note: have to update tvOS test image for testPositiveValuesWithCustomAxisMaximum. After changing tolerance to 0.001, it fails while the same iOS test pass.
I looked into the image diff, it shows the intersect of bar top edge and y axis line at y value 50 has diff, but I suppose the image is the same. safe to merge.

So the new unit tests should be solid now with better chance to detect pixel differences in order to avoid failing to find image diffs.

@liuxuan30
Copy link
Member

@jjatie please review my commits. and welcome others to give feedback.

@liuxuan30 liuxuan30 changed the title WIP: Minor updates for Swift 5 Minor updates for Swift 5 Apr 11, 2019
@codecov-io
Copy link

Codecov Report

Merging #3874 into master will decrease coverage by 0.87%.
The diff coverage is 80.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3874      +/-   ##
==========================================
- Coverage   32.82%   31.95%   -0.88%     
==========================================
  Files         114      118       +4     
  Lines       10637    13889    +3252     
==========================================
+ Hits         3492     4438     +946     
- Misses       7145     9451    +2306
Impacted Files Coverage Δ
Source/Charts/Charts/ChartViewBase.swift 22.95% <0%> (-0.22%) ⬇️
...a/Implementations/Standard/CombinedChartData.swift 64.63% <0%> (+3.28%) ⬆️
Source/Charts/Utils/Platform+Accessibility.swift 37.93% <0%> (+6.35%) ⬆️
...ource/Charts/Renderers/CombinedChartRenderer.swift 57.75% <0%> (-4.86%) ⬇️
Tests/Charts/BarChartTests.swift 100% <100%> (ø) ⬆️
Tests/Charts/LineChartTests.swift 100% <100%> (ø) ⬆️
Tests/Charts/PieChartTests.swift 100% <100%> (ø) ⬆️
Tests/Charts/CombinedChartTests.swift 100% <100%> (ø) ⬆️
Tests/Charts/Snapshot.swift 100% <100%> (ø)
Source/Charts/Renderers/LineRadarRenderer.swift 7.69% <0%> (-92.31%) ⬇️
... and 62 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 5d0b99a...30d997a. Read the comment docs.

@ChartsOrg ChartsOrg deleted a comment from codecov-io Apr 11, 2019
@jjatie jjatie merged commit b155c2f into master Apr 11, 2019
3.3 automation moved this from In progress to Done Apr 11, 2019
@jjatie jjatie deleted the swift-5 branch April 11, 2019 09:42
leandropjp added a commit to leandropjp/Charts that referenced this pull request Jun 5, 2019
* Added delegate callback to detect when panning is finished, to potentially allow users to manually reset the hightlight values once panning is complete

* Changed the part of the code where the delegate gets called

* Make NSUIAccessibilityElement initializer public.

* Add Parameters Section

```
(\n[ ]+)(((/// - parameter \w+:.*\s+)(///((\s+)|( \s+.+\s+)))?)*/// - parameter \w+:.*)
```

```
$1/// - Parameters:$1$2
```

* Remove parameter prefix

```
/// - parameter (\w+):(.*)(\s+///(\n))*(\s+)
```

```
///   - $1:$2$4$5
```

* Remove property’s `returns` section

```
/// - returns: (.+\s+((override|@IBOutlet|@objc|weak|unowned|lazy|static|class|open|public|private|fileprivate|internal)(\(set\))? )*(var|let))
```

```
/// $1
```

* Add missing `-`

```
/// (note|return|parameters|throws):
```

```
/// - $1:
```

* Sort sections

```
((///)[ ]+[^-\n]+(\s+))?(((((/// - Parameters:\s+(/// (( - \w+:)|([^-]{1})).*\s+)+)\s+)|(/// - Returns:.*\s+(/// [^-]{1}.*\s+)*)|(/// - Note:.*\s+(/// [^-]{1}.*\s+)*)|(/// - Throws:.*\s+(/// [^-]{1}.*\s+)*))(///\n\s+)?)+)
```

```
$1$2$3$15$7$17$13
```

* Uppercased the section title

* fix function groupBars document error

* Remove duplicated section

* Update ChartViewBase.swift

Updated documentation in the code based on feedback

* Add missing empty line between Summary and other section manually

* fix wrong assignment to axisMaxLabels property

* Remove meaningless comment

* improvements in barRect height calculation  (ChartsOrg#3650)

* fixed barRectCaculation

* fixed offset calculation

* Fix the  mess caused by the setting the min&min value of the y-axis by error :
Just simply swap their values

* Fix the mess caused by the setting the min&min value of the y-axis by error

* Revert "Fix the mess caused by the setting the min&min value of the y-axis by error"

This reverts commit 526a73a.

* Fix the mess caused by the setting the min&min value of the y-axis by error

* update offset calculation

* update code style

* update code style

* update offset calculation

* keep barRect calculation untouched

try to simply the calculation. keep barRect calculation untouched

* After the correction of min and max ,  they should be assigned back to  _axisMinimum and _axisMaximum

* add demo for bar chart unit test

* update unit test

* revert last commit

* update unit test

* make sure max is greater than min &
turnoff record mode for barchartest

* add new UT and fix some issues.

1. add more bar chart UT
2. code style fix
3. manually add chart.notifyDataSetChanged() - some old UT and new ones forget to call this method, leading the test images to be wrong.

Notice:
some test images diff shows slight pixel shift, not sure why, but both old and new image seems drawing correctly

* update tvOS images

* update tolerance to 1% & more swift-y

* update tvOS images, removing "Description Label", (not rendered anymore)

changing tolerance will trigger "Description Label" detection

* update iOS test images, "Description Label" no longer rendered.

* fixed offset calculation in some cases.
moved those codes into the for loop. because the offset of each bar may be different.
(detail in comments)

* Update Source/Charts/Renderers/BarChartRenderer.swift

Co-Authored-By: potato04 <shiww@outlook.com>

* Add missing properties to copy(with:) methods (ChartsOrg#3715)

* ChartsOrg#3578 Add missing properties to copy(with:) methods

* Add NSCopying conformance

* Fix legend offset bug for horizontal bar chart (Fixes ChartsOrg#3301)

* Fix applying lineCap value for line chart data sets (Fixes ChartsOrg#3739)

DataSets for line chart have lineCap property which is supposed to be applied to the chart line. But it was applied only if dataSet is drawn in linear/stepped mode. This commit makes lineCap work for any existing mode.

* Update README.md (ChartsOrg#3737)

Replace a confusing sentence with a clear one. Fix grammatical errors.

* fix ChartsOrg#3719

* add call chartScaled() after double tap (ChartsOrg#3770)

* Remove delegate method call for translation when no translation really occured

* Removed use of `values` where appropriate

* Fixed `addEntry` implementation

* Deprecated direct usage of values

* BarLineScatterCandleBubbleRenderer.XBounds conformance to RangeExpression and Sequence

Sequence conformance simplifies for-in loops
Looking forward to when data types conforming to Collection, RangeExpression conformance by XBounds allows for slicing of the collections further simplifying algorithms on data/datasets.

* Draws the line chart the same way regardless of the number of colors for the data set (ChartsOrg#3764)

* Multiple colors for valueline (Fixes ChartsOrg#3480) (ChartsOrg#3709)

* Multiple colors for valueline (Fixes ChartsOrg#3480)

This change adds a flag matchValueLineColorToPieSlice to PieChartDataSet and IPieChartDataSet protocol.
When enabled, valuelines will have the same color as slices they attached to.
matchValueLineColorToPieSlice is set to false by default, so colors won't be changed in old projects that use Charts.

* Changed variable name from matchValueLineColorToPieSlice to valueLineAutoColor

* Changed variable name from valueLineAutoColor to useValueColorForLine

* Changed variable name from valueLineAutoColor to useValueColorForLine

* fix code style

fix code style

* Changed check for useValueColorForLine with suggested

* fix code style

* Added name DrawLine: to do{} section

* bump version to 3.2.2

* update change log

* Renamed `values` to `entries` to reflect the property's type

Removed arbitrary setter access to `entries` to encourage use of `Collection` mechanics
Added `replaceEntries`

* Fixed tests

* Create "chartViewDidEndAnimate" callback function in "ChartViewBase" that is called when Animator stops animating

* Update protocol function description

* Improve HorizontalBarChart offset calculation for negative value labels (Fixes ChartsOrg#3850)

* Replace AnyObject with Any

This is in line with how Objc interfaces are now imported

* Fixed target on NSUIDisplayLink

* Removed unnecessary #if statements and unified style to align with Xcode's indentation

* Velocity samples calculation (ChartsOrg#3883)

* Updated `PieRadarChartViewBase.sampleVelocity(touchLocation:)` algorithm.

* Updated `PieRadarChartViewBase.calculateVelocity` algorithm

* Updated naming for `_velocitySamples`

* A fix for ChartsOrg#3848. Use a stock iterator instead of a custom one. (ChartsOrg#3891)

* Migrating to built-in algorithms (ChartsOrg#3892)

* Align `ChartLimit.LabelPosition` naming with `UIRectCorner` (ChartsOrg#3846)

* Align `ChartLimit.LabelPosition` naming with `UIRectCorner`

* Fixed Demos

* fix indent after replacing if with guard

* reverted mistaken changes

* Removed unused #if statements

* add animator reference to animatorDidStop ChartViewBase delegate callback.

* Minor updates for Swift 5 (ChartsOrg#3874)

* Minor updates for Swift 5

Need FBSnapshotTestCase to be updated

* Updated testing Framework for Swift 5

bumped minimum deployment version to 8.4

* Bumped Travis Xcode version

* Fix test failures. add a new extension to only use 64bit arch. This is the companion commit that only has code change regards fixing test failures.

* delete unused test images with specific screen size. this is a companion commit to only have deleted files

* rename the in-use test images. this is a companion commit to only have renamed files.

* change image diff to 0.001 tolerance
make clipValuesToContentEnabled to true to fix BarTests:testPositiveValuesWithCustomAxisMaximum() failure

* 1. merge master to fix xBounds iterator() to match the behavior of `stride(from: _xBounds.min, through: _xBounds.range + _xBounds.min, by: 1)`
this fix issues from ChartsOrg@2a1ecb4

2. revert clipValuesToContentEnabled to false by default. but enable it for bar chart test - testPositiveValuesWithCustomAxisMaximum()

3. update tvOS test image for testPositiveValuesWithCustomAxisMaximum. After changing tolerance to 0.001, it fails while the same iOS test pass.
I looked into the image diff, it shows the intersect of bar top edge and axis line at value 50 has diff, but I suppose the image is the same. safe to merge.

* fix ChartsOrg#3860. maxHeight didn't count the last label

* Reassess convenience initializers (ChartsOrg#3862)

* Reassess convenience initializers

The only data required to initialize an entry is an x and y value (or y in the case of Pie and Radar). All other data can easily be updated by initializing and assigning properties on the entry. Therefor, those initializers should be the ones marked as convenience.
Made initializer declarations consistent.

* Modernize BarChartDataEntry internal calculations

* Style updated for PR

* Fix horizontal bar chart not drawing values and add unit tests (ChartsOrg#3906)

* fix horizontal bar chart drawValues not correctly drawing and add testNotDrawValueAboveBars UT

* add unit tests for horizontal bar chart, including default tests and drawValues and drawValuesAboveBars
default data entries included positive and negative values

* add tvOS test images

* add stacked bar tests for bar chart unit tests

* fix typo

* change to guard statement for shouldDrawValues

* update test images to match master branch

* Data as any (ChartsOrg#3863)

* `ChartEntry.data` is now of type `Any`

There is no need to restrict `ChartEntry.data` to `AnyObject`. This PR loosens that restriction. As a result we cannot compare `data`, though this should never have been the case in the first place.

* Updated `ChartDataEntry` initializers to accept `Any` for `data`

* Updated test

* bump version to 3.3

* update change log

* update gemfile

* correct 3.3 to 3.3.0.

* For ChartsOrg#3917. make init(label: String?) convenient initializer (ChartsOrg#3973)

* fix ChartsOrg#3917. make `init(label: String?)` to be a convenient init to enable auto inheritance.

* add UT for default dataSet label
leandropjp added a commit to leandropjp/Charts that referenced this pull request Aug 9, 2019
* Avoid passing NaN to CoreGraphics API (Fixes ChartsOrg#1626)

* Added delegate callback to detect when panning is finished, to potentially allow users to manually reset the hightlight values once panning is complete

* Changed the part of the code where the delegate gets called

* Make NSUIAccessibilityElement initializer public.

* Add Parameters Section

```
(\n[ ]+)(((/// - parameter \w+:.*\s+)(///((\s+)|( \s+.+\s+)))?)*/// - parameter \w+:.*)
```

```
$1/// - Parameters:$1$2
```

* Remove parameter prefix

```
/// - parameter (\w+):(.*)(\s+///(\n))*(\s+)
```

```
///   - $1:$2$4$5
```

* Remove property’s `returns` section

```
/// - returns: (.+\s+((override|@IBOutlet|@objc|weak|unowned|lazy|static|class|open|public|private|fileprivate|internal)(\(set\))? )*(var|let))
```

```
/// $1
```

* Add missing `-`

```
/// (note|return|parameters|throws):
```

```
/// - $1:
```

* Sort sections

```
((///)[ ]+[^-\n]+(\s+))?(((((/// - Parameters:\s+(/// (( - \w+:)|([^-]{1})).*\s+)+)\s+)|(/// - Returns:.*\s+(/// [^-]{1}.*\s+)*)|(/// - Note:.*\s+(/// [^-]{1}.*\s+)*)|(/// - Throws:.*\s+(/// [^-]{1}.*\s+)*))(///\n\s+)?)+)
```

```
$1$2$3$15$7$17$13
```

* Uppercased the section title

* fix function groupBars document error

* Remove duplicated section

* Update ChartViewBase.swift

Updated documentation in the code based on feedback

* Add missing empty line between Summary and other section manually

* fix wrong assignment to axisMaxLabels property

* Remove meaningless comment

* improvements in barRect height calculation  (ChartsOrg#3650)

* fixed barRectCaculation

* fixed offset calculation

* Fix the  mess caused by the setting the min&min value of the y-axis by error :
Just simply swap their values

* Fix the mess caused by the setting the min&min value of the y-axis by error

* Revert "Fix the mess caused by the setting the min&min value of the y-axis by error"

This reverts commit 526a73a.

* Fix the mess caused by the setting the min&min value of the y-axis by error

* update offset calculation

* update code style

* update code style

* update offset calculation

* keep barRect calculation untouched

try to simply the calculation. keep barRect calculation untouched

* After the correction of min and max ,  they should be assigned back to  _axisMinimum and _axisMaximum

* add demo for bar chart unit test

* update unit test

* revert last commit

* update unit test

* make sure max is greater than min &
turnoff record mode for barchartest

* add new UT and fix some issues.

1. add more bar chart UT
2. code style fix
3. manually add chart.notifyDataSetChanged() - some old UT and new ones forget to call this method, leading the test images to be wrong.

Notice:
some test images diff shows slight pixel shift, not sure why, but both old and new image seems drawing correctly

* update tvOS images

* update tolerance to 1% & more swift-y

* update tvOS images, removing "Description Label", (not rendered anymore)

changing tolerance will trigger "Description Label" detection

* update iOS test images, "Description Label" no longer rendered.

* fixed offset calculation in some cases.
moved those codes into the for loop. because the offset of each bar may be different.
(detail in comments)

* Update Source/Charts/Renderers/BarChartRenderer.swift

Co-Authored-By: potato04 <shiww@outlook.com>

* Add missing properties to copy(with:) methods (ChartsOrg#3715)

* ChartsOrg#3578 Add missing properties to copy(with:) methods

* Add NSCopying conformance

* Fix legend offset bug for horizontal bar chart (Fixes ChartsOrg#3301)

* Fix applying lineCap value for line chart data sets (Fixes ChartsOrg#3739)

DataSets for line chart have lineCap property which is supposed to be applied to the chart line. But it was applied only if dataSet is drawn in linear/stepped mode. This commit makes lineCap work for any existing mode.

* Update README.md (ChartsOrg#3737)

Replace a confusing sentence with a clear one. Fix grammatical errors.

* fix ChartsOrg#3719

* add call chartScaled() after double tap (ChartsOrg#3770)

* Remove delegate method call for translation when no translation really occured

* Removed use of `values` where appropriate

* Fixed `addEntry` implementation

* Deprecated direct usage of values

* BarLineScatterCandleBubbleRenderer.XBounds conformance to RangeExpression and Sequence

Sequence conformance simplifies for-in loops
Looking forward to when data types conforming to Collection, RangeExpression conformance by XBounds allows for slicing of the collections further simplifying algorithms on data/datasets.

* Draws the line chart the same way regardless of the number of colors for the data set (ChartsOrg#3764)

* Multiple colors for valueline (Fixes ChartsOrg#3480) (ChartsOrg#3709)

* Multiple colors for valueline (Fixes ChartsOrg#3480)

This change adds a flag matchValueLineColorToPieSlice to PieChartDataSet and IPieChartDataSet protocol.
When enabled, valuelines will have the same color as slices they attached to.
matchValueLineColorToPieSlice is set to false by default, so colors won't be changed in old projects that use Charts.

* Changed variable name from matchValueLineColorToPieSlice to valueLineAutoColor

* Changed variable name from valueLineAutoColor to useValueColorForLine

* Changed variable name from valueLineAutoColor to useValueColorForLine

* fix code style

fix code style

* Changed check for useValueColorForLine with suggested

* fix code style

* Added name DrawLine: to do{} section

* bump version to 3.2.2

* update change log

* Renamed `values` to `entries` to reflect the property's type

Removed arbitrary setter access to `entries` to encourage use of `Collection` mechanics
Added `replaceEntries`

* Fixed tests

* Create "chartViewDidEndAnimate" callback function in "ChartViewBase" that is called when Animator stops animating

* Update protocol function description

* Improve HorizontalBarChart offset calculation for negative value labels (Fixes ChartsOrg#3850)

* Replace AnyObject with Any

This is in line with how Objc interfaces are now imported

* Fixed target on NSUIDisplayLink

* Removed unnecessary #if statements and unified style to align with Xcode's indentation

* Velocity samples calculation (ChartsOrg#3883)

* Updated `PieRadarChartViewBase.sampleVelocity(touchLocation:)` algorithm.

* Updated `PieRadarChartViewBase.calculateVelocity` algorithm

* Updated naming for `_velocitySamples`

* A fix for ChartsOrg#3848. Use a stock iterator instead of a custom one. (ChartsOrg#3891)

* Migrating to built-in algorithms (ChartsOrg#3892)

* Align `ChartLimit.LabelPosition` naming with `UIRectCorner` (ChartsOrg#3846)

* Align `ChartLimit.LabelPosition` naming with `UIRectCorner`

* Fixed Demos

* fix indent after replacing if with guard

* reverted mistaken changes

* Removed unused #if statements

* add animator reference to animatorDidStop ChartViewBase delegate callback.

* Minor updates for Swift 5 (ChartsOrg#3874)

* Minor updates for Swift 5

Need FBSnapshotTestCase to be updated

* Updated testing Framework for Swift 5

bumped minimum deployment version to 8.4

* Bumped Travis Xcode version

* Fix test failures. add a new extension to only use 64bit arch. This is the companion commit that only has code change regards fixing test failures.

* delete unused test images with specific screen size. this is a companion commit to only have deleted files

* rename the in-use test images. this is a companion commit to only have renamed files.

* change image diff to 0.001 tolerance
make clipValuesToContentEnabled to true to fix BarTests:testPositiveValuesWithCustomAxisMaximum() failure

* 1. merge master to fix xBounds iterator() to match the behavior of `stride(from: _xBounds.min, through: _xBounds.range + _xBounds.min, by: 1)`
this fix issues from ChartsOrg@2a1ecb4

2. revert clipValuesToContentEnabled to false by default. but enable it for bar chart test - testPositiveValuesWithCustomAxisMaximum()

3. update tvOS test image for testPositiveValuesWithCustomAxisMaximum. After changing tolerance to 0.001, it fails while the same iOS test pass.
I looked into the image diff, it shows the intersect of bar top edge and axis line at value 50 has diff, but I suppose the image is the same. safe to merge.

* fix ChartsOrg#3860. maxHeight didn't count the last label

* Reassess convenience initializers (ChartsOrg#3862)

* Reassess convenience initializers

The only data required to initialize an entry is an x and y value (or y in the case of Pie and Radar). All other data can easily be updated by initializing and assigning properties on the entry. Therefor, those initializers should be the ones marked as convenience.
Made initializer declarations consistent.

* Modernize BarChartDataEntry internal calculations

* Style updated for PR

* Fix horizontal bar chart not drawing values and add unit tests (ChartsOrg#3906)

* fix horizontal bar chart drawValues not correctly drawing and add testNotDrawValueAboveBars UT

* add unit tests for horizontal bar chart, including default tests and drawValues and drawValuesAboveBars
default data entries included positive and negative values

* add tvOS test images

* add stacked bar tests for bar chart unit tests

* fix typo

* change to guard statement for shouldDrawValues

* update test images to match master branch

* Data as any (ChartsOrg#3863)

* `ChartEntry.data` is now of type `Any`

There is no need to restrict `ChartEntry.data` to `AnyObject`. This PR loosens that restriction. As a result we cannot compare `data`, though this should never have been the case in the first place.

* Updated `ChartDataEntry` initializers to accept `Any` for `data`

* Updated test

* bump version to 3.3

* update change log

* update gemfile

* correct 3.3 to 3.3.0.

* For ChartsOrg#3917. make init(label: String?) convenient initializer (ChartsOrg#3973)

* fix ChartsOrg#3917. make `init(label: String?)` to be a convenient init to enable auto inheritance.

* add UT for default dataSet label

* Added a safety check before an unsafe array operation

* Update Info.plist

* Update License

Changed year in license file

* fixed stacked chart bug when there are different stacks on columns. (ChartsOrg#4029)

fix ChartsOrg#3659
* fixed stacked chart bug when there are different stacks on columns.
* added empty array check
leandropjp added a commit to leandropjp/Charts that referenced this pull request Nov 1, 2019
* Avoid passing NaN to CoreGraphics API (Fixes ChartsOrg#1626)

* Added delegate callback to detect when panning is finished, to potentially allow users to manually reset the hightlight values once panning is complete

* Changed the part of the code where the delegate gets called

* Make NSUIAccessibilityElement initializer public.

* Add Parameters Section

```
(\n[ ]+)(((/// - parameter \w+:.*\s+)(///((\s+)|( \s+.+\s+)))?)*/// - parameter \w+:.*)
```

```
$1/// - Parameters:$1$2
```

* Remove parameter prefix

```
/// - parameter (\w+):(.*)(\s+///(\n))*(\s+)
```

```
///   - $1:$2$4$5
```

* Remove property’s `returns` section

```
/// - returns: (.+\s+((override|@IBOutlet|@objc|weak|unowned|lazy|static|class|open|public|private|fileprivate|internal)(\(set\))? )*(var|let))
```

```
/// $1
```

* Add missing `-`

```
/// (note|return|parameters|throws):
```

```
/// - $1:
```

* Sort sections

```
((///)[ ]+[^-\n]+(\s+))?(((((/// - Parameters:\s+(/// (( - \w+:)|([^-]{1})).*\s+)+)\s+)|(/// - Returns:.*\s+(/// [^-]{1}.*\s+)*)|(/// - Note:.*\s+(/// [^-]{1}.*\s+)*)|(/// - Throws:.*\s+(/// [^-]{1}.*\s+)*))(///\n\s+)?)+)
```

```
$1$2$3$15$7$17$13
```

* Uppercased the section title

* fix function groupBars document error

* Remove duplicated section

* Update ChartViewBase.swift

Updated documentation in the code based on feedback

* Add missing empty line between Summary and other section manually

* fix wrong assignment to axisMaxLabels property

* Remove meaningless comment

* improvements in barRect height calculation  (ChartsOrg#3650)

* fixed barRectCaculation

* fixed offset calculation

* Fix the  mess caused by the setting the min&min value of the y-axis by error :
Just simply swap their values

* Fix the mess caused by the setting the min&min value of the y-axis by error

* Revert "Fix the mess caused by the setting the min&min value of the y-axis by error"

This reverts commit 526a73a.

* Fix the mess caused by the setting the min&min value of the y-axis by error

* update offset calculation

* update code style

* update code style

* update offset calculation

* keep barRect calculation untouched

try to simply the calculation. keep barRect calculation untouched

* After the correction of min and max ,  they should be assigned back to  _axisMinimum and _axisMaximum

* add demo for bar chart unit test

* update unit test

* revert last commit

* update unit test

* make sure max is greater than min &
turnoff record mode for barchartest

* add new UT and fix some issues.

1. add more bar chart UT
2. code style fix
3. manually add chart.notifyDataSetChanged() - some old UT and new ones forget to call this method, leading the test images to be wrong.

Notice:
some test images diff shows slight pixel shift, not sure why, but both old and new image seems drawing correctly

* update tvOS images

* update tolerance to 1% & more swift-y

* update tvOS images, removing "Description Label", (not rendered anymore)

changing tolerance will trigger "Description Label" detection

* update iOS test images, "Description Label" no longer rendered.

* fixed offset calculation in some cases.
moved those codes into the for loop. because the offset of each bar may be different.
(detail in comments)

* Update Source/Charts/Renderers/BarChartRenderer.swift

Co-Authored-By: potato04 <shiww@outlook.com>

* Add missing properties to copy(with:) methods (ChartsOrg#3715)

* ChartsOrg#3578 Add missing properties to copy(with:) methods

* Add NSCopying conformance

* Fix legend offset bug for horizontal bar chart (Fixes ChartsOrg#3301)

* Fix applying lineCap value for line chart data sets (Fixes ChartsOrg#3739)

DataSets for line chart have lineCap property which is supposed to be applied to the chart line. But it was applied only if dataSet is drawn in linear/stepped mode. This commit makes lineCap work for any existing mode.

* Update README.md (ChartsOrg#3737)

Replace a confusing sentence with a clear one. Fix grammatical errors.

* fix ChartsOrg#3719

* add call chartScaled() after double tap (ChartsOrg#3770)

* Remove delegate method call for translation when no translation really occured

* Removed use of `values` where appropriate

* Fixed `addEntry` implementation

* Deprecated direct usage of values

* BarLineScatterCandleBubbleRenderer.XBounds conformance to RangeExpression and Sequence

Sequence conformance simplifies for-in loops
Looking forward to when data types conforming to Collection, RangeExpression conformance by XBounds allows for slicing of the collections further simplifying algorithms on data/datasets.

* Draws the line chart the same way regardless of the number of colors for the data set (ChartsOrg#3764)

* Multiple colors for valueline (Fixes ChartsOrg#3480) (ChartsOrg#3709)

* Multiple colors for valueline (Fixes ChartsOrg#3480)

This change adds a flag matchValueLineColorToPieSlice to PieChartDataSet and IPieChartDataSet protocol.
When enabled, valuelines will have the same color as slices they attached to.
matchValueLineColorToPieSlice is set to false by default, so colors won't be changed in old projects that use Charts.

* Changed variable name from matchValueLineColorToPieSlice to valueLineAutoColor

* Changed variable name from valueLineAutoColor to useValueColorForLine

* Changed variable name from valueLineAutoColor to useValueColorForLine

* fix code style

fix code style

* Changed check for useValueColorForLine with suggested

* fix code style

* Added name DrawLine: to do{} section

* bump version to 3.2.2

* update change log

* Renamed `values` to `entries` to reflect the property's type

Removed arbitrary setter access to `entries` to encourage use of `Collection` mechanics
Added `replaceEntries`

* Fixed tests

* Create "chartViewDidEndAnimate" callback function in "ChartViewBase" that is called when Animator stops animating

* Update protocol function description

* Improve HorizontalBarChart offset calculation for negative value labels (Fixes ChartsOrg#3850)

* Replace AnyObject with Any

This is in line with how Objc interfaces are now imported

* Fixed target on NSUIDisplayLink

* Removed unnecessary #if statements and unified style to align with Xcode's indentation

* Velocity samples calculation (ChartsOrg#3883)

* Updated `PieRadarChartViewBase.sampleVelocity(touchLocation:)` algorithm.

* Updated `PieRadarChartViewBase.calculateVelocity` algorithm

* Updated naming for `_velocitySamples`

* A fix for ChartsOrg#3848. Use a stock iterator instead of a custom one. (ChartsOrg#3891)

* Migrating to built-in algorithms (ChartsOrg#3892)

* Align `ChartLimit.LabelPosition` naming with `UIRectCorner` (ChartsOrg#3846)

* Align `ChartLimit.LabelPosition` naming with `UIRectCorner`

* Fixed Demos

* fix indent after replacing if with guard

* reverted mistaken changes

* Removed unused #if statements

* add animator reference to animatorDidStop ChartViewBase delegate callback.

* Minor updates for Swift 5 (ChartsOrg#3874)

* Minor updates for Swift 5

Need FBSnapshotTestCase to be updated

* Updated testing Framework for Swift 5

bumped minimum deployment version to 8.4

* Bumped Travis Xcode version

* Fix test failures. add a new extension to only use 64bit arch. This is the companion commit that only has code change regards fixing test failures.

* delete unused test images with specific screen size. this is a companion commit to only have deleted files

* rename the in-use test images. this is a companion commit to only have renamed files.

* change image diff to 0.001 tolerance
make clipValuesToContentEnabled to true to fix BarTests:testPositiveValuesWithCustomAxisMaximum() failure

* 1. merge master to fix xBounds iterator() to match the behavior of `stride(from: _xBounds.min, through: _xBounds.range + _xBounds.min, by: 1)`
this fix issues from ChartsOrg@2a1ecb4

2. revert clipValuesToContentEnabled to false by default. but enable it for bar chart test - testPositiveValuesWithCustomAxisMaximum()

3. update tvOS test image for testPositiveValuesWithCustomAxisMaximum. After changing tolerance to 0.001, it fails while the same iOS test pass.
I looked into the image diff, it shows the intersect of bar top edge and axis line at value 50 has diff, but I suppose the image is the same. safe to merge.

* fix ChartsOrg#3860. maxHeight didn't count the last label

* Reassess convenience initializers (ChartsOrg#3862)

* Reassess convenience initializers

The only data required to initialize an entry is an x and y value (or y in the case of Pie and Radar). All other data can easily be updated by initializing and assigning properties on the entry. Therefor, those initializers should be the ones marked as convenience.
Made initializer declarations consistent.

* Modernize BarChartDataEntry internal calculations

* Style updated for PR

* Fix horizontal bar chart not drawing values and add unit tests (ChartsOrg#3906)

* fix horizontal bar chart drawValues not correctly drawing and add testNotDrawValueAboveBars UT

* add unit tests for horizontal bar chart, including default tests and drawValues and drawValuesAboveBars
default data entries included positive and negative values

* add tvOS test images

* add stacked bar tests for bar chart unit tests

* fix typo

* change to guard statement for shouldDrawValues

* update test images to match master branch

* Data as any (ChartsOrg#3863)

* `ChartEntry.data` is now of type `Any`

There is no need to restrict `ChartEntry.data` to `AnyObject`. This PR loosens that restriction. As a result we cannot compare `data`, though this should never have been the case in the first place.

* Updated `ChartDataEntry` initializers to accept `Any` for `data`

* Updated test

* bump version to 3.3

* update change log

* update gemfile

* correct 3.3 to 3.3.0.

* For ChartsOrg#3917. make init(label: String?) convenient initializer (ChartsOrg#3973)

* fix ChartsOrg#3917. make `init(label: String?)` to be a convenient init to enable auto inheritance.

* add UT for default dataSet label

* fix ChartsOrg#3975.
if we disable highlight for pie chart data set, we still need to render without a shift.

* Added a safety check before an unsafe array operation

* Update Info.plist

* Update License

Changed year in license file

* fixed stacked chart bug when there are different stacks on columns. (ChartsOrg#4029)

fix ChartsOrg#3659
* fixed stacked chart bug when there are different stacks on columns.
* added empty array check

* fix ChartsOrg#4093, also close ChartsOrg#3960
1. change XBounds iterator to use self.min + self.range rather than self.x
2. align drawLinear,  drawCubicBezier to new XBounds iterator.
3. fix unexpected dash line during linear animation due to reading the next entry point

* Fix Swift Package Manager compile issue

Signed-off-by: Ryne Cheow <rynecheow@gmail.com>

* Unspecify library type

Signed-off-by: Ryne Cheow <rynecheow@gmail.com>

* Fix gitignore to ignore .swiftpm as a directory

Signed-off-by: Ryne Cheow <rynecheow@gmail.com>

* Apply Xcode11 changes
automatic remove warnings detected by Xcode11

* bump to iPhone 8 as iPhone 7 has been dropped out

* bump to test framework to 6.1

* chart types that are not affected by formatter change

* tests affected by formatter change of `minimumIntegerDigits` from 0 to 1

* regenerate bar chart tests

* rebuild tvOS test images

* Fixes ChartsOrg#4099: Line renderer did not render lines if their coordinates fell outside of the viewport. (ChartsOrg#4100)

* Fixed ChartsOrg#4099: Line renderer did not render lines if they coordinates fell outside of the viewport, even though they might intersect the viewport.

* Updated inline documentation.

* Implemented code review feedback and removed unnecessary checks for performance reasons.

* Simplified and clarified the linear function to check for collisions with the left, top and bottom edges of the view port, and commented out the unecessary logic that checks for collision with the right edge of the view port.

* Updated in-line documentation.

* Update ViewPortHandler.swift

add a check for vertical line and a few comments change

* bump to 3.4.0

* fix change log format

* fix pod build and update gems

* introduce gracefully degrading abstractions for dark mode for ios and… (ChartsOrg#4171)

* introduce gracefully degrading abstractions for dark mode for ios and macos and use them to draw text

* it's .labelColor not .label on NSColor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
3.3
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants