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

improvements in barRect height calculation #3650

Merged
merged 24 commits into from
Nov 1, 2018

Conversation

potato04
Copy link
Contributor

@potato04 potato04 commented Sep 19, 2018

issue

My last PR #3587 fixed bar height calculation when all y values equals 0.
Recently, I found bars will displayed in an unexpected size when all y values less than 0.
And the black border will be oversized too when voice over is enable.
img_0333

how to reproduce

replace those codes
https://github.com/danielgindi/Charts/blob/5087a04bbefc9f15995113954ce217bbfb445577/ChartsDemo-iOS/Swift/Demos/AnotherBarChartViewController.swift#L64-L68
with

        let yVals = [
            BarChartDataEntry(x: 0, y: -10),
            BarChartDataEntry(x: 1, y: -20),
            BarChartDataEntry(x: 2, y: -30),
            BarChartDataEntry(x: 3, y: -15)
        ]

other

I moved the offset calculation code out of the loop, calculate once is enough
https://github.com/danielgindi/Charts/blob/5087a04bbefc9f15995113954ce217bbfb445577/Source/Charts/Renderers/BarChartRenderer.swift#L112

@codecov-io
Copy link

codecov-io commented Sep 19, 2018

Codecov Report

Merging #3650 into master will increase coverage by 1.44%.
The diff coverage is 99.14%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #3650      +/-   ##
=========================================
+ Coverage   31.06%   32.5%   +1.44%     
=========================================
  Files         114     114              
  Lines       10465   10681     +216     
=========================================
+ Hits         3251    3472     +221     
+ Misses       7214    7209       -5
Impacted Files Coverage Δ
Tests/Charts/BarChartTests.swift 100% <100%> (ø) ⬆️
Source/Charts/Renderers/BarChartRenderer.swift 52.18% <100%> (+0.7%) ⬆️
Source/Charts/Components/YAxis.swift 87.3% <86.66%> (+8.13%) ⬆️
Source/Charts/Renderers/LegendRenderer.swift 53.06% <0%> (-0.92%) ⬇️
...ce/Charts/Renderers/CandleStickChartRenderer.swift 0% <0%> (ø) ⬆️
Source/Charts/Utils/Platform+Accessibility.swift 31.57% <0%> (ø) ⬆️
Source/Charts/Charts/BarLineChartViewBase.swift 67.1% <0%> (+1.31%) ⬆️
Source/Charts/Utils/Transformer.swift 49.31% <0%> (+2.73%) ⬆️
Source/Charts/Renderers/AxisRendererBase.swift 67.36% <0%> (+2.77%) ⬆️
... and 3 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 0b2e873...d5d9abd. Read the comment docs.

@potato04 potato04 changed the title fixed barRectCalculation improvements in barRect height calculation Sep 22, 2018
@potato04
Copy link
Contributor Author

@petester42

@liuxuan30
Copy link
Member

liuxuan30 commented Sep 27, 2018

In like one or two years ago, I tested the negative bar height, and it's fine. Somehow you said it's broken. It seems the main change is the offset introduction. BTW, you mentioned voice over, which i think is irrelevant?

I need to check some old commits

@liuxuan30
Copy link
Member

liuxuan30 commented Sep 27, 2018

I checked the old commits and your PR. However I found in most cases your fix seems correct, but if you try to set

chartView.leftAxis.axisMaximum = -40.0

and with your test data, it shouldn't draw any bars, but instead, it draws 4 bars and wrong. seems a new issue to me. Not having a fix yet. It seems even I revert all of the changes, it still draw only one bar, and left axis labels are all gone. It seems the axis range calculation and matrix messed up.

Would you mind taking a look if you could have a quick fix? If you couldn't, it's fine, we will file a new issue to track it.

BTW, it's time to add UT for negative bars, and +/- bars, do you know how to add UT?

@potato04
Copy link
Contributor Author

In like one or two years ago, I tested the negative bar height, and it's fine. Somehow you said it's broken. It seems the main change is the offset introduction. BTW, you mentioned voice over, which i think is irrelevant?

I need to check some old commits

The reason of introducing offset is voice over (Accessibility) , you can check this PR #1060

I checked the old commits and your PR. However I found in most cases your fix seems correct, but if you try to set

chartView.leftAxis.axisMaximum = -40.0

and with your test data, it shouldn't draw any bars, but instead, it draws 4 bars and wrong. seems a new issue to me. Not having a fix yet. It seems even I revert all of the changes, it still draw only one bar, and left axis labels are all gone. It seems the axis range calculation and matrix messed up.

Would you mind taking a look if you could have a quick fix? If you couldn't, it's fine, we will file a new issue to track it.

BTW, it's time to add UT for negative bars, and +/- bars, do you know how to add UT?

Yes, I will check it out and update this PR as soon as possible

@potato04
Copy link
Contributor Author

I think I solved these problems.

  1. chartView.leftAxis.axisMaximum = -40.0 This problem is due to the wrong calculation of originYOffset.
  2. It seems even I revert all of the changes, it still draw only one bar, and left axis labels are all gone. When max or min was set manually, sometimes it will cause min>max, so the y-axis will not work properly.
    Please review my new commits.

