-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added DataApproximator+N extension #2848
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2848 +/- ##
==========================================
+ Coverage 19.64% 22.89% +3.24%
==========================================
Files 113 116 +3
Lines 13792 15596 +1804
Branches 0 271 +271
==========================================
+ Hits 2709 3570 +861
- Misses 11083 11990 +907
- Partials 0 36 +36
Continue to review full report at Codecov.
|
wow, @danielgindi you should look at this :) |
} | ||
} | ||
|
||
fileprivate class LineAlt { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
let dividend = fabs(dy * self.x - dx * self.y - linePoint1.x * linePoint2.y + linePoint2.x * linePoint1.y) | ||
let divisor = sqrt(dx * dx + dy * dy) | ||
|
||
return dividend/divisor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dividend / divisor
to keep consistent spacing
return | ||
} | ||
|
||
for i in start+1..<end { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start + 1..<end
, though throughout Charts it is sometimes written as start + 1 ..< end
extension DataApproximator { | ||
/// uses the douglas peuker algorithm to reduce the given arraylist of entries to given number of points | ||
/// More algorithm details here - http://psimpl.sourceforge.net/douglas-peucker.html | ||
@objc open class func reduceWithDouglasPeukerN(_ points: [CGPoint], resultCount: Int) -> [CGPoint] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The algorithm shouldn't be overridden. @objc public static func reduceWithDouglasPeukerN(_ points: [CGPoint], resultCount: Int) -> [CGPoint]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, but in current code there is
@objc open class func reduceWithDouglasPeuker(_ points: [CGPoint], tolerance: CGFloat) -> [CGPoint]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be changed too. This is fine then. I will change to static in a separate PR.
} | ||
|
||
// Keeps array sorted | ||
private class func insertLine(_ line: LineAlt, into array: inout [LineAlt]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static func
array.insert(line, at: insertionIndex) | ||
} | ||
|
||
private class func insertionIndex(for line: LineAlt, into array: inout [LineAlt]) -> Int { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static func
Awesome! |
Fixed PR notes |
* Fixed using wrong axis (Issue #2257) * fix #1830. credit from #2049 (#2874) * fix #1830. credit from #2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Minor cleanup to Highlighter types (#3003) * Minor cleanup to Highlighter types * Fixes for PR * Pulled master and updated code style * added DataApproximator+N extension (#2848) * added DataApproximator+N extension * fixed PR notes * Readded in missing files
* Fixed using wrong axis (Issue #2257) * fix #1830. credit from #2049 (#2874) * fix #1830. credit from #2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Minor cleanup to Highlighter types (#3003) * Minor cleanup to Highlighter types * Fixes for PR * Pulled master and updated code style * added DataApproximator+N extension (#2848) * added DataApproximator+N extension * fixed PR notes * Moved drawing methods into CGContext extension Much nicer call sites. Renamed some parameter names. Removed `NSAttributedStringKey` where type inference was sufficient. Minor tidy of drawText calls in AxisRenderers * Pulled latest master * Pulled master * Fixed code style
* added DataApproximator+N extension * fixed PR notes
* 'master' of https://github.com/danielgindi/Charts: (34 commits) Fixed X-Axis Labels Not Showing (ChartsOrg#3154) (ChartsOrg#3174) fix programatical unhighlighting for BarCharView (ChartsOrg#3159) Give the users customizable axis label limits (Fixes ChartsOrg#2085) (ChartsOrg#2894) bump pod version chart views now use open legend renderer property instead of internal one (ChartsOrg#3149) Fix axis label disappear when zooming in deep enough (ChartsOrg#3132) added DataApproximator+N extension (ChartsOrg#2848) Minor cleanup to Highlighter types (ChartsOrg#3003) Refactored ChartUtils method into CGPoint extension (ChartsOrg#3087) Update ViewPortHandler.swift (ChartsOrg#3143) add option to build demo projects unit tests on iOS (ChartsOrg#3121) Replaced relevant `ChartUtils` methods with `Double` extensions (ChartsOrg#2994) Update 4.0.0 with master (ChartsOrg#3135) Removed redundant ivars in BarLineChartViewBase (ChartsOrg#3043) fix ChartsOrg#1830. credit from ChartsOrg#2049 (ChartsOrg#2874) Makes ChartsDemo compiling again (ChartsOrg#3117) Fixed using wrong axis (Issue ChartsOrg#2257) Removed methods and properties deprecated in 1.0 (ChartsOrg#2996) for ChartsOrg#3061 revert animationUpdate() and animationEnd() not trigger crash if subclass does nothing The backing var is not necessary. (ChartsOrg#3000) ... # Conflicts: # Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift # Source/Charts/Highlight/BarHighlighter.swift # Source/Charts/Renderers/BarChartRenderer.swift
* added DataApproximator+N extension * fixed PR notes
* 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>
* Remove java interface convention (#2997) * Renamed `IMarker` to `Marker` following Swift API guidelines. * Renamed `IAxisValueFormatter` to `AxisValueFormatter` * Renamed `IFillFormatter` to `FillFormatter` * Renamed `IValueFormatter` to `ValueFormatter` * Renamed `IHighlighter` to `Highlighter` * Renamed `I*DataSet` to `*DataSetProtocol` to follow Swift API guidelines * Fixed naming of `LineRadarChartDataSetProtocol` and `RadarChartDataSetProtocol` from previous commit * Renamed "Interfaces" to "DataProviders" for clarity * Updated Demos to for new type naming * Renderer protocols (#3136) * Renderer is now a protocol Renamed Renderers, and organized the Renderer folder. * DataRenderer is now a protocol * AxisRenderer is now a protocol * Chartviewbase redundant ivar (#3045) * Fixed using wrong axis (Issue #2257) * fix #1830. credit from #2049 (#2874) * fix #1830. credit from #2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * ChartViewBase cleanup For the most part, condensing logic and using `guard` where appropriate Removed optionality of many internal variables as they were only optional to allow for deferred initialization. This is now replaced with lazy vars. Removed empty initializer overrides. `fileprivate` is now `private` * Removed redundant ivars In favour of proper access control * Fixes after merge * Renamed `animator` to `chartAnimator` on `ChartViewBase` to no conflict with `NSView`'s `animator()` method. * pulled latest master * Code style fix * Removed AxisRendererBase.swift * Fixed demos * BarChartRenderer Logic cleanup (#3008) * Logic cleanup Mostly using guard where appropriate Few very minor performance improvements * Made use of `==` where appropriate to simplify logic * Returned fatalError message * Replaced `Buffer` class with simple typealias. There was only one instance where reference semantics might have be helpful, but was easily reimplemented with value semantics. * Syncing 4.0.0 with master (#3160) * Fixed using wrong axis (Issue #2257) * fix #1830. credit from #2049 (#2874) * fix #1830. credit from #2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Minor cleanup to Highlighter types (#3003) * Minor cleanup to Highlighter types * Fixes for PR * Pulled master and updated code style * added DataApproximator+N extension (#2848) * added DataApproximator+N extension * fixed PR notes * Readded in missing files * Moved ChartUtils drawing methods into CGContext extension (#3086) * Fixed using wrong axis (Issue #2257) * fix #1830. credit from #2049 (#2874) * fix #1830. credit from #2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Minor cleanup to Highlighter types (#3003) * Minor cleanup to Highlighter types * Fixes for PR * Pulled master and updated code style * added DataApproximator+N extension (#2848) * added DataApproximator+N extension * fixed PR notes * Moved drawing methods into CGContext extension Much nicer call sites. Renamed some parameter names. Removed `NSAttributedStringKey` where type inference was sufficient. Minor tidy of drawText calls in AxisRenderers * Pulled latest master * Pulled master * Fixed code style * Utils Cleanup (#3054) * Cleanup Replaced unnecessary getters with proper access control Replaced unnecessary convenience inits with default parameters Minor refactoring * Pulled latest master * Pulled latest master * Pulled latest master * Fix after pulling master * Fixed using wrong axis (Issue #2257) * fix #1830. credit from #2049 (#2874) * fix #1830. credit from #2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Finished cleanup * Pulled master * Chartdata collection conformance (#3023) * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Updates for PR Also added remove subrange. * PR review fixes * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Relocated `appendEntry(_:todataSet:)` * Removed methods from CombinedChartData * weak -> unowned (#3039) * weak -> unowned `ViewPortJob`s are owned by the Charts that make them. They are guaranteed to only exist while the chart exists. The `Transformer` and `ViewPortHandler` are supplied by the chart, so they will also only exist while the chart exists. Therefor none of them need to be `weak`, but can be `unowned` instead. It's a minor change in the code base (removing some guard statements), but it makes it much easier to discern how the framework is architected. * pulled latest master * Removed optionality from valueFormatter where appropriate (#3106) * Removed optionality from valueFormatter where appropriate In ChartBaseDataSet, `valueFormatter` never returned nil, and escaped early if trying to set it to nil. It appears this was made optional solely to provide lazy initialization. We now use a lazy var instead. In AxisBase, the backing var `_axisValueFormatter` would never be treated as nil, and appears to be made optional solely to provide lazy initialization. We now use a lazy var instead. In `valueFormatter` we can remove the `nil` check, but leave it optional to keep the same functionality. * Pulled 4.0.0 * Pulled latest 4.0.0 * Fixed pro file * Chartdata collection refactor (#3024) * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Removed unnecessary `get` from subscripts. * Removed redundant methods * Relocated `appendEntry(_:todataSet:)` * Removed methods from CombinedChartData * Moved the default value formatter (#3088) * Moved the default value formatter It is now simply `DefaultValueFomatter()` Removed unnecessary backing ivars in `DefaultValuetFormatter` in favour of property observers Deprecated static func constructor in favour of initializer * Add option to rotate value text for line charts * Add value text rotation for bar charts * Add value text rotation for other charts * Fixed misuse/deprecation of "!" operator * Updated projects for Xcode 9.3 and Swift 4.1 added a workspace to include all demos with the project to make it easier to test changes * Pulled master * Moved travis to Xcode 9.3beta temporarily * Updated Rakefile for new project names * Updated demo imports * Rename valueRotationAngle -> valueLabelAngle * Make function private & remove line break * Refactored ChartData (#3169) * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Updates for PR Also added remove subrange. * Refactored ChartData Removed redundancy from min/max logic. Lots of naming changes. Cleaner implementations. * PR review fixes * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Removed redundant methods * Relocated `appendEntry(_:todataSet:)` * pulled latest 4.0.0 * Disabled Collection support for CombinedChartData * Removed methods from CombinedChartData * Pulled latest 4.0 * Fixes after merge * Removed used of dataSet(forIndex:) * Fixed merge conflicts * Fixed merge conflicts * updated demos * Pulled latest 4.0.0 * Fixed demos * Fixed objective c demos * Moved travis to Xcode 9.3 beta temporarily * Fixed macOS demo info.plist and tv demo device name * PR Fixes * Fixed objective-c naming * PR Fixes * fix comment * Remove unnecessary file (#3432) * Dataset logic cleanup (#3001) * Cleaned up `ChartDataSet` logic Added TODOs for areas where simple changes can help improve Swift consistency. * Tidied up logic for `ChartDataSet` subclasses Minor changes to take advantage of Swift features and help improve readability. * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Pulled latest master * Pulled latest master * Updates for PR Also added remove subrange. * Refactored ChartData Removed redundancy from min/max logic. Lots of naming changes. Cleaner implementations. * PR review fixes * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Removed redundant methods * Relocated `appendEntry(_:todataSet:)` * pulled latest 4.0.0 * Disabled Collection support for CombinedChartData * Removed methods from CombinedChartData * Pulled latest 4.0 * Fixes after merge * Removed used of dataSet(forIndex:) * Fixed merge conflicts * Fixed merge conflicts * updated demos * Pulled latest 4.0.0 * Fixed demos * Fixed objective c demos * Moved travis to Xcode 9.3 beta temporarily * Fixed macOS demo info.plist and tv demo device name * PR Fixes * Fixed objective-c naming * PR Fixes * PR Fixes * Added gradient line drawing to LineChartRenderer * Stabilize and clean the code * Extract line drawing into function * Fix macOS build * Move `drawGradientLine` out of `drawLine` method * Remove unused parameters from `drawLine` function * Fix gradient location calculation * Add toggle gradient line into demo options * Improvements after code review * Code cleanup * Remove unnecessary function for generating gradient line - additional code optimizations * Fix: gradient lines peaks are truncated when line width > 1 * Make legendRenderer property public in order to be externally customizable * fix build issue in objc demo * Add minimum slice angle for value labels to PieChartView * Rename drawSliceTextMinimumAngle to sliceTextDrawingThreshold * Fix sliceTextDrawingThreshold renaming in demo * fix build of demos * Add label colors to legend entries (#3558) * add label colors to legend entries * Change interface of LegendEntry * Add Swift version 4.1 to podspec * Turned gradient components and locations into constants (#3775) * Cleaned up `ChartDataSet` logic Added TODOs for areas where simple changes can help improve Swift consistency. * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Pulled latest master * Unified Style Replaced custom algorithms with built-in ones Made axis renderer implementations feel "Swift-ier" * Updates for PR Also added remove subrange. * Refactored ChartData Removed redundancy from min/max logic. Lots of naming changes. Cleaner implementations. * Fixed horizontal barchart bug, * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Relocated `appendEntry(_:todataSet:)` * Disabled Collection support for CombinedChartData * Removed used of dataSet(forIndex:) * Fixed merge conflicts * updated demos * PR Fixes * Fixed axisLabels calculation * Fill rewrite (#3084) close #3140 * Fill is now a protocol Different fill logic is broken up into separate classes. This has a few benefits: 1. It makes the `Fill` types more readable (logic is grouped together) 2. No optionals 3. Most importantly it allows consumers to create new Fill types without looking into the framework. * Added super.init() for objc * Updated Fill access No need to subclass existing fills now that the system is more flexible. If functionality is needed from another fill, user can call it within their own `fillPath(context: CGContext, rect: CGRect)` implementation. * Updated Fill Names * Update Fill.swift update code style Co-authored-by: Jacob Christie <jchristie@christie.teamspace.ad> Co-authored-by: Xuan <liuxuan30@gmail.com> * update to Swift 5, Xcode 13.5.1, and fix warnings * fix all compile errors and wrong symbols either by git or me. * revert back to convenience init for BarChartDataSet fix ChartDataTests compile errors: use new API dataSet(forLabel:, ignorecase: ) * actually, I compared the old master and find this is a mistake while merging to make init(label:) in BarChartDataSet. It should be in ChartDataSet. * fix -0.0 issue in 4.0 merge. fix func calculateLegendOffsets in BarLineChartViewBase due to mistaking added back offsetBottom += xAxis.labelRotatedHeight. see #4277 for details now bar & horizontal bar chart tests should pass. * fix pie chart UT failures. didSet will no be called in init(), so we call it manually also fix set.valueFormatter in data setter * fix line chart UT failures * Remove `isIndirectValuesCall` * Bump Travis to Xcode 12 * Remove misuse of `count` (#4461) * Remove misuse of `count` * Fix protocol method name * Update ChartColorTemplates.swift use fallbackColor for `colorFromString()` * Revert "Update ChartColorTemplates.swift" This reverts commit b4111fd. Co-authored-by: Xuan <liuxuan30@gmail.com> * switch to source compiling swift code * fix Carthage error after changing to source compile. Carthage/Carthage#3019 there is a workaround mentioned [here](Carthage/Carthage#3019 (comment)) making travis to build from carthage.sh until the root issue is fixed. * update project settings * recreate iOS+tvOS images due to iOS14 SDK uncertain changes. * Remove unnecessary ternary in boolean expression (#4435) * Remove internal use of datasets (#4459) * Remove internal use of ChartData.dataSets * Rebased onto ResolveConflicts * Remove duplicated line Co-authored-by: jjatie <j.christie@icloud.com> Co-authored-by: ctran <chinh.tran@mail.de> Co-authored-by: larryonoff <larryonoff@gmail.com> Co-authored-by: Jacob Christie <jakechristie@dal.ca> Co-authored-by: Katalin Nagy <nagy.katalin@codespring.ro> Co-authored-by: Pierre-Marc Airoldi <pierremarcairoldi@gmail.com> Co-authored-by: Marshall Weir <marshall.weir@gmail.com> Co-authored-by: Jacob Christie <jacob.christie@kinduct.com> Co-authored-by: Jacob Christie <19879272+jjatie@users.noreply.github.com> Co-authored-by: Jacob Christie <jchristie@christie.teamspace.ad> Co-authored-by: BJ Miller <2272819+SixFiveSoftware@users.noreply.github.com>
* Remove java interface convention (ChartsOrg#2997) * Renamed `IMarker` to `Marker` following Swift API guidelines. * Renamed `IAxisValueFormatter` to `AxisValueFormatter` * Renamed `IFillFormatter` to `FillFormatter` * Renamed `IValueFormatter` to `ValueFormatter` * Renamed `IHighlighter` to `Highlighter` * Renamed `I*DataSet` to `*DataSetProtocol` to follow Swift API guidelines * Fixed naming of `LineRadarChartDataSetProtocol` and `RadarChartDataSetProtocol` from previous commit * Renamed "Interfaces" to "DataProviders" for clarity * Updated Demos to for new type naming * Renderer protocols (ChartsOrg#3136) * Renderer is now a protocol Renamed Renderers, and organized the Renderer folder. * DataRenderer is now a protocol * AxisRenderer is now a protocol * Chartviewbase redundant ivar (ChartsOrg#3045) * Fixed using wrong axis (Issue ChartsOrg#2257) * fix ChartsOrg#1830. credit from ChartsOrg#2049 (ChartsOrg#2874) * fix ChartsOrg#1830. credit from ChartsOrg#2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (ChartsOrg#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (ChartsOrg#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (ChartsOrg#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (ChartsOrg#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (ChartsOrg#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (ChartsOrg#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * ChartViewBase cleanup For the most part, condensing logic and using `guard` where appropriate Removed optionality of many internal variables as they were only optional to allow for deferred initialization. This is now replaced with lazy vars. Removed empty initializer overrides. `fileprivate` is now `private` * Removed redundant ivars In favour of proper access control * Fixes after merge * Renamed `animator` to `chartAnimator` on `ChartViewBase` to no conflict with `NSView`'s `animator()` method. * pulled latest master * Code style fix * Removed AxisRendererBase.swift * Fixed demos * BarChartRenderer Logic cleanup (ChartsOrg#3008) * Logic cleanup Mostly using guard where appropriate Few very minor performance improvements * Made use of `==` where appropriate to simplify logic * Returned fatalError message * Replaced `Buffer` class with simple typealias. There was only one instance where reference semantics might have be helpful, but was easily reimplemented with value semantics. * Syncing 4.0.0 with master (ChartsOrg#3160) * Fixed using wrong axis (Issue ChartsOrg#2257) * fix ChartsOrg#1830. credit from ChartsOrg#2049 (ChartsOrg#2874) * fix ChartsOrg#1830. credit from ChartsOrg#2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (ChartsOrg#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (ChartsOrg#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (ChartsOrg#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (ChartsOrg#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (ChartsOrg#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (ChartsOrg#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Minor cleanup to Highlighter types (ChartsOrg#3003) * Minor cleanup to Highlighter types * Fixes for PR * Pulled master and updated code style * added DataApproximator+N extension (ChartsOrg#2848) * added DataApproximator+N extension * fixed PR notes * Readded in missing files * Moved ChartUtils drawing methods into CGContext extension (ChartsOrg#3086) * Fixed using wrong axis (Issue ChartsOrg#2257) * fix ChartsOrg#1830. credit from ChartsOrg#2049 (ChartsOrg#2874) * fix ChartsOrg#1830. credit from ChartsOrg#2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (ChartsOrg#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (ChartsOrg#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (ChartsOrg#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (ChartsOrg#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (ChartsOrg#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (ChartsOrg#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Minor cleanup to Highlighter types (ChartsOrg#3003) * Minor cleanup to Highlighter types * Fixes for PR * Pulled master and updated code style * added DataApproximator+N extension (ChartsOrg#2848) * added DataApproximator+N extension * fixed PR notes * Moved drawing methods into CGContext extension Much nicer call sites. Renamed some parameter names. Removed `NSAttributedStringKey` where type inference was sufficient. Minor tidy of drawText calls in AxisRenderers * Pulled latest master * Pulled master * Fixed code style * Utils Cleanup (ChartsOrg#3054) * Cleanup Replaced unnecessary getters with proper access control Replaced unnecessary convenience inits with default parameters Minor refactoring * Pulled latest master * Pulled latest master * Pulled latest master * Fix after pulling master * Fixed using wrong axis (Issue ChartsOrg#2257) * fix ChartsOrg#1830. credit from ChartsOrg#2049 (ChartsOrg#2874) * fix ChartsOrg#1830. credit from ChartsOrg#2049 * add combined chart unit tests for iOS, tvOS (macOS only have build process) * use iterater rather than index * Removed redundant ivars in BarLineChartViewBase (ChartsOrg#3043) * Removed redundant ivars in favour of proper access control * Moved initialization of axes to their declaration to keep the same optionality exposed. * Update 4.0.0 with master (ChartsOrg#3135) * Replaced relevant `ChartUtils` methods with `Double` extensions (ChartsOrg#2994) * Replaced relevant `ChartUtils` methods with `Double` extensions Improves readability. `nextUp` is built in and provides the same functionality. * Updated `ChartUtilsTests` to match changes * add option to build demo projects unit tests on iOS (ChartsOrg#3121) * add option to build demo projects unit tests on iOS * add ChartsDemo-OSX build test. * Update ViewPortHandler.swift (ChartsOrg#3143) fix a small bug * Refactored ChartUtils method into CGPoint extension (ChartsOrg#3087) * Refactored ChartUtils method into CGPoint extension * Replaced ChartUtils.defaultValueFormatter() * Codestyle fixes * Finished cleanup * Pulled master * Chartdata collection conformance (ChartsOrg#3023) * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Updates for PR Also added remove subrange. * PR review fixes * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Relocated `appendEntry(_:todataSet:)` * Removed methods from CombinedChartData * weak -> unowned (ChartsOrg#3039) * weak -> unowned `ViewPortJob`s are owned by the Charts that make them. They are guaranteed to only exist while the chart exists. The `Transformer` and `ViewPortHandler` are supplied by the chart, so they will also only exist while the chart exists. Therefor none of them need to be `weak`, but can be `unowned` instead. It's a minor change in the code base (removing some guard statements), but it makes it much easier to discern how the framework is architected. * pulled latest master * Removed optionality from valueFormatter where appropriate (ChartsOrg#3106) * Removed optionality from valueFormatter where appropriate In ChartBaseDataSet, `valueFormatter` never returned nil, and escaped early if trying to set it to nil. It appears this was made optional solely to provide lazy initialization. We now use a lazy var instead. In AxisBase, the backing var `_axisValueFormatter` would never be treated as nil, and appears to be made optional solely to provide lazy initialization. We now use a lazy var instead. In `valueFormatter` we can remove the `nil` check, but leave it optional to keep the same functionality. * Pulled 4.0.0 * Pulled latest 4.0.0 * Fixed pro file * Chartdata collection refactor (ChartsOrg#3024) * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [ChartsOrg#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Removed unnecessary `get` from subscripts. * Removed redundant methods * Relocated `appendEntry(_:todataSet:)` * Removed methods from CombinedChartData * Moved the default value formatter (ChartsOrg#3088) * Moved the default value formatter It is now simply `DefaultValueFomatter()` Removed unnecessary backing ivars in `DefaultValuetFormatter` in favour of property observers Deprecated static func constructor in favour of initializer * Add option to rotate value text for line charts * Add value text rotation for bar charts * Add value text rotation for other charts * Fixed misuse/deprecation of "!" operator * Updated projects for Xcode 9.3 and Swift 4.1 added a workspace to include all demos with the project to make it easier to test changes * Pulled master * Moved travis to Xcode 9.3beta temporarily * Updated Rakefile for new project names * Updated demo imports * Rename valueRotationAngle -> valueLabelAngle * Make function private & remove line break * Refactored ChartData (ChartsOrg#3169) * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [ChartsOrg#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Updates for PR Also added remove subrange. * Refactored ChartData Removed redundancy from min/max logic. Lots of naming changes. Cleaner implementations. * PR review fixes * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Removed redundant methods * Relocated `appendEntry(_:todataSet:)` * pulled latest 4.0.0 * Disabled Collection support for CombinedChartData * Removed methods from CombinedChartData * Pulled latest 4.0 * Fixes after merge * Removed used of dataSet(forIndex:) * Fixed merge conflicts * Fixed merge conflicts * updated demos * Pulled latest 4.0.0 * Fixed demos * Fixed objective c demos * Moved travis to Xcode 9.3 beta temporarily * Fixed macOS demo info.plist and tv demo device name * PR Fixes * Fixed objective-c naming * PR Fixes * fix comment * Remove unnecessary file (ChartsOrg#3432) * Dataset logic cleanup (ChartsOrg#3001) * Cleaned up `ChartDataSet` logic Added TODOs for areas where simple changes can help improve Swift consistency. * Tidied up logic for `ChartDataSet` subclasses Minor changes to take advantage of Swift features and help improve readability. * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [ChartsOrg#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Pulled latest master * Pulled latest master * Updates for PR Also added remove subrange. * Refactored ChartData Removed redundancy from min/max logic. Lots of naming changes. Cleaner implementations. * PR review fixes * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Removed redundant methods * Relocated `appendEntry(_:todataSet:)` * pulled latest 4.0.0 * Disabled Collection support for CombinedChartData * Removed methods from CombinedChartData * Pulled latest 4.0 * Fixes after merge * Removed used of dataSet(forIndex:) * Fixed merge conflicts * Fixed merge conflicts * updated demos * Pulled latest 4.0.0 * Fixed demos * Fixed objective c demos * Moved travis to Xcode 9.3 beta temporarily * Fixed macOS demo info.plist and tv demo device name * PR Fixes * Fixed objective-c naming * PR Fixes * PR Fixes * Added gradient line drawing to LineChartRenderer * Stabilize and clean the code * Extract line drawing into function * Fix macOS build * Move `drawGradientLine` out of `drawLine` method * Remove unused parameters from `drawLine` function * Fix gradient location calculation * Add toggle gradient line into demo options * Improvements after code review * Code cleanup * Remove unnecessary function for generating gradient line - additional code optimizations * Fix: gradient lines peaks are truncated when line width > 1 * Make legendRenderer property public in order to be externally customizable * fix build issue in objc demo * Add minimum slice angle for value labels to PieChartView * Rename drawSliceTextMinimumAngle to sliceTextDrawingThreshold * Fix sliceTextDrawingThreshold renaming in demo * fix build of demos * Add label colors to legend entries (ChartsOrg#3558) * add label colors to legend entries * Change interface of LegendEntry * Add Swift version 4.1 to podspec * Turned gradient components and locations into constants (ChartsOrg#3775) * Cleaned up `ChartDataSet` logic Added TODOs for areas where simple changes can help improve Swift consistency. * Added Collection conformances MutableCollection RandomAccessCollection RangeReplaceableCollection * [ChartsOrg#3018] Refactored use of `ChartData` to use new `Collection` conformances * Fixed required initializers * ChartData adopts ExressibleByArrayLiteral * Modified demos to take advantage of collection conformance. * Pulled latest master * Unified Style Replaced custom algorithms with built-in ones Made axis renderer implementations feel "Swift-ier" * Updates for PR Also added remove subrange. * Refactored ChartData Removed redundancy from min/max logic. Lots of naming changes. Cleaner implementations. * Fixed horizontal barchart bug, * Removed unnecessary `get` from subscripts. * Disabled `remove(at:)` for CombinedChartView * Relocated `appendEntry(_:todataSet:)` * Disabled Collection support for CombinedChartData * Removed used of dataSet(forIndex:) * Fixed merge conflicts * updated demos * PR Fixes * Fixed axisLabels calculation * Fill rewrite (ChartsOrg#3084) close ChartsOrg#3140 * Fill is now a protocol Different fill logic is broken up into separate classes. This has a few benefits: 1. It makes the `Fill` types more readable (logic is grouped together) 2. No optionals 3. Most importantly it allows consumers to create new Fill types without looking into the framework. * Added super.init() for objc * Updated Fill access No need to subclass existing fills now that the system is more flexible. If functionality is needed from another fill, user can call it within their own `fillPath(context: CGContext, rect: CGRect)` implementation. * Updated Fill Names * Update Fill.swift update code style Co-authored-by: Jacob Christie <jchristie@christie.teamspace.ad> Co-authored-by: Xuan <liuxuan30@gmail.com> * update to Swift 5, Xcode 13.5.1, and fix warnings * fix all compile errors and wrong symbols either by git or me. * revert back to convenience init for BarChartDataSet fix ChartDataTests compile errors: use new API dataSet(forLabel:, ignorecase: ) * actually, I compared the old master and find this is a mistake while merging to make init(label:) in BarChartDataSet. It should be in ChartDataSet. * fix -0.0 issue in 4.0 merge. fix func calculateLegendOffsets in BarLineChartViewBase due to mistaking added back offsetBottom += xAxis.labelRotatedHeight. see ChartsOrg#4277 for details now bar & horizontal bar chart tests should pass. * fix pie chart UT failures. didSet will no be called in init(), so we call it manually also fix set.valueFormatter in data setter * fix line chart UT failures * Remove `isIndirectValuesCall` * Bump Travis to Xcode 12 * Remove misuse of `count` (ChartsOrg#4461) * Remove misuse of `count` * Fix protocol method name * Update ChartColorTemplates.swift use fallbackColor for `colorFromString()` * Revert "Update ChartColorTemplates.swift" This reverts commit b4111fd. Co-authored-by: Xuan <liuxuan30@gmail.com> * switch to source compiling swift code * fix Carthage error after changing to source compile. Carthage/Carthage#3019 there is a workaround mentioned [here](Carthage/Carthage#3019 (comment)) making travis to build from carthage.sh until the root issue is fixed. * update project settings * recreate iOS+tvOS images due to iOS14 SDK uncertain changes. * Remove unnecessary ternary in boolean expression (ChartsOrg#4435) * Remove internal use of datasets (ChartsOrg#4459) * Remove internal use of ChartData.dataSets * Rebased onto ResolveConflicts * Remove duplicated line Co-authored-by: jjatie <j.christie@icloud.com> Co-authored-by: ctran <chinh.tran@mail.de> Co-authored-by: larryonoff <larryonoff@gmail.com> Co-authored-by: Jacob Christie <jakechristie@dal.ca> Co-authored-by: Katalin Nagy <nagy.katalin@codespring.ro> Co-authored-by: Pierre-Marc Airoldi <pierremarcairoldi@gmail.com> Co-authored-by: Marshall Weir <marshall.weir@gmail.com> Co-authored-by: Jacob Christie <jacob.christie@kinduct.com> Co-authored-by: Jacob Christie <19879272+jjatie@users.noreply.github.com> Co-authored-by: Jacob Christie <jchristie@christie.teamspace.ad> Co-authored-by: BJ Miller <2272819+SixFiveSoftware@users.noreply.github.com>
* 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>
This implementation does not require tolerance for approximation and takes number of resulting points as parameter instead.
Uses modified Douglas-Peucker algorithm described here - http://psimpl.sourceforge.net/douglas-peucker.html