@@ -125,9 +125,11 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
if barData.yMin > 0 {
heightOffset = CGFloat(offsetAxis.axisMinimum)
}
}
if !offsetAxis._customAxisMax {
Copy link
Member

@liuxuan30 liuxuan30 Sep 28, 2018

Choose a reason for hiding this comment

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

at first I was thinking a fix like this:

if !offsetAxis._customAxisMin || !offsetAxis._customAxisMax {
    if barData.yMin > 0 {
        heightOffset = CGFloat(offsetAxis.axisMinimum)
    }
    if barData.yMax < 0 {
        originYOffset = CGFloat(offsetAxis.axisMaximum)
    }         
}

I think there is a chance when offsetAxis._customAxisMin is true, and offsetAxis._customAxisMax is false, you still need to set originYOffset. Like all negative values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After some debugging, it seems that the value of _customAxisMax/_customAxisMin has nothing to do with calculating offset.

Copy link
Member

Choose a reason for hiding this comment

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

really? As the old commit said, if you touch nothing, the bar will draw from zero. So it does not need any offset. I will check the edge

Source/Charts/Components/YAxis.swift Outdated Show resolved Hide resolved
Source/Charts/Components/YAxis.swift Outdated Show resolved Hide resolved
@liuxuan30
Copy link
Member

once we find the right fix, we shall add UT for it.

@liuxuan30 liuxuan30 self-assigned this Sep 28, 2018
@liuxuan30
Copy link
Member

liuxuan30 commented Sep 28, 2018

One more issue found:
data set:

        let yVals = [
            BarChartDataEntry(x: 0, y: 10),
            BarChartDataEntry(x: 1, y: 20),
            BarChartDataEntry(x: 2, y: 30),
            BarChartDataEntry(x: 3, y: 15)
        ]

and enable

chartView.leftAxis.inverted = true

it draws wrong:
image

only uses

barRect.origin.y = top
barRect.size.height = bottom - top

solve the issue. It's not about the min/max bug, but the inverted feature and accessibility.

I tested pure positive values has issue, pure negative values has same issue, +/- combined values don't.

We also need to check highlight code as well. The highlight seems right, as forgot to consider the offset.

The accessibility has more bug then we think :( I think we need add enough UTs for bar chart

@liuxuan30 liuxuan30 closed this Sep 28, 2018
@liuxuan30 liuxuan30 reopened this Sep 28, 2018
@liuxuan30
Copy link
Member

liuxuan30 commented Sep 28, 2018

It seems the inverted bug starts from barRect.origin.y = top + originYOffset, need to change accordingly, as well as the height. the bottom and top will be flipped and the barRect would mess up easily.

I think we have to think about a clean solution
have to get back to work. used up free time today

@potato04
Copy link
Contributor Author

Please review the new commits and advise your comments

}
else if _customAxisMax && !_customAxisMin
{
min = max - 1
Copy link
Member

@liuxuan30 liuxuan30 Sep 29, 2018

Choose a reason for hiding this comment

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

what you think if we use min = 0.5 * max and max = 1.5 * min? @potato04 @jjatie @petester42 ?
clearly if min > max, and user only set one custom value of them, +/- 1 is not always the good value, for example with large values and decimals

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@potato04 potato04 Oct 6, 2018

Choose a reason for hiding this comment

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

It seems that the min/max correction is not perfect.

//This will work
chart.leftAxis.axisMinimum = 100
chart.leftAxis.axisMaximum = 0
chart.data = data
//This won't work
chart.data = data
chart.leftAxis.axisMinimum = 100
chart.leftAxis.axisMaximum = 0
chart.data = data
chart.leftAxis.axisMinimum = 100
chart.leftAxis.axisMaximum = 0
// have to call this to make it work
chart.notifyDataSetChanged()

Source/Charts/Renderers/BarChartRenderer.swift Outdated Show resolved Hide resolved
try to simply the calculation. keep barRect calculation untouched
@liuxuan30
Copy link
Member

liuxuan30 commented Sep 29, 2018

@potato04 Could you grant me push to your branch? Seems I cannot push a commit directly to your fix-barRectCaculation branch. So I use Github editor to add one more commit. Please have a review if my change b67c251 is valid. The idea is to keep barRect calculation the same, move the offset earlier.

@liuxuan30
Copy link
Member

@potato04

Check if highlight code need to change as well
Check Horizontal bar chart

I suppose highlight code need to align, right?

@potato04
Copy link
Contributor Author

potato04 commented Oct 17, 2018

@potato04

Check if highlight code need to change as well
Check Horizontal bar chart

I suppose highlight code need to align, right?

Horizontal bar and highlight seem to be working fine
Do you mean that we shall add unit tests?

@liuxuan30
Copy link
Member

@potato04

Check if highlight code need to change as well
Check Horizontal bar chart

I suppose highlight code need to align, right?

Horizontal bar and highlight seem to be working fine

highlight code is still drawing from zero line I suppose? Shall we need to align the barRect?

Do you mean that we shall add unit tests?

I don't think we need to add so far.

@potato04
Copy link
Contributor Author

potato04 commented Oct 19, 2018

oh, i got you

highlight code is still drawing from zero line I suppose? Shall we need to align the barRect?

no, we don't need to do that. Because it makes no difference to the UI

moved those codes into the for loop. because the offset of each bar may be different.
(detail in comments)
@potato04
Copy link
Contributor Author

Some issues that were fundamental to the calculation of bar rectangle had not yet been adequately addressed. I had to create a commit again...😓
In this commit, First, I moved the offset calculation code back into the loop because the offset of each bar may be different.
Second, replaced originYOffset and heightOffset with topOffset and bottomOffset and added comments to make it easier to understand the calculation process.

@liuxuan30
Copy link
Member

oh, i got you

highlight code is still drawing from zero line I suppose? Shall we need to align the barRect?

no, we don't need to do that. Because it makes no difference to the UI

I don't think so, because, I remember the old behavior is drawing from zero line, and we change it to draw from the offset. The old behavior is also not affecting UI. It's like an improvement, so I think we should align both rendering and highlight with the same logic.

I checked the highlight code:

                    y1 = e.y
                    y2 = 0.0
                }
                
                prepareBarHighlight(x: e.x, y1: y1, y2: y2, barWidthHalf: barData.barWidth / 2.0, trans: trans, rect: &barRect)

it is similar, drawing from y2 = 0.0, using the clip trick to cut off unnecessary part of the highlight. Though it's working ok, but I'm kind of concerned if their barRect calculations are not aligned, there would be problem in the future?

@jjatie what you think?

@liuxuan30
Copy link
Member

@potato04 more barRects to check:

  1. bar border feature;
  2. bar shadow feature;

they are involved with rect cuculation. We have to check it as well.

@potato04
Copy link
Contributor Author

potato04 commented Oct 22, 2018

The old behavior is also not affecting UI.

Yes, It will affects the UI when it comes to accessibility.
If you turn on voice over on your iPhone(guide: https://help.apple.com/iphone/10/#/iph3e2e2329), open chart-demo app and select one of the bars in the chart view, then a corresponding black border( VoiceOver Cursor) will appear, before i created this PR, the VoiceOver Cursor was oversized in some cases, because its size depends on the size of the bar being drawn instead of the size after being clipped. please take a look at the image I posted at the top of this thread. The reason is the previous offset calculation did not cover all cases. So the main purpose of my PR is improve offset calculation and fix other problems caused by it.

Co-Authored-By: potato04 <shiww@outlook.com>
@jjatie
Copy link
Collaborator

jjatie commented Oct 22, 2018

@liuxuan30 @potato04 The bar border is fine (it's just a stroke setting, no calculation involved). The highlight seems fine. I'll need to take a closer look at the bar shadows later.

This PR is making me really want to try out Core Animation for our bar Charts.

@liuxuan30
Copy link
Member

@jjatie I would support try out CA as well. What you think that do we need to change highlight barRect calculation to align with this PR? I'm kind of unsure. I would agree what @potato04 said above. Highlight code works fine, but the way we calculate the barRect has changed significantly.

@liuxuan30
Copy link
Member

@jjatie this means you are ok to leave highlight untouched? then we could merge then

@jjatie jjatie merged commit c01a765 into ChartsOrg:master Nov 1, 2018
mtpromano pushed a commit to MobileTradingPartnersLLP/ios-charts that referenced this pull request Jan 22, 2019
…ing/swift-4.2

* commit 'f2795b9813e7e8c2bcdac3f4c3cc74790116999e': (108 commits)
  Remove delegate method call for translation when no translation really occured
  add call chartScaled() after double tap (ChartsOrg#3770)
  fix ChartsOrg#3719
  Update README.md (ChartsOrg#3737)
  Fix applying lineCap value for line chart data sets (Fixes ChartsOrg#3739)
  Fix legend offset bug for horizontal bar chart (Fixes ChartsOrg#3301)
  Add missing properties to copy(with:) methods (ChartsOrg#3715)
  improvements in barRect height calculation  (ChartsOrg#3650)
  Remove meaningless comment
  fix wrong assignment to axisMaxLabels property
  Add missing empty line between Summary and other section manually
  fix casting warnings
  Fix guard statement format.
  Fix memory leak for macOS.
  Update ChartViewBase.swift
  bump version to 3.2.1
  close ChartsOrg#3659: fix index out of bounds issue when using stacked bar chart
  Fix memory leak after rendering
  close ChartsOrg#3661: update podspec to include swift verison
  fix issue ChartsOrg#3662
  ...

# Conflicts:
#	Charts.xcodeproj/project.pbxproj
#	ChartsDemo-iOS/ChartsDemo-iOS.xcodeproj/project.pbxproj
#	ChartsDemo-iOS/Objective-C/Demos/LineChartFilledViewController.m
#	ChartsDemo-iOS/Objective-C/Demos/RadarChartViewController.m
#	ChartsDemo-iOS/Swift/Demos/CandleStickChartViewController.swift
#	Rakefile
#	Source/Charts/Charts/BarLineChartViewBase.swift
#	Source/Charts/Charts/ChartViewBase.swift
#	Source/Charts/Charts/HorizontalBarChartView.swift
#	Source/Charts/Charts/PieChartView.swift
#	Source/Charts/Charts/RadarChartView.swift
#	Source/Charts/Components/Legend.swift
#	Source/Charts/Components/Marker.swift
#	Source/Charts/Components/YAxis.swift
#	Source/Charts/Data/Implementations/ChartBaseDataSet.swift
#	Source/Charts/Data/Implementations/Standard/ChartData.swift
#	Source/Charts/Data/Implementations/Standard/PieChartData.swift
#	Source/Charts/Data/Interfaces/ChartDataSetProtocol.swift
#	Source/Charts/Data/Interfaces/ScatterChartDataSetProtocol.swift
#	Source/Charts/Filters/DataApproximator+N.swift
#	Source/Charts/Formatters/FillFormatter.swift
#	Source/Charts/Formatters/ValueFormatter.swift
#	Source/Charts/Highlight/BarHighlighter.swift
#	Source/Charts/Highlight/ChartHighlighter.swift
#	Source/Charts/Highlight/HorizontalBarHighlighter.swift
#	Source/Charts/Renderers/AxisRendererBase.swift
#	Source/Charts/Renderers/BarChartRenderer.swift
#	Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift
#	Source/Charts/Renderers/BubbleChartRenderer.swift
#	Source/Charts/Renderers/CandleStickChartRenderer.swift
#	Source/Charts/Renderers/ChartDataRendererBase.swift
#	Source/Charts/Renderers/CombinedChartRenderer.swift
#	Source/Charts/Renderers/HorizontalBarChartRenderer.swift
#	Source/Charts/Renderers/LegendRenderer.swift
#	Source/Charts/Renderers/LineChartRenderer.swift
#	Source/Charts/Renderers/PieChartRenderer.swift
#	Source/Charts/Renderers/RadarChartRenderer.swift
#	Source/Charts/Renderers/Renderer.swift
#	Source/Charts/Renderers/ScatterChartRenderer.swift
#	Source/Charts/Renderers/XAxisRenderer.swift
#	Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift
#	Source/Charts/Renderers/XAxisRendererRadarChart.swift
#	Source/Charts/Renderers/YAxisRenderer.swift
#	Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift
#	Source/Charts/Renderers/YAxisRendererRadarChart.swift
#	Source/Charts/Utils/ChartUtils.swift
#	Source/Charts/Utils/ViewPortHandler.swift
#	Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testAllRightAxisDependency_iOS_375.0_667.0@2x.png
#	Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testAllRightAxisDependency_tvOS_1920.0_1080.0.png
#	Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testDefaultAxisDependency_iOS_375.0_667.0@2x.png
#	Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testDefaultAxisDependency_tvOS_1920.0_1080.0.png
#	Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testLeftRightAxisDependency_iOS_375.0_667.0@2x.png
#	Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testLeftRightAxisDependency_tvOS_1920.0_1080.0.png
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
danielgindi added a commit to danielgindi/MPAndroidChart that referenced this pull request Jan 23, 2020
danielgindi added a commit to danielgindi/MPAndroidChart that referenced this pull request Jan 23, 2020
danielgindi added a commit to danielgindi/MPAndroidChart that referenced this pull request Jan 23, 2020
RonakAndroid added a commit to RonakAndroid/MPAndroidChart that referenced this pull request Oct 27, 2020
* Create FUNDING.yml

* Update FUNDING.yml

* Update README.md

* Safe guards

These will be even more important when moving to Kotlin ranges

* Added highlightColor parameter for pie charts

ChartsOrg/Charts#2961

* Consider axis dependency in Combined chart

ChartsOrg/Charts#2874

* Added an implementation of Douglas Peucker with resultCount input

ChartsOrg/Charts#2848

* Fixed axis label disappearing when zooming in

ChartsOrg/Charts#3132

* Make min/max axis labels configurable

ChartsOrg/Charts#2894

* Avoid race condition for interval/intervalMagnitude

ChartsOrg/Charts#2377

* Custom text alignment for no-data

ChartsOrg/Charts#3199

* Select correct axis for legend distance calculation in horz bar chart

ChartsOrg/Charts#2214

* Use correct color index for bubble chart

ChartsOrg/Charts#3202

* Added dataIndex param for highlightValue (combined charts)

ChartsOrg/Charts#2852

* Reset min/max when clearing ChartDataSet

ChartsOrg/Charts#3265

* Call notifyDataChanged for an opportunity for subclasses

* Add a warning message if pie chart has more than one data set

ChartsOrg/Charts#3286

* Add option to disable clipping data to contentRect

ChartsOrg/Charts#3360

* Support for labelXOffset for YAxis label

* This is for the inline bubble selection

ChartsOrg/Charts#3548

* Fixed index out of bounds issue when using stacked bar chart

ChartsOrg/Charts@b03cf16

* Improve min/max calculation

ChartsOrg/Charts#3650

* Call onChartScale listener after double-tap-zoom

ChartsOrg/Charts#3770

* Multiple colors for valueline

ChartsOrg/Charts#3709

* Renamed values -> entries for consistency

ChartsOrg/Charts#3847

* Improved negative offset for horz bar chart

ChartsOrg/Charts#3854

* maxHeight didn't account for the last label

ChartsOrg/Charts#3900

* Fixed a bug where a pie slice without highlight enabled is hidden

ChartsOrg/Charts#3969

* Remove unexpected dash line during linear animation

ChartsOrg/Charts#4094

* Corrected check for line in vertical bounds

ChartsOrg/Charts#4100

* Finalized vertical line collision check

* Fixed merge residue

* Implement a more generic Fill class instead of GradientColor

Support HorizontalBarChart too.

* Update LICENSE

The LICENSE file was not properly filled out. It was missing some templates that were supposed to be filled in at the end of the license.  Additionally, the entire Apache 2.0 license is not required on a project that makes use of it. Only this disclaimer is required.

See http://www.apache.org/licenses/LICENSE-2.0#apply under the "How to apply the Apache License to your work" for more information.

* fix NPE when use solid color with barchart

* Update BarChartRenderer.java

* Update HorizontalBarChartRenderer.java

* Update BarChartRenderer.java

* Update README.md

* Update README.md

* Update README.md

* Update LICENSE

* Revert: e5b6619 - bring back polymorphism to value formatters

If anyone does not know how to add a space or change the format in anyway,
please learn how to subclass.

Co-authored-by: Philipp Jahoda <phil.jahoda@gmail.com>
Co-authored-by: Daniel Cohen Gindi <danielgindi@gmail.com>
Co-authored-by: Nathan Fiscaletti <nate.fiscaletti@gmail.com>
Co-authored-by: Anirut Teerabut <anirut.t@linecorp.com>
Co-authored-by: Anirut Teerabut <oatrice.dev@gmail.com>
ysravankumar added a commit to ysravankumar/MPAndroidChart that referenced this pull request Feb 16, 2021
* Extend test cases (for bugfix)

* Remove unused local variable

* Removed redundancies

* Fixed entry searching algorithm to handle sequential same values

* Move on from the deprecated property in the demos

* Avoid crash for `centerAxisLabelsEnabled` when entry count == 1

* Fixes for cubic bezier edges

* Removed redundant condition

* Update gradle

* Guard `roundToNextSignificant` and `decimal` from invalids

* Minor fixes for interval in axis labels

* Allow label centering for 1 label

* Set z-index of markers to be the highest

* [FIX] not find centeringEnabled

* Extend test cases

* Refactoring, prepare example for testing highlight

* Fix typo

* Corrected calcMinMaxY for autoScaleMinMax

* Feature: spaceMin/spaceMax for axis

* Default spaceMin/spaceMax for bar charts

This avoids having to set custom axisMinimum/axisMaximum, or offsetting x

* Improved highlight for scatter/bubble, and fixes highlightValueWithX

* Avoid crash when dataset is empty

* Update gradle & android sdk

* Default spaceMin/max for xAxis in candlestick charts

* Fixed last label of line chart not rendering

* Fixed bar chart demo first value being empty

* Clear up grouped bar example

* Make highlightFullBarEnabled feature work again

* Update README.md

* Update README.md

* Update README.md

* Move to Realm v2.0.2, update example

* Migrate to Realm v2.0.2, fix example

* Update AxisBase.java

Mistake fixed

* Make automatically disabling slice-spacing an opt-in feature

* Bugfix: Corrected clipRect on the proper rect variable

* Fixed glitch in clipping rects.

It's the Android's renderer's bug.
When specifying exact clipping rects,
  they are clipping more than they should!
So drawing a thin 1px line on the edge of a clipping rect fail.
Instead of insetting by half the line width, inset by full line width.

* Renamed new property getter

* Added `clipValuesToContent` property for clipping values

* Added missing isDrawBordersEnabled getter

* Fixed weird glitch in mixed (pos/neg) stacked bars highlight

ChartsOrg/Charts#1744
ChartsOrg/Charts#1726

* Fixed double calculation of xAxis spacing

* Fix: typo for October

* Gradle updates

* Fixed EPSILON. (Closes PhilJay#2432)

Closes PhilJay#2424
Closes PhilJay#2394
Closes PhilJay#2393
Closes PhilJay#2385

* Added IndexAxisValueFormatter, to allow for easy x-axis labels like MPAndroidChart 2.0

* Fixed a bug where the mod-360 bypass draws a full-circle for 0 slices.

* Upgrade version

* Upgrade manifest

* Update README.md

* Update README.md

* Update README.md

* drawBottomYLabelEntryEnabled

* Gradle updates

* resetZoom()

* Correctly position 0 in stacked bar

* Fix for default text size being set in PX instead of DP

The default text size in ComponentBase was defined as 10 pixels
instead of 10dp, which causes tiny text and does not reflect
the javadoc and the general behavior of setTextSize(...)

* Fix circles inherit alpha (Fixes PhilJay#2620)

ISSUE:
When using multiple LineDataSets like the follows:

    int solidColor = 0xFFFF00FF;
    dataSet.setColor(solidColor);
    dataSet.setCircleColor(solidColor);

    int semiTransparentColor = 0x8A000000;
    fadedSet.setColor(semiTransparentColor);

    LineData data = new LineData(dataSet, fadedSet);

the circles in 'dataSet' will rendered with the alpha from
fadedSet (0x8A).

The reason for this is that mRenderPaint is not reset properly
before drawing the circles. The first time drawCircles is called
the imageCache.fill(...) method is used where the color is set by
mRenderPaint.setColor(set.getCircleColor(i)), restoring the alpha
to 0xFF. The second time homever, imageCache.fill(...) is not called
which means that mRenderPaint will use it's old color/alpha,
which in this case is from fadedSet.

TEST INFO:
To trigger the issue, add the following to LineChartActivity1:

    final ArrayList<Entry> fadedEntries = new ArrayList<>();
    for (int i = 0; i < count; i++) {

        float val = (float) (Math.random() * range) + 3;
        fadedEntries.add(new Entry(i, val));
    }
    final LineDataSet fadedDateSet = new LineDataSet(fadedEntries, "Faded");
    fadedDateSet.setColor(0x42000000);

    dataSets.add(fadedDateSet); // add the datasets

and launch the first item in the example app.

SOLUTION:
This commit replaces mRenderPaint with null when drawing the circle
bitmap. If circleColor has been defined with a semi-transparent
color, it will be drawn that way in the cached bitmap, hence the the
bitmap itself does not need to be drawn with an alpha.

* fix tests for java executable location. bug PhilJay#2805
PhilJay#2805

* fix PhilJay#2813

* Implemented icon support

* Added examples for icon entries

* Improved feb29 formula

* Moved auto scale before render of axis lines

ChartsOrg/Charts#2177

* Consider isEnabled in more axis rendering cases

* Fix for missing setters in getInstance method

The zoomAndCenterAnimated method in BarLineChartBase crashes with a NullPointer exception because the yAxis variable is null when onAnimationUpdate is called. The yAxis is null because of missing setters in the getInstance method of AnimatedZoomJob.

* Update README.md

* Update README.md

* Update README.md

* Updating versions

* Remove line width minimum constraint

* Update README.md

* Update README.md

* Update README.md

* Clear lastHighlighted when `clear` is called

* Create LICENSE

* Fix some potential NPEs with WeakReference usage

Even if the WeakReference field is not null, the contained value may be null.  Additionally, you always need a strong reference to the value to ensure it isn't garbage collected while you're using it.

* Update README.md

* Update README.md

* Run view port jobs after applying changes

* Add default x spacing (half width) for scatter chart as well

* Fix CombinedChartView not drawing markers

* Allow locking drag on either axes

* add option to draw limit lines on top of data

* Refactored LargeValueFormatter

* Update README.md

* Update gradle and dependencies

* Out comment gradle wrapper

* Update maven android plugin

* Add maven plugin to example

* Add new google repo

* Add new google repo

* Update README.md

* Update version

* Update README.md

* Update README.md

* Added option to set restrictions for Y axis autoscaling.

* Update gitignore, add assets

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Add files via upload

* Delete googlee1205ea43aa2c32a.html

* Avoid that the last label entry in the x-labels clip off the edge of the screen PhilJay#3819

* Add option for using slice color as value line color

Fixes: PhilJay#3897

* Rename RadarChartActivitry to RadarChartActivity

* Remove unused imports

* Remove Custom Check

calculate() no longer checks if min and max is custom, it just adds the padding.

* update to Android Studio 3.1.2

* Create ISSUE_TEMPLATE.md

* Create PULL_REQUEST_TEMPLATE.md

* refactor(EasingFunction): Simplified EasingFunction

EasingFunction has been simplified greatly, and I've added a MUCH needed
annotation to relevant methods.

Easing.EasingOptions has been deprecated, as well as any methods using
them. Converting is as simple as deleting the "EasingOptions" part.

A new signature is available for animateXY()!

You are now able to pass one EasingFunction to animateXY() if you want
both axes to be animated the same way.

Quietly included are some gradle build updates, incrementing the
appcompat version to 27.1.1, and using the new `javacompiler` to avoid
deprecation of `javacompile`

* fix(docs): Broken Contributing link

* Update issue templates

* Downgrade ISSUE_TEMPLATE.md to generic issue

* Update Bug_report.md

quick fix

* Update CONTRIBUTING.md

Condensed CONTRIBUTING and added helpful reference links.

And cake!

* Update README.md

* Delete lingering MyEasingFunction.java

I made the decision to remove this file instead of updating it, as I'm
sure most will instead prefer to look at the actual Easing class. If you
miss this example class... ¯\_(ツ)_/¯

* - multiple gradient color

* docs(templates): Update Issue & PR templates

I've updated the issue and pull request templates, again. This time I
looked to the node.js request library for inspiration.

It's no secret that this project has been attracting a LOT of very
low-quality issues. Almost all are asking questions that can be easily
answered if the person looked at the example project or the wiki.

Specifically, the new Support_help.md file.

This file will hopefully bait these low-quality support questions and
reduce the number of opened issues regarding debugging or support
significantly.

I've updated the default ISSUE_TEMPLATE.md to be a copy of Bug_report.md
to force people to read that notice text if they decide to not choose
any of the templates.

* chore(template): Move templates to .github folder

* Update and reorganise copy data sets methods (Fix for PhilJay#1604).

Copying class properties is always done in protected copy method.

* Fixed code review comments.

* Remove mLabelRotatedHeight counted twice, when calculating legend offsets. (Fix for PhilJay#2369).

Removed statements where completely not needed as calculating offsets is alredy done in BarLineCharBase#calculateOffsets(...)

* Fixed Javadoc

* Remove redundant findViewById casts, that became obsolete after migration to API 26.

* docs(README): Update & simplify README

- Re-ordered some of the sections
- Simplified some sections
- Reformatted here and there
- Added a few emojis, how cute!

The goal of this change was to hopefully further reduce the amount of
issue support/ question spam. By moving the sections around to show the
more important parts higher up, like usage and documentation links, I
hope this will make it easier for people to find the documentation.

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Huge Project Refresh

Before anyone freaks out, all these changes are under-the-hood, meaning that you probably won't even notice them at all.

The biggest difference is raising the minSdkVersion from 9 to 14. Recently android bumped this number interally as there are basically no devices running lower than 14 anymore. Sorry but you are just wasting your time if you are trying to support anything lower than 14 now.

The next biggest change is updating the project to the new AndroidX libraries, which changes some imports and nothing else really.

The third biggest change is fixing a few bugs in the code that cause values to be drawn even if there are none, which results in your app crashing. Surprisingly, these checks already existed in a few of the newer chart types, but most lacked this simple check.

Other than those three changes, nothing else is functionally different. Well, saving to gallery works on all charts in the example app now, and you can quickly see the code for each example in the menus.

The only real potential "breaking" change is that charts are now saved as PNGs by default instead of JPGs if you go the route of not specifying as a JPG. You may want to double check your file sizes as PNGs can be larger than low quality JPGs.

I still have more plans for simplifying the API and fixing other issues with the project, for the small few that closely pay attention to individual commits: there's going to be more soon.

* More Linting

Lots of things in the example app are now marked with the 'final' modifier, and saveToGallery() is protected in classes that implement it. As well, new suppressions are in a few places.

NEW text is now removed completely. Looks like this has been unused for a long time and it's just stuck around anyway.

* More Cleanup

I've removed the realm examples, mainly because the library was buggy.
In the previous commit, I already removed the examples from the list
since they didn't add anything to the overall demonstration. I thought
that if anyone wants to use realm.io with the charts, they can see the
actual library.

The file structure has been updated to match how Android Studio does
things. Some files added way back when have been deleted as they don't
do anything but cause the linter to freak out about 'unused properties'

All 'build.gradle' files have been refreshed as well.

Small addition to the README file to add a quick way to reach sections
of the page.

* Bump version to 3.1.0-alpha

* Fix link error

* New ValueFormatter

I created a simplified value formatter class, which is an abstract class rather
than an interface.

The switch was chosen because the new format has all the methods predefined
(something an interface wouldn't allow) meaning you can extend it and only
change what you want. This also means that you only need one value formatting
class for labels rather than two different classes, it just makes more sense.

Please check the method signatures to learn how to use them, I'm sure you'll
find this new format is much more customizable and faster to use.

I've made the class abstract even though there are no abstract methods or
fields, this is because it would certainly be a mistake to create a
ValueFormatter and not override any methods.

To convert existing code, just use 'extends' instead of 'implements' and change
the names to 'ValueFormatter'. You'll need to change the methods you overwrite
as well, just check the class and use the one you need.

* Remove Deprecated Things

Long deprecated Legend constructor and positioning has been removed, it was
replaced with a new way to position the Legend.

The old Easing options have been removed now, accessing them is as easy as
removing the `EasingOption` part, such that the names look like
`Easing.Linear` or `Easing.EaseInOutQuad` now.

* Remove unnecessary API checks

Also added run configuration for the MPChartExample.
Removed deprecated Legend stuff.

* Add Curved Slices to Pie Chart

Finally added support for rounded slices, and somewhat improved the code
for the PieChartRenderer class.

* Add option to set minimum angles

Allows to force minimum slice angles when drawing charts, which means that any
slices with angles lower than the minimum will be drawn with the minimum angle.

When changing this setting on the fly, you have to call
`notifyDataSetChanged()` and `invalidate()` for the minimum angle to take
effect.

This only functions if all slices can be drawn with the minimum angle. For
example if a chart has 5 slices, the largest functioning minimum angle is
`72f` degrees on a 360 degree chart, or 20% of the chart's `maxAngle`.

* Update README.md

* Update Bug_report.md

* Update Feature_request.md

* Update Support_help.md

* Minor changes to project and example

* New example app release

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* PercentFormatter: make space between number and percent sign optional

* fix little typo

* Update gradle

* Create FUNDING.yml

* Update FUNDING.yml

* Update README.md

* Safe guards

These will be even more important when moving to Kotlin ranges

* Added highlightColor parameter for pie charts

ChartsOrg/Charts#2961

* Consider axis dependency in Combined chart

ChartsOrg/Charts#2874

* Added an implementation of Douglas Peucker with resultCount input

ChartsOrg/Charts#2848

* Fixed axis label disappearing when zooming in

ChartsOrg/Charts#3132

* Make min/max axis labels configurable

ChartsOrg/Charts#2894

* Avoid race condition for interval/intervalMagnitude

ChartsOrg/Charts#2377

* Custom text alignment for no-data

ChartsOrg/Charts#3199

* Select correct axis for legend distance calculation in horz bar chart

ChartsOrg/Charts#2214

* Use correct color index for bubble chart

ChartsOrg/Charts#3202

* Added dataIndex param for highlightValue (combined charts)

ChartsOrg/Charts#2852

* Reset min/max when clearing ChartDataSet

ChartsOrg/Charts#3265

* Call notifyDataChanged for an opportunity for subclasses

* Add a warning message if pie chart has more than one data set

ChartsOrg/Charts#3286

* Add option to disable clipping data to contentRect

ChartsOrg/Charts#3360

* Support for labelXOffset for YAxis label

* This is for the inline bubble selection

ChartsOrg/Charts#3548

* Fixed index out of bounds issue when using stacked bar chart

ChartsOrg/Charts@b03cf16

* Improve min/max calculation

ChartsOrg/Charts#3650

* Call onChartScale listener after double-tap-zoom

ChartsOrg/Charts#3770

* Multiple colors for valueline

ChartsOrg/Charts#3709

* Renamed values -> entries for consistency

ChartsOrg/Charts#3847

* Improved negative offset for horz bar chart

ChartsOrg/Charts#3854

* maxHeight didn't account for the last label

ChartsOrg/Charts#3900

* Fixed a bug where a pie slice without highlight enabled is hidden

ChartsOrg/Charts#3969

* Remove unexpected dash line during linear animation

ChartsOrg/Charts#4094

* Corrected check for line in vertical bounds

ChartsOrg/Charts#4100

* Finalized vertical line collision check

* Fixed merge residue

* Implement a more generic Fill class instead of GradientColor

Support HorizontalBarChart too.

* Update LICENSE

The LICENSE file was not properly filled out. It was missing some templates that were supposed to be filled in at the end of the license.  Additionally, the entire Apache 2.0 license is not required on a project that makes use of it. Only this disclaimer is required.

See http://www.apache.org/licenses/LICENSE-2.0#apply under the "How to apply the Apache License to your work" for more information.

* fix NPE when use solid color with barchart

* Update BarChartRenderer.java

* Update HorizontalBarChartRenderer.java

* Update BarChartRenderer.java

* Update README.md

* Update README.md

* Update README.md

* Update LICENSE

* Revert: e5b6619 - bring back polymorphism to value formatters

If anyone does not know how to add a space or change the format in anyway,
please learn how to subclass.

* Update README.md

* Update README.md

Co-authored-by: PhilJay <phil.jahoda@gmail.com>
Co-authored-by: Voicu <nortonedd@yahoo.com>
Co-authored-by: Daniel Cohen Gindi <danielgindi@gmail.com>
Co-authored-by: Mark <mayq0518@163.com>
Co-authored-by: nielsz <nielsz.spam@gmail.com>
Co-authored-by: Evgeniy <Ewg777@users.noreply.github.com>
Co-authored-by: Mahesh Gaya <maheshgaya@users.noreply.github.com>
Co-authored-by: Patrick Ivarsson <patrick.ivarsson@sonymobile.com>
Co-authored-by: travisfw <none@none>
Co-authored-by: Stephen McBride <stephenmcbride@users.noreply.github.com>
Co-authored-by: Scott Kennedy <skennedy27@gmail.com>
Co-authored-by: davidgoli <davigoli@gmail.com>
Co-authored-by: Maxim Pestryakov <MaximPestryakov@users.noreply.github.com>
Co-authored-by: Pawel Grzybek <grzybek@gmail.com>
Co-authored-by: zhanglong <zhanglong@zhanglongdeMac-mini.local>
Co-authored-by: sembozdemir <sembozdemir@gmail.com>
Co-authored-by: Wilder Pereira <wilder_roberto@hotmail.com>
Co-authored-by: almic <mick.ashton@flare-esports.net>
Co-authored-by: Hannes Achleitner <hannes.software@gmx.at>
Co-authored-by: Anirut Teerabut <oatrice.dev@gmail.com>
Co-authored-by: RobertZagorski <robertzagorsky@gmail.com>
Co-authored-by: duchampdev <duchampdev@outlook.com>
Co-authored-by: Nathan Fiscaletti <nate.fiscaletti@gmail.com>
Co-authored-by: Anirut Teerabut <anirut.t@linecorp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants