diff --git a/.gitignore b/.gitignore index 2e85c41c045..c578499374c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,10 @@ -Pods .DS_Store -build -DerivedData - -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata/ -*.moved-aside -*.xccheckout -*.xcscmblueprint - -timeline.xctimeline -playground.xcworkspace +Pods +Carthage/Build/ +build +xcuserdata -.build Stats.dmg Stats.app create-dmg \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 60bffc76ceb..59fc105224b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ # Changelog All notable changes to this project will be documented in this file. +### [v1.3.0] + - CPU hyperthreading mode disabled by default in bar chart widget + - added view for CPU module + - added view for Memory module + - added view for Battery module + - changed the menu item with preferences to list + - improved widgets draw algorithm + - implemented view for modules with charts and some information + - moved from own implementation to LauncAtLogin library + - fixed a lot of bugs + ### [v1.2.13] - changed version checker logic @@ -81,6 +92,7 @@ All notable changes to this project will be documented in this file. ### [v1.0.0] - first release +[v1.3.0]: https://github.com/exelban/stats/releases/tag/v1.3.0 [v1.2.13]: https://github.com/exelban/stats/releases/tag/v1.2.13 [v1.2.12]: https://github.com/exelban/stats/releases/tag/v1.2.12 [v1.2.11]: https://github.com/exelban/stats/releases/tag/v1.2.11 diff --git a/Cartfile b/Cartfile new file mode 100644 index 00000000000..ea251114108 --- /dev/null +++ b/Cartfile @@ -0,0 +1,2 @@ +github "sindresorhus/LaunchAtLogin" +github "danielgindi/Charts" ~> 3.3.0 \ No newline at end of file diff --git a/Cartfile.resolved b/Cartfile.resolved new file mode 100644 index 00000000000..c9d31569b6d --- /dev/null +++ b/Cartfile.resolved @@ -0,0 +1,2 @@ +github "danielgindi/Charts" "v3.3.0" +github "sindresorhus/LaunchAtLogin" "v2.5.0" diff --git a/Carthage/Checkouts/Charts/.github/ISSUE_TEMPLATE.md b/Carthage/Checkouts/Charts/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000000..1878f561b18 --- /dev/null +++ b/Carthage/Checkouts/Charts/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,33 @@ +> ℹ Please fill out this template when filing an issue. +> All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info. +> +> Per our [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md), we use GitHub for +> bugs and feature requests, not general support. Other issues should be opened on Stack Overflow with the tag [`ios-charts`.](https://stackoverflow.com/questions/tagged/ios-charts) +> +> Please remove this line and everything above it before submitting. + +* [ ] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md). + +## What did you do? + +ℹ Please replace this with what you did. + +## What did you expect to happen? + +ℹ Please replace this with what you expected to happen. + +## What happened instead? + +ℹ Please replace this with of what happened instead. + +## Charts Environment + +**Charts version/Branch/Commit Number:** +**Xcode version:** +**Swift version:** +**Platform(s) running Charts:** +**macOS version running Xcode:** + +## Demo Project + +ℹ Please link to or upload a project we can download that reproduces the issue. diff --git a/Carthage/Checkouts/Charts/.github/PULL_REQUEST_TEMPLATE.md b/Carthage/Checkouts/Charts/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000000..30eee845614 --- /dev/null +++ b/Carthage/Checkouts/Charts/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,13 @@ +### Issue Link :link: + + +### Goals :soccer: + + + +### Implementation Details :construction: + + + +### Testing Details :mag: + \ No newline at end of file diff --git a/Carthage/Checkouts/Charts/.gitignore b/Carthage/Checkouts/Charts/.gitignore new file mode 100644 index 00000000000..8ba8e0ead7b --- /dev/null +++ b/Carthage/Checkouts/Charts/.gitignore @@ -0,0 +1,74 @@ +# OS X +.DS_Store + +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData/ + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.xccheckout +*.moved-aside +*.xcuserstate + +## Obj-C/Swift specific +DerivedData +*.hmap +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +.build/ +project.xcworkspace + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +Carthage +Charts.framework.zip +ChartsRealm.framework.zip diff --git a/Carthage/Checkouts/Charts/.travis.yml b/Carthage/Checkouts/Charts/.travis.yml new file mode 100644 index 00000000000..9f8be9f73b6 --- /dev/null +++ b/Carthage/Checkouts/Charts/.travis.yml @@ -0,0 +1,25 @@ +language: objective-c +osx_image: xcode10 +matrix: + include: + - osx_image: xcode10.2 + env: PLATFORM="iOS" + - osx_image: xcode10.2 + env: PLATFORM="tvOS" + - osx_image: xcode10.2 + env: PLATFORM="macOS" +env: + global: + - LANG=en_US.UTF-8 + - secure: HRl5Cg3/LmTJYCSDGtV8Fiqf6OgWXR6C5YkNviOElU9YmcCTvnmE7MCm+gK8hJNIQ2mWCBTlxTC7jJxeYlx0D+JQ6IhRc75B4zXgbtth6HCzlvhWDcBbNU/K+JPDjy2EAoVgvf8Xseq6GqM4WcVg2Pwr9PS3aaH/SKDE6yVoPXRM2wXRAxIdxayqm/RQgG88jAKgg+Ub5DKW/c9NLLbUf/WdY9SgQDJtqeZCMv7G3/IzW34KZgVPsqSrPByzZXbf7KgYkYLQlscH4mcUctk1qxhdCae//zcgUZo/utpXWbPXQqtvDpuqrg9IRvoGxa/D1I7dLSJsVnk4aP7RW18vn4HJ82C2AiEp+lU2TQE9y5lXcGssZVIa5aZNTWL90HVer3Kg6AnHffvdCSZ/UHsMZJFURUXL9fRIlWVGuEDeQOqlV6lUmEtp/BiEdV4D5PuCyT6snsmEwkc51goyqh6uS6XhJyqYEQdxdoybznwp91tVmASsRybppIGHTkcWN5csF4zQt40tEwd8LoqM+bBUo0wxKiKsNsecL4JA+YDYs2saZY9U3s8jAaIon+qDu071fPRaPEvBhYHYDhy4cTvBXibyGUYGHkrgLu0w19wDfHcJKt2In58yOmaCCLNoTGp/ZLNVRyZ8VDlj/NdJ2dWpMsL2Aj7OxU065kCL2FlvuRU= +cache: + - bundler +before_install: + - brew update + - brew upgrade carthage || true + - carthage version + - carthage bootstrap --platform $PLATFORM +script: + - bundle exec rake ci[$PLATFORM] +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/Carthage/Checkouts/Charts/Assets/feature_graphic.png b/Carthage/Checkouts/Charts/Assets/feature_graphic.png new file mode 100644 index 00000000000..ba0a65998d2 Binary files /dev/null and b/Carthage/Checkouts/Charts/Assets/feature_graphic.png differ diff --git a/Carthage/Checkouts/Charts/Assets/feature_graphic.psd b/Carthage/Checkouts/Charts/Assets/feature_graphic.psd new file mode 100644 index 00000000000..0ac018dc069 Binary files /dev/null and b/Carthage/Checkouts/Charts/Assets/feature_graphic.psd differ diff --git a/Carthage/Checkouts/Charts/CHANGELOG.md b/Carthage/Checkouts/Charts/CHANGELOG.md new file mode 100644 index 00000000000..e45f888907e --- /dev/null +++ b/Carthage/Checkouts/Charts/CHANGELOG.md @@ -0,0 +1,3553 @@ +# Change Log + +## [v3.3](https://github.com/danielgindi/Charts/tree/v3.3) (2019-04-15) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v3.2.2...v3.3) + +**Implemented enhancements:** + +- Renamed `values` to `entries` to reflect the property's type [\#3847](https://github.com/danielgindi/Charts/pull/3847) ([jjatie](https://github.com/jjatie)) + +**Fixed bugs:** + +- Pie chart with vertical orientation clips last legend entry [\#3860](https://github.com/danielgindi/Charts/issues/3860) + +**Closed issues:** + +- the first point of LineChartView is not displayed, and so is demo [\#3938](https://github.com/danielgindi/Charts/issues/3938) +- How can i get CenterEntry in the View when i setted the MaxVisibleRange? [\#3925](https://github.com/danielgindi/Charts/issues/3925) +- EXC\_BAD\_ACCESS error on PieChart [\#3923](https://github.com/danielgindi/Charts/issues/3923) +- The first dot doesn't show up when I use lineChart [\#3915](https://github.com/danielgindi/Charts/issues/3915) +- Swift 5 Support w/ Cocoapods [\#3913](https://github.com/danielgindi/Charts/issues/3913) +- HOW to create pie chart like below image . https://user-images.githubusercontent.com/20434573/54804603-1d31fa80-4c9a-11e9-9960-00cf7c7d117d.png [\#3908](https://github.com/danielgindi/Charts/issues/3908) +- x Axis grid line origin is wrong ! maybe a bug, anxious!!! [\#3904](https://github.com/danielgindi/Charts/issues/3904) +- why not use CAShapeLayer? [\#3903](https://github.com/danielgindi/Charts/issues/3903) +- Chart legend [\#3896](https://github.com/danielgindi/Charts/issues/3896) +- Wrong values from pixelForValues [\#3895](https://github.com/danielgindi/Charts/issues/3895) +- Cannot set labels for RadarChart [\#3893](https://github.com/danielgindi/Charts/issues/3893) +- I can't migrate the swift files\(combined chart\) in objective c project. Could please share the objective c code fully. Thanks in advance. [\#3890](https://github.com/danielgindi/Charts/issues/3890) +- Draw circle only on last value [\#3887](https://github.com/danielgindi/Charts/issues/3887) +- Mismatch left axis maximum and minimum values [\#3886](https://github.com/danielgindi/Charts/issues/3886) +- How to animate? start poisiton is not from zero. [\#3885](https://github.com/danielgindi/Charts/issues/3885) +- I want to change line chart fill colours [\#3882](https://github.com/danielgindi/Charts/issues/3882) +- Circle view is not showing for first point of line chart [\#3881](https://github.com/danielgindi/Charts/issues/3881) +- support ECG demo? [\#3880](https://github.com/danielgindi/Charts/issues/3880) +- How to remove the values given outside the circle in piechart [\#3878](https://github.com/danielgindi/Charts/issues/3878) +- file was built for x86\_64 which is not the architecture being linked \(arm64\):error: linker command failed with exit code 1 \(use -v to see invocation\) [\#3877](https://github.com/danielgindi/Charts/issues/3877) +- Clipping first and last circle from line chart IOS. [\#3873](https://github.com/danielgindi/Charts/issues/3873) +- Smoothly moving a slowly changing linechart [\#3859](https://github.com/danielgindi/Charts/issues/3859) +- Monthly X-Axis labels \(corresponding values\) in my LineChart are not at the right position [\#3858](https://github.com/danielgindi/Charts/issues/3858) +- CandleChart do not render the first candle in CombineChartView [\#3857](https://github.com/danielgindi/Charts/issues/3857) +- Have 2 or more tresholds for one graph [\#3856](https://github.com/danielgindi/Charts/issues/3856) +- Unexpected crash on 3.2.2 [\#3855](https://github.com/danielgindi/Charts/issues/3855) +- How to change the display of legends? [\#3853](https://github.com/danielgindi/Charts/issues/3853) +- I want to call a method after the chart has been dragged and stopped. How can I detect it and the chart has stopped? [\#3851](https://github.com/danielgindi/Charts/issues/3851) +- HorizontalBarChartView bar negative values position [\#3850](https://github.com/danielgindi/Charts/issues/3850) +- charts 有数据创建图表后,点击按钮将数据置为空则崩溃 [\#3849](https://github.com/danielgindi/Charts/issues/3849) +- No circle is drawn on a line chart when there is only one data. \(version 3.2.2 only\) [\#3848](https://github.com/danielgindi/Charts/issues/3848) +- slice color [\#3844](https://github.com/danielgindi/Charts/issues/3844) +- BarChartView showing consecutive values in xAxis [\#3843](https://github.com/danielgindi/Charts/issues/3843) +- How to hide those icons? [\#3842](https://github.com/danielgindi/Charts/issues/3842) +- Swift 4.2: 'values' is deprecated Warnings [\#3840](https://github.com/danielgindi/Charts/issues/3840) +- Y-axis values draw error [\#3837](https://github.com/danielgindi/Charts/issues/3837) +- Horizontal Bar Chart Value Labels Cut Off [\#3836](https://github.com/danielgindi/Charts/issues/3836) +- The right Y axis displays incorrect values that does not fit the chart [\#3835](https://github.com/danielgindi/Charts/issues/3835) +- How to align labels on left side and put values inside bars on HorizontalBarChartView? \[HELP WANTED\] [\#3833](https://github.com/danielgindi/Charts/issues/3833) +- How to show the tooltip like value when clicked on candle of candleStick chart [\#3832](https://github.com/danielgindi/Charts/issues/3832) +- In line chart, can I make all labels in Chart area even with changing yOffset? [\#3829](https://github.com/danielgindi/Charts/issues/3829) +- Multiline value labels on BarChart. [\#3826](https://github.com/danielgindi/Charts/issues/3826) +- how can I spin the selected slice of piechart to top. [\#3825](https://github.com/danielgindi/Charts/issues/3825) +- Update Cocoapods [\#3773](https://github.com/danielgindi/Charts/issues/3773) +- Select circles on line chart [\#3307](https://github.com/danielgindi/Charts/issues/3307) + +**Merged pull requests:** + +- Fix horizontal bar chart not drawing values and add unit tests [\#3906](https://github.com/danielgindi/Charts/pull/3906) ([liuxuan30](https://github.com/liuxuan30)) +- fix \#3860. maxHeight didn't count the last label [\#3900](https://github.com/danielgindi/Charts/pull/3900) ([liuxuan30](https://github.com/liuxuan30)) +- Migrating to built-in algorithms [\#3892](https://github.com/danielgindi/Charts/pull/3892) ([jjatie](https://github.com/jjatie)) +- Use a stock iterator instead of a custom one. [\#3891](https://github.com/danielgindi/Charts/pull/3891) ([phughes](https://github.com/phughes)) +- Removed unnecessary \#if statements and unified style to align with Xc… [\#3884](https://github.com/danielgindi/Charts/pull/3884) ([jjatie](https://github.com/jjatie)) +- Velocity samples calculation [\#3883](https://github.com/danielgindi/Charts/pull/3883) ([jjatie](https://github.com/jjatie)) +- Minor updates for Swift 5 [\#3874](https://github.com/danielgindi/Charts/pull/3874) ([jjatie](https://github.com/jjatie)) +- Replace AnyObject with Any [\#3864](https://github.com/danielgindi/Charts/pull/3864) ([jjatie](https://github.com/jjatie)) +- Data as any [\#3863](https://github.com/danielgindi/Charts/pull/3863) ([jjatie](https://github.com/jjatie)) +- Reassess convenience initializers [\#3862](https://github.com/danielgindi/Charts/pull/3862) ([jjatie](https://github.com/jjatie)) +- HorizontalBarChar value label offset calculation [\#3854](https://github.com/danielgindi/Charts/pull/3854) ([chaaarly](https://github.com/chaaarly)) +- Create `chartViewDidEndAnimate` in ChartViewDelegate [\#3852](https://github.com/danielgindi/Charts/pull/3852) ([Lcsmarcal](https://github.com/Lcsmarcal)) +- Align `ChartLimit.LabelPosition` naming with `UIRectCorner` [\#3846](https://github.com/danielgindi/Charts/pull/3846) ([jjatie](https://github.com/jjatie)) + +## [v3.2.2](https://github.com/danielgindi/Charts/tree/v3.2.2) (2019-02-13) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v3.2.1...v3.2.2) + +**Implemented enhancements:** + +- 【PieChart】Please support multiple colors for valueline. [\#3480](https://github.com/danielgindi/Charts/issues/3480) + +**Fixed bugs:** + +- CombinedChartView's candleData don't display in v3.2.0 [\#3662](https://github.com/danielgindi/Charts/issues/3662) +- Incorrect behavior for AxisBase.axisMaxLabels [\#3656](https://github.com/danielgindi/Charts/issues/3656) +- Horizontal Bar Chart legend issue [\#3301](https://github.com/danielgindi/Charts/issues/3301) + +**Closed issues:** + +- barchartview draw value in bottom of chart [\#3827](https://github.com/danielgindi/Charts/issues/3827) +- Regarding to label of axis, I think it displays .03 instead of 0.03 [\#3824](https://github.com/danielgindi/Charts/issues/3824) +- Bar Chart Not Showing Colours Correctly [\#3823](https://github.com/danielgindi/Charts/issues/3823) +- Pie Chart on click show value on label. Does anyone know how to do it? [\#3822](https://github.com/danielgindi/Charts/issues/3822) +- chartTranslated in a Pie Chart is not called [\#3821](https://github.com/danielgindi/Charts/issues/3821) +- Issue creating a simple line chart [\#3820](https://github.com/danielgindi/Charts/issues/3820) +- How to save image of scrollable graph [\#3819](https://github.com/danielgindi/Charts/issues/3819) +- Candle charts not showing candles on swift 4.2 [\#3818](https://github.com/danielgindi/Charts/issues/3818) +- How to get a value from line graph if there is more than one lines [\#3817](https://github.com/danielgindi/Charts/issues/3817) +- Multiple colors for the same line [\#3816](https://github.com/danielgindi/Charts/issues/3816) +- Memory Leaks in subclass of LineChartView [\#3813](https://github.com/danielgindi/Charts/issues/3813) +- Distortion When Animating Height of Auto Layout `LineChartView` [\#3811](https://github.com/danielgindi/Charts/issues/3811) +- How to show break in line chart for more than one graph? [\#3810](https://github.com/danielgindi/Charts/issues/3810) +- PIE Chart Colors not properly set [\#3809](https://github.com/danielgindi/Charts/issues/3809) +- A Question to contribution [\#3808](https://github.com/danielgindi/Charts/issues/3808) +- When y value is equal ,HorizontalBarChartView only show integer [\#3806](https://github.com/danielgindi/Charts/issues/3806) +- Highlight per drag not working! [\#3805](https://github.com/danielgindi/Charts/issues/3805) +- chartTranslated is called when no translation happened [\#3803](https://github.com/danielgindi/Charts/issues/3803) +- Xcode10 real machine operation error! [\#3802](https://github.com/danielgindi/Charts/issues/3802) +- Bar Width issue after reset the data [\#3801](https://github.com/danielgindi/Charts/issues/3801) +- Performance issue: drawCircles\(context: CGContext\) in LineChart [\#3798](https://github.com/danielgindi/Charts/issues/3798) +- LineChartView Y-Aixs label'number inaccuracy [\#3794](https://github.com/danielgindi/Charts/issues/3794) +- charts在特定范围内的参考坐标精度问题 [\#3793](https://github.com/danielgindi/Charts/issues/3793) +- Change chart legend show order [\#3791](https://github.com/danielgindi/Charts/issues/3791) +- hello,I don't want to display the pie chart by zero percent. How can I do this [\#3790](https://github.com/danielgindi/Charts/issues/3790) +- how to center legend text of LineChartView? [\#3789](https://github.com/danielgindi/Charts/issues/3789) +- How to Plot only for the available x axis and leave the rest of the x axis blank? [\#3788](https://github.com/danielgindi/Charts/issues/3788) +- Custom chart marker [\#3787](https://github.com/danielgindi/Charts/issues/3787) +- How to shift xAxis values to right? [\#3785](https://github.com/danielgindi/Charts/issues/3785) +- How to disable Accessibility support? [\#3782](https://github.com/danielgindi/Charts/issues/3782) +- Feature: Add option to draw limit lines on top of data [\#3781](https://github.com/danielgindi/Charts/issues/3781) +- Legend spacing issue with LineChart and colors\[\] [\#3780](https://github.com/danielgindi/Charts/issues/3780) +- How to change value line length for each value in pieChartView [\#3776](https://github.com/danielgindi/Charts/issues/3776) +- Crash on the function isDrawingValuesAllowed [\#3772](https://github.com/danielgindi/Charts/issues/3772) +- How to let y axis line show same space when axisMinimum = 0? [\#3771](https://github.com/danielgindi/Charts/issues/3771) +- Xcode 10.1 pod install Charts open project error!!! [\#3769](https://github.com/danielgindi/Charts/issues/3769) +- Is it possible to make some gaps on a same line plot? [\#3765](https://github.com/danielgindi/Charts/issues/3765) +- Is it possible to draw custom shape on chart and handle touch on it [\#3763](https://github.com/danielgindi/Charts/issues/3763) +- Start slice automatically seleted in pie chart [\#3762](https://github.com/danielgindi/Charts/issues/3762) +- How to change color when press down on pie chart? [\#3761](https://github.com/danielgindi/Charts/issues/3761) +- notifyDataSetChanged\(\) crash when datapoint is highlighted in LineChartView [\#3759](https://github.com/danielgindi/Charts/issues/3759) +- BarChartView display half in first bar when change from group bar to bar only [\#3757](https://github.com/danielgindi/Charts/issues/3757) +- Description of Bar doesn't appear in Horizontal BarChartView [\#3756](https://github.com/danielgindi/Charts/issues/3756) +- Chart spacing between xAxis Labels [\#3755](https://github.com/danielgindi/Charts/issues/3755) +- Granularity makes my app crash because require index from zero [\#3753](https://github.com/danielgindi/Charts/issues/3753) +- this counter will make your app being crash in particular case [\#3752](https://github.com/danielgindi/Charts/issues/3752) +- Bar Chart Drawing is wrong without setting axisminimum [\#3751](https://github.com/danielgindi/Charts/issues/3751) +- Help needed - in changing the position for Piechart in SWIFT [\#3749](https://github.com/danielgindi/Charts/issues/3749) +- When using CombinedChartView, CandleChartData cannot be displayed [\#3748](https://github.com/danielgindi/Charts/issues/3748) +- Linear chart line with different thickness of direction [\#3746](https://github.com/danielgindi/Charts/issues/3746) +- I want to try a lot of line charts corresponding to the X axis is different, how can I achieve it. [\#3745](https://github.com/danielgindi/Charts/issues/3745) +- 折线图-具体时间的数据绘制进图表问题 [\#3743](https://github.com/danielgindi/Charts/issues/3743) +- Changing lineCap doesn't work when mode is not linear/stepped [\#3739](https://github.com/danielgindi/Charts/issues/3739) +- Reverse Pie Chart animation [\#3738](https://github.com/danielgindi/Charts/issues/3738) +- How to create y-axis for empty label ? [\#3735](https://github.com/danielgindi/Charts/issues/3735) +- Different colors for above and below 0 when filling a Line Chart [\#3733](https://github.com/danielgindi/Charts/issues/3733) +- How to adding multiple lines to Line Chart for swift 4.0? [\#3732](https://github.com/danielgindi/Charts/issues/3732) +- How to format y-values drawn on bar? [\#3731](https://github.com/danielgindi/Charts/issues/3731) +- how to moveViewToX and not calling setNeedsDisplay\(\) [\#3730](https://github.com/danielgindi/Charts/issues/3730) +- When using CombinedChartView, CandleChartData cannot be displayed [\#3729](https://github.com/danielgindi/Charts/issues/3729) +- Need Help. How to show labels in xAxis for GroupedBarChart? [\#3728](https://github.com/danielgindi/Charts/issues/3728) +- Force axis granularity [\#3727](https://github.com/danielgindi/Charts/issues/3727) +- Y decimal values error [\#3725](https://github.com/danielgindi/Charts/issues/3725) +- if i have 840entrys how can i set the xaxis what i want .e.g i only want to show the 0 and 840 [\#3723](https://github.com/danielgindi/Charts/issues/3723) +- if i have 840entrys how can i set the xaxis what i want .e.g i only want to show the 0 and 840 [\#3722](https://github.com/danielgindi/Charts/issues/3722) +- Align both right and left axis in the same line [\#3720](https://github.com/danielgindi/Charts/issues/3720) +- The `open var noDataTextAlignment: NSTextAlignment = .left` is missing the `@objc` so it's not exposed in Objective C. [\#3719](https://github.com/danielgindi/Charts/issues/3719) +- How to hide bottom colors & label section in Bar Chat [\#3718](https://github.com/danielgindi/Charts/issues/3718) +- Draw Line chart for non linear X-axis [\#3717](https://github.com/danielgindi/Charts/issues/3717) +- Any way to adjust the candle bar width? [\#3716](https://github.com/danielgindi/Charts/issues/3716) +- xAxis grid line in-between bar rather than center of bar [\#3713](https://github.com/danielgindi/Charts/issues/3713) +- Bubble Chart is not rendering [\#3711](https://github.com/danielgindi/Charts/issues/3711) +- Bubble Chart is not rendering [\#3710](https://github.com/danielgindi/Charts/issues/3710) +- \[Feature request\] Continue line chart beyond x-axis limits [\#3708](https://github.com/danielgindi/Charts/issues/3708) +- Use of unresolved identifier 'UIAccessibility' & Type 'UIAccessibilityTraits' \(aka 'UInt64'\) has no member 'header' [\#3707](https://github.com/danielgindi/Charts/issues/3707) +- How to draw a line chart in sections? [\#3706](https://github.com/danielgindi/Charts/issues/3706) +- \[Feature / Help\] Resize Chart based on data visibility [\#3705](https://github.com/danielgindi/Charts/issues/3705) +- \[Request / Help\] Resize Chart based on hidden / shown lines [\#3704](https://github.com/danielgindi/Charts/issues/3704) +- listening for click events in pieChartView [\#3703](https://github.com/danielgindi/Charts/issues/3703) +- How to add Strings on Left Axis in iOS-charts? [\#3702](https://github.com/danielgindi/Charts/issues/3702) +- \[Charts.BarChartDataSet setDrawIconsEnabled:\]: unrecognized selector sent to instance [\#3700](https://github.com/danielgindi/Charts/issues/3700) +- How can I set xAxis to second line? [\#3698](https://github.com/danielgindi/Charts/issues/3698) +- Add to OC project and the api is so big, How to solve this problem [\#3697](https://github.com/danielgindi/Charts/issues/3697) +- How can I call func stringForValue\(\_ value: Double, axis: AxisBase?\) -\> String [\#3696](https://github.com/danielgindi/Charts/issues/3696) +- Line chart, slide left and right to see more data? How to set it up [\#3693](https://github.com/danielgindi/Charts/issues/3693) +- Value for SWIFT\_VERSION cannot be empty. \(in target 'Charts'\) [\#3692](https://github.com/danielgindi/Charts/issues/3692) +- how to make a combine chart \(line chart + bar chart\) with leftAxis taking the top half area of the combined graph and right axis taking the bottom half [\#3690](https://github.com/danielgindi/Charts/issues/3690) +- is there any library for Gantt chart in ios swift ? please suggest me a solution..... [\#3688](https://github.com/danielgindi/Charts/issues/3688) +- Integrated to xcode10 crash [\#3687](https://github.com/danielgindi/Charts/issues/3687) +- XCode 10 app crash. [\#3686](https://github.com/danielgindi/Charts/issues/3686) +- Getting Errors in Xcode 9.2 [\#3684](https://github.com/danielgindi/Charts/issues/3684) +- How to show double vale with string in y-axis [\#3683](https://github.com/danielgindi/Charts/issues/3683) +- When I have a lot of data, how can I slide to the far right by default? [\#3682](https://github.com/danielgindi/Charts/issues/3682) +- Pie Chart - Slices are not drawn and values are overlapping [\#3679](https://github.com/danielgindi/Charts/issues/3679) +- setVisibleXRangeMaximum is behaving unexpectedly [\#3678](https://github.com/danielgindi/Charts/issues/3678) +- Getting issues after pod update. [\#3677](https://github.com/danielgindi/Charts/issues/3677) +- Pie chart and gradient [\#3674](https://github.com/danielgindi/Charts/issues/3674) +- CandleStickChartRenderer drawDataSet method does not work with CombinedChartView [\#3673](https://github.com/danielgindi/Charts/issues/3673) +- How to Hide Text? [\#3672](https://github.com/danielgindi/Charts/issues/3672) +- Memory leaks were detected also in the demo project [\#3671](https://github.com/danielgindi/Charts/issues/3671) +- Can't add two pie charts in a uiviewcontroller at same time [\#3670](https://github.com/danielgindi/Charts/issues/3670) +- ChartData ValueTextColor can not achieve a variety of colors [\#3669](https://github.com/danielgindi/Charts/issues/3669) +- PieChartView settings color is Invalid [\#3668](https://github.com/danielgindi/Charts/issues/3668) +- DrawValuesEnabled variable unreachable \(Swift 4.2\) [\#3665](https://github.com/danielgindi/Charts/issues/3665) +- Failed to verify bitcode in Charts.framework [\#3663](https://github.com/danielgindi/Charts/issues/3663) +- \[3.2.0\] Excessive Memory leaks in Swift 4.2 related to LineChartView, not present in 3.1.1 w/Swift 4 [\#3649](https://github.com/danielgindi/Charts/issues/3649) +- BarChart - xAxis Labels disappear if not a min of 2 on the screen [\#2854](https://github.com/danielgindi/Charts/issues/2854) +- 柱状图一直横向拉伸, 持续差不多 15s 就崩溃了 [\#2642](https://github.com/danielgindi/Charts/issues/2642) +- Any one try to integrate with SpriteKit/SKScene ? [\#2129](https://github.com/danielgindi/Charts/issues/2129) + +**Merged pull requests:** + +- Add Collection conformances to ChartDataSet types [\#3815](https://github.com/danielgindi/Charts/pull/3815) ([jjatie](https://github.com/jjatie)) +- Fix condition that is checked before `chartTranslated` delegate method call [\#3804](https://github.com/danielgindi/Charts/pull/3804) ([anton-filimonov](https://github.com/anton-filimonov)) +- fix \#3719 [\#3778](https://github.com/danielgindi/Charts/pull/3778) ([liuxuan30](https://github.com/liuxuan30)) +- Turned gradient components and locations into constants [\#3775](https://github.com/danielgindi/Charts/pull/3775) ([jjatie](https://github.com/jjatie)) +- add chartScaled\(\) call after double tap in BarLineChartViewBase [\#3770](https://github.com/danielgindi/Charts/pull/3770) ([artemiusmk](https://github.com/artemiusmk)) +- Fixes sharp edges on the line chart [\#3764](https://github.com/danielgindi/Charts/pull/3764) ([stokatyan](https://github.com/stokatyan)) +- Fix applying lineCap value for line chart data sets \(Fixes \#3739\) [\#3740](https://github.com/danielgindi/Charts/pull/3740) ([anton-filimonov](https://github.com/anton-filimonov)) +- Update README.md [\#3737](https://github.com/danielgindi/Charts/pull/3737) ([justinlew](https://github.com/justinlew)) +- Fix legend offset bug for horizontal bar chart \(Fixes \#3301\) [\#3736](https://github.com/danielgindi/Charts/pull/3736) ([SvenMuc](https://github.com/SvenMuc)) +- Fix wrong assignment to axisMaxLabels property [\#3721](https://github.com/danielgindi/Charts/pull/3721) ([ggirotto](https://github.com/ggirotto)) +- Add missing properties to copy\(with:\) methods [\#3715](https://github.com/danielgindi/Charts/pull/3715) ([dstranz](https://github.com/dstranz)) +- Multiple colors for valueline \(Fixes \#3480\) [\#3709](https://github.com/danielgindi/Charts/pull/3709) ([AlexeiGitH](https://github.com/AlexeiGitH)) +- Fix memory leak after rendering [\#3680](https://github.com/danielgindi/Charts/pull/3680) ([YusukeOba](https://github.com/YusukeOba)) +- fix issue \#3662 [\#3664](https://github.com/danielgindi/Charts/pull/3664) ([Michael-Du](https://github.com/Michael-Du)) +- Make NSUIAccessibilityElement initializer public. [\#3654](https://github.com/danielgindi/Charts/pull/3654) ([417-72KI](https://github.com/417-72KI)) +- improvements in barRect height calculation [\#3650](https://github.com/danielgindi/Charts/pull/3650) ([potato04](https://github.com/potato04)) +- Update document to latest format [\#3621](https://github.com/danielgindi/Charts/pull/3621) ([kemchenj](https://github.com/kemchenj)) +- Feature - ChartView Pan Ended Delegate Call [\#3612](https://github.com/danielgindi/Charts/pull/3612) ([AntonTheDev](https://github.com/AntonTheDev)) +- Axis Renderers Cleanup [\#3164](https://github.com/danielgindi/Charts/pull/3164) ([jjatie](https://github.com/jjatie)) + +## [v3.2.1](https://github.com/danielgindi/Charts/tree/v3.2.1) (2018-10-08) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v3.2.0...v3.2.1) + +**Closed issues:** + +- Getting error after updating XCode to 10 from 9.4 [\#3661](https://github.com/danielgindi/Charts/issues/3661) +- Bar Chart with horizondal scroll on clicking button. [\#3660](https://github.com/danielgindi/Charts/issues/3660) +- How to change the piechart' valueLineColor and valueTextColor color individually [\#3658](https://github.com/danielgindi/Charts/issues/3658) +- Update to Swift 4.2 [\#3655](https://github.com/danielgindi/Charts/issues/3655) +- I am trying to use charts. for ios app. I am using cocoa pod for dependency setup. After setup i am trying to build the code it throwing compile errors. [\#3653](https://github.com/danielgindi/Charts/issues/3653) +- Type 'RunLoop' has no member 'Mode' [\#3652](https://github.com/danielgindi/Charts/issues/3652) +- Module compiled with Swift 4.1.2 cannot be imported by the Swift 4.2 [\#3651](https://github.com/danielgindi/Charts/issues/3651) +- Type 'RunLoop' has no member 'Mode' [\#3648](https://github.com/danielgindi/Charts/issues/3648) +- As of todays update, I am running into this issue. 'common' renamed RunLoopMode.commonModes [\#3647](https://github.com/danielgindi/Charts/issues/3647) +- Change circleHoleColor for one point [\#3646](https://github.com/danielgindi/Charts/issues/3646) +- This API is not working with Swift 4.1.. even after taking V3.2 of Charts API also.. I fixed it myself :\( [\#3645](https://github.com/danielgindi/Charts/issues/3645) +- Help building Charts Demo [\#3643](https://github.com/danielgindi/Charts/issues/3643) +- Limit line label orientation [\#3641](https://github.com/danielgindi/Charts/issues/3641) +- Is it possible to zoom into a range of values? [\#3639](https://github.com/danielgindi/Charts/issues/3639) +- Not working with SDK-Swift 4.2 [\#3635](https://github.com/danielgindi/Charts/issues/3635) +- getting the error that let is implicitly final please change from open to public in Xcode10 GM Seed [\#3634](https://github.com/danielgindi/Charts/issues/3634) +- How to optimize when the amount of data is large [\#3633](https://github.com/danielgindi/Charts/issues/3633) +- Adding mathematical function plotting [\#3632](https://github.com/danielgindi/Charts/issues/3632) +- Color shadow inside piechart [\#3631](https://github.com/danielgindi/Charts/issues/3631) +- I can not set one label on y axis. [\#3630](https://github.com/danielgindi/Charts/issues/3630) +- where is the code for draw the xAxis and yAxis indicateLine [\#3628](https://github.com/danielgindi/Charts/issues/3628) +- Is it possible to add a vertical label for Y-Axis? Or anyone working on it? [\#3627](https://github.com/danielgindi/Charts/issues/3627) +- Adding dashed lines in between bars in bar graph [\#3626](https://github.com/danielgindi/Charts/issues/3626) +- Create Line chart and/or Bar chart from String Array [\#3625](https://github.com/danielgindi/Charts/issues/3625) +- Change data if button press [\#3624](https://github.com/danielgindi/Charts/issues/3624) +- Pie Chart and Legend [\#3622](https://github.com/danielgindi/Charts/issues/3622) +- Add labels to marker or create custom marker view [\#3620](https://github.com/danielgindi/Charts/issues/3620) +- is there any way we can change the values font size for ipad in the same code? [\#3618](https://github.com/danielgindi/Charts/issues/3618) +- Reg: Display Min and Max Point in a PopUp [\#3617](https://github.com/danielgindi/Charts/issues/3617) +- Charts ScaleX problem [\#3616](https://github.com/danielgindi/Charts/issues/3616) +- CombinedChartView - EXC\_BAD\_ACCESS with doubleTapToZoomEnabled [\#3614](https://github.com/danielgindi/Charts/issues/3614) +- BarChartView How to set the fixed width and spacing? [\#3609](https://github.com/danielgindi/Charts/issues/3609) +- How can I combine two lineCharts? [\#3607](https://github.com/danielgindi/Charts/issues/3607) +- 'Charts/Charts-Swift.h' file not found [\#3603](https://github.com/danielgindi/Charts/issues/3603) +- Combined Chart with Horizontal Bar chart and a Line chart [\#3600](https://github.com/danielgindi/Charts/issues/3600) +- Design customization [\#3597](https://github.com/danielgindi/Charts/issues/3597) +- Move pie chart to specific location in the view [\#3595](https://github.com/danielgindi/Charts/issues/3595) +- Adding text data points to axis [\#3592](https://github.com/danielgindi/Charts/issues/3592) +- Performance hit [\#3585](https://github.com/danielgindi/Charts/issues/3585) +- Multiple colours for setValueTextColor and xAxis label with NSAttributedString [\#3566](https://github.com/danielgindi/Charts/issues/3566) +- Can't set a fixed width for YAxis with outside style. [\#3565](https://github.com/danielgindi/Charts/issues/3565) +- Switch from Grouped Bar chart back to normal [\#3551](https://github.com/danielgindi/Charts/issues/3551) +- X or Y axis interval of the labels [\#3547](https://github.com/danielgindi/Charts/issues/3547) +- How can I plot all Axis Value? [\#3540](https://github.com/danielgindi/Charts/issues/3540) +- When the number of numeric numbers on the Y axis does not agree, the right of the multiple charts will not be aligned. [\#3347](https://github.com/danielgindi/Charts/issues/3347) + +## [v3.2.0](https://github.com/danielgindi/Charts/tree/v3.2.0) (2018-09-17) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v3.1.1...v3.2.0) + +**Fixed bugs:** + +- Remove noDataText [\#3396](https://github.com/danielgindi/Charts/issues/3396) + +**Closed issues:** + +- Xcode 10 beta & Swift 4.2 support [\#3623](https://github.com/danielgindi/Charts/issues/3623) +- CombinedChartView not population correctly [\#3619](https://github.com/danielgindi/Charts/issues/3619) +- How to remove Cubic Line chart value? [\#3615](https://github.com/danielgindi/Charts/issues/3615) +- How to set Y axis to display different colors of label [\#3611](https://github.com/danielgindi/Charts/issues/3611) +- Installation with carthage error!!! [\#3610](https://github.com/danielgindi/Charts/issues/3610) +- xcodebuild archive error [\#3606](https://github.com/danielgindi/Charts/issues/3606) +- swift library added successfully, but can't reach any of the interfaces [\#3605](https://github.com/danielgindi/Charts/issues/3605) +- BarChart draw sum of values above bar [\#3604](https://github.com/danielgindi/Charts/issues/3604) +- iOS 12 [\#3601](https://github.com/danielgindi/Charts/issues/3601) +- v [\#3598](https://github.com/danielgindi/Charts/issues/3598) +- Compilation errors with Swift 4.1 [\#3596](https://github.com/danielgindi/Charts/issues/3596) +- Bar Chart highlights last clicked bar [\#3594](https://github.com/danielgindi/Charts/issues/3594) +- Remove hightlight, when swipe ends. Or just catch event when swipe ends [\#3588](https://github.com/danielgindi/Charts/issues/3588) +- bars did not displayed as expect [\#3586](https://github.com/danielgindi/Charts/issues/3586) +- what about the property 'gradientPositions' on branch 4.0.0, and how to use [\#3584](https://github.com/danielgindi/Charts/issues/3584) +- Creating markers for Radar Charts [\#3582](https://github.com/danielgindi/Charts/issues/3582) +- How to display value on touch? [\#3581](https://github.com/danielgindi/Charts/issues/3581) +- LineChart \(gradient fill\) is not working in Swift 4 [\#3580](https://github.com/danielgindi/Charts/issues/3580) +- Is there a way to use Line Chart with custom xAxis? [\#3579](https://github.com/danielgindi/Charts/issues/3579) +- Xaxis MutliLine and Value Multiline [\#3575](https://github.com/danielgindi/Charts/issues/3575) +- REACT NATIVE CHART ISSUE [\#3574](https://github.com/danielgindi/Charts/issues/3574) +- Data labels not shown when mutable array of entries used. [\#3573](https://github.com/danielgindi/Charts/issues/3573) +- Grid background color extends beyond data sets [\#3572](https://github.com/danielgindi/Charts/issues/3572) +- real time plot [\#3571](https://github.com/danielgindi/Charts/issues/3571) +- Add shadow effect for pie chart [\#3570](https://github.com/danielgindi/Charts/issues/3570) +- The target “Charts” contains source code developed with Swift 2.x. Xcode 9 does not support building or migrating Swift 2.x targets. [\#3569](https://github.com/danielgindi/Charts/issues/3569) +- What is the best way to show around 100'000 values? [\#3568](https://github.com/danielgindi/Charts/issues/3568) +- CandleChart In CombinedChartView not work [\#3567](https://github.com/danielgindi/Charts/issues/3567) +- the x axis label is not in the right position when I used groupBarChart [\#3564](https://github.com/danielgindi/Charts/issues/3564) +- Bar Charts with only top outline like line chart [\#3562](https://github.com/danielgindi/Charts/issues/3562) +- How to fill the area between two lines on LineChart [\#3561](https://github.com/danielgindi/Charts/issues/3561) +- How to support rose chart? [\#3560](https://github.com/danielgindi/Charts/issues/3560) +- How I can get unselected entry [\#3559](https://github.com/danielgindi/Charts/issues/3559) +- Custom x-axis labels won't show without backing data [\#3557](https://github.com/danielgindi/Charts/issues/3557) +- Cannot build Charts project using Carthage [\#3555](https://github.com/danielgindi/Charts/issues/3555) +- Customizing bar chart [\#3554](https://github.com/danielgindi/Charts/issues/3554) +- Line Chart: Can't display icons unless data labels are also displayed [\#3553](https://github.com/danielgindi/Charts/issues/3553) +- How to enable highlight to some datapoints only when chart is zoomed [\#3552](https://github.com/danielgindi/Charts/issues/3552) +- 关于OC项目引入Charts IPA体积过大的问题 [\#3549](https://github.com/danielgindi/Charts/issues/3549) +- X or Y unit?How to do? [\#3545](https://github.com/danielgindi/Charts/issues/3545) +- Why my chart have line on zero on yAXis [\#3544](https://github.com/danielgindi/Charts/issues/3544) +- Value of type 'EnumeratedSequence\<\[CGPoint\]\>' has no member 'compactMap' [\#3543](https://github.com/danielgindi/Charts/issues/3543) +- Show Axis unit in last label [\#3542](https://github.com/danielgindi/Charts/issues/3542) +- In iOS-Charts how to hide one of Y axis grid lines. [\#3541](https://github.com/danielgindi/Charts/issues/3541) +- Highlighting on a scrollable line graph [\#3539](https://github.com/danielgindi/Charts/issues/3539) +- disable gradient fill Linechart [\#3537](https://github.com/danielgindi/Charts/issues/3537) +- Undefined symbols for architecture - import issues [\#3536](https://github.com/danielgindi/Charts/issues/3536) +- Horizontal Bar Chart Bar Collapsing [\#3535](https://github.com/danielgindi/Charts/issues/3535) +- How to remove space between line chart and top legend [\#3534](https://github.com/danielgindi/Charts/issues/3534) +- Scrolling of bar chart is not working initially. [\#3532](https://github.com/danielgindi/Charts/issues/3532) +- Remove DataSet label [\#3531](https://github.com/danielgindi/Charts/issues/3531) +- HorizontalBarChartView 横向柱状图Y轴问题 [\#3530](https://github.com/danielgindi/Charts/issues/3530) +- 怎么设置柱状图的宽度不变 [\#3529](https://github.com/danielgindi/Charts/issues/3529) +- Is it possible to show the values of a horizontal stacked bar chart centered? [\#3526](https://github.com/danielgindi/Charts/issues/3526) +- how to change LineChartDataSet without strange redraw issues? [\#3525](https://github.com/danielgindi/Charts/issues/3525) +- I want to add image in left side of line graph when we scroll the image is also scroll [\#3521](https://github.com/danielgindi/Charts/issues/3521) +- Fixed label at axis origin [\#3519](https://github.com/danielgindi/Charts/issues/3519) +- Horizontal bar charts labels max out too early [\#3517](https://github.com/danielgindi/Charts/issues/3517) +- multiple PieCharts in on Screen [\#3516](https://github.com/danielgindi/Charts/issues/3516) +- First and Last Bars are not displaying full bars in CombinedChartView [\#3515](https://github.com/danielgindi/Charts/issues/3515) +- Line chart does not render correctly [\#3514](https://github.com/danielgindi/Charts/issues/3514) +- Line chart with LineChartView the line is lower than the minimum values [\#3513](https://github.com/danielgindi/Charts/issues/3513) +- Bar chart is plotting for empty value and Line chart is not appeared in CombinedChartView [\#3511](https://github.com/danielgindi/Charts/issues/3511) +- The shape of graph becomes smaller and smaller in RadarChartGraph [\#3510](https://github.com/danielgindi/Charts/issues/3510) +- not able to display x-axis labels like \(jun, july\) in line chart [\#3509](https://github.com/danielgindi/Charts/issues/3509) +- Move points on LineChart with Pan Gesture [\#3508](https://github.com/danielgindi/Charts/issues/3508) +- 32 bit Device not handling high x-values [\#3507](https://github.com/danielgindi/Charts/issues/3507) +- How do you override the getFormattedValue\(\) method when it doesn't exist? [\#3506](https://github.com/danielgindi/Charts/issues/3506) +- drawBarShadowEnabled is crashing in swift 4 [\#3505](https://github.com/danielgindi/Charts/issues/3505) +- x,y axis and guidelines hide on grah reload [\#3503](https://github.com/danielgindi/Charts/issues/3503) +- 显示float问题 [\#3501](https://github.com/danielgindi/Charts/issues/3501) +- App Crash in release mode not in debug mode [\#3499](https://github.com/danielgindi/Charts/issues/3499) +- Arrow on axis end [\#3498](https://github.com/danielgindi/Charts/issues/3498) +- LineChartView setup "set.mode = LineChartModeCubicBezier",The wave-peak trough of the smooth chart shows no value and deviates from these points [\#3497](https://github.com/danielgindi/Charts/issues/3497) +- Errors when trying to compile a project using Charts [\#3496](https://github.com/danielgindi/Charts/issues/3496) +- Need Help I want to Make 2 lines of X axis label and x axis label background color [\#3495](https://github.com/danielgindi/Charts/issues/3495) +- Getting current xAxis value [\#3494](https://github.com/danielgindi/Charts/issues/3494) +- where to catch the function about marker disappears or appears with dataEntrance [\#3493](https://github.com/danielgindi/Charts/issues/3493) +- Get chart image without rendering chart [\#3492](https://github.com/danielgindi/Charts/issues/3492) +- Cant able to set XAxis Range for custom DateTime formatter [\#3491](https://github.com/danielgindi/Charts/issues/3491) +- How to set the accuracy of data, such as two decimal places, e.g 2.32, 3.21. [\#3490](https://github.com/danielgindi/Charts/issues/3490) +- FFT graphs? [\#3489](https://github.com/danielgindi/Charts/issues/3489) +- Is there a better way to easily add highest and lowest value in candlestick chart [\#3488](https://github.com/danielgindi/Charts/issues/3488) +- Remove piechart center white area [\#3487](https://github.com/danielgindi/Charts/issues/3487) +- xAxis label is croped when using custom valueFormatter [\#3485](https://github.com/danielgindi/Charts/issues/3485) +- Change location of left axis labels [\#3484](https://github.com/danielgindi/Charts/issues/3484) +- How to plot multiple yValue but display selected xValue in xAxis Label? [\#3483](https://github.com/danielgindi/Charts/issues/3483) +- Bubble Charts Choose not jump into the method “chartValueSelected...”? [\#3482](https://github.com/danielgindi/Charts/issues/3482) +- How to plot time value format on x-axis in real time graph [\#3481](https://github.com/danielgindi/Charts/issues/3481) +- How to remove Right side vertical line and values in LineChartView [\#3478](https://github.com/danielgindi/Charts/issues/3478) +- Bar Chart View acting weird \(zooming\) [\#3477](https://github.com/danielgindi/Charts/issues/3477) +- Is their anyway to show legend in rows and columns format? [\#3476](https://github.com/danielgindi/Charts/issues/3476) +- Duplicate Y-axis values while pitching the graph moving up [\#3475](https://github.com/danielgindi/Charts/issues/3475) +- getValuesByTouchPoint / UIView coords to graph coords [\#3474](https://github.com/danielgindi/Charts/issues/3474) +- Pie Chart label not show if its value 0 [\#3473](https://github.com/danielgindi/Charts/issues/3473) +- Build failed [\#3472](https://github.com/danielgindi/Charts/issues/3472) +- What will be the version of pod if I am running on swift 2.3 ? [\#3471](https://github.com/danielgindi/Charts/issues/3471) +- Using SPM results in a "dependency graph is unresolvable" error. [\#3470](https://github.com/danielgindi/Charts/issues/3470) +- Demo is not compiling [\#3469](https://github.com/danielgindi/Charts/issues/3469) +- Question [\#3466](https://github.com/danielgindi/Charts/issues/3466) +- need help [\#3464](https://github.com/danielgindi/Charts/issues/3464) +- bar Chart legend always show one label [\#3462](https://github.com/danielgindi/Charts/issues/3462) +- Monitor rotation angle [\#3461](https://github.com/danielgindi/Charts/issues/3461) +- when clicking chartView,How to prompt multiple markerView [\#3460](https://github.com/danielgindi/Charts/issues/3460) +- The chart will draw incorrectly if LineChart leftAxis.axisMinimum does not start at zero [\#3458](https://github.com/danielgindi/Charts/issues/3458) +- Grouped bar chart plotting wrong !! [\#3457](https://github.com/danielgindi/Charts/issues/3457) +- 为什么我设置X轴不显示 [\#3456](https://github.com/danielgindi/Charts/issues/3456) +- how to set string values on x axis in bar chart? please help [\#3455](https://github.com/danielgindi/Charts/issues/3455) +- Left axis and right axis not same zero line [\#3454](https://github.com/danielgindi/Charts/issues/3454) +- How can make HorizontalBarChart dont start at zero? [\#3453](https://github.com/danielgindi/Charts/issues/3453) +- Can't customise X-axis grid line labels in time value line chart. [\#3452](https://github.com/danielgindi/Charts/issues/3452) +- xAxis gridlines are missing [\#3451](https://github.com/danielgindi/Charts/issues/3451) +- How to add attributed string in Xaxis labels [\#3450](https://github.com/danielgindi/Charts/issues/3450) +- 点击0这一列,所有的柱状图都高亮,可以吗 [\#3449](https://github.com/danielgindi/Charts/issues/3449) +- how to use 'LineChartView' to draw a line between nonzero values? [\#3448](https://github.com/danielgindi/Charts/issues/3448) +- The maximum value of the histogram is not shown. [\#3447](https://github.com/danielgindi/Charts/issues/3447) +- The Y-axis numerical display problem. [\#3446](https://github.com/danielgindi/Charts/issues/3446) +- Is it possible to show x-Axis gridlines when there's only one ChartDataEntry? [\#3444](https://github.com/danielgindi/Charts/issues/3444) +- Chart callback events [\#3443](https://github.com/danielgindi/Charts/issues/3443) +- Help needed with Grouped Horizontal Bar Chart [\#3442](https://github.com/danielgindi/Charts/issues/3442) +- Candlestick doesn't work when x does not start at 0 [\#3441](https://github.com/danielgindi/Charts/issues/3441) +- Is there a callback method? [\#3439](https://github.com/danielgindi/Charts/issues/3439) +- oc项目集成Charts,上架打包失败,提示ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '时间炼.app/Frameworks/Charts.framework/Charts' is not permitted. Your app can’t contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."。新手,求解答!Thanks [\#3438](https://github.com/danielgindi/Charts/issues/3438) +- Axis label alignment with labelRotationAngle [\#3437](https://github.com/danielgindi/Charts/issues/3437) +- Show grid with axis deactivated [\#3436](https://github.com/danielgindi/Charts/issues/3436) +- Error: cannot use instance member '\_viewPortHandler' within property initializer; property initializers run before 'self' is available [\#3434](https://github.com/danielgindi/Charts/issues/3434) +- remove labels [\#3433](https://github.com/danielgindi/Charts/issues/3433) +- How to set the number of lines for the label of xAxis of HorizontalBarChartView ? [\#3431](https://github.com/danielgindi/Charts/issues/3431) +- xAxis labelText too long, it can not draw complete. [\#3430](https://github.com/danielgindi/Charts/issues/3430) +- Weird crash [\#3427](https://github.com/danielgindi/Charts/issues/3427) +- Why does the default value of the Y label take the decimal point? [\#3426](https://github.com/danielgindi/Charts/issues/3426) +- Why won't the viewport move to the last X value of my line chart? [\#3425](https://github.com/danielgindi/Charts/issues/3425) +- How to disable highlight for some specific values [\#3423](https://github.com/danielgindi/Charts/issues/3423) +- IAxisValueFormatter Error: Index out of range [\#3422](https://github.com/danielgindi/Charts/issues/3422) +- can we animate SelectionShift when selecting a segment of pie chart? [\#3420](https://github.com/danielgindi/Charts/issues/3420) +- Y-axis minimum scale deviation problem. [\#3419](https://github.com/danielgindi/Charts/issues/3419) +- How do you set the scale of the Y-axis? [\#3418](https://github.com/danielgindi/Charts/issues/3418) +- BarLineChartViewBase doubleTapGestureRecognized [\#3417](https://github.com/danielgindi/Charts/issues/3417) +- Remove the box from the pie chart. [\#3416](https://github.com/danielgindi/Charts/issues/3416) +- Unable to set transparent color or clear color to the graphs background. [\#3414](https://github.com/danielgindi/Charts/issues/3414) +- BarChartView has no TouchUpInside event, only TouchDown event. [\#3411](https://github.com/danielgindi/Charts/issues/3411) +- YAxis,the integer bit is missing, showing.0 or.00 [\#3410](https://github.com/danielgindi/Charts/issues/3410) +- touchesEnded can't be called in chart view? [\#3409](https://github.com/danielgindi/Charts/issues/3409) +- Is it possible to show date values in the Stacked BarChart? [\#3408](https://github.com/danielgindi/Charts/issues/3408) +- Passing STRING values to X-Axis currently the SetDataCount is accepting only INT and Double data types [\#3407](https://github.com/danielgindi/Charts/issues/3407) +- compactMap build error [\#3405](https://github.com/danielgindi/Charts/issues/3405) +- Marker in CombinedChart is displayed incorrectly. [\#3404](https://github.com/danielgindi/Charts/issues/3404) +- I need to customize the column chart [\#3401](https://github.com/danielgindi/Charts/issues/3401) +- YAxis show the value .0 or .00 [\#3400](https://github.com/danielgindi/Charts/issues/3400) +- How to do BarChart \(grouped DataSets\)\(OC\)? [\#3399](https://github.com/danielgindi/Charts/issues/3399) +- Can't build success with xcode toolchains swift 4.0.3 release [\#3398](https://github.com/danielgindi/Charts/issues/3398) +- pod not install in xcode 9.3 version [\#3397](https://github.com/danielgindi/Charts/issues/3397) +- Lag during scroll [\#3395](https://github.com/danielgindi/Charts/issues/3395) +- Hide percents on PieChartDiagram when it's so small [\#3394](https://github.com/danielgindi/Charts/issues/3394) +- Value of type 'BarChartDataEntries' has no member 'unit' [\#3393](https://github.com/danielgindi/Charts/issues/3393) +- BarChart 1st bar offset [\#3392](https://github.com/danielgindi/Charts/issues/3392) +- Open up Access Modifiers? [\#3391](https://github.com/danielgindi/Charts/issues/3391) +- ld: warning: directory not found for option '-F/Users/hansenpen/Library/Developer/Xcode/DerivedData/CS\_PROJECT\_-\_ALPHA-hglwyidqwcstjvejzxikmednefgv/Build/Products/Debug-iphonesimulator/Charts' ld: framework not found Charts clang: error: linker command failed with exit code 1 \(use -v to see invocation\) [\#3390](https://github.com/danielgindi/Charts/issues/3390) +- How to install charts Framework using Xcode 9.1 [\#3388](https://github.com/danielgindi/Charts/issues/3388) +- Unable to compile swift 3.2 code from xcode 9.3. I am using 3.1.1 version of charts. [\#3387](https://github.com/danielgindi/Charts/issues/3387) +- why there is flexible space between the BarChatView and the xAxis ? sometimes the space are nil but sometimes the space exist . when it happens the xAxis will draw rect inside the PilaView . it doesn't connected with the XAxisLabelPosition attribute . i cann't figured it out [\#3386](https://github.com/danielgindi/Charts/issues/3386) +- Error building project [\#3385](https://github.com/danielgindi/Charts/issues/3385) +- missing property in latest LineChartView [\#3383](https://github.com/danielgindi/Charts/issues/3383) +- minOffset not working [\#3382](https://github.com/danielgindi/Charts/issues/3382) +- Display Real time data like pulseRate. [\#3381](https://github.com/danielgindi/Charts/issues/3381) +- Grouped bar chart shows up as stacked bar chart after migration. [\#3380](https://github.com/danielgindi/Charts/issues/3380) +- Candle stick chart cds.setBarSpace\(\) not working [\#3379](https://github.com/danielgindi/Charts/issues/3379) +- Line chart fill color goes above/below zeroline [\#3377](https://github.com/danielgindi/Charts/issues/3377) +- Charts Pod not working with Xcode 9.3 \(Swift 4.1\) [\#3376](https://github.com/danielgindi/Charts/issues/3376) +- Can any one know how to draw this charts [\#3375](https://github.com/danielgindi/Charts/issues/3375) +- Compile error on newest ChartsDemo-iOS project [\#3373](https://github.com/danielgindi/Charts/issues/3373) +- ChartIndexAxisValueFormatter Not working in line charts [\#3371](https://github.com/danielgindi/Charts/issues/3371) +- Line Graph xValue [\#3367](https://github.com/danielgindi/Charts/issues/3367) +- xAxis labels are not aligned with grouped bar, when data is more [\#3364](https://github.com/danielgindi/Charts/issues/3364) +- Select the data point programmatically and the highLight is NAN [\#3363](https://github.com/danielgindi/Charts/issues/3363) +- Layout issue with chart legend [\#3359](https://github.com/danielgindi/Charts/issues/3359) +- Is it possible to draw the line on top of a custom XAxisRenderer? [\#3348](https://github.com/danielgindi/Charts/issues/3348) +- How to set x-axis labels with selected round with color. [\#3345](https://github.com/danielgindi/Charts/issues/3345) +- How to hide the grid background on some bar [\#3342](https://github.com/danielgindi/Charts/issues/3342) +- Space between axis line and axis label [\#3336](https://github.com/danielgindi/Charts/issues/3336) +- Can't manage to align plots with x axis values [\#3332](https://github.com/danielgindi/Charts/issues/3332) +- Show the last x axis label on bar chart [\#3324](https://github.com/danielgindi/Charts/issues/3324) +- HorizontalBarChartView display partial data [\#3320](https://github.com/danielgindi/Charts/issues/3320) +- 如何在滑动代理中获取当前中心位置所对应的数据源的索引 [\#3318](https://github.com/danielgindi/Charts/issues/3318) +- Visible max and min Y Values [\#2600](https://github.com/danielgindi/Charts/issues/2600) +- Invert xAxis label [\#2504](https://github.com/danielgindi/Charts/issues/2504) +- @junito1209 please explain what are you doing on Charts wiki page [\#2261](https://github.com/danielgindi/Charts/issues/2261) +- Crash Observed when AxisRenderer interval is becoming NaN [\#2168](https://github.com/danielgindi/Charts/issues/2168) +- Problem selecting bubbles on the same xIndex [\#2060](https://github.com/danielgindi/Charts/issues/2060) + +**Merged pull requests:** + +- Add Swift version 4.1 to podspec [\#3608](https://github.com/danielgindi/Charts/pull/3608) ([larryonoff](https://github.com/larryonoff)) +- update barRect.size.height calculation [\#3587](https://github.com/danielgindi/Charts/pull/3587) ([potato04](https://github.com/potato04)) +- Add label colors to legend entries [\#3558](https://github.com/danielgindi/Charts/pull/3558) ([petester42](https://github.com/petester42)) +- Support inlune bubble viz selection [\#3548](https://github.com/danielgindi/Charts/pull/3548) ([chuynadamas](https://github.com/chuynadamas)) +- fix the error title for demo [\#3528](https://github.com/danielgindi/Charts/pull/3528) ([yangasahi](https://github.com/yangasahi)) +- Changes for Swift 4.2, Xcode 10 and iOS 12 [\#3522](https://github.com/danielgindi/Charts/pull/3522) ([jlcanale](https://github.com/jlcanale)) +- Accessibility Support for \(most\) Chart types [\#3520](https://github.com/danielgindi/Charts/pull/3520) ([mathewa6](https://github.com/mathewa6)) +- Changed comment that referenced getFormattedValue\(\) method in IValueFormatter [\#3518](https://github.com/danielgindi/Charts/pull/3518) ([JCMcLovin](https://github.com/JCMcLovin)) +- Fix merge conflicts in \#3218 [\#3500](https://github.com/danielgindi/Charts/pull/3500) ([petester42](https://github.com/petester42)) +- Make legendRenderer property public in order to be externally customizable [\#3445](https://github.com/danielgindi/Charts/pull/3445) ([nagykatalin](https://github.com/nagykatalin)) +- Fix broken demo link in readme [\#3440](https://github.com/danielgindi/Charts/pull/3440) ([robert-cronin](https://github.com/robert-cronin)) +- Added clamping function for `Comparable` [\#3435](https://github.com/danielgindi/Charts/pull/3435) ([jjatie](https://github.com/jjatie)) +- Fix CocoaPods compilation [\#3432](https://github.com/danielgindi/Charts/pull/3432) ([larryonoff](https://github.com/larryonoff)) +- update candle chart view options in demo project [\#3424](https://github.com/danielgindi/Charts/pull/3424) ([cuong1112035](https://github.com/cuong1112035)) +- Add Objective-c compatible for turning off drag in X and Y Axis separately [\#3421](https://github.com/danielgindi/Charts/pull/3421) ([lennonhe](https://github.com/lennonhe)) +- Added gradient line drawing to LineChartRenderer. based on PR \#3142 [\#3415](https://github.com/danielgindi/Charts/pull/3415) ([larryonoff](https://github.com/larryonoff)) +- Add more render options for y axis labels [\#3406](https://github.com/danielgindi/Charts/pull/3406) ([alexrepty](https://github.com/alexrepty)) +- Refactored ChartData [\#3169](https://github.com/danielgindi/Charts/pull/3169) ([jjatie](https://github.com/jjatie)) +- Dataset logic cleanup [\#3001](https://github.com/danielgindi/Charts/pull/3001) ([jjatie](https://github.com/jjatie)) +- Added value text rotation [\#2200](https://github.com/danielgindi/Charts/pull/2200) ([chinh-tran](https://github.com/chinh-tran)) + +## [v3.1.1](https://github.com/danielgindi/Charts/tree/v3.1.1) (2018-04-02) +[Full Changelog](https://github.com/danielgindi/Charts/compare/3.1.1...v3.1.1) + +## [3.1.1](https://github.com/danielgindi/Charts/tree/3.1.1) (2018-04-02) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v3.1.0...3.1.1) + +**Fixed bugs:** + +- ChartsDemo-Swift crashes [\#3327](https://github.com/danielgindi/Charts/issues/3327) + +**Closed issues:** + +- Why does yVals start with a negative number when the data is empty? [\#3374](https://github.com/danielgindi/Charts/issues/3374) +- Compile Error [\#3372](https://github.com/danielgindi/Charts/issues/3372) +- Y Axis need to add Time slots for current day [\#3368](https://github.com/danielgindi/Charts/issues/3368) +- inconsistent include of UIKit vs AppKit [\#3362](https://github.com/danielgindi/Charts/issues/3362) +- Crash Issue in BarChartData [\#3361](https://github.com/danielgindi/Charts/issues/3361) +- How can we format the LABEL used for values? [\#3354](https://github.com/danielgindi/Charts/issues/3354) +- Remove value labels padding [\#3350](https://github.com/danielgindi/Charts/issues/3350) +- Does Charts support real-time drawing [\#3344](https://github.com/danielgindi/Charts/issues/3344) +- Constant for Bar width and space [\#3343](https://github.com/danielgindi/Charts/issues/3343) +- Bar Graph groupBars function issue [\#1966](https://github.com/danielgindi/Charts/issues/1966) +- bar chart from dates [\#1963](https://github.com/danielgindi/Charts/issues/1963) +- A crash of CombinedChartView,when touch on the chart view\(chas\) [\#1957](https://github.com/danielgindi/Charts/issues/1957) +- Graph doesn't display on older iPads [\#1954](https://github.com/danielgindi/Charts/issues/1954) +- Regarding deprecated xValues [\#1947](https://github.com/danielgindi/Charts/issues/1947) +- Charts being overlaid inside UICollectionView using dequeueReusableCell [\#1943](https://github.com/danielgindi/Charts/issues/1943) +- We are unable to split the label in two lines. [\#1941](https://github.com/danielgindi/Charts/issues/1941) +- Make releases so they follow the Semantic Versioning \(SemVer\) [\#1930](https://github.com/danielgindi/Charts/issues/1930) +- Marker Position [\#1876](https://github.com/danielgindi/Charts/issues/1876) +- Charts 3.0 unable to draw discontinuous line chart [\#1866](https://github.com/danielgindi/Charts/issues/1866) +- Radar charts custom labels [\#1840](https://github.com/danielgindi/Charts/issues/1840) +- Unable to subclass [\#1838](https://github.com/danielgindi/Charts/issues/1838) +- offset goes wrong when using mutiple bar chart in combined chart [\#1813](https://github.com/danielgindi/Charts/issues/1813) +- Histogram Example? [\#1792](https://github.com/danielgindi/Charts/issues/1792) +- Sunburst Chart [\#1715](https://github.com/danielgindi/Charts/issues/1715) +- Line chart with preview [\#1520](https://github.com/danielgindi/Charts/issues/1520) +- Get scroll position of dragable line chart [\#1272](https://github.com/danielgindi/Charts/issues/1272) +- Trend line in scatter chart? [\#1263](https://github.com/danielgindi/Charts/issues/1263) +- Can we use custom image instead of Circle in line chart? [\#1206](https://github.com/danielgindi/Charts/issues/1206) +- Legend with NSAttributedString and multiple lines on Vertical [\#1193](https://github.com/danielgindi/Charts/issues/1193) +- Trim the legend view [\#1192](https://github.com/danielgindi/Charts/issues/1192) +- Chart auto min/max does not take into account second line [\#1136](https://github.com/danielgindi/Charts/issues/1136) +- Add different colorHoleColor for different datapoints in a LineChart iOS Charts [\#1104](https://github.com/danielgindi/Charts/issues/1104) +- How to remove marker programatically [\#1097](https://github.com/danielgindi/Charts/issues/1097) +- Overlapping issues in x and y axis values [\#1048](https://github.com/danielgindi/Charts/issues/1048) +- Enhancement: Horizontal Combined Chart [\#1041](https://github.com/danielgindi/Charts/issues/1041) +- Enhancement: Linked x-axis or stacked y-axis. [\#1022](https://github.com/danielgindi/Charts/issues/1022) +- Scale or zoom to particular axis or point in Combined chart view [\#993](https://github.com/danielgindi/Charts/issues/993) +- Max Value Y - Axis = 1 , How to set Y-Axis increment Y- Value ? [\#989](https://github.com/danielgindi/Charts/issues/989) +- Drawing value for the WholeStack only [\#926](https://github.com/danielgindi/Charts/issues/926) +- Pie chart Y values overlap [\#779](https://github.com/danielgindi/Charts/issues/779) +- Swift Package Manager [\#753](https://github.com/danielgindi/Charts/issues/753) +- Stacked bar chart with different number of rects [\#744](https://github.com/danielgindi/Charts/issues/744) +- The label value position with the same yAxis and different value. [\#724](https://github.com/danielgindi/Charts/issues/724) +- Minimum / maximum scale causes the chart to slide sideways when trying to pinch zoom further [\#437](https://github.com/danielgindi/Charts/issues/437) +- Top and bottom grid line diverging widths [\#411](https://github.com/danielgindi/Charts/issues/411) + +**Merged pull requests:** + +- Swift 4.1 [\#3370](https://github.com/danielgindi/Charts/pull/3370) ([jjatie](https://github.com/jjatie)) +- Update ILineRadarChartDataSet.swift [\#3366](https://github.com/danielgindi/Charts/pull/3366) ([Ewg777](https://github.com/Ewg777)) +- Add option to disable clipping data to contentRect [\#3360](https://github.com/danielgindi/Charts/pull/3360) ([wtmoose](https://github.com/wtmoose)) + +## [v3.1.0](https://github.com/danielgindi/Charts/tree/v3.1.0) (2018-03-22) +[Full Changelog](https://github.com/danielgindi/Charts/compare/3.1.0...v3.1.0) + +## [3.1.0](https://github.com/danielgindi/Charts/tree/3.1.0) (2018-03-22) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v3.0.5...3.1.0) + +**Fixed bugs:** + +- Bug in ZoomViewJob? [\#3299](https://github.com/danielgindi/Charts/issues/3299) +- BarChartView bug if set barWidth was 1.0? [\#3213](https://github.com/danielgindi/Charts/issues/3213) +- Scatter circle disappear when chart scaled [\#3185](https://github.com/danielgindi/Charts/issues/3185) +- PieChart `highlightValue\(x:y:dataSetIndex:\)` should provide error for dataSetIndex \> 1 [\#3146](https://github.com/danielgindi/Charts/issues/3146) +- PieChart size is extremely small in a UITableViewCell [\#3108](https://github.com/danielgindi/Charts/issues/3108) +- Handling critical Y values with autoScaleMinMaxEnabled [\#2053](https://github.com/danielgindi/Charts/issues/2053) +- Charts 3.0 - Error: this application, or a library it uses, has passed an invalid numeric value \(NaN, or not-a-number\) to CoreGraphics API and this value is being ignored [\#1626](https://github.com/danielgindi/Charts/issues/1626) + +**Closed issues:** + +- Programatically passed renderer is corrupting animations [\#3349](https://github.com/danielgindi/Charts/issues/3349) +- How to show Integer value [\#3346](https://github.com/danielgindi/Charts/issues/3346) +- Does not build on Xcode 8.3.3 & Swift 3 [\#3341](https://github.com/danielgindi/Charts/issues/3341) +- how to use pod 'Charts' into objective c project , i create header file to use swift , but what should i do after create header file ? [\#3338](https://github.com/danielgindi/Charts/issues/3338) +- How to show all labels in xAxis ? [\#3337](https://github.com/danielgindi/Charts/issues/3337) +- How to set the interval in X axis label [\#3335](https://github.com/danielgindi/Charts/issues/3335) +- Line chart with solid and dashed line [\#3334](https://github.com/danielgindi/Charts/issues/3334) +- Code signing is required for product type 'Application' in SDK 'iOS 11.2' [\#3333](https://github.com/danielgindi/Charts/issues/3333) +- My project within framework target and pod Charts into my framework target can't load Charts framework [\#3328](https://github.com/danielgindi/Charts/issues/3328) +- Swift 4.1 compilation warnings [\#3323](https://github.com/danielgindi/Charts/issues/3323) +- Two Horizontal grid lines always appear above Base Axis line [\#3322](https://github.com/danielgindi/Charts/issues/3322) +- BalloonMarker support swift 3 ? [\#3321](https://github.com/danielgindi/Charts/issues/3321) +- Unable to get horizontal scrolling in bar chart [\#3319](https://github.com/danielgindi/Charts/issues/3319) +- Horizontal Bar Chart xAxis formatted label textColor [\#3317](https://github.com/danielgindi/Charts/issues/3317) +- Wrong dataSetIndex in stringForValue delegate method [\#3314](https://github.com/danielgindi/Charts/issues/3314) +- Limit line in the left and right drag or zoom can be fixed [\#3313](https://github.com/danielgindi/Charts/issues/3313) +- Save picture crash in demos on iOS 11+ [\#3311](https://github.com/danielgindi/Charts/issues/3311) +- How to display reload text in iOS-Charts? [\#3310](https://github.com/danielgindi/Charts/issues/3310) +- Can't show Label text in XAxis [\#3308](https://github.com/danielgindi/Charts/issues/3308) +- Straight lines [\#3306](https://github.com/danielgindi/Charts/issues/3306) +- Values on X axis issue [\#3304](https://github.com/danielgindi/Charts/issues/3304) +- when setInverted\(true\) in the leftAxis of CombinedChart, the candleStickData doesnot show ? [\#3303](https://github.com/danielgindi/Charts/issues/3303) +- HorizontalBarChart X axe labels duplicated [\#3300](https://github.com/danielgindi/Charts/issues/3300) +- how can i change label color? [\#3298](https://github.com/danielgindi/Charts/issues/3298) +- value granularity [\#3296](https://github.com/danielgindi/Charts/issues/3296) +- Better way to manage Stacked Bar Chart Value labels? [\#3295](https://github.com/danielgindi/Charts/issues/3295) +- Remove Y axis border line in Line Graph [\#3294](https://github.com/danielgindi/Charts/issues/3294) +- XAxisRenderer not called [\#3293](https://github.com/danielgindi/Charts/issues/3293) +- How to display string value on xAxis label in line chart [\#3292](https://github.com/danielgindi/Charts/issues/3292) +- how to change the color of text that displayed below the chart ios swift 3 [\#3288](https://github.com/danielgindi/Charts/issues/3288) +- color in BalloonMarker is never used [\#3287](https://github.com/danielgindi/Charts/issues/3287) +- Question: LineChart variable line thickness? [\#3285](https://github.com/danielgindi/Charts/issues/3285) +- Modify selected slice [\#3284](https://github.com/danielgindi/Charts/issues/3284) +- Put shadow under slice [\#3283](https://github.com/danielgindi/Charts/issues/3283) +- How can I take selected value index in Pie Chart [\#3282](https://github.com/danielgindi/Charts/issues/3282) +- hide other label when one slice of pie chart was selected [\#3281](https://github.com/danielgindi/Charts/issues/3281) +- How to show custom x and y axis details in LineChart in objective c ??? [\#3280](https://github.com/danielgindi/Charts/issues/3280) +- I need to put dates from an array on xAxis [\#3277](https://github.com/danielgindi/Charts/issues/3277) +- Is there a way to round the corners of the BalloonMarker? [\#3276](https://github.com/danielgindi/Charts/issues/3276) +- Set values not showing until chart is zoomed [\#3275](https://github.com/danielgindi/Charts/issues/3275) +- How to add gap between chart and legend? [\#3274](https://github.com/danielgindi/Charts/issues/3274) +- LineChart : How to show the grid in right axis [\#3271](https://github.com/danielgindi/Charts/issues/3271) +- How to custom axis' label in horizontal bar chart [\#3270](https://github.com/danielgindi/Charts/issues/3270) +- LineChart: How to fix space between point on xAxis [\#3269](https://github.com/danielgindi/Charts/issues/3269) +- Line Chart Issue in CombinedChartView [\#3268](https://github.com/danielgindi/Charts/issues/3268) +- LineChartRenderer - drawHighlighted:context:indices: [\#3267](https://github.com/danielgindi/Charts/issues/3267) +- Scatter Bar Char - Plots on axis \(0,0\) partially visible [\#3266](https://github.com/danielgindi/Charts/issues/3266) +- is it support the ios 7??? [\#3263](https://github.com/danielgindi/Charts/issues/3263) +- Combined chart for candlestick + bar [\#3262](https://github.com/danielgindi/Charts/issues/3262) +- setScatterShape applied to Legend also [\#3261](https://github.com/danielgindi/Charts/issues/3261) +- ChartDataSet min and max values not recalculated when calling clear\(\) [\#3260](https://github.com/danielgindi/Charts/issues/3260) +- How to realize the Line and the bar Chart in the same one Chart? [\#3259](https://github.com/danielgindi/Charts/issues/3259) +- '\_xBounds' and other variables inaccessible due to 'internal' protection level workaround [\#3258](https://github.com/danielgindi/Charts/issues/3258) +- //view\_line\_graph.centerViewTo\(xValue: Double\(dataEntries\[pos\].x\) , yValue: Double\(dataEntries\[pos\].y\), axis: YAxis.AxisDependency.right\) [\#3257](https://github.com/danielgindi/Charts/issues/3257) +- dyld: Library not loaded: @rpath/Charts.framework/Charts [\#3250](https://github.com/danielgindi/Charts/issues/3250) +- X Axis disapeared [\#3249](https://github.com/danielgindi/Charts/issues/3249) +- Save zoom state [\#3248](https://github.com/danielgindi/Charts/issues/3248) +- leftAxis label bug? [\#3246](https://github.com/danielgindi/Charts/issues/3246) +- x-axis label jumps when zoomed in and side scrolling. [\#3245](https://github.com/danielgindi/Charts/issues/3245) +- avoidFirstLastClippingEnabled not working and set last circleColor a different value [\#3244](https://github.com/danielgindi/Charts/issues/3244) +- Got totally 50 errors after install CocoaPods ..! I am using Swift 4.0 [\#3243](https://github.com/danielgindi/Charts/issues/3243) +- Error in Library When added pod file [\#3242](https://github.com/danielgindi/Charts/issues/3242) +- How to do multiple data on x axis? [\#3241](https://github.com/danielgindi/Charts/issues/3241) +- Missing entries in PieChartDataEntry legends. [\#3240](https://github.com/danielgindi/Charts/issues/3240) +- Candle Stick does not show [\#3239](https://github.com/danielgindi/Charts/issues/3239) +- How i give LineChart Entry using x index and y value in Charts '3.0.4'? help wanted [\#3238](https://github.com/danielgindi/Charts/issues/3238) +- ChartDataEntry with icons shows scatter shape at same time [\#3237](https://github.com/danielgindi/Charts/issues/3237) +- HorizontalBarChart - Right axis label starts with the highest value up to the same value [\#3235](https://github.com/danielgindi/Charts/issues/3235) +- Carthage Charts [\#3234](https://github.com/danielgindi/Charts/issues/3234) +- 3.0.5 Bar chart xAxis valueFormatter regression - no data points shown. [\#3233](https://github.com/danielgindi/Charts/issues/3233) +- Pin the graph on one side while zooming [\#3232](https://github.com/danielgindi/Charts/issues/3232) +- yAxisMaximum auto-increment RadarChartView [\#3231](https://github.com/danielgindi/Charts/issues/3231) +- Compile issue after install pod 'Chart' [\#3230](https://github.com/danielgindi/Charts/issues/3230) +- corner line chart [\#3227](https://github.com/danielgindi/Charts/issues/3227) +- Make specific pieChart segment stick out and go back to normal size, animated [\#3224](https://github.com/danielgindi/Charts/issues/3224) +- Dash line and highlighted top value [\#3221](https://github.com/danielgindi/Charts/issues/3221) +- Why is the xAxis Value Formater so often called? [\#3220](https://github.com/danielgindi/Charts/issues/3220) +- How easy is to add some technical indicators? [\#3219](https://github.com/danielgindi/Charts/issues/3219) +- How to set X-Axis data to bottom of chart with strings data? [\#3212](https://github.com/danielgindi/Charts/issues/3212) +- how to drag the LineChartView [\#3211](https://github.com/danielgindi/Charts/issues/3211) +- Release 3.0.5 contains version number inconsistencies [\#3210](https://github.com/danielgindi/Charts/issues/3210) +- Unable to Hide PieChart Legends. [\#3209](https://github.com/danielgindi/Charts/issues/3209) +- Recent release with my Swift3 project [\#3208](https://github.com/danielgindi/Charts/issues/3208) +- Cannot set double value in Combined chart line chart. [\#3205](https://github.com/danielgindi/Charts/issues/3205) +- Bar charts with different column widths [\#3204](https://github.com/danielgindi/Charts/issues/3204) +- Labels on x-axes not linked to chart data points [\#3203](https://github.com/danielgindi/Charts/issues/3203) +- Remark: The AppCoda tutorial is outdated [\#3196](https://github.com/danielgindi/Charts/issues/3196) +- Unable to set strings as values in x axis of linechart [\#3195](https://github.com/danielgindi/Charts/issues/3195) +- drag event issie [\#3194](https://github.com/danielgindi/Charts/issues/3194) +- Custom XAxisRenderer labels are shifting around when scrolling [\#3193](https://github.com/danielgindi/Charts/issues/3193) +- How to asynchronous drawings LineChart? [\#3192](https://github.com/danielgindi/Charts/issues/3192) +- How do I listen to the left or right to the end of the event when I zoom in on the lineCharts? [\#3184](https://github.com/danielgindi/Charts/issues/3184) +- Want to delete color set beside legend label [\#3180](https://github.com/danielgindi/Charts/issues/3180) +- How to show/hide Stacked Bar Chart yValue? [\#3175](https://github.com/danielgindi/Charts/issues/3175) +- Readme needs to be updated for 3.0.5 [\#3170](https://github.com/danielgindi/Charts/issues/3170) +- Add Axis description to Charts Framework [\#3168](https://github.com/danielgindi/Charts/issues/3168) +- ChartViewDelegate not called when barChart is out of screen [\#3165](https://github.com/danielgindi/Charts/issues/3165) +- dash line \(separators\) in between in bars. [\#3163](https://github.com/danielgindi/Charts/issues/3163) +- StackedBarChart Value on middle of each stacked bar chart [\#3162](https://github.com/danielgindi/Charts/issues/3162) +- ChartLimitLine Label Position [\#3161](https://github.com/danielgindi/Charts/issues/3161) +- bar chat [\#3158](https://github.com/danielgindi/Charts/issues/3158) +- Bar coloring [\#3157](https://github.com/danielgindi/Charts/issues/3157) +- HorizontalBarChart doesn't display bar draw values when bar is partially off ViewPort [\#3155](https://github.com/danielgindi/Charts/issues/3155) +- X-Axis Labels not showing [\#3154](https://github.com/danielgindi/Charts/issues/3154) +- How to make highlight scrolling on chart not trigger parent scrollView? \[help\] [\#3153](https://github.com/danielgindi/Charts/issues/3153) +- How to fill the color like the marked part of this following picture? Thanks a lot! [\#3144](https://github.com/danielgindi/Charts/issues/3144) +- finger leaves the chart area [\#3128](https://github.com/danielgindi/Charts/issues/3128) +- Technical Support in Github [\#3126](https://github.com/danielgindi/Charts/issues/3126) +- Plotting the bar from top to bottom \(in reverse manner\) [\#3125](https://github.com/danielgindi/Charts/issues/3125) +- pieChart Data name overlap [\#3109](https://github.com/danielgindi/Charts/issues/3109) +- LineChart with different colors based on values. [\#3107](https://github.com/danielgindi/Charts/issues/3107) +- AxisBase Value Formatter [\#3105](https://github.com/danielgindi/Charts/issues/3105) +- Multiple charts in same view [\#3103](https://github.com/danielgindi/Charts/issues/3103) +- Draw dotted x-axis timeline [\#3102](https://github.com/danielgindi/Charts/issues/3102) +- PieChart value labels are overlaping when values are between 0 to 9 [\#2948](https://github.com/danielgindi/Charts/issues/2948) +- xValues on X-Axis for non-continuous dates [\#2398](https://github.com/danielgindi/Charts/issues/2398) +- y-labels position is wrong,when i set autoScaleMinMaxEnabled = YES [\#2379](https://github.com/danielgindi/Charts/issues/2379) +- Distance between chart legend and the horizontal bar chart is to big in case of rotated labels [\#2138](https://github.com/danielgindi/Charts/issues/2138) +- How to set LabelCount bigger than 25 in HorizatalBarView [\#2085](https://github.com/danielgindi/Charts/issues/2085) + +**Merged pull requests:** + +- bump to 3.1 release [\#3357](https://github.com/danielgindi/Charts/pull/3357) ([liuxuan30](https://github.com/liuxuan30)) +- Refactors -\[tableView:cellForRowAtIndexPath:\] [\#3326](https://github.com/danielgindi/Charts/pull/3326) ([valeriyvan](https://github.com/valeriyvan)) +- minor bug fix in favor of 3.1 release [\#3312](https://github.com/danielgindi/Charts/pull/3312) ([liuxuan30](https://github.com/liuxuan30)) +- add pie chart unit tests [\#3297](https://github.com/danielgindi/Charts/pull/3297) ([liuxuan30](https://github.com/liuxuan30)) +- Align Objc and Swift demos balloon marker [\#3291](https://github.com/danielgindi/Charts/pull/3291) ([liuxuan30](https://github.com/liuxuan30)) +- for \#3146. add a warning message if pie chart has more than one data set [\#3286](https://github.com/danielgindi/Charts/pull/3286) ([liuxuan30](https://github.com/liuxuan30)) +- Issue templates [\#3278](https://github.com/danielgindi/Charts/pull/3278) ([jjatie](https://github.com/jjatie)) +- Min and Max reset when clearing ChartDataSet \(Fixes \#3260\) [\#3265](https://github.com/danielgindi/Charts/pull/3265) ([carlo-](https://github.com/carlo-)) +- Restored old performance in ChartDataSet [\#3216](https://github.com/danielgindi/Charts/pull/3216) ([jjatie](https://github.com/jjatie)) +- Support other bundle than main MarkerView.viewFromXib\(\) [\#3215](https://github.com/danielgindi/Charts/pull/3215) ([charlymr](https://github.com/charlymr)) +- BubbleChart uses correct colour for index now. [\#3202](https://github.com/danielgindi/Charts/pull/3202) ([jjatie](https://github.com/jjatie)) +- Added custom text alignment for noData [\#3199](https://github.com/danielgindi/Charts/pull/3199) ([jjatie](https://github.com/jjatie)) +- Call setNeedsDisplay\(\) to trigger render noDataText [\#3198](https://github.com/danielgindi/Charts/pull/3198) ([liuxuan30](https://github.com/liuxuan30)) +- Updated README for 3.0.5 [\#3183](https://github.com/danielgindi/Charts/pull/3183) ([jjatie](https://github.com/jjatie)) +- Balloon Marker indicates position of data [\#3181](https://github.com/danielgindi/Charts/pull/3181) ([jjatie](https://github.com/jjatie)) +- Fixed a duplicated assignment compared with obj-c code. [\#3179](https://github.com/danielgindi/Charts/pull/3179) ([canapio](https://github.com/canapio)) +- Fixed X-Axis Labels Not Showing \(\#3154\) [\#3174](https://github.com/danielgindi/Charts/pull/3174) ([leedsalex](https://github.com/leedsalex)) +- fix programatical unhighlighting for BarCharView [\#3159](https://github.com/danielgindi/Charts/pull/3159) ([jekahy](https://github.com/jekahy)) +- Removed optionality from valueFormatter where appropriate [\#3106](https://github.com/danielgindi/Charts/pull/3106) ([jjatie](https://github.com/jjatie)) +- Moved the default value formatter [\#3088](https://github.com/danielgindi/Charts/pull/3088) ([jjatie](https://github.com/jjatie)) +- Utils Cleanup [\#3054](https://github.com/danielgindi/Charts/pull/3054) ([jjatie](https://github.com/jjatie)) +- weak -\> unowned [\#3039](https://github.com/danielgindi/Charts/pull/3039) ([jjatie](https://github.com/jjatie)) +- Fix BalloonMarker's text position calculation, consider insets [\#3035](https://github.com/danielgindi/Charts/pull/3035) ([yangcaimu](https://github.com/yangcaimu)) +- Chartdata collection refactor [\#3024](https://github.com/danielgindi/Charts/pull/3024) ([jjatie](https://github.com/jjatie)) +- Chartdata collection conformance [\#3023](https://github.com/danielgindi/Charts/pull/3023) ([jjatie](https://github.com/jjatie)) +- Give the users customizable axis label limits \(Fixes \#2085\) [\#2894](https://github.com/danielgindi/Charts/pull/2894) ([igzrobertoestrada](https://github.com/igzrobertoestrada)) +- For \#2840. add dataIndex parameter in `highlightValue\(\)` calls [\#2852](https://github.com/danielgindi/Charts/pull/2852) ([liuxuan30](https://github.com/liuxuan30)) +- fix \#2356 crash if floor\(10.0 \* intervalMagnitude\) is 0.0 [\#2377](https://github.com/danielgindi/Charts/pull/2377) ([liuxuan30](https://github.com/liuxuan30)) +- Fixes the distance issue between the legend and the horizontal bar chart \(Fixes \#2138\) [\#2214](https://github.com/danielgindi/Charts/pull/2214) ([SvenMuc](https://github.com/SvenMuc)) + +## [v3.0.5](https://github.com/danielgindi/Charts/tree/v3.0.5) (2018-01-08) +[Full Changelog](https://github.com/danielgindi/Charts/compare/3.0.5...v3.0.5) + +## [3.0.5](https://github.com/danielgindi/Charts/tree/3.0.5) (2018-01-08) +[Full Changelog](https://github.com/danielgindi/Charts/compare/3.0.4...3.0.5) + +**Implemented enhancements:** + +- range, and therefore interval, is NaN in computeAxisValues [\#2845](https://github.com/danielgindi/Charts/issues/2845) +- Crash when calling `func highlightValue\(x: Double, dataSetIndex: Int, callDelegate: Bool\)` [\#2840](https://github.com/danielgindi/Charts/issues/2840) + +**Fixed bugs:** + +- Combined Chart, when highlight is active, bars hides line [\#3091](https://github.com/danielgindi/Charts/issues/3091) +- A problem of CombinedChartView's YAxis [\#1830](https://github.com/danielgindi/Charts/issues/1830) + +**Closed issues:** + +- Command /bin/sh failed with exit code 1 [\#3156](https://github.com/danielgindi/Charts/issues/3156) +- Xcode 9 / Swift 4 issue with current master [\#3152](https://github.com/danielgindi/Charts/issues/3152) +- Is it possible to show value on touch next to highlight position? [\#3151](https://github.com/danielgindi/Charts/issues/3151) +- Remove legend [\#3150](https://github.com/danielgindi/Charts/issues/3150) +- Add a shadow to the line chart [\#3148](https://github.com/danielgindi/Charts/issues/3148) +- Missing alternate x-axis labels on line chart [\#3139](https://github.com/danielgindi/Charts/issues/3139) +- Can the histogram set the corner? [\#3138](https://github.com/danielgindi/Charts/issues/3138) +- Charts demo ipa file request [\#3137](https://github.com/danielgindi/Charts/issues/3137) +- Main Thread Checker: UI API called on background thread. [\#3129](https://github.com/danielgindi/Charts/issues/3129) +- How to get X\_axis touch points coordinates in radar graph [\#3127](https://github.com/danielgindi/Charts/issues/3127) +- Division by zero crash in AxisRendererBase [\#3124](https://github.com/danielgindi/Charts/issues/3124) +- why bar chart non start at zero [\#3123](https://github.com/danielgindi/Charts/issues/3123) +- BarChart - Show X-Axis with Step as 1 [\#3122](https://github.com/danielgindi/Charts/issues/3122) +- Have Line Graph Value Labels Above/Below Independently [\#3120](https://github.com/danielgindi/Charts/issues/3120) +- Corner Radius on Grid Background [\#3119](https://github.com/danielgindi/Charts/issues/3119) +- ChartsDemo doesn't compile [\#3116](https://github.com/danielgindi/Charts/issues/3116) +- Rounded line chart [\#3115](https://github.com/danielgindi/Charts/issues/3115) +- value of barChart covered by title [\#3113](https://github.com/danielgindi/Charts/issues/3113) +- PieChartView Can not highlight which i want to highlighted [\#3110](https://github.com/danielgindi/Charts/issues/3110) +- How to scroll bar chart if max values to show? [\#3101](https://github.com/danielgindi/Charts/issues/3101) +- Is it possible to draw a chart like this? [\#3097](https://github.com/danielgindi/Charts/issues/3097) +- How to disable the rotation option of pie charts in iOS charts? [\#3096](https://github.com/danielgindi/Charts/issues/3096) +- How to disable the rotation option of pie charts in iOS charts? [\#3095](https://github.com/danielgindi/Charts/issues/3095) +- 数据空值处理问题 [\#3094](https://github.com/danielgindi/Charts/issues/3094) +- how to display the integer values on pie chart instead of float? [\#3093](https://github.com/danielgindi/Charts/issues/3093) +- Line Chart point colours depend on value at each point [\#3090](https://github.com/danielgindi/Charts/issues/3090) +- how to cancel highlights when the drag gesture ends [\#3089](https://github.com/danielgindi/Charts/issues/3089) +- why my value is .50 ?Why not 0.5? How to do? [\#3083](https://github.com/danielgindi/Charts/issues/3083) +- how to use String in YAxis, rather than Double? [\#3082](https://github.com/danielgindi/Charts/issues/3082) +- Scrolling axis [\#3081](https://github.com/danielgindi/Charts/issues/3081) +- Clipping of values in line graph [\#3077](https://github.com/danielgindi/Charts/issues/3077) +- \[LineChart\] Ignore / don't plot first or end value [\#3075](https://github.com/danielgindi/Charts/issues/3075) +- Which attribute control the yellow line,like the picture? [\#3074](https://github.com/danielgindi/Charts/issues/3074) +- Archive error using swift 4.0 [\#3072](https://github.com/danielgindi/Charts/issues/3072) +- How can I have a chart like this one? [\#3070](https://github.com/danielgindi/Charts/issues/3070) +- Module compiled with Swift 4.0 cannot be imported in Swift 3.2.3 [\#3068](https://github.com/danielgindi/Charts/issues/3068) +- Unable to make chart look like IOS Stock App after trying every mode \(LineChartModeLinear = 0, LineChartModeStepped = 1, LineChartModeCubicBezier = 2, LineChartModeHorizontalBezier = 3\) of LineChartDataSet [\#3066](https://github.com/danielgindi/Charts/issues/3066) +- Cannot Select barChar column [\#3065](https://github.com/danielgindi/Charts/issues/3065) +- Updating data in LineChart takes up to 30 seconds [\#3064](https://github.com/danielgindi/Charts/issues/3064) +- How to sync the scrolling of 2 charts [\#3063](https://github.com/danielgindi/Charts/issues/3063) +- Line chart with bottom spacing and custom position y-labels at min and max values [\#3059](https://github.com/danielgindi/Charts/issues/3059) +- 'characters' is deprecated: Please use String or Substring directly [\#3057](https://github.com/danielgindi/Charts/issues/3057) +- Pod to OC error [\#3053](https://github.com/danielgindi/Charts/issues/3053) +- How to represent a null value,It's like the picture? not 0 [\#3052](https://github.com/danielgindi/Charts/issues/3052) +- dyld library not loaded @rpath/charts.framework/charts reason : image not found XCode 9.1 MacOS version 10.12.6 [\#3050](https://github.com/danielgindi/Charts/issues/3050) +- Can't change the border width of circle point in line chart. [\#3049](https://github.com/danielgindi/Charts/issues/3049) +- Charts library is not working in Swift 4 Xcode 9 [\#3048](https://github.com/danielgindi/Charts/issues/3048) +- Create an image of the entire chart [\#3037](https://github.com/danielgindi/Charts/issues/3037) +- lineChartView only enables one data set to be with icons [\#3036](https://github.com/danielgindi/Charts/issues/3036) +- Add charts to UIView programatically [\#3033](https://github.com/danielgindi/Charts/issues/3033) +- Only disable animation for adding values [\#3031](https://github.com/danielgindi/Charts/issues/3031) +- BarChartDataSet with only negative values doesn't call stringForValue on formatter [\#3030](https://github.com/danielgindi/Charts/issues/3030) +- Please provide an example for pieradarchart [\#3029](https://github.com/danielgindi/Charts/issues/3029) +- Multiple charts in a collection view [\#3028](https://github.com/danielgindi/Charts/issues/3028) +- Bubbles chart [\#3027](https://github.com/danielgindi/Charts/issues/3027) +- delete [\#3025](https://github.com/danielgindi/Charts/issues/3025) +- How to change position xAxis Label on the Top Bar Chart ? [\#3022](https://github.com/danielgindi/Charts/issues/3022) +- How to decrease space between chartData ? Is there any parameter ? [\#3021](https://github.com/danielgindi/Charts/issues/3021) +- 已解决 [\#3020](https://github.com/danielgindi/Charts/issues/3020) +- Drawing min mix median lines [\#3017](https://github.com/danielgindi/Charts/issues/3017) +- Installation error through cocapods [\#3016](https://github.com/danielgindi/Charts/issues/3016) +- Swift 4.0.2 not compatible [\#3015](https://github.com/danielgindi/Charts/issues/3015) +- Error NSAttributedStringKey.font on Xcode 9.1 Swift 4 with Charts \(3.0.4\) [\#3014](https://github.com/danielgindi/Charts/issues/3014) +- Double Bar Lines [\#3013](https://github.com/danielgindi/Charts/issues/3013) +- Same zero line for left and right axis [\#3011](https://github.com/danielgindi/Charts/issues/3011) +- How to get version 3.0.2 ? [\#3009](https://github.com/danielgindi/Charts/issues/3009) +- How can I scroll to previous data? [\#3006](https://github.com/danielgindi/Charts/issues/3006) +- Crashing in X-axis render method. [\#3004](https://github.com/danielgindi/Charts/issues/3004) +- How to align yAxis at zero point? [\#2989](https://github.com/danielgindi/Charts/issues/2989) +- Line Chart View not drawn because Date values in xAxis \(not sorted Ascending/Descending\) ? [\#2988](https://github.com/danielgindi/Charts/issues/2988) +- Showing .0, .00 accoding the the decimal places insted of 0 in graphs [\#2987](https://github.com/danielgindi/Charts/issues/2987) +- How to select one of them in the first time。 [\#2985](https://github.com/danielgindi/Charts/issues/2985) +- 当饼状图的数据为0%的时候,左下角有个多余的字母N,问题已解决,有遇到这个问题的请私聊我 [\#2984](https://github.com/danielgindi/Charts/issues/2984) +- Scale to particular x-axis range in line chart [\#2979](https://github.com/danielgindi/Charts/issues/2979) +- ChartViewDelegate [\#2978](https://github.com/danielgindi/Charts/issues/2978) +- What is the compatible version with Xcode 8.3.3 ? [\#2977](https://github.com/danielgindi/Charts/issues/2977) +- ScatterChartDataSet troubles with alignments. [\#2976](https://github.com/danielgindi/Charts/issues/2976) +- Uneven X-Axis values for a line chart [\#2975](https://github.com/danielgindi/Charts/issues/2975) +- Stacked bar chart value label clipped [\#2974](https://github.com/danielgindi/Charts/issues/2974) +- Pie chart monochrome or gradient fill not support [\#2973](https://github.com/danielgindi/Charts/issues/2973) +- PieChart:- PieChart not completely show. [\#2972](https://github.com/danielgindi/Charts/issues/2972) +- Error after updating to Xcode 9.1 [\#2970](https://github.com/danielgindi/Charts/issues/2970) +- Add cornerRadius to vertical highlighter line and draw circle only on highlight [\#2969](https://github.com/danielgindi/Charts/issues/2969) +- How can I don't draw lines when data absent at some point? [\#2968](https://github.com/danielgindi/Charts/issues/2968) +- How to use your file directly to my project without pod installation? [\#2964](https://github.com/danielgindi/Charts/issues/2964) +- Line chart lines are clipped [\#2963](https://github.com/danielgindi/Charts/issues/2963) +- Marker with multiple datasets [\#2962](https://github.com/danielgindi/Charts/issues/2962) +- how do i run it in xcode 9?? [\#2958](https://github.com/danielgindi/Charts/issues/2958) +- Regarding Xcode version [\#2957](https://github.com/danielgindi/Charts/issues/2957) +- Cannot align chart description on left instead of right [\#2956](https://github.com/danielgindi/Charts/issues/2956) +- change color of bar chart programmatically ? [\#2954](https://github.com/danielgindi/Charts/issues/2954) +- Remove or change line color in chart [\#2953](https://github.com/danielgindi/Charts/issues/2953) +- Show line bar position per seconds [\#2952](https://github.com/danielgindi/Charts/issues/2952) +- Add Two Custom Marker views on linechart graph [\#2951](https://github.com/danielgindi/Charts/issues/2951) +- Display high and low value in chart but Displayed one only [\#2947](https://github.com/danielgindi/Charts/issues/2947) +- Change LineChartDataSet label color not value color. [\#2944](https://github.com/danielgindi/Charts/issues/2944) +- when dataset value is increases then the graph value is misplace . and i am showing three bar in one group. and also show the integer value in particular bar above. [\#2938](https://github.com/danielgindi/Charts/issues/2938) +- Errors after conversion to Swift4 NSAttributedStringKey [\#2937](https://github.com/danielgindi/Charts/issues/2937) +- xAxis setLabelsToSkip and valuesObjc want to have replace api [\#2936](https://github.com/danielgindi/Charts/issues/2936) +- xAxis value is started with 0 but it not coordinate with y axis 0 value [\#2935](https://github.com/danielgindi/Charts/issues/2935) +- line charts with many gradients according the value [\#2934](https://github.com/danielgindi/Charts/issues/2934) +- Xcode 9.1 - Characters is deprecated [\#2933](https://github.com/danielgindi/Charts/issues/2933) +- How to add corner radius to balloonmarker [\#2932](https://github.com/danielgindi/Charts/issues/2932) +- leftAxis and rightAxis didn't show up [\#2931](https://github.com/danielgindi/Charts/issues/2931) +- Errors when importing BalloonMarker [\#2928](https://github.com/danielgindi/Charts/issues/2928) +- Bar chart does not start at zero. [\#2927](https://github.com/danielgindi/Charts/issues/2927) +- The following binaries use incompatible versions of Swift [\#2926](https://github.com/danielgindi/Charts/issues/2926) +- Change the color of a specific X-Axis label and the corresponding data value in a line chart using Charts framework [\#2925](https://github.com/danielgindi/Charts/issues/2925) +- Adding corner radius on top of Bar [\#2924](https://github.com/danielgindi/Charts/issues/2924) +- I want to change colour of the label text on the x-axis where it's highlighted. [\#2923](https://github.com/danielgindi/Charts/issues/2923) +- How to give Gradient colour for limit line in linechartviewDataSet [\#2922](https://github.com/danielgindi/Charts/issues/2922) +- Gradient colour for stroke line horizantally .It is possible in android [\#2921](https://github.com/danielgindi/Charts/issues/2921) +- y axis range not automatically recalculated when adding entry to data set [\#2920](https://github.com/danielgindi/Charts/issues/2920) +- Build framework from project [\#2919](https://github.com/danielgindi/Charts/issues/2919) +- How to draw a diagram above the axis labels? [\#2918](https://github.com/danielgindi/Charts/issues/2918) +- - [\#2917](https://github.com/danielgindi/Charts/issues/2917) +- How to use IValueFormatter in stacked bar chart [\#2916](https://github.com/danielgindi/Charts/issues/2916) +- Use of unresolved identifier NSAttributedStringKey in Xcode 8.3.2 for swift 3 [\#2915](https://github.com/danielgindi/Charts/issues/2915) +- Barchart with rounded bar style [\#2912](https://github.com/danielgindi/Charts/issues/2912) +- Animate adding single point [\#2911](https://github.com/danielgindi/Charts/issues/2911) +- Crash [\#2910](https://github.com/danielgindi/Charts/issues/2910) +- Multi Window [\#2909](https://github.com/danielgindi/Charts/issues/2909) +- how can I unhighlight any slice selected before in PieChart ? [\#2908](https://github.com/danielgindi/Charts/issues/2908) +- Barchart DefaultValueFormatter dataSetIndex always 0 [\#2907](https://github.com/danielgindi/Charts/issues/2907) +- LineChartDataSet Multi color [\#2906](https://github.com/danielgindi/Charts/issues/2906) +- How to disconnect data points? [\#2905](https://github.com/danielgindi/Charts/issues/2905) +- Licensing question [\#2904](https://github.com/danielgindi/Charts/issues/2904) +- A way to add values to labels on x axis? [\#2903](https://github.com/danielgindi/Charts/issues/2903) +- Update cocoapods.org version [\#2902](https://github.com/danielgindi/Charts/issues/2902) +- noDataText for PieChartView isn't working. [\#2901](https://github.com/danielgindi/Charts/issues/2901) +- xcode9 alert swift question [\#2900](https://github.com/danielgindi/Charts/issues/2900) +- Dynamically set the bar width [\#2898](https://github.com/danielgindi/Charts/issues/2898) +- Marker action [\#2897](https://github.com/danielgindi/Charts/issues/2897) +- Filler line for acceptable range of values in LineChart [\#2896](https://github.com/danielgindi/Charts/issues/2896) +- Pie chart full view [\#2895](https://github.com/danielgindi/Charts/issues/2895) +- Problem with BalloonMarker in lineChart [\#2892](https://github.com/danielgindi/Charts/issues/2892) +- OS X Bar chart Demo highlight and stacked color are inconsistent [\#2890](https://github.com/danielgindi/Charts/issues/2890) +- Problem with charts in UITableView cells [\#2888](https://github.com/danielgindi/Charts/issues/2888) +- drawing xAxis ratio values [\#2885](https://github.com/danielgindi/Charts/issues/2885) +- Xcode 9 compatibility [\#2883](https://github.com/danielgindi/Charts/issues/2883) +- Large Whitespace Between X-Axis Labels and Legend [\#2882](https://github.com/danielgindi/Charts/issues/2882) +- help about performance issues about line charts [\#2881](https://github.com/danielgindi/Charts/issues/2881) +- Animation on PieChartView [\#2880](https://github.com/danielgindi/Charts/issues/2880) +- Scrolling chart after setting lineChart.xAxis.axisMaximum = someValue [\#2879](https://github.com/danielgindi/Charts/issues/2879) +- "chartValueSelected" is not getting called in customView [\#2878](https://github.com/danielgindi/Charts/issues/2878) +- curve line [\#2877](https://github.com/danielgindi/Charts/issues/2877) +- Swift 4 issue [\#2876](https://github.com/danielgindi/Charts/issues/2876) +- 不显示百分号了 [\#2873](https://github.com/danielgindi/Charts/issues/2873) +- LineChartView: Using two different colors in one dataset [\#2871](https://github.com/danielgindi/Charts/issues/2871) +- xcode 9.0 errors after installing pod 'Charts' [\#2869](https://github.com/danielgindi/Charts/issues/2869) +- Change scroll direction HorizontalBarChartView x-axis from top to bottom chart [\#2868](https://github.com/danielgindi/Charts/issues/2868) +- Set names of X-axis and Y-axis itself \(not their labels\) [\#2867](https://github.com/danielgindi/Charts/issues/2867) +- 'characters' is deprecated: Please use String or Substring directly [\#2866](https://github.com/danielgindi/Charts/issues/2866) +- Syntax error in pod [\#2865](https://github.com/danielgindi/Charts/issues/2865) +- Filled Line Chart [\#2863](https://github.com/danielgindi/Charts/issues/2863) +- How can I highlight a specific slice of the PieChart? [\#2862](https://github.com/danielgindi/Charts/issues/2862) +- How can I make the chart rotate completely, 360, 720 on a button click ? [\#2861](https://github.com/danielgindi/Charts/issues/2861) +- How can I make the chart rotate completely, 360, 720 on a button click ? [\#2860](https://github.com/danielgindi/Charts/issues/2860) +- xcode9 pod install have a problem [\#2856](https://github.com/danielgindi/Charts/issues/2856) +- can I implement stacked bar with rounded corners ? [\#2855](https://github.com/danielgindi/Charts/issues/2855) +- Updating Charts to 3.0.4 and Swift 4 doesn't work [\#2851](https://github.com/danielgindi/Charts/issues/2851) +- How to add string labels to XAxis horizontal bar in Charts framework\(swift 3\) [\#2850](https://github.com/danielgindi/Charts/issues/2850) +- How to show off numbers in HorizontalBar [\#2849](https://github.com/danielgindi/Charts/issues/2849) +- In Multiple bar chart Unable to set Values more than 4 bar in under given year.. [\#2847](https://github.com/danielgindi/Charts/issues/2847) +- Type 'NSAttributedStringKey' \(aka 'NSString'\) has no member 'font' [\#2844](https://github.com/danielgindi/Charts/issues/2844) +- Install charts via cocapods pulls back old version 3.0.2 [\#2843](https://github.com/danielgindi/Charts/issues/2843) +- xcode 9.0 compile ERROR: "static var 'defaultFormatter' is not public" [\#2842](https://github.com/danielgindi/Charts/issues/2842) +- Pass String to LineChartData [\#2841](https://github.com/danielgindi/Charts/issues/2841) +- Customised graph with ranges\(Normal-blue and Warning-yellow\) also with it's legend [\#2838](https://github.com/danielgindi/Charts/issues/2838) +- using UIGraphicsGetCurrentContext in MarkerImage subclass [\#2835](https://github.com/danielgindi/Charts/issues/2835) +- How to show BarChartDataSet with descending x values? [\#2834](https://github.com/danielgindi/Charts/issues/2834) +- getTransformer function doesn't work properly when AxisDependency is set to right [\#2833](https://github.com/danielgindi/Charts/issues/2833) +- Grouped Bar chart X-axis and Bar Alignment [\#2832](https://github.com/danielgindi/Charts/issues/2832) +- How to create a custom Marker from Xib - Swift [\#2831](https://github.com/danielgindi/Charts/issues/2831) +- does not support new Objective-C project with Xcode 9 [\#2830](https://github.com/danielgindi/Charts/issues/2830) +- radarChart default labelCount [\#2829](https://github.com/danielgindi/Charts/issues/2829) +- NSDecimalNumber instead of Double [\#2828](https://github.com/danielgindi/Charts/issues/2828) +- LineChart 填充 [\#2825](https://github.com/danielgindi/Charts/issues/2825) +- Swift: Different colours for circles in one LineChartDataSet [\#2824](https://github.com/danielgindi/Charts/issues/2824) +- Unable to update Chart library [\#2823](https://github.com/danielgindi/Charts/issues/2823) +- xMin, xMax, yMin, yMax not recalculated to zero on .clear\(\) [\#2822](https://github.com/danielgindi/Charts/issues/2822) +- OS X errors with swift 4 [\#2819](https://github.com/danielgindi/Charts/issues/2819) +- I want to add marker image from line chart in swift 4.0 [\#2818](https://github.com/danielgindi/Charts/issues/2818) +- ChartMarkerView not able to subclass of swift class [\#2817](https://github.com/danielgindi/Charts/issues/2817) +- Type 'NSAttributedStringKey' \(aka 'NSString'\) has no member 'font' [\#2816](https://github.com/danielgindi/Charts/issues/2816) +- StackedBarChart isn't stacking bars [\#2815](https://github.com/danielgindi/Charts/issues/2815) +- Cocoapod 3.0.4 [\#2814](https://github.com/danielgindi/Charts/issues/2814) +- Error aplication Thread in ios 11 with version 3.0.4 [\#2812](https://github.com/danielgindi/Charts/issues/2812) +- Cannot compile with version 3.0.3 and Xcode 9 due to incompatible Swift version [\#2810](https://github.com/danielgindi/Charts/issues/2810) +- I have the version 3.0.4 but when compile project I has an error [\#2809](https://github.com/danielgindi/Charts/issues/2809) +- 拖动的时候 会强烈抖动 [\#2808](https://github.com/danielgindi/Charts/issues/2808) +- Version 3.0.4 doesn't appear via Cocoapods [\#2807](https://github.com/danielgindi/Charts/issues/2807) +- Bump Pod Version [\#2805](https://github.com/danielgindi/Charts/issues/2805) +- module 'Charts' not found when dray it into target [\#2803](https://github.com/danielgindi/Charts/issues/2803) +- How to get y-axis values "Int" to "Double" [\#2799](https://github.com/danielgindi/Charts/issues/2799) +- The line chart enlarged is crash [\#2797](https://github.com/danielgindi/Charts/issues/2797) +- How to change the entrylabel\(i.e, 90%\) color in PieChart [\#2794](https://github.com/danielgindi/Charts/issues/2794) +- Chart Grid Lines Don't Always Draw [\#2791](https://github.com/danielgindi/Charts/issues/2791) +- Charts.framework: No such file or directory [\#2789](https://github.com/danielgindi/Charts/issues/2789) +- Memory Leak in Horizontal Bar Chart [\#2745](https://github.com/danielgindi/Charts/issues/2745) +- axisDependency does not work [\#2258](https://github.com/danielgindi/Charts/issues/2258) +- HorizontalBarChart does not update labels correctly [\#2257](https://github.com/danielgindi/Charts/issues/2257) + +**Merged pull requests:** + +- Syncing 4.0.0 with master [\#3160](https://github.com/danielgindi/Charts/pull/3160) ([jjatie](https://github.com/jjatie)) +- Subclassing of LegendRenderer didn't take any effect [\#3149](https://github.com/danielgindi/Charts/pull/3149) ([l-lemesev](https://github.com/l-lemesev)) +- Update ViewPortHandler.swift [\#3143](https://github.com/danielgindi/Charts/pull/3143) ([ParkinWu](https://github.com/ParkinWu)) +- Renderer protocols [\#3136](https://github.com/danielgindi/Charts/pull/3136) ([jjatie](https://github.com/jjatie)) +- Update 4.0.0 with master [\#3135](https://github.com/danielgindi/Charts/pull/3135) ([jjatie](https://github.com/jjatie)) +- Fix axis label disappear when zooming in deep enough [\#3132](https://github.com/danielgindi/Charts/pull/3132) ([liuxuan30](https://github.com/liuxuan30)) +- Updating 4.0.0 with latest changes in master [\#3130](https://github.com/danielgindi/Charts/pull/3130) ([jjatie](https://github.com/jjatie)) +- add option to build demo projects unit tests on iOS [\#3121](https://github.com/danielgindi/Charts/pull/3121) ([liuxuan30](https://github.com/liuxuan30)) +- Makes ChartsDemo compiling again [\#3117](https://github.com/danielgindi/Charts/pull/3117) ([valeriyvan](https://github.com/valeriyvan)) +- Fixed using wrong axis \(Issue \#2257\) [\#3114](https://github.com/danielgindi/Charts/pull/3114) ([defranke](https://github.com/defranke)) +- for \#3061 fix animation crash [\#3098](https://github.com/danielgindi/Charts/pull/3098) ([liuxuan30](https://github.com/liuxuan30)) +- Refactored ChartUtils method into CGPoint extension [\#3087](https://github.com/danielgindi/Charts/pull/3087) ([jjatie](https://github.com/jjatie)) +- Moved ChartUtils drawing methods into CGContext extension [\#3086](https://github.com/danielgindi/Charts/pull/3086) ([jjatie](https://github.com/jjatie)) +- for \#2745. chart should be weak. [\#3078](https://github.com/danielgindi/Charts/pull/3078) ([liuxuan30](https://github.com/liuxuan30)) +- Fix a bug may cause infinite loop. [\#3073](https://github.com/danielgindi/Charts/pull/3073) ([JyHu](https://github.com/JyHu)) +- Chartviewbase redundant ivar [\#3045](https://github.com/danielgindi/Charts/pull/3045) ([jjatie](https://github.com/jjatie)) +- Removed `isKind\(of:\)` [\#3044](https://github.com/danielgindi/Charts/pull/3044) ([jjatie](https://github.com/jjatie)) +- Removed redundant ivars in BarLineChartViewBase [\#3043](https://github.com/danielgindi/Charts/pull/3043) ([jjatie](https://github.com/jjatie)) +- fileprivate -\> private [\#3042](https://github.com/danielgindi/Charts/pull/3042) ([jjatie](https://github.com/jjatie)) +- Viewportjob minor cleanup [\#3041](https://github.com/danielgindi/Charts/pull/3041) ([jjatie](https://github.com/jjatie)) +- Removed @objc from internal properties [\#3038](https://github.com/danielgindi/Charts/pull/3038) ([jjatie](https://github.com/jjatie)) +- Minor changes to BubbleChartRenderer logic [\#3010](https://github.com/danielgindi/Charts/pull/3010) ([jjatie](https://github.com/jjatie)) +- BarChartRenderer Logic cleanup [\#3008](https://github.com/danielgindi/Charts/pull/3008) ([jjatie](https://github.com/jjatie)) +- Minor changes to Animator [\#3005](https://github.com/danielgindi/Charts/pull/3005) ([jjatie](https://github.com/jjatie)) +- Minor cleanup to Highlighter types [\#3003](https://github.com/danielgindi/Charts/pull/3003) ([jjatie](https://github.com/jjatie)) +- Resubmit of \#2730 [\#3002](https://github.com/danielgindi/Charts/pull/3002) ([jjatie](https://github.com/jjatie)) +- The backing var is not necessary. [\#3000](https://github.com/danielgindi/Charts/pull/3000) ([jjatie](https://github.com/jjatie)) +- Minor refactoring of Formatter logic [\#2998](https://github.com/danielgindi/Charts/pull/2998) ([jjatie](https://github.com/jjatie)) +- Remove java interface convention [\#2997](https://github.com/danielgindi/Charts/pull/2997) ([jjatie](https://github.com/jjatie)) +- Removed methods and properties deprecated in 1.0 [\#2996](https://github.com/danielgindi/Charts/pull/2996) ([jjatie](https://github.com/jjatie)) +- Replaced `ChartUtils` methods with `CGSize` extensions [\#2995](https://github.com/danielgindi/Charts/pull/2995) ([jjatie](https://github.com/jjatie)) +- Replaced relevant `ChartUtils` methods with `Double` extensions [\#2994](https://github.com/danielgindi/Charts/pull/2994) ([jjatie](https://github.com/jjatie)) +- Replaced `ChartUtils.Math` in favour of an extension on `FloatingPoint` [\#2993](https://github.com/danielgindi/Charts/pull/2993) ([jjatie](https://github.com/jjatie)) +- Minor changes to logic in `ViewPortJob` subclasses. [\#2992](https://github.com/danielgindi/Charts/pull/2992) ([jjatie](https://github.com/jjatie)) +- `ChartRenderer`'s must be initialized with a chart [\#2982](https://github.com/danielgindi/Charts/pull/2982) ([jjatie](https://github.com/jjatie)) +- Animator non nil [\#2981](https://github.com/danielgindi/Charts/pull/2981) ([jjatie](https://github.com/jjatie)) +- View port handler nonnil [\#2980](https://github.com/danielgindi/Charts/pull/2980) ([jjatie](https://github.com/jjatie)) +- Add support for iPhone X [\#2967](https://github.com/danielgindi/Charts/pull/2967) ([liuxuan30](https://github.com/liuxuan30)) +- added highlightColor parameter for pie charts [\#2961](https://github.com/danielgindi/Charts/pull/2961) ([pascalherrmann](https://github.com/pascalherrmann)) +- Add Swift Package Manager support. [\#2950](https://github.com/danielgindi/Charts/pull/2950) ([BrianDoig](https://github.com/BrianDoig)) +- Fix turning off drag in X and Y axes separately. [\#2949](https://github.com/danielgindi/Charts/pull/2949) ([maciejtrybilo](https://github.com/maciejtrybilo)) +- modify for Character Alert: characters is deprecated [\#2942](https://github.com/danielgindi/Charts/pull/2942) ([suzuhiroruri](https://github.com/suzuhiroruri)) +- fix \#2890. Turned out it's multiple bar chart but not grouped [\#2891](https://github.com/danielgindi/Charts/pull/2891) ([liuxuan30](https://github.com/liuxuan30)) +- Update LICENSE [\#2887](https://github.com/danielgindi/Charts/pull/2887) ([sDaniel](https://github.com/sDaniel)) +- fix \#1830. credit from https://github.com/danielgindi/Charts/pull/2049 [\#2874](https://github.com/danielgindi/Charts/pull/2874) ([liuxuan30](https://github.com/liuxuan30)) +- duplicated code for set1 in set2 section [\#2872](https://github.com/danielgindi/Charts/pull/2872) ([liuxuan30](https://github.com/liuxuan30)) +- added DataApproximator+N extension [\#2848](https://github.com/danielgindi/Charts/pull/2848) ([666tos](https://github.com/666tos)) +- Bumped pod version [\#2806](https://github.com/danielgindi/Charts/pull/2806) ([mohpor](https://github.com/mohpor)) +- unwrap optionals [\#2698](https://github.com/danielgindi/Charts/pull/2698) ([russellbstephens](https://github.com/russellbstephens)) +- Replaced unnecessary NSObjectProtocol [\#2629](https://github.com/danielgindi/Charts/pull/2629) ([jjatie](https://github.com/jjatie)) +- Swift iOS Demos [\#2628](https://github.com/danielgindi/Charts/pull/2628) ([jjatie](https://github.com/jjatie)) +- add example playground [\#2364](https://github.com/danielgindi/Charts/pull/2364) ([thierryH91200](https://github.com/thierryH91200)) +- Compatibility with swift playgrounds [\#2335](https://github.com/danielgindi/Charts/pull/2335) ([macteo](https://github.com/macteo)) + +## [3.0.4](https://github.com/danielgindi/Charts/tree/3.0.4) (2017-09-21) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v3.0.4...3.0.4) + +## [v3.0.4](https://github.com/danielgindi/Charts/tree/v3.0.4) (2017-09-21) +[Full Changelog](https://github.com/danielgindi/Charts/compare/3.0.3...v3.0.4) + +**Closed issues:** + +- cocoaPod can not install branch of swift4 [\#2802](https://github.com/danielgindi/Charts/issues/2802) +- Swift 4 [\#2801](https://github.com/danielgindi/Charts/issues/2801) +- how tomake leftAxis.inverted and LineChartDataSet.fillColor not inverted [\#2798](https://github.com/danielgindi/Charts/issues/2798) +- Bar Chart Demo One Label One Color [\#2792](https://github.com/danielgindi/Charts/issues/2792) +- BarChart draw vertical dotted lines on specific bars [\#2788](https://github.com/danielgindi/Charts/issues/2788) +- How can I control the number of decimals? [\#2787](https://github.com/danielgindi/Charts/issues/2787) +- Charts “3.0.2” cannot find "BalloonMarker" [\#2786](https://github.com/danielgindi/Charts/issues/2786) +- Graphs gets cut from both ends [\#2785](https://github.com/danielgindi/Charts/issues/2785) +- Is it possible to draw multiple lineCharts with different starting points on same view? [\#2783](https://github.com/danielgindi/Charts/issues/2783) +- getFormattedLabel Index Out of Range [\#2782](https://github.com/danielgindi/Charts/issues/2782) +- Line chart right axis inset [\#2781](https://github.com/danielgindi/Charts/issues/2781) +- No type or protocol named 'IChartAxisValueFormatter' [\#2780](https://github.com/danielgindi/Charts/issues/2780) +- Zero Value is under BarChart [\#2779](https://github.com/danielgindi/Charts/issues/2779) +- App crashes while using Charts swift library in Objective C Project [\#2778](https://github.com/danielgindi/Charts/issues/2778) +- Cannot subscript a value of type '\[String : AnyObject\]' with an index of type 'NSAttributedStringKey' [\#2777](https://github.com/danielgindi/Charts/issues/2777) +- How to drag data entries to change their y value in real time. [\#2776](https://github.com/danielgindi/Charts/issues/2776) +- How to break line the legends ? [\#2775](https://github.com/danielgindi/Charts/issues/2775) +- How can I get current viewport shown x range and scale value [\#2770](https://github.com/danielgindi/Charts/issues/2770) +- How to disable scale of left YAxis? [\#2748](https://github.com/danielgindi/Charts/issues/2748) +- Bar Chart remove x if y is 0 [\#2747](https://github.com/danielgindi/Charts/issues/2747) +- How to display Negative X-Axis on LineChart [\#797](https://github.com/danielgindi/Charts/issues/797) + +**Merged pull requests:** + +- Changes for Swift 4 [\#2507](https://github.com/danielgindi/Charts/pull/2507) ([liuxuan30](https://github.com/liuxuan30)) + +## [3.0.3](https://github.com/danielgindi/Charts/tree/3.0.3) (2017-09-08) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v3.0.3...3.0.3) + +## [v3.0.3](https://github.com/danielgindi/Charts/tree/v3.0.3) (2017-09-08) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v3.0.2...v3.0.3) + +**Implemented enhancements:** + +- fatal error: Index out of range [\#2109](https://github.com/danielgindi/Charts/issues/2109) + +**Fixed bugs:** + +- Crash in YAxisRendererRadarChart [\#2356](https://github.com/danielgindi/Charts/issues/2356) +- Fatal error when providing multiple data sets in PieChartData [\#2099](https://github.com/danielgindi/Charts/issues/2099) + +**Closed issues:** + +- X Values Hidden On Bar Graph [\#2774](https://github.com/danielgindi/Charts/issues/2774) +- How to add new real-time data to lineChart ? [\#2773](https://github.com/danielgindi/Charts/issues/2773) +- Avoid xAxis limit-labels display in a one-bar BarChart. [\#2771](https://github.com/danielgindi/Charts/issues/2771) +- zoom at particular position via code [\#2769](https://github.com/danielgindi/Charts/issues/2769) +- how to use HorizontalBarChart with decimal number as xAxis [\#2768](https://github.com/danielgindi/Charts/issues/2768) +- Cannot rescale Y-axis even if changing axisMinimum and axisMaximum [\#2766](https://github.com/danielgindi/Charts/issues/2766) +- I want to change ValueFormat of BarChartDataSet. I can't change it. [\#2764](https://github.com/danielgindi/Charts/issues/2764) +- Changing x-label formats from one line to word-wrapped is awkward [\#2763](https://github.com/danielgindi/Charts/issues/2763) +- chartValueSelected not getting value from Max Value [\#2762](https://github.com/danielgindi/Charts/issues/2762) +- Dual YAxis [\#2761](https://github.com/danielgindi/Charts/issues/2761) +- How to set the position of the values top on BarChartView? [\#2759](https://github.com/danielgindi/Charts/issues/2759) +- Line chart xAxis cut left or right in iphone 5 [\#2758](https://github.com/danielgindi/Charts/issues/2758) +- TableView does not scroll vertically after graph is rendered to cells [\#2757](https://github.com/danielgindi/Charts/issues/2757) +- Fill the color between two line charts using IFillFormatter [\#2756](https://github.com/danielgindi/Charts/issues/2756) +- How to use custom view for labels of xAxis? [\#2755](https://github.com/danielgindi/Charts/issues/2755) +- Chart not consistently showing data [\#2753](https://github.com/danielgindi/Charts/issues/2753) +- Obtaining current number of points being rendered in zoomed viewing window [\#2752](https://github.com/danielgindi/Charts/issues/2752) +- Barchart starting above X-Axis [\#2751](https://github.com/danielgindi/Charts/issues/2751) +- Getting the position of Data array of entry: ChartDataEntry via chartValueSelected\(args\) method [\#2750](https://github.com/danielgindi/Charts/issues/2750) +- Create Simple Bar Chart [\#2749](https://github.com/danielgindi/Charts/issues/2749) +- iOS8 simulator crashed iOS 8模拟器崩溃在画Y轴线的地方 [\#2746](https://github.com/danielgindi/Charts/issues/2746) +- Chart displays values, but no bars [\#2744](https://github.com/danielgindi/Charts/issues/2744) +- Can not inherit Charts to subclass some cutomize charts [\#2743](https://github.com/danielgindi/Charts/issues/2743) +- CandleStick fill colors not showing [\#2742](https://github.com/danielgindi/Charts/issues/2742) +- Bar chart click on outside of bar calling delegate [\#2741](https://github.com/danielgindi/Charts/issues/2741) +- Resize chart after adding limit line [\#2739](https://github.com/danielgindi/Charts/issues/2739) +- Pie chart entry icon get cut [\#2738](https://github.com/danielgindi/Charts/issues/2738) +- How can I set ValuePosition for individual slices? [\#2736](https://github.com/danielgindi/Charts/issues/2736) +- You can't slide along the X-axis [\#2735](https://github.com/danielgindi/Charts/issues/2735) +- Candlechart zooming disable interaction with viewcontroller [\#2734](https://github.com/danielgindi/Charts/issues/2734) +- 2 datasets, one should only display one label at the top [\#2733](https://github.com/danielgindi/Charts/issues/2733) +- How do I change the color of the text on top of the bars? [\#2732](https://github.com/danielgindi/Charts/issues/2732) +- Can't subclass BarChartRenderer due to 'fileprivate' status of many properties [\#2731](https://github.com/danielgindi/Charts/issues/2731) +- Left axis axisMinimum inside a TableviewCell does not work [\#2729](https://github.com/danielgindi/Charts/issues/2729) +- How to set minimum displayed Y axis value [\#2728](https://github.com/danielgindi/Charts/issues/2728) +- Custom Text Axis X Horizontal Bar Chart [\#2726](https://github.com/danielgindi/Charts/issues/2726) +- Crash when use in Notification Content Extension [\#2725](https://github.com/danielgindi/Charts/issues/2725) +- Problems encountered with charts [\#2724](https://github.com/danielgindi/Charts/issues/2724) +- Can I use Charts in Swift 4? [\#2723](https://github.com/danielgindi/Charts/issues/2723) +- Add gradient to bar chart [\#2722](https://github.com/danielgindi/Charts/issues/2722) +- Draw bar chart from axisMinimum instead of 0 [\#2721](https://github.com/danielgindi/Charts/issues/2721) +- Different Charts-Swifg.h when simulator and iphone [\#2720](https://github.com/danielgindi/Charts/issues/2720) +- Viewport transX jumping when zooming Y scale \(dynamic/realtime data\) [\#2719](https://github.com/danielgindi/Charts/issues/2719) +- Align X labels with Charts [\#2718](https://github.com/danielgindi/Charts/issues/2718) +- iOS swift3 Chart xaxis duplicate value issue for linechartview [\#2715](https://github.com/danielgindi/Charts/issues/2715) +- Label Position xAxis Radar Chart [\#2714](https://github.com/danielgindi/Charts/issues/2714) +- Showing actual value IN ADDITION to percentage, in a pie slice? [\#2713](https://github.com/danielgindi/Charts/issues/2713) +- Fail to display any thing in line chart. [\#2712](https://github.com/danielgindi/Charts/issues/2712) +- How to decrees column width size in LineChart [\#2710](https://github.com/danielgindi/Charts/issues/2710) +- Runtime EXC\_BAD\_ACCESS with barchart whiles zoom in [\#2709](https://github.com/danielgindi/Charts/issues/2709) +- How to format values on barchart [\#2708](https://github.com/danielgindi/Charts/issues/2708) +- where do I find ioscharts.framework? [\#2707](https://github.com/danielgindi/Charts/issues/2707) +- Add horizontal line at certain value on Y-Axis? [\#2706](https://github.com/danielgindi/Charts/issues/2706) +- BarChart does not render with multiple data sets [\#2705](https://github.com/danielgindi/Charts/issues/2705) +- Balloon Marker: making it work in line chart inside combined view [\#2703](https://github.com/danielgindi/Charts/issues/2703) +- IValueFormatter text showing More than one Time [\#2700](https://github.com/danielgindi/Charts/issues/2700) +- Disable bar selection or highlight? [\#2699](https://github.com/danielgindi/Charts/issues/2699) +- Increase Yaxis Labes According to the max values. [\#2696](https://github.com/danielgindi/Charts/issues/2696) +- xAxis scrolling in combineChartView [\#2695](https://github.com/danielgindi/Charts/issues/2695) +- How to highlight at specific entry ? [\#2693](https://github.com/danielgindi/Charts/issues/2693) +- Horizontal bar charts 'Y' values are getting overlapped with '0' [\#2691](https://github.com/danielgindi/Charts/issues/2691) +- Two ChartViews own the same Xaxis [\#2690](https://github.com/danielgindi/Charts/issues/2690) +- issues about BarChartView [\#2689](https://github.com/danielgindi/Charts/issues/2689) +- Tap Gesture Handler callback method [\#2686](https://github.com/danielgindi/Charts/issues/2686) +- How to draw dashed circles for values? [\#2685](https://github.com/danielgindi/Charts/issues/2685) +- How to Redraw the charts? [\#2684](https://github.com/danielgindi/Charts/issues/2684) +- BarChartView top border not showing [\#2682](https://github.com/danielgindi/Charts/issues/2682) +- Drawing horizontal dashed lines except on x-axis line? [\#2681](https://github.com/danielgindi/Charts/issues/2681) +- X-Axis Date values not displaying properly? [\#2680](https://github.com/danielgindi/Charts/issues/2680) +- Dashed border on highlighted bar - BarChart [\#2675](https://github.com/danielgindi/Charts/issues/2675) +- ChartFill - I would like to fill above the line [\#2674](https://github.com/danielgindi/Charts/issues/2674) +- Anyone have iOS charts working with Xcode 9 Beta? [\#2673](https://github.com/danielgindi/Charts/issues/2673) +- Change Scale on Y Axis for CombinedChart [\#2672](https://github.com/danielgindi/Charts/issues/2672) +- Y-axis with text [\#2671](https://github.com/danielgindi/Charts/issues/2671) +- Show only 2 labels on xAxis in CombinedChartView [\#2670](https://github.com/danielgindi/Charts/issues/2670) +- Graphing just a part of the data [\#2669](https://github.com/danielgindi/Charts/issues/2669) +- How to add texts/image into a chart? [\#2667](https://github.com/danielgindi/Charts/issues/2667) +- Is it possible to scroll without Zooming/ Scaling ? [\#2666](https://github.com/danielgindi/Charts/issues/2666) +- Use Charts in Swift3,Error [\#2664](https://github.com/danielgindi/Charts/issues/2664) +- Custom highlighter/marker [\#2663](https://github.com/danielgindi/Charts/issues/2663) +- Display programatically a marker on a chart [\#2662](https://github.com/danielgindi/Charts/issues/2662) +- Scrollview inside Marker [\#2661](https://github.com/danielgindi/Charts/issues/2661) +- Bitcode Problem [\#2660](https://github.com/danielgindi/Charts/issues/2660) +- Fix Marker on center even when chart is scaled or dragged [\#2659](https://github.com/danielgindi/Charts/issues/2659) +- How to add marker to center position in ios charts while scrolling horizontally with increasing scaleX and enabling drag [\#2658](https://github.com/danielgindi/Charts/issues/2658) +- Y Axis scales display format [\#2657](https://github.com/danielgindi/Charts/issues/2657) +- Marker and long press gesture... [\#2656](https://github.com/danielgindi/Charts/issues/2656) +- Pie chart Crash [\#2655](https://github.com/danielgindi/Charts/issues/2655) +- YAxisValues:"Zero" of the integer part is not displayed when the YAxis coordinate is zero [\#2653](https://github.com/danielgindi/Charts/issues/2653) +- Memory leak when valueFormatter is set [\#2652](https://github.com/danielgindi/Charts/issues/2652) +- autoScaleMinMaxEnabled, axisMaximum and axisMinimum [\#2651](https://github.com/danielgindi/Charts/issues/2651) +- Draw X-Axis labels with dates keeping index of x-axis independent like before [\#2648](https://github.com/danielgindi/Charts/issues/2648) +- About ChartHighLight [\#2647](https://github.com/danielgindi/Charts/issues/2647) +- Start value from X-Axis [\#2646](https://github.com/danielgindi/Charts/issues/2646) +- Combined chart with horizontal bar and bubble [\#2644](https://github.com/danielgindi/Charts/issues/2644) +- I have a problem with compiling [\#2643](https://github.com/danielgindi/Charts/issues/2643) +- How to implement custom dataset in objective-c? [\#2639](https://github.com/danielgindi/Charts/issues/2639) +- I am not able to set values on the bar in simple bar chart. [\#2638](https://github.com/danielgindi/Charts/issues/2638) +- Swift based Charts library increased application size when used for objective c based project [\#2637](https://github.com/danielgindi/Charts/issues/2637) +- 使用CombinedChartView绘制柱形图,如何只让当前bar视图显示灰色背影。 [\#2636](https://github.com/danielgindi/Charts/issues/2636) +- OHLC charts... [\#2635](https://github.com/danielgindi/Charts/issues/2635) +- unable to set string values on x-axis in grouped bar chart . [\#2632](https://github.com/danielgindi/Charts/issues/2632) +- How to set group width in multiple bar chart? [\#2631](https://github.com/danielgindi/Charts/issues/2631) +- override renderLegend\(context: CGContext\) [\#2630](https://github.com/danielgindi/Charts/issues/2630) +- Changing chart's type without creating a new object... [\#2627](https://github.com/danielgindi/Charts/issues/2627) +- Using Charts in NSStackView [\#2626](https://github.com/danielgindi/Charts/issues/2626) +- Does PieChart support multiple columns of vertical legend? [\#2625](https://github.com/danielgindi/Charts/issues/2625) +- I need this method: setShowOnlyMinMax [\#2624](https://github.com/danielgindi/Charts/issues/2624) +- Unable to use this library in Objective-c . [\#2623](https://github.com/danielgindi/Charts/issues/2623) +- 计算柱形图的宽度和设定间隙 [\#2622](https://github.com/danielgindi/Charts/issues/2622) +- How to adjust RadarChartView text from the bottom of the height? [\#2621](https://github.com/danielgindi/Charts/issues/2621) +- How to give all pie-slices a rounded edge? [\#2620](https://github.com/danielgindi/Charts/issues/2620) +- Alternative color to fill in radar chart [\#2617](https://github.com/danielgindi/Charts/issues/2617) +- About gradient color for lineChartView [\#2615](https://github.com/danielgindi/Charts/issues/2615) +- Invalid bundle [\#2614](https://github.com/danielgindi/Charts/issues/2614) +- Want to display circles at data points on a line graph only if the data has changed or is about to change [\#2613](https://github.com/danielgindi/Charts/issues/2613) +- Swift language Version. [\#2612](https://github.com/danielgindi/Charts/issues/2612) +- Linker Command Fail error [\#2611](https://github.com/danielgindi/Charts/issues/2611) +- xAxis's first lable always on the left [\#2610](https://github.com/danielgindi/Charts/issues/2610) +- when i Creat one LineChartData objc. it's draws Three points [\#2609](https://github.com/danielgindi/Charts/issues/2609) +- i wanna display Char form with no data. but with Y Values. [\#2608](https://github.com/danielgindi/Charts/issues/2608) +- Is there any way to get the xaxis value when chart scroll end specific area? [\#2607](https://github.com/danielgindi/Charts/issues/2607) +- Memory Leak in Legend and ArrayBufferProtocol [\#2606](https://github.com/danielgindi/Charts/issues/2606) +- fatal error due to call to computeAxisValues during call to notifyDataSetChanged [\#2605](https://github.com/danielgindi/Charts/issues/2605) +- Bar Chart & label displayed wrongly when dataset count changes [\#2603](https://github.com/danielgindi/Charts/issues/2603) +- BarChart.Axis label change starting index when .rightAxix is enabled [\#2602](https://github.com/danielgindi/Charts/issues/2602) +- Spacing between left axis labels [\#2601](https://github.com/danielgindi/Charts/issues/2601) +- React Native support [\#2598](https://github.com/danielgindi/Charts/issues/2598) +- Not able to see yAxis label while changing position of that label [\#2596](https://github.com/danielgindi/Charts/issues/2596) +- About stacked bar value label postion [\#2595](https://github.com/danielgindi/Charts/issues/2595) +- Invalid Bundle - Xcode 9 Beta 2 [\#2593](https://github.com/danielgindi/Charts/issues/2593) +- Stacked bar always show last value [\#2592](https://github.com/danielgindi/Charts/issues/2592) +- Use Charts in App Extension [\#2590](https://github.com/danielgindi/Charts/issues/2590) +- About bar and line combined [\#2589](https://github.com/danielgindi/Charts/issues/2589) +- Draw graph of a function [\#2588](https://github.com/danielgindi/Charts/issues/2588) +- Scrolling chart [\#2587](https://github.com/danielgindi/Charts/issues/2587) +- How change value double to value int format? [\#2586](https://github.com/danielgindi/Charts/issues/2586) +- stringForValue value [\#2585](https://github.com/danielgindi/Charts/issues/2585) +- Invalid architecture... support arm64. [\#2584](https://github.com/danielgindi/Charts/issues/2584) +- Line chart with blank data show Y axis label incorrect on iPhone 5 [\#2583](https://github.com/danielgindi/Charts/issues/2583) +- 'M\_PI' is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting. [\#2580](https://github.com/danielgindi/Charts/issues/2580) +- 0 lost when the value less than 1.0,why? [\#2579](https://github.com/danielgindi/Charts/issues/2579) +- Error Library not loaded: @rpath/libswiftAppKit.dylib [\#2578](https://github.com/danielgindi/Charts/issues/2578) +- CenterText/Description Text overruns onto PieChart [\#2577](https://github.com/danielgindi/Charts/issues/2577) +- Hide specific legend not all [\#2576](https://github.com/danielgindi/Charts/issues/2576) +- horizontal barchart each bar have different maximum value [\#2575](https://github.com/danielgindi/Charts/issues/2575) +- Barchart fixed interval in left axis [\#2574](https://github.com/danielgindi/Charts/issues/2574) +- Change color of Bar chart data label [\#2573](https://github.com/danielgindi/Charts/issues/2573) +- Visible ChartDataEntry when zoomed in? [\#2572](https://github.com/danielgindi/Charts/issues/2572) +- Changing color of the bar graph [\#2571](https://github.com/danielgindi/Charts/issues/2571) +- Custom bar chart highlight style [\#2570](https://github.com/danielgindi/Charts/issues/2570) +- How to show LineChart with icon [\#2566](https://github.com/danielgindi/Charts/issues/2566) +- how to do Paging [\#2565](https://github.com/danielgindi/Charts/issues/2565) +- Range float bars [\#2564](https://github.com/danielgindi/Charts/issues/2564) +- Cropping left axis labels and missing some values [\#2563](https://github.com/danielgindi/Charts/issues/2563) +- How to create a custom marker view in line chart for showing x values as well [\#2562](https://github.com/danielgindi/Charts/issues/2562) +- HorizontalBarChartView:when i set Xvalue = 0,1,2,3..... HorizontalBarChartView some X dont show [\#2559](https://github.com/danielgindi/Charts/issues/2559) +- But I hope also have the valueFonts property set for each font size, like valueColors [\#2558](https://github.com/danielgindi/Charts/issues/2558) +- charts uses iphone show "No architectures to compile for \(ONLY\_ACTIVE\_ARCH=YES, active arch=arm64, VALID\_ARCHS=i386 x86\_64 \)". [\#2557](https://github.com/danielgindi/Charts/issues/2557) +- Caching charts [\#2555](https://github.com/danielgindi/Charts/issues/2555) +- How to add X axis values in the balloon marker view in IOS Charts? [\#2554](https://github.com/danielgindi/Charts/issues/2554) +- One label for each data point - Line Chart - SOLUTION FOUND [\#2553](https://github.com/danielgindi/Charts/issues/2553) +- PieChart legend.yOffset bug [\#2552](https://github.com/danielgindi/Charts/issues/2552) +- PieChart legend.yOffset bug [\#2551](https://github.com/danielgindi/Charts/issues/2551) +- Duplicates x-axis labels are plotted separately in graph? [\#2549](https://github.com/danielgindi/Charts/issues/2549) +- How to set the label count for X axis ? [\#2548](https://github.com/danielgindi/Charts/issues/2548) +- Hide graph label if value fall below a certain threshold/minimum [\#2547](https://github.com/danielgindi/Charts/issues/2547) +- BarChar Position Label [\#2546](https://github.com/danielgindi/Charts/issues/2546) +- Swift language upgrade required [\#2544](https://github.com/danielgindi/Charts/issues/2544) +- BarChartDataEntry different value than value display for each BarChartDataSet [\#2543](https://github.com/danielgindi/Charts/issues/2543) +- LineChartDataSet why there is no valueFonts [\#2542](https://github.com/danielgindi/Charts/issues/2542) +- Need swift combined chart demo. [\#2540](https://github.com/danielgindi/Charts/issues/2540) +- Pie Chart Highlighted region [\#2536](https://github.com/danielgindi/Charts/issues/2536) +- Replace the value label without redraw the bar. [\#2535](https://github.com/danielgindi/Charts/issues/2535) +- Lines on Horizontal Bar Chart [\#2532](https://github.com/danielgindi/Charts/issues/2532) +- Cannot convert value of type 'AutoreleasingUnsafeMutablePointer\' to expected argument type 'AutoreleasingUnsafeMutablePointer\?' [\#2530](https://github.com/danielgindi/Charts/issues/2530) +- zoom programatically, reset the zoom, set the highlight and moving the X-Axis and the Y-Axis to the middle [\#2529](https://github.com/danielgindi/Charts/issues/2529) +- BarGraph - 0 values - Bar Offset [\#2528](https://github.com/danielgindi/Charts/issues/2528) +- Chart displays intermittently [\#2527](https://github.com/danielgindi/Charts/issues/2527) +- Changing BarChart xAxis label position [\#2526](https://github.com/danielgindi/Charts/issues/2526) +- Create PDF Of Charts [\#2525](https://github.com/danielgindi/Charts/issues/2525) +- What is the equivalent of "onChartDoubleTapped"? [\#2524](https://github.com/danielgindi/Charts/issues/2524) +- Delegate Memory Leak [\#2523](https://github.com/danielgindi/Charts/issues/2523) +- Chart is sometimes not showing data on Plus devices [\#2521](https://github.com/danielgindi/Charts/issues/2521) +- How to run in Xcode 9 \(beta\) [\#2520](https://github.com/danielgindi/Charts/issues/2520) +- HorizontalBarChartView offset X [\#2519](https://github.com/danielgindi/Charts/issues/2519) +- Line not showing in LineChart [\#2518](https://github.com/danielgindi/Charts/issues/2518) +- Displaying float values in bar chart label. [\#2517](https://github.com/danielgindi/Charts/issues/2517) +- Not working with Xcode 9 Beta1 [\#2514](https://github.com/danielgindi/Charts/issues/2514) +- PieChart: Identify univocally a specific entry [\#2513](https://github.com/danielgindi/Charts/issues/2513) +- Right Align Y Value Labels for Horizontal Bar Chart [\#2512](https://github.com/danielgindi/Charts/issues/2512) +- Swift 3 Cubic line chart [\#2510](https://github.com/danielgindi/Charts/issues/2510) +- Inserting dataPoint "labels" in Radar Chart [\#2508](https://github.com/danielgindi/Charts/issues/2508) +- How to remove decimals from y values in iOS Charts? [\#2506](https://github.com/danielgindi/Charts/issues/2506) +- Add background to chart's legend [\#2505](https://github.com/danielgindi/Charts/issues/2505) +- Combine Bar, Line and Pie chart [\#2503](https://github.com/danielgindi/Charts/issues/2503) +- Chart not in centre of view [\#2502](https://github.com/danielgindi/Charts/issues/2502) +- Can't use different Charts Framework with different versions of Xcode [\#2499](https://github.com/danielgindi/Charts/issues/2499) +- How to change the label colors of certain XAxis values? [\#2498](https://github.com/danielgindi/Charts/issues/2498) +- Chart points are being clipped out in ScatterChart [\#2496](https://github.com/danielgindi/Charts/issues/2496) +- PieChart render very small [\#2495](https://github.com/danielgindi/Charts/issues/2495) +- Bar values inside bar horizontally? [\#2494](https://github.com/danielgindi/Charts/issues/2494) +- I used Charts in my iOS project and when I start to zoom the chart labels on xAxis get repeated again and again. How can I fix my problem? [\#2493](https://github.com/danielgindi/Charts/issues/2493) +- linechart shadow [\#2492](https://github.com/danielgindi/Charts/issues/2492) +- Set a fixed bar width in BarChartView [\#2491](https://github.com/danielgindi/Charts/issues/2491) +- Linechart inverted [\#2490](https://github.com/danielgindi/Charts/issues/2490) +- Pie chart not accepting more than one dataSet [\#2489](https://github.com/danielgindi/Charts/issues/2489) +- Graph x-axis values not displaying in swift 3.0 [\#2488](https://github.com/danielgindi/Charts/issues/2488) +- How to round corner in Radar Charts? [\#2487](https://github.com/danielgindi/Charts/issues/2487) +- Display header label on xAxis and yAxis [\#2485](https://github.com/danielgindi/Charts/issues/2485) +- XAxis label issue with multiple/grouped bar chart [\#2481](https://github.com/danielgindi/Charts/issues/2481) +- After integration, the project package becomes bigger. [\#2480](https://github.com/danielgindi/Charts/issues/2480) +- Pinch to Zoom is not working as expected over Bar Chart [\#2479](https://github.com/danielgindi/Charts/issues/2479) +- Two markers on one line \[LineChartView\] [\#2476](https://github.com/danielgindi/Charts/issues/2476) +- Adjust the spacing between bars. \(not grouped\) [\#2475](https://github.com/danielgindi/Charts/issues/2475) +- Issue with order of x-values and Multi LineChart [\#2474](https://github.com/danielgindi/Charts/issues/2474) +- Show Integer values on LineChart [\#2473](https://github.com/danielgindi/Charts/issues/2473) +- Loading a blank chart [\#2472](https://github.com/danielgindi/Charts/issues/2472) +- LineChart isn't shown correct [\#2471](https://github.com/danielgindi/Charts/issues/2471) +- Device Orientation not detected when using Charts module [\#2469](https://github.com/danielgindi/Charts/issues/2469) +- How to set spacing between bars? [\#2467](https://github.com/danielgindi/Charts/issues/2467) +- what happened to sliceSpace function in piechartdataset? [\#2466](https://github.com/danielgindi/Charts/issues/2466) +- How to scroll between charts on carousel [\#2465](https://github.com/danielgindi/Charts/issues/2465) +- PieChartData and NSNumberFormatter memory leak about demo project [\#2464](https://github.com/danielgindi/Charts/issues/2464) +- Custom View within the PieChart Center [\#2463](https://github.com/danielgindi/Charts/issues/2463) +- toggle highlight for pie chart slice [\#2462](https://github.com/danielgindi/Charts/issues/2462) +- HorizontalBarChartView [\#2461](https://github.com/danielgindi/Charts/issues/2461) +- Cubic Line Distorted [\#2459](https://github.com/danielgindi/Charts/issues/2459) +- Plotband support [\#2458](https://github.com/danielgindi/Charts/issues/2458) +- Bubble charts: Can i set the size same to all the bubbles? [\#2456](https://github.com/danielgindi/Charts/issues/2456) +- Single point on line chart not showing - Swift 3 [\#2455](https://github.com/danielgindi/Charts/issues/2455) +- Plotting large amount of data slows down the Graph. [\#2454](https://github.com/danielgindi/Charts/issues/2454) +- Error on Manually adding on my project [\#2453](https://github.com/danielgindi/Charts/issues/2453) +- How to implement Gantt charts using iOS-Charts? [\#2451](https://github.com/danielgindi/Charts/issues/2451) +- How come I can't set a default color theme in ChartColorTemplate.swift? [\#2450](https://github.com/danielgindi/Charts/issues/2450) +- What is relation between the BubbleSize and the axis value?Can we control the size of Bubble in Bubble Chart? [\#2448](https://github.com/danielgindi/Charts/issues/2448) +- chart 3.0 xAxis labels not mapped [\#2447](https://github.com/danielgindi/Charts/issues/2447) +- fatal error: Index out of range while subclassing renderer [\#2446](https://github.com/danielgindi/Charts/issues/2446) +- Bug in line chart yAxis when range are less than 1 [\#2445](https://github.com/danielgindi/Charts/issues/2445) +- Help with custom graphic/chart [\#2442](https://github.com/danielgindi/Charts/issues/2442) +- PieChart center Attributed Text [\#2441](https://github.com/danielgindi/Charts/issues/2441) +- PieChart center Attributed Text [\#2440](https://github.com/danielgindi/Charts/issues/2440) +- show tooltip on click [\#2438](https://github.com/danielgindi/Charts/issues/2438) +- Got Error : “\_OBJC\_CLASS\_$\_\_TtC10ChartsDemo12XYMarkerView” in Charts [\#2437](https://github.com/danielgindi/Charts/issues/2437) +- Change color label over circle [\#2436](https://github.com/danielgindi/Charts/issues/2436) +- How to set labels based on max and min value of the plot? [\#2434](https://github.com/danielgindi/Charts/issues/2434) +- How to make the pie chart selected by default? [\#2431](https://github.com/danielgindi/Charts/issues/2431) +- Animate 3 dataSets one by one [\#2428](https://github.com/danielgindi/Charts/issues/2428) +- Marker points on wrong position [\#2426](https://github.com/danielgindi/Charts/issues/2426) +- Legend leak in version 3.0.1 [\#2425](https://github.com/danielgindi/Charts/issues/2425) +- Show Two Circles in Pie Chart [\#2424](https://github.com/danielgindi/Charts/issues/2424) +- restrainViewPort is not working. Chart stays the same! [\#2423](https://github.com/danielgindi/Charts/issues/2423) +- Line Chart show value on specific coordinate [\#2420](https://github.com/danielgindi/Charts/issues/2420) +- Is it possible to extend the gesture handler? [\#2419](https://github.com/danielgindi/Charts/issues/2419) +- Memory Leak in BarChartView Data [\#2416](https://github.com/danielgindi/Charts/issues/2416) +- Track Scroll Left or Right [\#2415](https://github.com/danielgindi/Charts/issues/2415) +- How can I add the xVals to LineChartData object? [\#2412](https://github.com/danielgindi/Charts/issues/2412) +- Line chart doesn't redraw correctly after removeEntry\(\) [\#2411](https://github.com/danielgindi/Charts/issues/2411) +- Bar width [\#2410](https://github.com/danielgindi/Charts/issues/2410) +- There is no way to restrict zoom level after certain zoom level [\#2409](https://github.com/danielgindi/Charts/issues/2409) +- Half Pie Chart no full view [\#2408](https://github.com/danielgindi/Charts/issues/2408) +- How to use gradient colors for each column in a histogram? [\#2407](https://github.com/danielgindi/Charts/issues/2407) +- Fill line chart when drag with two fingers [\#2405](https://github.com/danielgindi/Charts/issues/2405) +- chartValueSelected Delegate Method Not Called [\#2404](https://github.com/danielgindi/Charts/issues/2404) +- Draw bar line even though the value is zero [\#2403](https://github.com/danielgindi/Charts/issues/2403) +- Adding line/dataset on line chart that already has a line [\#2401](https://github.com/danielgindi/Charts/issues/2401) +- help with labels [\#2400](https://github.com/danielgindi/Charts/issues/2400) +- 'Charts/Charts.h' file not found when tried build using "XCODEBUILD" command in terminal [\#2397](https://github.com/danielgindi/Charts/issues/2397) +- moveViewToX\(\) has no affect on a chart whose frame has not been set yet [\#2395](https://github.com/danielgindi/Charts/issues/2395) +- Appending Units\(i.e. m/s, mpg, etc\) to yaxis?? [\#2394](https://github.com/danielgindi/Charts/issues/2394) +- Chart Top label Issue [\#2392](https://github.com/danielgindi/Charts/issues/2392) +- How to just draw one circle value for LineChartView [\#2391](https://github.com/danielgindi/Charts/issues/2391) +- Support for 3D charts [\#2389](https://github.com/danielgindi/Charts/issues/2389) +- Y Axis range calculation is incorrect for Bar Charts [\#2386](https://github.com/danielgindi/Charts/issues/2386) +- Is having a ChartViewBase inside a custom UIView even possible? [\#2384](https://github.com/danielgindi/Charts/issues/2384) +- "chartValueSelected" is not getting called. [\#2383](https://github.com/danielgindi/Charts/issues/2383) +- Does it support XO line\(American CandleStick\)? [\#2382](https://github.com/danielgindi/Charts/issues/2382) +- Chart Won't Display [\#2381](https://github.com/danielgindi/Charts/issues/2381) +- autoScaleMinMaxEnabled Not Working [\#2374](https://github.com/danielgindi/Charts/issues/2374) +- Graph is being drawn outside of visible area [\#2373](https://github.com/danielgindi/Charts/issues/2373) +- Compile error on Release build configuration [\#2372](https://github.com/danielgindi/Charts/issues/2372) +- moveViewToX clips bar [\#2370](https://github.com/danielgindi/Charts/issues/2370) +- swift 3.x -\> New ChartMarker? [\#2369](https://github.com/danielgindi/Charts/issues/2369) +- Crash on computeAxisValues of Bar Chart [\#2368](https://github.com/danielgindi/Charts/issues/2368) +- How to properly reset zoom on data refresh? [\#2367](https://github.com/danielgindi/Charts/issues/2367) +- What is the meaning of xValue in moveViewToAnimated? [\#2366](https://github.com/danielgindi/Charts/issues/2366) +- Horizontal Bar Chart rightAxis default maximum space [\#2363](https://github.com/danielgindi/Charts/issues/2363) +- Why my LineChartDataSet's line is behind the bar? [\#2354](https://github.com/danielgindi/Charts/issues/2354) +- charts2.5 bottom line render issue [\#2352](https://github.com/danielgindi/Charts/issues/2352) +- Limit the number of bars to 10 when the x-axis is made of strings [\#2351](https://github.com/danielgindi/Charts/issues/2351) +- Not able to plot values in linechart [\#2349](https://github.com/danielgindi/Charts/issues/2349) +- Text in Marker [\#2348](https://github.com/danielgindi/Charts/issues/2348) +- PieChart overlay lines or dots for select slices in the pie chart [\#2347](https://github.com/danielgindi/Charts/issues/2347) +- Multiple colors grid background [\#2346](https://github.com/danielgindi/Charts/issues/2346) +- The direction of the two BarChart [\#2345](https://github.com/danielgindi/Charts/issues/2345) +- how to format y-axix values [\#2343](https://github.com/danielgindi/Charts/issues/2343) +- different Bar color based on values [\#2342](https://github.com/danielgindi/Charts/issues/2342) +- XCode wants to convert Chart [\#2341](https://github.com/danielgindi/Charts/issues/2341) +- Population Pyramid [\#2340](https://github.com/danielgindi/Charts/issues/2340) +- Not all labels shown on horizontal bar chart with large datasets [\#2339](https://github.com/danielgindi/Charts/issues/2339) +- Using ChartViewBase as the type and instantiating the chart later as a specific type [\#2338](https://github.com/danielgindi/Charts/issues/2338) +- Remove Highlight from bar graph [\#2337](https://github.com/danielgindi/Charts/issues/2337) +- Set diffent style to single line graph [\#2336](https://github.com/danielgindi/Charts/issues/2336) +- change the color of the highlight point [\#2334](https://github.com/danielgindi/Charts/issues/2334) +- Extra space to the right of chart [\#2333](https://github.com/danielgindi/Charts/issues/2333) +- xcode 8.3 swift 3.1 [\#2332](https://github.com/danielgindi/Charts/issues/2332) +- AxisDependencyRight Question~~ [\#2331](https://github.com/danielgindi/Charts/issues/2331) +- Module Charts not found XCODE 8.1 Error [\#2330](https://github.com/danielgindi/Charts/issues/2330) +- How to remove Grid [\#2329](https://github.com/danielgindi/Charts/issues/2329) +- The spacing between the two points is wider than the distance between the labels [\#2327](https://github.com/danielgindi/Charts/issues/2327) +- Skipped installing realm-cocoa.framework binary due to the error: [\#2326](https://github.com/danielgindi/Charts/issues/2326) +- Pie Chart view as Int instead of double on segment? [\#2325](https://github.com/danielgindi/Charts/issues/2325) +- Not able to give X axis Values [\#2324](https://github.com/danielgindi/Charts/issues/2324) +- Labels to PieChart? v 3.0.2 [\#2323](https://github.com/danielgindi/Charts/issues/2323) +- How to prevent static data sets from redrawing and hogging CPU [\#2322](https://github.com/danielgindi/Charts/issues/2322) +- BarChart xAxis labels a moving [\#2321](https://github.com/danielgindi/Charts/issues/2321) +- How to add a fade background for data values [\#2320](https://github.com/danielgindi/Charts/issues/2320) +- Limit Line after update to 3.0.2 no longer shown [\#2319](https://github.com/danielgindi/Charts/issues/2319) +- Charts v3.0.2 does not build using Carthage [\#2317](https://github.com/danielgindi/Charts/issues/2317) +- Too much Warnings on the comments [\#2316](https://github.com/danielgindi/Charts/issues/2316) +- spaceMin and spaceMax are not percentages [\#2314](https://github.com/danielgindi/Charts/issues/2314) +- API for increasing or decreasing condition for CandleStick Chart [\#2311](https://github.com/danielgindi/Charts/issues/2311) +- Create Tag to include 'fix for Xcode 8.3' [\#2309](https://github.com/danielgindi/Charts/issues/2309) +- Ambiguous use of 'data' [\#2304](https://github.com/danielgindi/Charts/issues/2304) +- Default backgroundColor \(nil\) displays as black instead of clear. [\#2222](https://github.com/danielgindi/Charts/issues/2222) +- pdf report with Line Chart blurry from iphone 7 [\#2204](https://github.com/danielgindi/Charts/issues/2204) +- how to add Values to Pie Chart? and how to show complete pie chart instead of doughnut [\#2150](https://github.com/danielgindi/Charts/issues/2150) +- 'LineChartView' is unavailable: cannot find Swift declaration for this class [\#2145](https://github.com/danielgindi/Charts/issues/2145) +- Display label MMyyyy for barChart [\#2142](https://github.com/danielgindi/Charts/issues/2142) +- barSpace attribute [\#2137](https://github.com/danielgindi/Charts/issues/2137) +- Bar Chart, Shifting Y Position [\#2134](https://github.com/danielgindi/Charts/issues/2134) +- highlightValue is throwing "fatal error: Index out of range" in Combined Chart [\#2076](https://github.com/danielgindi/Charts/issues/2076) + +**Merged pull requests:** + +- Update xcode project for xcode 9 [\#2767](https://github.com/danielgindi/Charts/pull/2767) ([petester42](https://github.com/petester42)) +- Fixed value setter on PieChartDataEntry [\#2754](https://github.com/danielgindi/Charts/pull/2754) ([martnst](https://github.com/martnst)) +- Conform to macOS api changes in swift 3.2 [\#2717](https://github.com/danielgindi/Charts/pull/2717) ([ohbargain](https://github.com/ohbargain)) +- Fix CombinedChartView not draw markers [\#2702](https://github.com/danielgindi/Charts/pull/2702) ([xzysun](https://github.com/xzysun)) +- Reduce build time with minor reference refactor [\#2679](https://github.com/danielgindi/Charts/pull/2679) ([xinranw](https://github.com/xinranw)) +- Fix Typo: Probider -\> Provider [\#2650](https://github.com/danielgindi/Charts/pull/2650) ([russellbstephens](https://github.com/russellbstephens)) +- Adding a third party tutorial [\#2604](https://github.com/danielgindi/Charts/pull/2604) ([osianSmith](https://github.com/osianSmith)) +- fix \#2099, avoid crash when some chart only allow 1 data set [\#2500](https://github.com/danielgindi/Charts/pull/2500) ([liuxuan30](https://github.com/liuxuan30)) +- tutorial link added to readme [\#2484](https://github.com/danielgindi/Charts/pull/2484) ([annalizhaz](https://github.com/annalizhaz)) +- Allow turning off drag in X and Y axes separately. [\#2413](https://github.com/danielgindi/Charts/pull/2413) ([maciejtrybilo](https://github.com/maciejtrybilo)) +- Run view port jobs afterwards \(Fixes \#2395\) [\#2396](https://github.com/danielgindi/Charts/pull/2396) ([feosuna1](https://github.com/feosuna1)) +- Minor improvements in BalloonMarker.swift [\#2393](https://github.com/danielgindi/Charts/pull/2393) ([valeriyvan](https://github.com/valeriyvan)) +- remove build for ci tests procedure, use `clean test` directly [\#2388](https://github.com/danielgindi/Charts/pull/2388) ([liuxuan30](https://github.com/liuxuan30)) +- Update Travis config for Xcode 8.3 and fix test failures [\#2378](https://github.com/danielgindi/Charts/pull/2378) ([liuxuan30](https://github.com/liuxuan30)) +- Fix Simple Bar Chart Demo, switch use of x and y values [\#2365](https://github.com/danielgindi/Charts/pull/2365) ([franqueli](https://github.com/franqueli)) +- Bug fixing with one line, updating ChartViewBase.swift [\#2355](https://github.com/danielgindi/Charts/pull/2355) ([Eric0625](https://github.com/Eric0625)) +- Fixed, If the last value is the max or min, the range will be wrong [\#2229](https://github.com/danielgindi/Charts/pull/2229) ([aelam](https://github.com/aelam)) +- fix \#2222 move default backgroundColor to initialize\(\) [\#2228](https://github.com/danielgindi/Charts/pull/2228) ([liuxuan30](https://github.com/liuxuan30)) +- Fix \#1879. Similar cut in half issue in scatter chart like others [\#1891](https://github.com/danielgindi/Charts/pull/1891) ([liuxuan30](https://github.com/liuxuan30)) + +## [v3.0.2](https://github.com/danielgindi/Charts/tree/v3.0.2) (2017-04-02) +[Full Changelog](https://github.com/danielgindi/Charts/compare/3.0.2...v3.0.2) + +## [3.0.2](https://github.com/danielgindi/Charts/tree/3.0.2) (2017-04-02) +[Full Changelog](https://github.com/danielgindi/Charts/compare/3.0.1...3.0.2) + +**Implemented enhancements:** + +- Plotting Realm data in Swift. RLMResults not available [\#898](https://github.com/danielgindi/Charts/issues/898) + +**Fixed bugs:** + +- \[Bug\] Double BarChart second value text mispaced [\#1191](https://github.com/danielgindi/Charts/issues/1191) +- \: CGAffineTransformInvert: singular matrix [\#802](https://github.com/danielgindi/Charts/issues/802) + +**Closed issues:** + +- Please give option for installing via Swift Package Manager too [\#2313](https://github.com/danielgindi/Charts/issues/2313) +- Adjust spacing between axis labels and axes? [\#2310](https://github.com/danielgindi/Charts/issues/2310) +- \*PieChart\* Get color of top 3 largest percent [\#2308](https://github.com/danielgindi/Charts/issues/2308) +- Set the x axis data problems, and 2.3.0 apis are quite different.Need your help [\#2307](https://github.com/danielgindi/Charts/issues/2307) +- little issue with chart custoemView size & chart data [\#2305](https://github.com/danielgindi/Charts/issues/2305) +- hello,A small problem. [\#2303](https://github.com/danielgindi/Charts/issues/2303) +- Running 1 of 1 custom shell scripts [\#2302](https://github.com/danielgindi/Charts/issues/2302) +- Multiple warnings xCode 8.3 [\#2298](https://github.com/danielgindi/Charts/issues/2298) +- Remove color label in pie-chart [\#2297](https://github.com/danielgindi/Charts/issues/2297) +- Charts 2.3 with Swift 3 \(xCode 8.3\) [\#2295](https://github.com/danielgindi/Charts/issues/2295) +- Modify Marker before showing value [\#2294](https://github.com/danielgindi/Charts/issues/2294) +- Xcode 8.3: 62 deprecation warnings [\#2293](https://github.com/danielgindi/Charts/issues/2293) +- Fix warning for Xcode8.3 [\#2292](https://github.com/danielgindi/Charts/issues/2292) +- Chart Selected function is not called on click of every Bar. [\#2291](https://github.com/danielgindi/Charts/issues/2291) +- “Swift Language Version” [\#2290](https://github.com/danielgindi/Charts/issues/2290) +- Swift 3.1 support [\#2288](https://github.com/danielgindi/Charts/issues/2288) +- Swift 3.1 Build [\#2287](https://github.com/danielgindi/Charts/issues/2287) +- ChartTouchDelegate never called [\#2286](https://github.com/danielgindi/Charts/issues/2286) +- Radar map size setting [\#2284](https://github.com/danielgindi/Charts/issues/2284) +- How do I set the radar map size? [\#2283](https://github.com/danielgindi/Charts/issues/2283) +- Adjust circle radius for individual line chart data point [\#2282](https://github.com/danielgindi/Charts/issues/2282) +- Get current axis interval between labels [\#2281](https://github.com/danielgindi/Charts/issues/2281) +- Only allow slice space for the selected item in a pie chart [\#2278](https://github.com/danielgindi/Charts/issues/2278) +- PieChartDataSet [\#2277](https://github.com/danielgindi/Charts/issues/2277) +- I want to un-highlight a line chart when dragging has stopped, among other things. Am I missing it? Thanks [\#2276](https://github.com/danielgindi/Charts/issues/2276) +- Demo for Swift 3 [\#2274](https://github.com/danielgindi/Charts/issues/2274) +- Getting the percentage and label for a slice [\#2273](https://github.com/danielgindi/Charts/issues/2273) +- Line chart - LineChartDataSet Background color. [\#2272](https://github.com/danielgindi/Charts/issues/2272) +- place image at top of each bar in bar graph [\#2271](https://github.com/danielgindi/Charts/issues/2271) +- How to draw circle at the end of a data set on line chart [\#2270](https://github.com/danielgindi/Charts/issues/2270) +- when i install pod 'Charts'. its install Old Version Of library 2.3 and give me error convert code into latest swift. [\#2269](https://github.com/danielgindi/Charts/issues/2269) +- ChartsDemo Buildtime Error: No such module 'RealmSwift' [\#2268](https://github.com/danielgindi/Charts/issues/2268) +- Total Data [\#2267](https://github.com/danielgindi/Charts/issues/2267) +- Line Chart Highlight, Remove X axis line and display label [\#2266](https://github.com/danielgindi/Charts/issues/2266) +- Increasing bar width in grouped sets of BarChartView [\#2263](https://github.com/danielgindi/Charts/issues/2263) +- lineChart.leftAxis.startAtZeroEnabled is not available in Swift 3 library [\#2262](https://github.com/danielgindi/Charts/issues/2262) +- Can't find highlightcolor [\#2256](https://github.com/danielgindi/Charts/issues/2256) +- Custom yAxis values [\#2254](https://github.com/danielgindi/Charts/issues/2254) +- Dynamic generate Int values for axis [\#2253](https://github.com/danielgindi/Charts/issues/2253) +- viewController can't be dealloc [\#2252](https://github.com/danielgindi/Charts/issues/2252) +- How to include a gap between data points & lines [\#2251](https://github.com/danielgindi/Charts/issues/2251) +- Highlight particular X and Y coordinations in the iOS charts [\#2250](https://github.com/danielgindi/Charts/issues/2250) +- Bar shapes are overlapped with other bars [\#2248](https://github.com/danielgindi/Charts/issues/2248) +- Xaxis Label value in range \(2.5-5.0,5.0-7.5\) [\#2246](https://github.com/danielgindi/Charts/issues/2246) +- Multiline axis labels are cut off [\#2244](https://github.com/danielgindi/Charts/issues/2244) +- Problems with creating CombinedChart \(Line + grouped BarChart\) in Swift 3.0 [\#2243](https://github.com/danielgindi/Charts/issues/2243) +- Convert to Current Swift Syntax [\#2242](https://github.com/danielgindi/Charts/issues/2242) +- Line chart real time data - memory leak [\#2241](https://github.com/danielgindi/Charts/issues/2241) +- Radar chart bug - grey view shown on 6 plus and 7 plus [\#2238](https://github.com/danielgindi/Charts/issues/2238) +- How to set dual axis in line chart [\#2237](https://github.com/danielgindi/Charts/issues/2237) +- Tableview stuttering when rendering a pie chart [\#2234](https://github.com/danielgindi/Charts/issues/2234) +- Set vertical legend [\#2233](https://github.com/danielgindi/Charts/issues/2233) +- how to join XAxisLabel in MultipleBarChart under every Bar [\#2232](https://github.com/danielgindi/Charts/issues/2232) +- Custom xAxisRenderer [\#2230](https://github.com/danielgindi/Charts/issues/2230) +- demo can not run [\#2227](https://github.com/danielgindi/Charts/issues/2227) +- Change color of lineChartDataSet when chartValueSelected [\#2226](https://github.com/danielgindi/Charts/issues/2226) +- Legend Label problem when the device changes orientation [\#2224](https://github.com/danielgindi/Charts/issues/2224) +- Legend vertical offset for horizontally aligned legends [\#2223](https://github.com/danielgindi/Charts/issues/2223) +- Don't display or load all Variables on the Left of the Bar \(iOS - Swift 3\) [\#2221](https://github.com/danielgindi/Charts/issues/2221) +- Horizontal Bar Chart lines not visible with two BarChartDataSet in chart data [\#2220](https://github.com/danielgindi/Charts/issues/2220) +- Bar chart with limit line for each Bar [\#2219](https://github.com/danielgindi/Charts/issues/2219) +- why the zero can't show at the first [\#2218](https://github.com/danielgindi/Charts/issues/2218) +- About BalloonMarker [\#2216](https://github.com/danielgindi/Charts/issues/2216) +- How can I have these values in positive? Thanks. [\#2212](https://github.com/danielgindi/Charts/issues/2212) +- Line Graph is not showing line on the Chart [\#2209](https://github.com/danielgindi/Charts/issues/2209) +- Issue of enum description [\#2208](https://github.com/danielgindi/Charts/issues/2208) +- I find a issues in HorizontalBarChartView [\#2205](https://github.com/danielgindi/Charts/issues/2205) +- My ipa\(used Charts\) is 40M ;another ipa\(unused Charts\) is 13M,how to be sliming??? [\#2203](https://github.com/danielgindi/Charts/issues/2203) +- Legend vertical offset [\#2202](https://github.com/danielgindi/Charts/issues/2202) +- Charts not showing on tvOS [\#2201](https://github.com/danielgindi/Charts/issues/2201) +- Is it enable to keep the origin visible X Range when I appended more data [\#2198](https://github.com/danielgindi/Charts/issues/2198) +- Issue with Realm [\#2195](https://github.com/danielgindi/Charts/issues/2195) +- External lines - Pie Chart [\#2194](https://github.com/danielgindi/Charts/issues/2194) +- Hide labels - Pie chart [\#2193](https://github.com/danielgindi/Charts/issues/2193) +- is two sided bar graph possible ? [\#2192](https://github.com/danielgindi/Charts/issues/2192) +- Optimisation of drawing many points on line graph [\#2190](https://github.com/danielgindi/Charts/issues/2190) +- Bar Chart with dual axis [\#2188](https://github.com/danielgindi/Charts/issues/2188) +- Customize Text inside Ballon Marker [\#2186](https://github.com/danielgindi/Charts/issues/2186) +- "Shell Script Invocation Error: Command /bin/sh failed with exit code 1' [\#2185](https://github.com/danielgindi/Charts/issues/2185) +- Increase space between bars with only one dataset and assign font for specific value and xAxis label [\#2184](https://github.com/danielgindi/Charts/issues/2184) +- "noDataText" does not work [\#2179](https://github.com/danielgindi/Charts/issues/2179) +- Change color of one label [\#2178](https://github.com/danielgindi/Charts/issues/2178) +- Line Chart not show empty values - Charts 3.0 [\#2176](https://github.com/danielgindi/Charts/issues/2176) +- Bottom Label is not printing whole array list. [\#2175](https://github.com/danielgindi/Charts/issues/2175) +- Stacked Horizontal Chart Scaling [\#2174](https://github.com/danielgindi/Charts/issues/2174) +- How to set different colors for intervals on LineChart? [\#2172](https://github.com/danielgindi/Charts/issues/2172) +- Could you tell me how to forbidden line chart scroll up and down? [\#2171](https://github.com/danielgindi/Charts/issues/2171) +- Fixed BarWidth based on Pixel for BarChart [\#2170](https://github.com/danielgindi/Charts/issues/2170) +- Branch Chart3.0-Swift2.3 not found. [\#2166](https://github.com/danielgindi/Charts/issues/2166) +- "clipValuesToContentEnabled" does not work [\#2163](https://github.com/danielgindi/Charts/issues/2163) +- BarChartView with TableView [\#2161](https://github.com/danielgindi/Charts/issues/2161) +- How to show label on x-axis at regular interval and tail end on the graph line [\#2160](https://github.com/danielgindi/Charts/issues/2160) +- Set line cap to CGMutablePath [\#2159](https://github.com/danielgindi/Charts/issues/2159) +- why we set the y value 2.57,but the chart show 3,if i set y value2.44,the chart show 2.how to do the problem. [\#2157](https://github.com/danielgindi/Charts/issues/2157) +- Demo crush !!! [\#2154](https://github.com/danielgindi/Charts/issues/2154) +- Fixing the Segmentation fault issue after Convert to Swift 3.0 [\#2151](https://github.com/danielgindi/Charts/issues/2151) +- GitHub API request failed [\#2149](https://github.com/danielgindi/Charts/issues/2149) +- y-Values and x-Values as string in barchart, [\#2147](https://github.com/danielgindi/Charts/issues/2147) +- Piechart with smooth edges? [\#2146](https://github.com/danielgindi/Charts/issues/2146) +- Pie chart highlighted slice offset [\#2144](https://github.com/danielgindi/Charts/issues/2144) +- Formatter data on OS X [\#2141](https://github.com/danielgindi/Charts/issues/2141) +- How to add dates to line chart? [\#2136](https://github.com/danielgindi/Charts/issues/2136) +- 'backgroundColor' is inaccessible due to 'internal' protection level on mac OS X [\#2135](https://github.com/danielgindi/Charts/issues/2135) +- Some object files have incompatible Objective-C category definitions. Some category metadata may be lost. All files containing Objective-C categories should be built using the same compiler. [\#2133](https://github.com/danielgindi/Charts/issues/2133) +- Any Demo of all charts in Swift 3 [\#2132](https://github.com/danielgindi/Charts/issues/2132) +- How to access the Position of labels on x axis of Combined Line and Bar chart on swift\(3.0.1\) [\#2131](https://github.com/danielgindi/Charts/issues/2131) +- Wrong Limit line positioning when axisMinimum is set to 0 [\#2128](https://github.com/danielgindi/Charts/issues/2128) +- Extremely Slow compile Times on XCode 8.2.1 and swift 3.0.2 [\#2127](https://github.com/danielgindi/Charts/issues/2127) +- How to add TrackBall and edit label above BarCharts in Charts swift2 and swift 3?? [\#2126](https://github.com/danielgindi/Charts/issues/2126) +- Xcode 8.3 Compatible [\#2125](https://github.com/danielgindi/Charts/issues/2125) +- LineChartData\(dataSets: dataSets\) Missing xVals [\#2124](https://github.com/danielgindi/Charts/issues/2124) +- How to assign custom String values to XAxis? [\#2122](https://github.com/danielgindi/Charts/issues/2122) +- Simple Radar Chart causing hang / cpu 99% [\#2121](https://github.com/danielgindi/Charts/issues/2121) +- Can i use the framework without including the whole project ? [\#2118](https://github.com/danielgindi/Charts/issues/2118) +- Undefined symbols for architecture arm64 - Charts 3.0 CocoaPods [\#2117](https://github.com/danielgindi/Charts/issues/2117) +- method setlabelstoskip missing from XAxis.swift [\#2115](https://github.com/danielgindi/Charts/issues/2115) +- SocketIOClientConfiguration.swift wont compile [\#2113](https://github.com/danielgindi/Charts/issues/2113) +- No code signing identities found: No valid signing identities \(i.e. certificate and private key pair\) were found [\#2112](https://github.com/danielgindi/Charts/issues/2112) +- Can I custom draw circle in LineChart in version 3.0 ?\[help\] [\#2104](https://github.com/danielgindi/Charts/issues/2104) +- App crash XCode 8.2 Chart version 3.0 [\#2103](https://github.com/danielgindi/Charts/issues/2103) +- Charts 3.0.1 - Align x labels \(dates\) with plots [\#2094](https://github.com/danielgindi/Charts/issues/2094) +- Demo in Swift 3 [\#2092](https://github.com/danielgindi/Charts/issues/2092) +- How to set xAxis values from array in Swift 3.0 [\#2090](https://github.com/danielgindi/Charts/issues/2090) +- error to Methode [\#2089](https://github.com/danielgindi/Charts/issues/2089) +- fitBars doesnt seems to work [\#2088](https://github.com/danielgindi/Charts/issues/2088) +- oh, no!!!!!! Demo code can't run [\#2087](https://github.com/danielgindi/Charts/issues/2087) +- In BarChartView leftAxis labels cutdown, does-not fit on screen. [\#2086](https://github.com/danielgindi/Charts/issues/2086) +- accessing .rightAxis gives EXC\_BAD\_ACCESS [\#2082](https://github.com/danielgindi/Charts/issues/2082) +- leftAxis and value overlap in lineChartView [\#2080](https://github.com/danielgindi/Charts/issues/2080) +- I want to add 4 colours to the background of the chart. The colour zones depend on the y values. [\#2079](https://github.com/danielgindi/Charts/issues/2079) +- Value labels for multiple ChartDataSets all aligned at the beginning \(left\) of each bar in HorizontalBarChart [\#2077](https://github.com/danielgindi/Charts/issues/2077) +- How to Resize Labels in Pie Chart Legend [\#2075](https://github.com/danielgindi/Charts/issues/2075) +- Bar chart data entry [\#2074](https://github.com/danielgindi/Charts/issues/2074) +- How can I have a limit zone \(in android library mpandroidchart\) like feature in this iOS library [\#2073](https://github.com/danielgindi/Charts/issues/2073) +- BarChartView is unavailable, cannot find swift declaration [\#2072](https://github.com/danielgindi/Charts/issues/2072) +- Not enable to draw custom shape which is based on the XValue or YValue ? [\#2071](https://github.com/danielgindi/Charts/issues/2071) +- Can horizontalBarChartView invert the Axis ? [\#2070](https://github.com/danielgindi/Charts/issues/2070) +- can't set different padding of each side [\#2068](https://github.com/danielgindi/Charts/issues/2068) +- Area chart with missing points [\#2067](https://github.com/danielgindi/Charts/issues/2067) +- Demo code can't run [\#2066](https://github.com/danielgindi/Charts/issues/2066) +- Positioning the XAxis inconsistent with Y-axis and the Wiki in Swift 3 [\#2065](https://github.com/danielgindi/Charts/issues/2065) +- Radar chart title [\#2061](https://github.com/danielgindi/Charts/issues/2061) +- fixed increment [\#2059](https://github.com/danielgindi/Charts/issues/2059) +- Line Chart with callouts [\#2058](https://github.com/danielgindi/Charts/issues/2058) +- Delegate ChartValueSelected Not Called. [\#2057](https://github.com/danielgindi/Charts/issues/2057) +- IValueFormatter protocol not working [\#2055](https://github.com/danielgindi/Charts/issues/2055) +- "BalloonMarker“ cannot be find in my project [\#2051](https://github.com/danielgindi/Charts/issues/2051) +- How to use marker when I use CombinedChart? [\#2046](https://github.com/danielgindi/Charts/issues/2046) +- yVals have decimal point [\#2045](https://github.com/danielgindi/Charts/issues/2045) +- LeftAxis Labels will disappear [\#2044](https://github.com/danielgindi/Charts/issues/2044) +- Can't addEntry to a set in Swift 3 [\#2043](https://github.com/danielgindi/Charts/issues/2043) +- Will not compile in existing Objective-C Project. [\#2041](https://github.com/danielgindi/Charts/issues/2041) +- labels on xAxis not showing up and incorrect values on yAxis [\#2040](https://github.com/danielgindi/Charts/issues/2040) +- xAxis.valueFormatter = self create retain cycle [\#2039](https://github.com/danielgindi/Charts/issues/2039) +- Label's point of view [\#2038](https://github.com/danielgindi/Charts/issues/2038) +- How to show limited visible xValues labels? [\#2037](https://github.com/danielgindi/Charts/issues/2037) +- BarChart XAxis between Positive & Negative Values [\#2036](https://github.com/danielgindi/Charts/issues/2036) +- Error when trying to run ChartsDemo on iOS Simulator \(image not found\) [\#2035](https://github.com/danielgindi/Charts/issues/2035) +- big snap shot [\#2034](https://github.com/danielgindi/Charts/issues/2034) +- module file's minimum deployment target is ios9.3 [\#2031](https://github.com/danielgindi/Charts/issues/2031) +- Date formatter doesn't show up properly when using multiple bars in a chart. [\#2030](https://github.com/danielgindi/Charts/issues/2030) +- Y axis dynamic sampling ? [\#2029](https://github.com/danielgindi/Charts/issues/2029) +- Convert line chart entry to take dictionary [\#2027](https://github.com/danielgindi/Charts/issues/2027) +- How to set string value line \(27 Oct\) in xAxis [\#2025](https://github.com/danielgindi/Charts/issues/2025) +- Build \[ChartsDemo\] Error : 「ChartsRealm Reason: image not found 」alaway [\#2024](https://github.com/danielgindi/Charts/issues/2024) +- \[LineChartView\] setting xAxis.axisMinimum affects xAxis.spaceMin [\#2022](https://github.com/danielgindi/Charts/issues/2022) +- c vcgffrgfffgffgfgffffrfrfrrfdfdfdfdfdfdfggkjhghghghghjhjhjhjkjkjkkkklklklklikii0987654321poijkl;';lk;l; [\#2021](https://github.com/danielgindi/Charts/issues/2021) +- How to make the highlight line work with UIPanGestureRecognizer [\#2019](https://github.com/danielgindi/Charts/issues/2019) +- BarChart Issue for plotting the value on x-axis serially [\#2017](https://github.com/danielgindi/Charts/issues/2017) +- Please help me with the Pie Charts in Charts 3.0.1. [\#2016](https://github.com/danielgindi/Charts/issues/2016) +- ipa becomes larger after using Charts [\#2015](https://github.com/danielgindi/Charts/issues/2015) +- BarChartView highlight issues [\#2014](https://github.com/danielgindi/Charts/issues/2014) +- How to set up a line chart, the starting point of the distance from the left margin, border distance end points [\#2013](https://github.com/danielgindi/Charts/issues/2013) +- mult bars not show all [\#2012](https://github.com/danielgindi/Charts/issues/2012) +- how to change legend font size? [\#2011](https://github.com/danielgindi/Charts/issues/2011) +- image instead of text in CenterText in pie chart [\#2010](https://github.com/danielgindi/Charts/issues/2010) +- Change PieChart Center Color [\#2009](https://github.com/danielgindi/Charts/issues/2009) +- Demo issues [\#2008](https://github.com/danielgindi/Charts/issues/2008) +- How to display last label in X-Axis [\#2007](https://github.com/danielgindi/Charts/issues/2007) +- One point different values on the axis X [\#2005](https://github.com/danielgindi/Charts/issues/2005) +- Hide all text/labels/values in pieChart [\#2004](https://github.com/danielgindi/Charts/issues/2004) +- it is not an issue. it is related to OHLC chart [\#2003](https://github.com/danielgindi/Charts/issues/2003) +- Disable PieChart Label in Chart [\#2002](https://github.com/danielgindi/Charts/issues/2002) +- \[LineChartViewController stringForValue:axis:\] [\#2001](https://github.com/danielgindi/Charts/issues/2001) +- Values are cut out of the window [\#2000](https://github.com/danielgindi/Charts/issues/2000) +- XAxis in top AND bottom position [\#1999](https://github.com/danielgindi/Charts/issues/1999) +- Can't compile under Xcode 8.1 with Swift 3.0 [\#1998](https://github.com/danielgindi/Charts/issues/1998) +- Always display max 5 visible bars in BarChartView [\#1997](https://github.com/danielgindi/Charts/issues/1997) +- I want touchpoint in the bar to do something [\#1996](https://github.com/danielgindi/Charts/issues/1996) +- Is there any way to change chart data label from bottom of table to top? [\#1995](https://github.com/danielgindi/Charts/issues/1995) +- Installation not clear, for me [\#1994](https://github.com/danielgindi/Charts/issues/1994) +- Add space between bar chart [\#1993](https://github.com/danielgindi/Charts/issues/1993) +- How to fix the distance between each point on the X-coordinate? [\#1992](https://github.com/danielgindi/Charts/issues/1992) +- How to add tips to RadarChartView [\#1991](https://github.com/danielgindi/Charts/issues/1991) +- Piechart issue [\#1990](https://github.com/danielgindi/Charts/issues/1990) +- Multiple colors issue in stacked bar line charts swift3 [\#1989](https://github.com/danielgindi/Charts/issues/1989) +- ChartViewDelegate is not called. [\#1988](https://github.com/danielgindi/Charts/issues/1988) +- Always display vertical scrolling indicator on horizontal bar chart [\#1987](https://github.com/danielgindi/Charts/issues/1987) +- Can't compile DemoProject [\#1986](https://github.com/danielgindi/Charts/issues/1986) +- My pie chart legends still not showing [\#1985](https://github.com/danielgindi/Charts/issues/1985) +- no yValCount in ChartData [\#1982](https://github.com/danielgindi/Charts/issues/1982) +- no limitLineSegmentsBuffer in YAxisRenderer [\#1981](https://github.com/danielgindi/Charts/issues/1981) +- Legend label missing in pie chart [\#1980](https://github.com/danielgindi/Charts/issues/1980) +- For X axis the values are not adding [\#1979](https://github.com/danielgindi/Charts/issues/1979) +- When I have two data, charts shows the three data automatically [\#1978](https://github.com/danielgindi/Charts/issues/1978) +- Two legends for stacked bar chart [\#1977](https://github.com/danielgindi/Charts/issues/1977) +- X axis coordinate point spacing [\#1975](https://github.com/danielgindi/Charts/issues/1975) +- Carthage was not found [\#1974](https://github.com/danielgindi/Charts/issues/1974) +- How to Show XAxis Label On YAxis Bar In BarView Charts? [\#1973](https://github.com/danielgindi/Charts/issues/1973) +- Labels on Mac OS X application : place and title [\#1972](https://github.com/danielgindi/Charts/issues/1972) +- I am gettign @import AppKit is missing in Charts-Swift.h under charts.framework [\#1971](https://github.com/danielgindi/Charts/issues/1971) +- Multiline chart with common data point [\#1970](https://github.com/danielgindi/Charts/issues/1970) +- Version 3.0.1: Fill gradient fills out the wrong side of the chart [\#1968](https://github.com/danielgindi/Charts/issues/1968) +- How to pass data to the X axis?? [\#1967](https://github.com/danielgindi/Charts/issues/1967) +- How do I implement a legend click event? [\#1965](https://github.com/danielgindi/Charts/issues/1965) +- can't set the XVals [\#1964](https://github.com/danielgindi/Charts/issues/1964) +- Color for Legend label [\#1962](https://github.com/danielgindi/Charts/issues/1962) +- Two y axis plot on a side? [\#1961](https://github.com/danielgindi/Charts/issues/1961) +- Scrolling feature? [\#1960](https://github.com/danielgindi/Charts/issues/1960) +- Can you add the chart Of the triangle? [\#1958](https://github.com/danielgindi/Charts/issues/1958) +- Multiple y-data for single x-index [\#1955](https://github.com/danielgindi/Charts/issues/1955) +- LineChartView: axisMaximum and axisMinimum work wrong in rightAxis [\#1953](https://github.com/danielgindi/Charts/issues/1953) +- Radar Chart axis maximum [\#1952](https://github.com/danielgindi/Charts/issues/1952) +- Adding a single x-axis label for two data points. [\#1951](https://github.com/danielgindi/Charts/issues/1951) +- Adding title to X-axis and Y-axis [\#1950](https://github.com/danielgindi/Charts/issues/1950) +- Find screen location for bars in a bar chart [\#1949](https://github.com/danielgindi/Charts/issues/1949) +- \(3.0 Regression\) Scatter chart cuts off data at the edges [\#1946](https://github.com/danielgindi/Charts/issues/1946) +- How automatic showing marker? [\#1944](https://github.com/danielgindi/Charts/issues/1944) +- Right and left margins [\#1942](https://github.com/danielgindi/Charts/issues/1942) +- Displaying an overlay with extra / more detailed information on mouse hover [\#1940](https://github.com/danielgindi/Charts/issues/1940) +- Can we have flexible y Axis scale [\#1939](https://github.com/danielgindi/Charts/issues/1939) +- Charts3.0 - Can not show all the xAxis label if more than 8 value - Swift [\#1938](https://github.com/danielgindi/Charts/issues/1938) +- Barchart xAxis interval [\#1937](https://github.com/danielgindi/Charts/issues/1937) +- Avoiding chart legend [\#1936](https://github.com/danielgindi/Charts/issues/1936) +- Module compiled with Swift 2.3 cannot be imported in Swift 3.0.1 [\#1935](https://github.com/danielgindi/Charts/issues/1935) +- Charts-2.3.0/Source/ChartsRealm/Data/RealmPieData.swift:19:8: No such module 'Realm' [\#1934](https://github.com/danielgindi/Charts/issues/1934) +- iOS Demo Fails to build [\#1933](https://github.com/danielgindi/Charts/issues/1933) +- Pie chart Outside values, Inside Value and legend value [\#1932](https://github.com/danielgindi/Charts/issues/1932) +- Mermory Leak in "specialized ChartXAxisRenderer.drawLabels\(context : CGContext, pos : CGFloat, anchor : CGPoint\) -\> \(\)" [\#1928](https://github.com/danielgindi/Charts/issues/1928) +- stringForValue method return unexpected value when reload TableView data. [\#1927](https://github.com/danielgindi/Charts/issues/1927) +- Can't render CombinedChartView [\#1926](https://github.com/danielgindi/Charts/issues/1926) +- Migration to Chart 3.0, Problem with Stack BarChartView [\#1925](https://github.com/danielgindi/Charts/issues/1925) +- PieChartData issue in Swift 3 [\#1924](https://github.com/danielgindi/Charts/issues/1924) +- Values overlap for bar chart and labels of X-Axis [\#1923](https://github.com/danielgindi/Charts/issues/1923) +- Please Please Help, I can’t get Charts installed properly [\#1922](https://github.com/danielgindi/Charts/issues/1922) +- Chart bar finance \(OHLC Chart\) [\#1921](https://github.com/danielgindi/Charts/issues/1921) +- Double value cannot be converted to Int in AxisRendererBase.swift on line 125 [\#1920](https://github.com/danielgindi/Charts/issues/1920) +- Highlighted values on piechart too high? [\#1919](https://github.com/danielgindi/Charts/issues/1919) +- How to achieve this effect? [\#1918](https://github.com/danielgindi/Charts/issues/1918) +- SOLVED: Round number less than zero x values issue [\#1916](https://github.com/danielgindi/Charts/issues/1916) +- Charts does not install correctly [\#1915](https://github.com/danielgindi/Charts/issues/1915) +- Xcode 8.1 is reporting 'No such Module 'Charts' & Build/Compilation Errors [\#1914](https://github.com/danielgindi/Charts/issues/1914) +- Hide legend [\#1913](https://github.com/danielgindi/Charts/issues/1913) +- xAxis force show last label [\#1912](https://github.com/danielgindi/Charts/issues/1912) +- How to install in Xcode 7.3.1 [\#1911](https://github.com/danielgindi/Charts/issues/1911) +- Can we resurrect Chart2.2.5-Swift3.0? [\#1910](https://github.com/danielgindi/Charts/issues/1910) +- Chart Swift files not running on Obj-C XCODE8.0 install [\#1908](https://github.com/danielgindi/Charts/issues/1908) +- How to draw two circles and compare? [\#1906](https://github.com/danielgindi/Charts/issues/1906) +- custom xAxis for line chart I need an example [\#1905](https://github.com/danielgindi/Charts/issues/1905) +- QUESTION - How mask the ranges values in a Graph [\#1904](https://github.com/danielgindi/Charts/issues/1904) +- How to give xAxis customized labels for linechartview [\#1903](https://github.com/danielgindi/Charts/issues/1903) +- How to set the axis options of radar chart? [\#1902](https://github.com/danielgindi/Charts/issues/1902) +- no match color bar chart with label [\#1900](https://github.com/danielgindi/Charts/issues/1900) +- LineChartView highlightEnabled no work [\#1899](https://github.com/danielgindi/Charts/issues/1899) +- Can i change the value Above bar from double to int? [\#1898](https://github.com/danielgindi/Charts/issues/1898) +- Scrolling x-axis labels [\#1897](https://github.com/danielgindi/Charts/issues/1897) +- noDataText doesn't work on CombinedChart \(works fine on PieChart and BarChart\) [\#1896](https://github.com/danielgindi/Charts/issues/1896) +- StringForValue in class IValueFormatter receives dataSetIndex as 0 [\#1895](https://github.com/danielgindi/Charts/issues/1895) +- Cannot build in big project using cocoapods [\#1894](https://github.com/danielgindi/Charts/issues/1894) +- Carthage build error with xcode 8.1 and Charts 2.3.0 [\#1893](https://github.com/danielgindi/Charts/issues/1893) +- Unable to select BarChartView from storyboard \(iOS\) [\#1892](https://github.com/danielgindi/Charts/issues/1892) +- XAxis entry count is greater than it should be. [\#1890](https://github.com/danielgindi/Charts/issues/1890) +- pod update failed - ARC Semantic Issue [\#1888](https://github.com/danielgindi/Charts/issues/1888) +- How to show marker on y-Axis data? [\#1887](https://github.com/danielgindi/Charts/issues/1887) +- Can't building and run the ChartsDemo [\#1886](https://github.com/danielgindi/Charts/issues/1886) +- how to resolve label overlapping problem with stack bar chart [\#1885](https://github.com/danielgindi/Charts/issues/1885) +- PieChart values [\#1884](https://github.com/danielgindi/Charts/issues/1884) +- Custom marker gets displayed wrong on the latest value [\#1883](https://github.com/danielgindi/Charts/issues/1883) +- Tap gesture inside the candle bar [\#1882](https://github.com/danielgindi/Charts/issues/1882) +- rotating chartview [\#1881](https://github.com/danielgindi/Charts/issues/1881) +- \[Question\] Scatter Chart && Bubble Chart: How to show out whole radius instead of hiding half radius of first data entry? [\#1879](https://github.com/danielgindi/Charts/issues/1879) +- Horizontal bar chart dose not show all xAxis labels. [\#1878](https://github.com/danielgindi/Charts/issues/1878) +- X axis values [\#1877](https://github.com/danielgindi/Charts/issues/1877) +- Pie Chart no xAxis [\#1875](https://github.com/danielgindi/Charts/issues/1875) +- want the demo application in swift 3.0 for Charts [\#1872](https://github.com/danielgindi/Charts/issues/1872) +- Pie Bar Chart issues [\#1870](https://github.com/danielgindi/Charts/issues/1870) +- PieChartView a strange arrow [\#1869](https://github.com/danielgindi/Charts/issues/1869) +- custom gradient color of BarChatView [\#1868](https://github.com/danielgindi/Charts/issues/1868) +- Set space between labels in xAxis [\#1865](https://github.com/danielgindi/Charts/issues/1865) +- label over sample point [\#1864](https://github.com/danielgindi/Charts/issues/1864) +- Realtime Scatterplot crashes when each ChartDataEntry is added dynamically on ScatterView.data [\#1863](https://github.com/danielgindi/Charts/issues/1863) +- Assign Bar Colours Selectively [\#1862](https://github.com/danielgindi/Charts/issues/1862) +- Detect when finger leaves the chart area [\#1861](https://github.com/danielgindi/Charts/issues/1861) +- Pie chart touch event conflict [\#1860](https://github.com/danielgindi/Charts/issues/1860) +- Customize X-axis and grid lines [\#1859](https://github.com/danielgindi/Charts/issues/1859) +- Issue with candle stick when used in combined chart [\#1858](https://github.com/danielgindi/Charts/issues/1858) +- CandleStick Background Color [\#1857](https://github.com/danielgindi/Charts/issues/1857) +- Line Support Gradient Color? [\#1856](https://github.com/danielgindi/Charts/issues/1856) +- Piechart has no xAxis? [\#1855](https://github.com/danielgindi/Charts/issues/1855) +- Retain cycle setting delegate to valueFormatter [\#1854](https://github.com/danielgindi/Charts/issues/1854) +- how to show Xaxis label value as my array value [\#1852](https://github.com/danielgindi/Charts/issues/1852) +- Skip Drawing Circles for LineCharts [\#1795](https://github.com/danielgindi/Charts/issues/1795) +- Realm update [\#1789](https://github.com/danielgindi/Charts/issues/1789) +- "Module compiled with Swift 3.0 cannot be imported in Swift 3.0.1" [\#1788](https://github.com/danielgindi/Charts/issues/1788) +- Move Realm integration to another repository [\#1756](https://github.com/danielgindi/Charts/issues/1756) +- limit line real time update [\#1755](https://github.com/danielgindi/Charts/issues/1755) +- Travis does not use github token for pull request build [\#1734](https://github.com/danielgindi/Charts/issues/1734) +- custom string value at top of bar. [\#1109](https://github.com/danielgindi/Charts/issues/1109) + +**Merged pull requests:** + +- Minor typo fix in console alert message "it's" -\> "its" [\#2301](https://github.com/danielgindi/Charts/pull/2301) ([simonbromberg](https://github.com/simonbromberg)) +- Fix Xcode 8.3 compiler warnings [\#2279](https://github.com/danielgindi/Charts/pull/2279) ([krbarnes](https://github.com/krbarnes)) +- Updated to use Realm version 2.4.3 [\#2199](https://github.com/danielgindi/Charts/pull/2199) ([kimdv](https://github.com/kimdv)) +- Fixed the inconsistency of AxisMax and AxisMin [\#2177](https://github.com/danielgindi/Charts/pull/2177) ([aelam](https://github.com/aelam)) +- Fixes index out of range crash. [\#2167](https://github.com/danielgindi/Charts/pull/2167) ([kzaher](https://github.com/kzaher)) +- remove deprecation warnings in XCode 8.3 [\#2162](https://github.com/danielgindi/Charts/pull/2162) ([LeviDahl](https://github.com/LeviDahl)) +- 'backgroundColor' is inaccessible due to 'internal' protection level … [\#2156](https://github.com/danielgindi/Charts/pull/2156) ([thierryH91200](https://github.com/thierryH91200)) +- Fixes Xcode 8.3 beta build issue [\#2116](https://github.com/danielgindi/Charts/pull/2116) ([davidarve](https://github.com/davidarve)) +- Adds NSPhotoLibraryUsageDescription to plist of ChartsDemo [\#2101](https://github.com/danielgindi/Charts/pull/2101) ([valeriyvan](https://github.com/valeriyvan)) +- Fix demo and test targets not running/testing [\#2084](https://github.com/danielgindi/Charts/pull/2084) ([petester42](https://github.com/petester42)) +- fix a typo, as orientation is horizontal by default [\#2078](https://github.com/danielgindi/Charts/pull/2078) ([liuxuan30](https://github.com/liuxuan30)) +- Update Podspec RealmSwift Dependency to 2.1.1 to be in line with Cartfile [\#2064](https://github.com/danielgindi/Charts/pull/2064) ([anttyc](https://github.com/anttyc)) +- Fix NSCopying implementation in CandleChartDataEntry [\#2056](https://github.com/danielgindi/Charts/pull/2056) ([leo150](https://github.com/leo150)) +- Add support for extensions [\#2048](https://github.com/danielgindi/Charts/pull/2048) ([raptorxcz](https://github.com/raptorxcz)) +- Update "Usage" section of README [\#1984](https://github.com/danielgindi/Charts/pull/1984) ([elaewin](https://github.com/elaewin)) +- All Charts Icons Support Swift3 \[Dub \#629, \#624, \#1261\] [\#1793](https://github.com/danielgindi/Charts/pull/1793) ([abjurato](https://github.com/abjurato)) + +## [3.0.1](https://github.com/danielgindi/Charts/tree/3.0.1) (2016-11-20) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v3.0.1...3.0.1) + +## [v3.0.1](https://github.com/danielgindi/Charts/tree/v3.0.1) (2016-11-20) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.3.1...v3.0.1) + +**Closed issues:** + +- Legend under the bar in bar Chart [\#1850](https://github.com/danielgindi/Charts/issues/1850) +- MultipleBarChart barSpace does not work [\#1849](https://github.com/danielgindi/Charts/issues/1849) +- Can not show decimal in y value on BarChart [\#1848](https://github.com/danielgindi/Charts/issues/1848) +- Cannot add labels to a simple Bar Chart [\#1846](https://github.com/danielgindi/Charts/issues/1846) +- when running my project on iphone device but not simulator it has error"image not found" [\#1845](https://github.com/danielgindi/Charts/issues/1845) +- Removing red selector cross on Line Chart nodes [\#1844](https://github.com/danielgindi/Charts/issues/1844) +- Get screen\(x,y\) value from the plotted points [\#1843](https://github.com/danielgindi/Charts/issues/1843) +- Color between two limit lines [\#1842](https://github.com/danielgindi/Charts/issues/1842) +- Charts-umbrella.h [\#1841](https://github.com/danielgindi/Charts/issues/1841) +- Unable to call 'data' from lineChartView. [\#1839](https://github.com/danielgindi/Charts/issues/1839) +- How to use charts library in my objective c program?.. [\#1837](https://github.com/danielgindi/Charts/issues/1837) +- Migration to Swift 3.x [\#1836](https://github.com/danielgindi/Charts/issues/1836) +- How to hide BarChart hide bottom description color & text ? [\#1835](https://github.com/danielgindi/Charts/issues/1835) +- please help Line Graph not working on Charts 2.3.0 \(for Xcode8 and Swift 2.3.0\) [\#1834](https://github.com/danielgindi/Charts/issues/1834) +- Error when adding embedded binaries [\#1832](https://github.com/danielgindi/Charts/issues/1832) +- X-Axis for different different charts [\#1831](https://github.com/danielgindi/Charts/issues/1831) +- Setting values label [\#1829](https://github.com/danielgindi/Charts/issues/1829) +- Adding background color between two limit lines [\#1828](https://github.com/danielgindi/Charts/issues/1828) +- Horizontal bar chart doesn't start at 0 [\#1827](https://github.com/danielgindi/Charts/issues/1827) +- Gradient Background for LineChart. \(Not Working\) [\#1826](https://github.com/danielgindi/Charts/issues/1826) +- y axis label show wiered value 1.11022302462516e- when passed 0 as value [\#1825](https://github.com/danielgindi/Charts/issues/1825) +- Pie chart specific colors [\#1824](https://github.com/danielgindi/Charts/issues/1824) +- Help ? [\#1823](https://github.com/danielgindi/Charts/issues/1823) +- Its possible change the thickness of the pie chart? [\#1822](https://github.com/danielgindi/Charts/issues/1822) +- BarChart moveToX wrong [\#1820](https://github.com/danielgindi/Charts/issues/1820) +- How to set multiple Stackbar with Charts 3 [\#1819](https://github.com/danielgindi/Charts/issues/1819) +- How do i set [\#1818](https://github.com/danielgindi/Charts/issues/1818) +- LimitLine Label Value Overlap with BarChartData Label [\#1817](https://github.com/danielgindi/Charts/issues/1817) +- What is the replacement for xVals for BarChartData? in swift 3.0 [\#1816](https://github.com/danielgindi/Charts/issues/1816) +- Updated Demo Example for swift3 [\#1815](https://github.com/danielgindi/Charts/issues/1815) +- Line Chart: how to change background color through every odd label on YAxis? [\#1812](https://github.com/danielgindi/Charts/issues/1812) +- Can Radar Chart draw backgroud like this? [\#1811](https://github.com/danielgindi/Charts/issues/1811) +- Can i customize the X axis text a different color? [\#1810](https://github.com/danielgindi/Charts/issues/1810) +- Can we make a 3D Barchart with this Library?? [\#1809](https://github.com/danielgindi/Charts/issues/1809) +- 3.0.0 - adding X Values to LineChartData no longer supported? [\#1808](https://github.com/danielgindi/Charts/issues/1808) +- Swift 3 BarChart with image and title. [\#1807](https://github.com/danielgindi/Charts/issues/1807) +- How to make horizontal dotted lines or remove it? [\#1806](https://github.com/danielgindi/Charts/issues/1806) +- Full control over x labels in 3.0.0 [\#1804](https://github.com/danielgindi/Charts/issues/1804) +- How to change stackbar according to order? [\#1803](https://github.com/danielgindi/Charts/issues/1803) +- How to change stackbar according to order [\#1802](https://github.com/danielgindi/Charts/issues/1802) +- How to set multiple StackBar ? [\#1801](https://github.com/danielgindi/Charts/issues/1801) +- \[Swift 3\] LineChartData without xVals on constructor [\#1800](https://github.com/danielgindi/Charts/issues/1800) +- Zooming X and Y axis independently? [\#1799](https://github.com/danielgindi/Charts/issues/1799) +- Auto scroll xAxis [\#1798](https://github.com/danielgindi/Charts/issues/1798) +- How to add “%” to data in ios-chart [\#1797](https://github.com/danielgindi/Charts/issues/1797) +- can we set y axis max value to chart on horizontal bar graphs?? [\#1794](https://github.com/danielgindi/Charts/issues/1794) +- Fix the xAxis to use the values from my dataset [\#1791](https://github.com/danielgindi/Charts/issues/1791) +- PieChart values outside of chart? [\#1790](https://github.com/danielgindi/Charts/issues/1790) +- ChartLimitLine: How to customize label background and Position center of line [\#1787](https://github.com/danielgindi/Charts/issues/1787) +- With Xcode 8.1 can't build [\#1786](https://github.com/danielgindi/Charts/issues/1786) +- CandleStickChartView can not inherit [\#1784](https://github.com/danielgindi/Charts/issues/1784) +- Chart adds a -1 x-axis entry [\#1782](https://github.com/danielgindi/Charts/issues/1782) +- BarChart - Is It possible to limit the number of bars visible at a given time, and allow users to scroll through the rest horizontally ? [\#1781](https://github.com/danielgindi/Charts/issues/1781) +- Unable to Override some properties of LineChartView in Charts version 2.2.5 [\#1777](https://github.com/danielgindi/Charts/issues/1777) +- CandleStickChartView how to fixed-width, or based on the data dynamically calculate the zoom factor [\#1776](https://github.com/danielgindi/Charts/issues/1776) +- Scroll UIImageView on X-axes along with x-vals [\#1775](https://github.com/danielgindi/Charts/issues/1775) +- How to make BarChart Bar Sizes proportional? [\#1774](https://github.com/danielgindi/Charts/issues/1774) +- how can I set the spacing between bars ? [\#1773](https://github.com/danielgindi/Charts/issues/1773) +- Charts 3.0 labelCount bug? [\#1767](https://github.com/danielgindi/Charts/issues/1767) +- use lineCharts ,if i want show custom string at x, don't show int number, how to do it? [\#1760](https://github.com/danielgindi/Charts/issues/1760) +- ChartUtils Crash on 32 Bit Devices [\#1737](https://github.com/danielgindi/Charts/issues/1737) + +**Merged pull requests:** + +- Added a check against NaN [\#1733](https://github.com/danielgindi/Charts/pull/1733) ([Selficide](https://github.com/Selficide)) + +## [v2.3.1](https://github.com/danielgindi/Charts/tree/v2.3.1) (2016-11-04) +[Full Changelog](https://github.com/danielgindi/Charts/compare/2.3.1...v2.3.1) + +## [2.3.1](https://github.com/danielgindi/Charts/tree/2.3.1) (2016-11-04) +[Full Changelog](https://github.com/danielgindi/Charts/compare/3.0.0...2.3.1) + +**Fixed bugs:** + +- \[BUG\] multiple bar chart in ChartsDemo not display full for last x value [\#1770](https://github.com/danielgindi/Charts/issues/1770) +- PieChartDataSet no slice space shown when an entry has 0 value [\#1730](https://github.com/danielgindi/Charts/issues/1730) +- Bar on BarChart and CombinedChart doesn't start one Zero line [\#1729](https://github.com/danielgindi/Charts/issues/1729) +- Weird highlight rect in Stacked Bar Chart Negative [\#1726](https://github.com/danielgindi/Charts/issues/1726) +- CombinedChartView with CandleData - first/last candlesticks are cut in half [\#1717](https://github.com/danielgindi/Charts/issues/1717) +- Bug with showing negative values and vertical zooming Horizontal Bar Chart [\#1702](https://github.com/danielgindi/Charts/issues/1702) +- Setting circleHoleColor to clear causes artifact [\#1691](https://github.com/danielgindi/Charts/issues/1691) +- Charts 3.0 Carthage update issue [\#1690](https://github.com/danielgindi/Charts/issues/1690) + +**Closed issues:** + +- Problem with Formatter [\#1779](https://github.com/danielgindi/Charts/issues/1779) +- Could not cast value of type 'Charts.BarChartData' \(0x109bd1010\) to 'Charts.PieChartData' \(0x109be0320\). [\#1778](https://github.com/danielgindi/Charts/issues/1778) +- BarChartView - The first column and last column show only half? [\#1772](https://github.com/danielgindi/Charts/issues/1772) +- Stacked Bar Chart Opacity of Some Colors [\#1769](https://github.com/danielgindi/Charts/issues/1769) +- Custom Format YAxis [\#1768](https://github.com/danielgindi/Charts/issues/1768) +- to run ChartsDemo [\#1765](https://github.com/danielgindi/Charts/issues/1765) +- There is something wrong with LineChartView,ChartDataEntry,LineChartData and ChartDataEntry [\#1764](https://github.com/danielgindi/Charts/issues/1764) +- Strange margin/space in a grouped BarChart [\#1763](https://github.com/danielgindi/Charts/issues/1763) +- How to get the chart data entry points [\#1762](https://github.com/danielgindi/Charts/issues/1762) +- the newest version ,it can't build successes in xcode8,it pause at half,no stop or fail. [\#1761](https://github.com/danielgindi/Charts/issues/1761) +- Sorry, I no speak English, 3.0版本的LineChartView [\#1759](https://github.com/danielgindi/Charts/issues/1759) +- How to set x-axis labels with ios charts [\#1758](https://github.com/danielgindi/Charts/issues/1758) +- After 3.0 Upgrade, Marker not automatically showing [\#1757](https://github.com/danielgindi/Charts/issues/1757) +- How to set horizontal Value with a string array at my code using Charts 3.0 [\#1754](https://github.com/danielgindi/Charts/issues/1754) +- Issue with centering xAxis labels [\#1750](https://github.com/danielgindi/Charts/issues/1750) +- Charts / Swift 3.0 - Fatal error: Index out of range [\#1749](https://github.com/danielgindi/Charts/issues/1749) +- ChartsDemo dependency on realm-cocoa ~\> 1.1 issue [\#1748](https://github.com/danielgindi/Charts/issues/1748) +- Carthage realm-cocoa ~\> 1.1 dependency conflict [\#1747](https://github.com/danielgindi/Charts/issues/1747) +- how to set a Array of String for X-axis in swift 3? [\#1746](https://github.com/danielgindi/Charts/issues/1746) +- Xcode 8.1 is reporting 'No such Module 'Charts'' [\#1743](https://github.com/danielgindi/Charts/issues/1743) +- Swift: Custom Xaxis and Yaxis problem. [\#1740](https://github.com/danielgindi/Charts/issues/1740) +- xAxis value starting at "-1" instead of "0" in grouped barchart [\#1739](https://github.com/danielgindi/Charts/issues/1739) +- Compiling issue - xcode 8 [\#1736](https://github.com/danielgindi/Charts/issues/1736) +- How to make Radar five top angle tap enabled? [\#1735](https://github.com/danielgindi/Charts/issues/1735) +- Strings for Labels in Swift 3 [\#1732](https://github.com/danielgindi/Charts/issues/1732) +- HorizontalBarChart values not showing Charts 3.0 [\#1731](https://github.com/danielgindi/Charts/issues/1731) +- getMarkerPositionWithHighlight: always return CGPointZero [\#1728](https://github.com/danielgindi/Charts/issues/1728) +- Why drawValues is outside of clipping contentRect [\#1727](https://github.com/danielgindi/Charts/issues/1727) +- Set max highlight distance [\#1725](https://github.com/danielgindi/Charts/issues/1725) +- Trouble making custom labels along the X and Y Axis of my bar chart [\#1724](https://github.com/danielgindi/Charts/issues/1724) +- Swift 3 - BarChartData, resetLabelsToSkip\(\) and setLabelsToSkip\(0\) not working [\#1723](https://github.com/danielgindi/Charts/issues/1723) +- When zooming in, x-axis shows more labels than values [\#1722](https://github.com/danielgindi/Charts/issues/1722) +- How to set the xValues to the BarchartData ? [\#1721](https://github.com/danielgindi/Charts/issues/1721) +- How to show custom text on Y-axis of Line Chart? [\#1720](https://github.com/danielgindi/Charts/issues/1720) +- Add UIButtons to data points in a line graph, plotting date and time in X-axis [\#1719](https://github.com/danielgindi/Charts/issues/1719) +- How to set the xValues to the BarchartData ? [\#1718](https://github.com/danielgindi/Charts/issues/1718) +- \: Error: this application, or a library it uses, has passed an invalid numeric value \(NaN, or not-a-number\) to CoreGraphics API and this value is being ignored.Please fix this problem. [\#1714](https://github.com/danielgindi/Charts/issues/1714) +- cancel group display in BarChart [\#1713](https://github.com/danielgindi/Charts/issues/1713) +- PieChart, label is a little of values ,labels is overlap [\#1710](https://github.com/danielgindi/Charts/issues/1710) +- how to port calls to getEntriesAtIndex [\#1709](https://github.com/danielgindi/Charts/issues/1709) +- Exception upon calling \[ChartDataEntry initWithX:y:\] via ObjC + Charts using Pods as Framework [\#1708](https://github.com/danielgindi/Charts/issues/1708) +- Multiple bar Chart Xvalues Doesn't come centre to the grouped bars... [\#1707](https://github.com/danielgindi/Charts/issues/1707) +- \[BarChartDataEntry\] axis to accept NSString [\#1706](https://github.com/danielgindi/Charts/issues/1706) +- Conflict: Charts's Range conflict with Apple NSRange\(Swift 3: Range\). It makes me can not use the Apple's Range [\#1705](https://github.com/danielgindi/Charts/issues/1705) +- Excuse me, BarChartData the " initWithXVals:\(NSArray \*data\) dataSets:\(NSArray \*data\)" in Swift 3.0 V "XVals" is what method is the?I can't find the way,Help me。 [\#1704](https://github.com/danielgindi/Charts/issues/1704) +- Excuse me,BarChartData the initWithXVals:\(NSArray \*data\) dataSets:\(NSArray \*data\) in Swift 3.0 V What method is the?I can't find the way,Help me。 [\#1703](https://github.com/danielgindi/Charts/issues/1703) +- X-Axis and Y-Axis is not shown in swift 3 [\#1701](https://github.com/danielgindi/Charts/issues/1701) +- Can i use 2.2.5 version with Swift3 [\#1700](https://github.com/danielgindi/Charts/issues/1700) +- I update the pod to 3.0.0 but Xcode still wants to convert to Swift 3 [\#1699](https://github.com/danielgindi/Charts/issues/1699) +- \[Question\] Multiple lines with different units [\#1698](https://github.com/danielgindi/Charts/issues/1698) +- \[Question\] Missing intermediate values [\#1697](https://github.com/danielgindi/Charts/issues/1697) +- What happened to X-Axis labels in 3.0? [\#1696](https://github.com/danielgindi/Charts/issues/1696) +- What is the new delegate for selection of values in the chart swift 3.0 [\#1695](https://github.com/danielgindi/Charts/issues/1695) +- Can I have two different Yaxis scale on combined chart [\#1694](https://github.com/danielgindi/Charts/issues/1694) +- Zooming LineChart xAxis on 32bit device doesn't work correctly. [\#1693](https://github.com/danielgindi/Charts/issues/1693) +- How to show xAxis All value and Rotate Label? v3.0 [\#1692](https://github.com/danielgindi/Charts/issues/1692) +- \[LineChartView\] Wrong position Highlight and xAxis [\#1689](https://github.com/danielgindi/Charts/issues/1689) +- How to get back x-values for BarChart\[Charts 3 migration problem\] [\#1688](https://github.com/danielgindi/Charts/issues/1688) +- How to move data labels outside the chart. [\#1687](https://github.com/danielgindi/Charts/issues/1687) +- RadarChartView implementation [\#1686](https://github.com/danielgindi/Charts/issues/1686) +- problem with custom xaxis labels [\#1685](https://github.com/danielgindi/Charts/issues/1685) +- Update spec on cocoapods to 3.0 [\#1683](https://github.com/danielgindi/Charts/issues/1683) +- Pod install: SSL: certificate verification failed [\#1682](https://github.com/danielgindi/Charts/issues/1682) +- Setting a pieChartDataSet on 3.0 [\#1681](https://github.com/danielgindi/Charts/issues/1681) +- String value at x Axis of BarChart [\#1680](https://github.com/danielgindi/Charts/issues/1680) +- Zooming LineChart x axis on 32bit processor doesn't work as expected [\#1679](https://github.com/danielgindi/Charts/issues/1679) +- ChartLimitLine background color [\#1678](https://github.com/danielgindi/Charts/issues/1678) +- Left and right slide bar chart only half and remove background grid [\#1654](https://github.com/danielgindi/Charts/issues/1654) +- Setting centerAxisLabelsEnabled with a granularity set does not centre [\#1652](https://github.com/danielgindi/Charts/issues/1652) +- Realm and Charts 3.0 tutorial [\#1651](https://github.com/danielgindi/Charts/issues/1651) +- HorizontalBarChartView text for xValues -- charts 3.0 [\#1646](https://github.com/danielgindi/Charts/issues/1646) +- 'spaceBetweenLabels' not found on object XAxis [\#1643](https://github.com/danielgindi/Charts/issues/1643) +- this func -nsuiTouchesEnded does not work [\#1642](https://github.com/danielgindi/Charts/issues/1642) +- Adjust circle for selected point [\#1597](https://github.com/danielgindi/Charts/issues/1597) +- CombinedChartView fitBars property [\#1569](https://github.com/danielgindi/Charts/issues/1569) +- How to show x-axis labels only when value is a DataEntry in Line Chart? [\#1536](https://github.com/danielgindi/Charts/issues/1536) +- Why the coordinate points and the X axis the above data is not aligned? [\#1492](https://github.com/danielgindi/Charts/issues/1492) +- \*\*\*\*\*\*\*\*\*\*\*\*\* Migrating to Charts 3.0 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* [\#1474](https://github.com/danielgindi/Charts/issues/1474) +- How to show ChartMarker in CombinedChart? [\#1454](https://github.com/danielgindi/Charts/issues/1454) +- How to set the data margin Align right? [\#1372](https://github.com/danielgindi/Charts/issues/1372) +- Correct date on x axis [\#1325](https://github.com/danielgindi/Charts/issues/1325) +- The chart above and the chart below how to align [\#1276](https://github.com/danielgindi/Charts/issues/1276) +- Unable to select BarChartView from storyboard \(OS X\) [\#1197](https://github.com/danielgindi/Charts/issues/1197) + +**Merged pull requests:** + +- Fix png image using JPEG type when being saved on macOS [\#1783](https://github.com/danielgindi/Charts/pull/1783) ([petester42](https://github.com/petester42)) +- Updated Width Constraints - Fixes \#1770 [\#1771](https://github.com/danielgindi/Charts/pull/1771) ([SumoSimo](https://github.com/SumoSimo)) +- update cocoapods [\#1684](https://github.com/danielgindi/Charts/pull/1684) ([petester42](https://github.com/petester42)) + +## [3.0.0](https://github.com/danielgindi/Charts/tree/3.0.0) (2016-10-19) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v3.0.0...3.0.0) + +## [v3.0.0](https://github.com/danielgindi/Charts/tree/v3.0.0) (2016-10-19) +[Full Changelog](https://github.com/danielgindi/Charts/compare/2.3.0...v3.0.0) + +**Implemented enhancements:** + +- Chart description is drawn on top of markers [\#1344](https://github.com/danielgindi/Charts/issues/1344) + +**Fixed bugs:** + +- CandleStickChart - last CandleStick cut in half [\#1668](https://github.com/danielgindi/Charts/issues/1668) +- X labels Issues [\#1639](https://github.com/danielgindi/Charts/issues/1639) +- Marker display is abnormal [\#1575](https://github.com/danielgindi/Charts/issues/1575) +- Misplaced Radar Marker [\#1556](https://github.com/danielgindi/Charts/issues/1556) +- fatal error: Double value cannot be converted to Int because it is either infinite or NaN [\#1550](https://github.com/danielgindi/Charts/issues/1550) +- Problem with the xValue begins at 0 [\#1547](https://github.com/danielgindi/Charts/issues/1547) +- \(v3.0 + Swift3.0\)LineChart crash when dataSets is a empty array [\#1491](https://github.com/danielgindi/Charts/issues/1491) +- \(v3.0 + swift3.0\) charts' top are cropped/overlapped in ChartsDemo [\#1489](https://github.com/danielgindi/Charts/issues/1489) +- \(v3.0 + Swift3.0\) Time Line Chart Demo crash [\#1488](https://github.com/danielgindi/Charts/issues/1488) +- Last Value doesn't appear in barCharts and lineCharts [\#1384](https://github.com/danielgindi/Charts/issues/1384) +- Distance between chart legend and the chart is to big in case of rotated labels [\#1360](https://github.com/danielgindi/Charts/issues/1360) +- xAxis labels not align with values in Multiple Bar Chart [\#1334](https://github.com/danielgindi/Charts/issues/1334) +- text value on the last entry is missing from line chart [\#1323](https://github.com/danielgindi/Charts/issues/1323) + +**Closed issues:** + +- Finding the RadarChartView center position in a view [\#1677](https://github.com/danielgindi/Charts/issues/1677) +- How do I Use IValueFormatter to format XAxis labels in swift? [\#1676](https://github.com/danielgindi/Charts/issues/1676) +- How to set lineChart type to cubic lines [\#1674](https://github.com/danielgindi/Charts/issues/1674) +- In IOS 10 Xcode 8,I got some issues [\#1673](https://github.com/danielgindi/Charts/issues/1673) +- the first and last point have a line [\#1672](https://github.com/danielgindi/Charts/issues/1672) +- Last value on line graph has no text [\#1671](https://github.com/danielgindi/Charts/issues/1671) +- can I fix number of overlapping this problem? [\#1670](https://github.com/danielgindi/Charts/issues/1670) +- chartValueSelected delegate not called [\#1669](https://github.com/danielgindi/Charts/issues/1669) +- Charts.frameworkiOS did not show up [\#1667](https://github.com/danielgindi/Charts/issues/1667) +- Half a bar the first one of chart [\#1666](https://github.com/danielgindi/Charts/issues/1666) +- Charts : iOS 10, Xcode 8 - Embedded Framework iTunes Store operation failed while uploading on App Store [\#1665](https://github.com/danielgindi/Charts/issues/1665) +- We need an old version for Xcode 7.0 [\#1664](https://github.com/danielgindi/Charts/issues/1664) +- LineChartView is rotating LineChartData in 3.0 [\#1663](https://github.com/danielgindi/Charts/issues/1663) +- Showing all xAxis labels in a BarChart no matter the number of bars [\#1661](https://github.com/danielgindi/Charts/issues/1661) +- Can I set different color Label in lineChart?ForExample [\#1660](https://github.com/danielgindi/Charts/issues/1660) +- Combined Charts - Negative values for Line Chart are not rendered [\#1659](https://github.com/danielgindi/Charts/issues/1659) +- Swift 2.2 : How to show custom labels on x-axis ? [\#1658](https://github.com/danielgindi/Charts/issues/1658) +- Legends for multiple dataSets and multiple bar charts allignment [\#1657](https://github.com/danielgindi/Charts/issues/1657) +- Multi chart setup xAxis value format [\#1656](https://github.com/danielgindi/Charts/issues/1656) +- xAxis when zooming [\#1655](https://github.com/danielgindi/Charts/issues/1655) +- Request to solve a sort of bug [\#1653](https://github.com/danielgindi/Charts/issues/1653) +- Updating the last Candlestick entry. [\#1649](https://github.com/danielgindi/Charts/issues/1649) +- Use of '@import' when modules are disabled [\#1647](https://github.com/danielgindi/Charts/issues/1647) +- Didn't show last Y Axis [\#1645](https://github.com/danielgindi/Charts/issues/1645) +- noDataText is not working [\#1644](https://github.com/danielgindi/Charts/issues/1644) +- Custom background color [\#1641](https://github.com/danielgindi/Charts/issues/1641) +- Cannot get my Linechart to work since Xcode 8 update [\#1640](https://github.com/danielgindi/Charts/issues/1640) +- Horizontal Highlight at touch/click point... ?? [\#1636](https://github.com/danielgindi/Charts/issues/1636) +- Some acute questions about ZDLineChartView [\#1635](https://github.com/danielgindi/Charts/issues/1635) +- \[Travis\] Travis won't build issue [\#1633](https://github.com/danielgindi/Charts/issues/1633) +- PieChartView cannot show values name . [\#1632](https://github.com/danielgindi/Charts/issues/1632) +- How to make points interactive/draggable [\#1631](https://github.com/danielgindi/Charts/issues/1631) +- Charts 3.0 with Swift 3.0 [\#1630](https://github.com/danielgindi/Charts/issues/1630) +- LineChartData is nolonger allow initWithXVals, what should I do? [\#1629](https://github.com/danielgindi/Charts/issues/1629) +- BarChartData do not find this method initWithXVals: dataSets: [\#1628](https://github.com/danielgindi/Charts/issues/1628) +- Charts 3.0: How to set x-values for a line chart? [\#1627](https://github.com/danielgindi/Charts/issues/1627) +- How can I display the x Axis values on a LineChartView? [\#1625](https://github.com/danielgindi/Charts/issues/1625) +- Xcode - 8.0, Working Fine in Xcode 7.3 -up to iOS\(9.3\) Crash in Xcode 8 - iOS 10 [\#1624](https://github.com/danielgindi/Charts/issues/1624) +- I can't see the final number on the chart. [\#1623](https://github.com/danielgindi/Charts/issues/1623) +- can I Achieve this? Using this framework [\#1622](https://github.com/danielgindi/Charts/issues/1622) +- When Will Charts 3.0 Be Version Tagged? [\#1620](https://github.com/danielgindi/Charts/issues/1620) +- RadarChartData xVals cant use [\#1619](https://github.com/danielgindi/Charts/issues/1619) +- Extract ChartsRealm and Realm from the Charts project [\#1618](https://github.com/danielgindi/Charts/issues/1618) +- Crashing xcode 7.3.1 [\#1617](https://github.com/danielgindi/Charts/issues/1617) +- Method does not override any method from its superclass [\#1616](https://github.com/danielgindi/Charts/issues/1616) +- warning: Swift Charts 2.3.0 - error in module ChartsDebug info from this module will be unavailable in the debugger. [\#1615](https://github.com/danielgindi/Charts/issues/1615) +- ChartViewDelegate's chartValueSelected is tied up with Highlights [\#1614](https://github.com/danielgindi/Charts/issues/1614) +- 'ChartViewDelegate' is unavailable: cannot find Swift declaration for this class. [\#1613](https://github.com/danielgindi/Charts/issues/1613) +- \[NOT AN ISSUE\] Release for Charts 3.0 [\#1612](https://github.com/danielgindi/Charts/issues/1612) +- Charts/Classes/Utils/ChartUtils.swift error [\#1611](https://github.com/danielgindi/Charts/issues/1611) +- Issue with YAxis max and min in the RadarChart [\#1610](https://github.com/danielgindi/Charts/issues/1610) +- App Crash: could not cast to 'Charts.PieChartData': in 2.3.0 when upgrading to XCode 8.0 [\#1609](https://github.com/danielgindi/Charts/issues/1609) +- customAxisMin and customAxisMax not found on object ChartYAxis [\#1608](https://github.com/danielgindi/Charts/issues/1608) +- Using version 3.0 with Carthage? [\#1607](https://github.com/danielgindi/Charts/issues/1607) +- Chart 3.0 swift 3.0 [\#1606](https://github.com/danielgindi/Charts/issues/1606) +- Chart not centered/middled when having less values [\#1605](https://github.com/danielgindi/Charts/issues/1605) +- How to use a date/string for the X value [\#1604](https://github.com/danielgindi/Charts/issues/1604) +- Setting AxisBase.axisMaximum results in an axisRange of zero [\#1603](https://github.com/danielgindi/Charts/issues/1603) +- Pods failing for swift3.0 [\#1602](https://github.com/danielgindi/Charts/issues/1602) +- BarChart View issues [\#1601](https://github.com/danielgindi/Charts/issues/1601) +- Support for swift 3.0 [\#1600](https://github.com/danielgindi/Charts/issues/1600) +- Pod pointing to master branch code created issue in BarChartDataEntry [\#1599](https://github.com/danielgindi/Charts/issues/1599) +- Swift based library, but OC based Demo. Have you ever thought of provide a Swifty Demo? [\#1598](https://github.com/danielgindi/Charts/issues/1598) +- Grid and xaxis label issues. [\#1596](https://github.com/danielgindi/Charts/issues/1596) +- LeftAxis above bars in BarChartView [\#1595](https://github.com/danielgindi/Charts/issues/1595) +- cannot convert value of type\<\> to expected arguments RLMResults\ [\#1594](https://github.com/danielgindi/Charts/issues/1594) +- Member 'index' cannot be used on value of protocol type 'collection'; use a generic constraint instead [\#1593](https://github.com/danielgindi/Charts/issues/1593) +- Scrollable Graph [\#1592](https://github.com/danielgindi/Charts/issues/1592) +- charts 2.3 unsupported architectures i386 [\#1591](https://github.com/danielgindi/Charts/issues/1591) +- BarChart doesn't refresh after new dataSet [\#1590](https://github.com/danielgindi/Charts/issues/1590) +- Label of ChartLimitLine overlaps limit line a little [\#1589](https://github.com/danielgindi/Charts/issues/1589) +- IChartAxisValueFormatter cound't found [\#1588](https://github.com/danielgindi/Charts/issues/1588) +- How to use v2.2.5 swift3.0 in OC Project? [\#1587](https://github.com/danielgindi/Charts/issues/1587) +- Last LineChart y-label not being rendered [\#1585](https://github.com/danielgindi/Charts/issues/1585) +- Charts 3.0: Custom xAxis labels with gaps in data? [\#1584](https://github.com/danielgindi/Charts/issues/1584) +- BarChart xAxis labels disappear after zooming [\#1583](https://github.com/danielgindi/Charts/issues/1583) +- Add space between bars [\#1582](https://github.com/danielgindi/Charts/issues/1582) +- How to use v2.2.5 swift3.0 in OC Project? [\#1581](https://github.com/danielgindi/Charts/issues/1581) +- malloc: \*\*\* error for object : Invalid pointer dequeued from free list\*\*\* set a breakpoint in malloc\_error\_break to debug [\#1580](https://github.com/danielgindi/Charts/issues/1580) +- i want to add % in value [\#1579](https://github.com/danielgindi/Charts/issues/1579) +- Update the code to Swift 3.0 compliance [\#1578](https://github.com/danielgindi/Charts/issues/1578) +- Can I set a text label underneath each bar of a bar chart? [\#1577](https://github.com/danielgindi/Charts/issues/1577) +- Line Chart X-Axis values as a string [\#1576](https://github.com/danielgindi/Charts/issues/1576) +- Hide values in Combines chart [\#1574](https://github.com/danielgindi/Charts/issues/1574) +- Method does not override any method from its superclass [\#1573](https://github.com/danielgindi/Charts/issues/1573) +- Method does not override any method from its superclass [\#1572](https://github.com/danielgindi/Charts/issues/1572) +- Crash in Charts v2.2.5-Swift3.0 [\#1570](https://github.com/danielgindi/Charts/issues/1570) +- Cocoapods integration with objective c projects - can't resolve [\#1568](https://github.com/danielgindi/Charts/issues/1568) +- How to change x value [\#1567](https://github.com/danielgindi/Charts/issues/1567) +- \[Charts 3.0\] Issue with centerAxisLabelsEnabled [\#1566](https://github.com/danielgindi/Charts/issues/1566) +- \[Chart 3.0 BUG\] xAxis labels disappear after a deep zoom in [\#1564](https://github.com/danielgindi/Charts/issues/1564) +- Extraneous space between axis and bars when there is data with value of 0 [\#1557](https://github.com/danielgindi/Charts/issues/1557) +- Chart clip the Ballon Marker [\#1555](https://github.com/danielgindi/Charts/issues/1555) +- Argument labels '\(value:, xIndex:\)' do not match any available overloads, Cannot invoke initializer for type 'BarChartData' with an argument list of type '\(xVals: \[String\], dataSets: \[BarChartDataSet\]\)' [\#1554](https://github.com/danielgindi/Charts/issues/1554) +- Chart clip the Ballon Marker [\#1553](https://github.com/danielgindi/Charts/issues/1553) +- horizontal bar graphs with different colors and offset values [\#1552](https://github.com/danielgindi/Charts/issues/1552) +- valueFormatter API changes in Swift 3 [\#1551](https://github.com/danielgindi/Charts/issues/1551) +- Calling `setAxisMaxValue` leads to transform error. [\#1549](https://github.com/danielgindi/Charts/issues/1549) +- Demo in Swift? [\#1548](https://github.com/danielgindi/Charts/issues/1548) +- The LineChart is not working swift 3 [\#1546](https://github.com/danielgindi/Charts/issues/1546) +- Charts framework not usable in a Swift class added to an Objective C project [\#1545](https://github.com/danielgindi/Charts/issues/1545) +- How to add charts cocoapods dependency for Swift 3 project? [\#1544](https://github.com/danielgindi/Charts/issues/1544) +- Grouped bars in Combined chart [\#1543](https://github.com/danielgindi/Charts/issues/1543) +- I want to control width between bar [\#1542](https://github.com/danielgindi/Charts/issues/1542) +- Crash while using Combined Chart [\#1540](https://github.com/danielgindi/Charts/issues/1540) +- how can i draw only bar chart without x-axis, y-axis , grid line [\#1539](https://github.com/danielgindi/Charts/issues/1539) +- Charts.framework iOS not exist [\#1538](https://github.com/danielgindi/Charts/issues/1538) +- can i set data's starting point? [\#1537](https://github.com/danielgindi/Charts/issues/1537) +- Scatter Chart View V3.0 an another problem with balloon [\#1535](https://github.com/danielgindi/Charts/issues/1535) +- Granularity in line chart not working \(Chart3.0-Swift2.3 \) [\#1534](https://github.com/danielgindi/Charts/issues/1534) +- Error in ChartsPlatform.swift [\#1533](https://github.com/danielgindi/Charts/issues/1533) +- Still got an error when building Charts\(2.3.0\) with carthage [\#1532](https://github.com/danielgindi/Charts/issues/1532) +- Horizontal bar chart xAxis values missing [\#1531](https://github.com/danielgindi/Charts/issues/1531) +- Selection in a bar chart [\#1530](https://github.com/danielgindi/Charts/issues/1530) +- Multiple bar is not working [\#1529](https://github.com/danielgindi/Charts/issues/1529) +- X -axis - time , sometimes incorrectly displayed \( many of the data points \) [\#1528](https://github.com/danielgindi/Charts/issues/1528) +- Convert x value labels to String? from Double? \[Horizontal Barchart\] \(Swift v3\) [\#1527](https://github.com/danielgindi/Charts/issues/1527) +- Method doesn't override any method from its superclass [\#1526](https://github.com/danielgindi/Charts/issues/1526) +- Bar charts X-Axis labels repeating if the number of bars reduce [\#1524](https://github.com/danielgindi/Charts/issues/1524) +- The latest version can not run [\#1523](https://github.com/danielgindi/Charts/issues/1523) +- how to show the Chart without data? [\#1522](https://github.com/danielgindi/Charts/issues/1522) +- The usage is not correct [\#1521](https://github.com/danielgindi/Charts/issues/1521) +- Charts classes not found in swift class in my Objc Xcode project [\#1519](https://github.com/danielgindi/Charts/issues/1519) +- ChartUtils methods are marked internal and cannot be use to create custom charts [\#1518](https://github.com/danielgindi/Charts/issues/1518) +- Re: Fatal error while loading Bar Chart \#1511 [\#1517](https://github.com/danielgindi/Charts/issues/1517) +- I can't run this demo! [\#1516](https://github.com/danielgindi/Charts/issues/1516) +- Charts.framework iOS [\#1515](https://github.com/danielgindi/Charts/issues/1515) +- Setting x-values of BarChartView in Chart 2.2.6 [\#1514](https://github.com/danielgindi/Charts/issues/1514) +- Xcode 8.0,many errors...... [\#1513](https://github.com/danielgindi/Charts/issues/1513) +- Fatal error while loading Bar Chart [\#1511](https://github.com/danielgindi/Charts/issues/1511) +- Fix Intermittent CI Failures [\#1508](https://github.com/danielgindi/Charts/issues/1508) +- Info.plist Utility Error [\#1507](https://github.com/danielgindi/Charts/issues/1507) +- Bar chart "floats" above x-axis when axisMinValue set to 0 [\#1506](https://github.com/danielgindi/Charts/issues/1506) +- Issue with BarDataEntry Method [\#1504](https://github.com/danielgindi/Charts/issues/1504) +- \(v3.0 + Swift3.0\)IChartAxisValueFormatter's protocol function pass on a unexpected value\(double value discard\) [\#1503](https://github.com/danielgindi/Charts/issues/1503) +- Cannot invoke initializer for type 'LineChartData' [\#1502](https://github.com/danielgindi/Charts/issues/1502) +- when click node call chartValueSelected funtion [\#1499](https://github.com/danielgindi/Charts/issues/1499) +- \[BUG\] LineChart--- about "LineChartModeCubicBezier" [\#1490](https://github.com/danielgindi/Charts/issues/1490) +- Unneeded deprecated warning for Legend.position [\#1483](https://github.com/danielgindi/Charts/issues/1483) +- Scatter Chart View V3.0 bad point displayed with BaloonMaker [\#1482](https://github.com/danielgindi/Charts/issues/1482) +- How to set the LineChart disconnect style, I add NAN to Entry, isInBoundsRight function is crashed. [\#1471](https://github.com/danielgindi/Charts/issues/1471) +- \(v3.0\)Demo: no such module realm [\#1460](https://github.com/danielgindi/Charts/issues/1460) +- Please provide swift 2 version for this project [\#1457](https://github.com/danielgindi/Charts/issues/1457) +- Distinguish LineGraph callback. [\#1448](https://github.com/danielgindi/Charts/issues/1448) +- BarChart right/left bar cut in half [\#1446](https://github.com/danielgindi/Charts/issues/1446) +- Graph clipping while setting Y-axis min ,max Value [\#1444](https://github.com/danielgindi/Charts/issues/1444) +- ChartV3 autoScaleMinMaxEnabled not scaling candle charts correctly. [\#1442](https://github.com/danielgindi/Charts/issues/1442) +- conflict with scrollView [\#1438](https://github.com/danielgindi/Charts/issues/1438) +- Getting error, while assigning xVals to PieChartData. [\#1433](https://github.com/danielgindi/Charts/issues/1433) +- HorizontalBarChartView not show value at bar [\#1396](https://github.com/danielgindi/Charts/issues/1396) +- HorizontalBarCharView incorrect results for bounding box query [\#1382](https://github.com/danielgindi/Charts/issues/1382) +- Data entries are missing on the chart [\#1348](https://github.com/danielgindi/Charts/issues/1348) +- \[HEADS UP\] Realm swift 3.0 support is blocked due to Xcode 8 beta 3 swift compiler bug [\#1269](https://github.com/danielgindi/Charts/issues/1269) +- When the X-Axis's text is too long, it will cover the radar chart. [\#1143](https://github.com/danielgindi/Charts/issues/1143) +- Extracting ChartsRealm to a separate project [\#1119](https://github.com/danielgindi/Charts/issues/1119) +- Disable scrolling parent scrollview when readed end of the chart [\#1115](https://github.com/danielgindi/Charts/issues/1115) +- Pie Chart : Multiline label on legend is cutting off [\#1084](https://github.com/danielgindi/Charts/issues/1084) + +**Merged pull requests:** + +- Enter the matrix [\#1650](https://github.com/danielgindi/Charts/pull/1650) ([petester42](https://github.com/petester42)) +- fix bar chart in demo that date starts at 0 [\#1648](https://github.com/danielgindi/Charts/pull/1648) ([liuxuan30](https://github.com/liuxuan30)) +- fix \#1603 and API comment [\#1621](https://github.com/danielgindi/Charts/pull/1621) ([liuxuan30](https://github.com/liuxuan30)) +- Bugfix for fix \#1488, \#1564 [\#1565](https://github.com/danielgindi/Charts/pull/1565) ([liuxuan30](https://github.com/liuxuan30)) +- Single test target to make coverage easier [\#1563](https://github.com/danielgindi/Charts/pull/1563) ([petester42](https://github.com/petester42)) +- Fix codecov [\#1560](https://github.com/danielgindi/Charts/pull/1560) ([petester42](https://github.com/petester42)) +- Adds Codecov [\#1559](https://github.com/danielgindi/Charts/pull/1559) ([petester42](https://github.com/petester42)) +- Fix decimals crash in ChartsUtil [\#1558](https://github.com/danielgindi/Charts/pull/1558) ([petester42](https://github.com/petester42)) +- Fixes messaging issues with charts needing carthage [\#1525](https://github.com/danielgindi/Charts/pull/1525) ([petester42](https://github.com/petester42)) +- Attempt to make CI more stable [\#1510](https://github.com/danielgindi/Charts/pull/1510) ([petester42](https://github.com/petester42)) +- Fix Cocoapods setup being broken [\#1509](https://github.com/danielgindi/Charts/pull/1509) ([petester42](https://github.com/petester42)) + +## [2.3.0](https://github.com/danielgindi/Charts/tree/2.3.0) (2016-09-21) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.3.0...2.3.0) + +## [v2.3.0](https://github.com/danielgindi/Charts/tree/v2.3.0) (2016-09-21) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.2.5...v2.3.0) + +**Implemented enhancements:** + +- Seek help with CandleStickChartView [\#1297](https://github.com/danielgindi/Charts/issues/1297) +- Support Realm 1.0.1 \(Objective-C\) [\#1201](https://github.com/danielgindi/Charts/issues/1201) + +**Fixed bugs:** + +- macOS demo bar chart's first and last bar got half cut [\#1468](https://github.com/danielgindi/Charts/issues/1468) +- Label drawing glitch when changing data [\#1347](https://github.com/danielgindi/Charts/issues/1347) +- HorizontalBarChartView with multiple data set crashes on tap [\#1339](https://github.com/danielgindi/Charts/issues/1339) +- weird behavior resizing the pie. [\#1286](https://github.com/danielgindi/Charts/issues/1286) +- Line Chart\(Dual YAis\):if i drag the slider,double line only leave the one line \#bug [\#1250](https://github.com/danielgindi/Charts/issues/1250) +- only Have a X-Value,the PieChart too bigger, twinkle [\#1239](https://github.com/danielgindi/Charts/issues/1239) +- Chart always crash when marker added and highlightFullBarEnabled is true [\#1185](https://github.com/danielgindi/Charts/issues/1185) +- App is crashing for certain symbols when granularityEnabled is false [\#1181](https://github.com/danielgindi/Charts/issues/1181) +- Changing chart data + autoScaleMinMaxEnabled causes crash [\#1151](https://github.com/danielgindi/Charts/issues/1151) +- using ChartXAxisValueFormatter doesn't enable 3 lines x axis labels [\#1148](https://github.com/danielgindi/Charts/issues/1148) +- ChartMaker work wrong in a Combined Chart [\#737](https://github.com/danielgindi/Charts/issues/737) +- CombinedChart with grouped bars support [\#169](https://github.com/danielgindi/Charts/issues/169) + +**Closed issues:** + +- Typo in CONTRIBUTING.md [\#1501](https://github.com/danielgindi/Charts/issues/1501) +- noDataText overflows [\#1500](https://github.com/danielgindi/Charts/issues/1500) +- How can I get frame of Line chart? \(with out labels, chart only\) [\#1498](https://github.com/danielgindi/Charts/issues/1498) +- Last label on xAxis is not showing [\#1497](https://github.com/danielgindi/Charts/issues/1497) +- How do I set the value of the x-axis after update ? [\#1496](https://github.com/danielgindi/Charts/issues/1496) +- Xcode 8 swift 3 No Such Module Charts? [\#1494](https://github.com/danielgindi/Charts/issues/1494) +- Give id for node [\#1493](https://github.com/danielgindi/Charts/issues/1493) +- \(v3.0-Swift3.0\)crash because of image not found [\#1487](https://github.com/danielgindi/Charts/issues/1487) +- \(v3.0 LineChart\) xAxis with String/double label issue [\#1481](https://github.com/danielgindi/Charts/issues/1481) +- LineChart. Custom LineChartRenderer does not cross chart border [\#1480](https://github.com/danielgindi/Charts/issues/1480) +- LineChart. Labels for Y axis and Double format [\#1479](https://github.com/danielgindi/Charts/issues/1479) +- stringForValue value argument [\#1478](https://github.com/danielgindi/Charts/issues/1478) +- \[LineChart\] How to Darw "NSString" on xAxis? without Realm.io [\#1477](https://github.com/danielgindi/Charts/issues/1477) +- code 65 result after getting a Carthage update failure [\#1476](https://github.com/danielgindi/Charts/issues/1476) +- How to show xAxis All value and Rotate Label? [\#1475](https://github.com/danielgindi/Charts/issues/1475) +- Compiled with older version of Swift language \(2.0\) [\#1473](https://github.com/danielgindi/Charts/issues/1473) +- Some missing methods in swift 3 version [\#1472](https://github.com/danielgindi/Charts/issues/1472) +- v2.2.5 not support swift2.3 [\#1470](https://github.com/danielgindi/Charts/issues/1470) +- balloon marker [\#1469](https://github.com/danielgindi/Charts/issues/1469) +- How can I highlight single dot in lineChart? [\#1465](https://github.com/danielgindi/Charts/issues/1465) +- release new [\#1464](https://github.com/danielgindi/Charts/issues/1464) +- After the upgrade iOS10 Charts-iOS Change the case [\#1463](https://github.com/danielgindi/Charts/issues/1463) +- \(v3.0\)There is no Chart-iOS framework in Product [\#1462](https://github.com/danielgindi/Charts/issues/1462) +- ios10 the charts can not display! [\#1461](https://github.com/danielgindi/Charts/issues/1461) +- Swift 3.0 and Realm [\#1458](https://github.com/danielgindi/Charts/issues/1458) +- Unable to draw bars [\#1456](https://github.com/danielgindi/Charts/issues/1456) +- \[MC\] System group container issue [\#1455](https://github.com/danielgindi/Charts/issues/1455) +- iOS 10 and swift 3.0 issues [\#1453](https://github.com/danielgindi/Charts/issues/1453) +- Adding additional X index values without the initWithXVals [\#1451](https://github.com/danielgindi/Charts/issues/1451) +- Cannot convert Charts to Swift 3.0 [\#1449](https://github.com/danielgindi/Charts/issues/1449) +- Combine chart have a Bar color gray every bars? [\#1447](https://github.com/danielgindi/Charts/issues/1447) +- Compiling on New XCode 8 [\#1445](https://github.com/danielgindi/Charts/issues/1445) +- Customize scatter chart color for each data in dataSets [\#1443](https://github.com/danielgindi/Charts/issues/1443) +- XCode 8: Crash in xAxis Renderer after upgrade [\#1441](https://github.com/danielgindi/Charts/issues/1441) +- Xcode 8 and swift 3.0 [\#1440](https://github.com/danielgindi/Charts/issues/1440) +- How To use Swift3.0 In Xcode8 [\#1439](https://github.com/danielgindi/Charts/issues/1439) +- Error when running `pod lib lint` from another project [\#1436](https://github.com/danielgindi/Charts/issues/1436) +- Graph cutting off from axisLine while setting axis min ,max Value [\#1435](https://github.com/danielgindi/Charts/issues/1435) +- Cannot compile for targets below iPhone 5s [\#1434](https://github.com/danielgindi/Charts/issues/1434) +- Line chartView, I need a YAxis with the labelNum is inverted order [\#1432](https://github.com/danielgindi/Charts/issues/1432) +- PieChartDataEntry class not found - Swift/CocoaPods [\#1431](https://github.com/danielgindi/Charts/issues/1431) +- How to write a limit for each bar in horizontal bar chart? [\#1429](https://github.com/danielgindi/Charts/issues/1429) +- Bug with 2 candlestick datasets on one chart. [\#1428](https://github.com/danielgindi/Charts/issues/1428) +- getFillLinePosition not calling to create Area graph [\#1427](https://github.com/danielgindi/Charts/issues/1427) +- Lack of documentation [\#1426](https://github.com/danielgindi/Charts/issues/1426) +- Best method to use this in Objective c project [\#1425](https://github.com/danielgindi/Charts/issues/1425) +- Highlight sync between combined and line views [\#1424](https://github.com/danielgindi/Charts/issues/1424) +- How to create two bars one over another for Horizontal bar charts? [\#1423](https://github.com/danielgindi/Charts/issues/1423) +- \[Swift 3.0 specific\] linear line chart has additional line segments wile zooming in [\#1421](https://github.com/danielgindi/Charts/issues/1421) +- Is there a way to import PieChartDataEntry.swift in existing Pod? [\#1419](https://github.com/danielgindi/Charts/issues/1419) +- implement the same behavior as Android api [\#1418](https://github.com/danielgindi/Charts/issues/1418) +- Unable to build project in Xcode 8 [\#1417](https://github.com/danielgindi/Charts/issues/1417) +- Synchronizing scrolling/pan/highlight of multiple views. [\#1415](https://github.com/danielgindi/Charts/issues/1415) +- Custom X-Axis Values [\#1413](https://github.com/danielgindi/Charts/issues/1413) +- Query : When it will be available in CocoaPods? [\#1412](https://github.com/danielgindi/Charts/issues/1412) +- How to set background color of bars [\#1411](https://github.com/danielgindi/Charts/issues/1411) +- Query: Enable gridelines at specific location points. [\#1410](https://github.com/danielgindi/Charts/issues/1410) +- Syntax errors on one of our testing devices [\#1409](https://github.com/danielgindi/Charts/issues/1409) +- how to hide the ValueFormatter [\#1408](https://github.com/danielgindi/Charts/issues/1408) +- I can't see the zero\(float Num\) on ChartYAxis [\#1407](https://github.com/danielgindi/Charts/issues/1407) +- drawSliceTextEnabled = YES not working [\#1404](https://github.com/danielgindi/Charts/issues/1404) +- Customize popup on entry tap [\#1403](https://github.com/danielgindi/Charts/issues/1403) +- Query: How to create an area graph? [\#1402](https://github.com/danielgindi/Charts/issues/1402) +- Negative Bar Chart [\#1401](https://github.com/danielgindi/Charts/issues/1401) +- Cannot invoke initializer for type 'PieChartData' error in Swift 2.3 [\#1400](https://github.com/danielgindi/Charts/issues/1400) +- Get entry location in view when chart value is selected? [\#1399](https://github.com/danielgindi/Charts/issues/1399) +- Can you give me a Charts library wrote by OC. [\#1398](https://github.com/danielgindi/Charts/issues/1398) +- Barchart,,,,draw specific value [\#1397](https://github.com/danielgindi/Charts/issues/1397) +- How to customize left axis with string values? [\#1394](https://github.com/danielgindi/Charts/issues/1394) +- Swift & CocoaPods - Unable to Utilize Charts [\#1393](https://github.com/danielgindi/Charts/issues/1393) +- How to create a Pie chart, no 'how to' ? . The demo app sucks, doesn't compile. [\#1392](https://github.com/danielgindi/Charts/issues/1392) +- Need help in setDrawValues [\#1391](https://github.com/danielgindi/Charts/issues/1391) +- Display Integer value [\#1390](https://github.com/danielgindi/Charts/issues/1390) +- BarChartData Class is Missing InitWithXVals [\#1385](https://github.com/danielgindi/Charts/issues/1385) +- Undeclared or undefined identifiers while trying to compile project [\#1383](https://github.com/danielgindi/Charts/issues/1383) +- How to show/hide one of the line chart during runtime [\#1381](https://github.com/danielgindi/Charts/issues/1381) +- Charts-Swift.h is different [\#1380](https://github.com/danielgindi/Charts/issues/1380) +- infinite recursion in HorizontalBarChartHighlighter [\#1377](https://github.com/danielgindi/Charts/issues/1377) +- Charts errors in xcode beta 6 [\#1375](https://github.com/danielgindi/Charts/issues/1375) +- please tell me how do i handling these problems,thanks! [\#1373](https://github.com/danielgindi/Charts/issues/1373) +- Charts 3.0 and Swift 2.3 branch? [\#1370](https://github.com/danielgindi/Charts/issues/1370) +- Legend. Position is deprecated. [\#1369](https://github.com/danielgindi/Charts/issues/1369) +- App Crash: An instance 0xXXXXXXXX of class Charts.BarChartView was deallocated while key value observers were still registered with it. [\#1368](https://github.com/danielgindi/Charts/issues/1368) +- Unable to compile adding Charts to project via CocoaPods [\#1367](https://github.com/danielgindi/Charts/issues/1367) +- Cannot use PieChartDataSet or PieChartDataEntry when include with Cocoapod [\#1366](https://github.com/danielgindi/Charts/issues/1366) +- Charts is ~20M when built. Desired? [\#1365](https://github.com/danielgindi/Charts/issues/1365) +- swift 3 branch does not compile with Xcode 8 beta 6 [\#1364](https://github.com/danielgindi/Charts/issues/1364) +- There are two lines. The first number starts from scratch, but only one is from zero. The other one has a certain amount of cheap quantity. How do I get the other one from zero. [\#1363](https://github.com/danielgindi/Charts/issues/1363) +- missing class PieChartDataEntry \(macOS\) [\#1358](https://github.com/danielgindi/Charts/issues/1358) +- BarChartView can't show max y value's top label, only show half [\#1357](https://github.com/danielgindi/Charts/issues/1357) +- Horizontal Bar Chart not showing values [\#1356](https://github.com/danielgindi/Charts/issues/1356) +- rightAxis labels are not showing for value less then 1.0 in swift using cocoapod [\#1354](https://github.com/danielgindi/Charts/issues/1354) +- Chart's X-axis labels not resizing to accommodate multi-line text [\#1352](https://github.com/danielgindi/Charts/issues/1352) +- Pie Chart Graph Unusual Visual When Data Of Zero [\#1351](https://github.com/danielgindi/Charts/issues/1351) +- Chart render problem after double tap zoom [\#1350](https://github.com/danielgindi/Charts/issues/1350) +- Chart Bar drawing [\#1349](https://github.com/danielgindi/Charts/issues/1349) +- How to dynamically scale up / down data depends on zoom level [\#1346](https://github.com/danielgindi/Charts/issues/1346) +- Cannot install in ios9.3.2 [\#1345](https://github.com/danielgindi/Charts/issues/1345) +- Where can I find the exact color value of vordiplom colors? [\#1343](https://github.com/danielgindi/Charts/issues/1343) +- How to Modify X Axis values Swift? [\#1340](https://github.com/danielgindi/Charts/issues/1340) +- Line Chart : Data Line Color Change [\#1338](https://github.com/danielgindi/Charts/issues/1338) +- Line Chart x axis and y axis Line Color change? [\#1337](https://github.com/danielgindi/Charts/issues/1337) +- Grouped Bar Charts [\#1333](https://github.com/danielgindi/Charts/issues/1333) +- Integer for ChartDataEntry [\#1332](https://github.com/danielgindi/Charts/issues/1332) +- values from array for x axis on barchart [\#1331](https://github.com/danielgindi/Charts/issues/1331) +- Redundant conformance of 'RLMResults' to protocol 'SequenceType' on RealmChartsUtils [\#1329](https://github.com/danielgindi/Charts/issues/1329) +- Combined Chart Grouped Bar Width Not Changing [\#1328](https://github.com/danielgindi/Charts/issues/1328) +- Undefined symbols for architecture armv7: [\#1327](https://github.com/danielgindi/Charts/issues/1327) +- Error with carthage update ChartsRealm fails to build [\#1326](https://github.com/danielgindi/Charts/issues/1326) +- I am not able to design multicolor bar chart [\#1324](https://github.com/danielgindi/Charts/issues/1324) +- v2.2.5 demo code is different with pod installed version [\#1322](https://github.com/danielgindi/Charts/issues/1322) +- If the all value is 1 or 0, the ChartYAxis is error [\#1321](https://github.com/danielgindi/Charts/issues/1321) +- hide on select grid lines in line chart [\#1320](https://github.com/danielgindi/Charts/issues/1320) +- X data as a Date [\#1317](https://github.com/danielgindi/Charts/issues/1317) +- Also played well, before package, NO error, the recent packaging error, the error is "NO Scuh module 'charts", don't know is what reason to solve, use the xcode 7.1 \(7 b91b\) [\#1316](https://github.com/danielgindi/Charts/issues/1316) +- Crash with marker attached into CombinedChartView [\#1315](https://github.com/danielgindi/Charts/issues/1315) +- How to add more than 3 lines in chart [\#1314](https://github.com/danielgindi/Charts/issues/1314) +- is v3 Ready for production ? [\#1313](https://github.com/danielgindi/Charts/issues/1313) +- xAxis.axisMaxValue not working [\#1312](https://github.com/danielgindi/Charts/issues/1312) +- Symbol not found: \_\_TMVVSS17UnicodeScalarView9Generator Referenced from: Frameworks/Charts.framework/Charts [\#1311](https://github.com/danielgindi/Charts/issues/1311) +- how to named SWIFT\_CLASS\("....."\) [\#1310](https://github.com/danielgindi/Charts/issues/1310) +- How to set the length and color outside pie chart when a slice is highlighted? [\#1309](https://github.com/danielgindi/Charts/issues/1309) +- How to set the length and color outside pie chart when a slice is highlighted? [\#1308](https://github.com/danielgindi/Charts/issues/1308) +- I want set circle empty in Line Chart. Which properties i have to change? [\#1307](https://github.com/danielgindi/Charts/issues/1307) +- noDataText font and color [\#1305](https://github.com/danielgindi/Charts/issues/1305) +- how to let centerAttributedText line feed in bar chart ? [\#1304](https://github.com/danielgindi/Charts/issues/1304) +- Can Legend be selected or multi-selected? [\#1303](https://github.com/danielgindi/Charts/issues/1303) +- add financial bar chart \(Open-high-low-close chart\) [\#1302](https://github.com/danielgindi/Charts/issues/1302) +- How to select the first pie in bar chart? [\#1301](https://github.com/danielgindi/Charts/issues/1301) +- PieChartView Narrow with one value [\#1298](https://github.com/danielgindi/Charts/issues/1298) +- xAxis.axisMaxValue is never considered [\#1293](https://github.com/danielgindi/Charts/issues/1293) +- Please add Swift demo project also [\#1292](https://github.com/danielgindi/Charts/issues/1292) +- Swift 2.3 & 3.0 support: news, issues, PRs and state [\#1291](https://github.com/danielgindi/Charts/issues/1291) +- 2 lines on the charts with the same values [\#1289](https://github.com/danielgindi/Charts/issues/1289) +- How to set the y axis descript text [\#1285](https://github.com/danielgindi/Charts/issues/1285) +- how to setTouchEnabled to false [\#1283](https://github.com/danielgindi/Charts/issues/1283) +- legend set different form for different set [\#1282](https://github.com/danielgindi/Charts/issues/1282) +- Change Label Text Color PieChart [\#1280](https://github.com/danielgindi/Charts/issues/1280) +- Everyone welcome to try out `v3` branch before Charts 3.0 is released! [\#1279](https://github.com/danielgindi/Charts/issues/1279) +- \[FR\] make Marker a protocol [\#1278](https://github.com/danielgindi/Charts/issues/1278) +- Unable to convert charts to Swift3 [\#1277](https://github.com/danielgindi/Charts/issues/1277) +- Start at zero and draw cubic [\#1275](https://github.com/danielgindi/Charts/issues/1275) +- Customised size of x data points and Scatter Graph with Linear Trend Line [\#1274](https://github.com/danielgindi/Charts/issues/1274) +- How can i add null values to my chart? [\#1273](https://github.com/danielgindi/Charts/issues/1273) +- PIE-CHART how to get the index of the selected slice.??? [\#1267](https://github.com/danielgindi/Charts/issues/1267) +- How to select a value in line chart data point and same for bar chart [\#1265](https://github.com/danielgindi/Charts/issues/1265) +- update to the latest realm [\#1262](https://github.com/danielgindi/Charts/issues/1262) +- horizontal bar graph value different decimal places each time [\#1260](https://github.com/danielgindi/Charts/issues/1260) +- Charts vs. ShinobiCharts? [\#1259](https://github.com/danielgindi/Charts/issues/1259) +- LineChart overlap value label and y-Axis [\#1257](https://github.com/danielgindi/Charts/issues/1257) +- how to hide stacked bar chart label having 0 values [\#1256](https://github.com/danielgindi/Charts/issues/1256) +- fillColor for negative values [\#1255](https://github.com/danielgindi/Charts/issues/1255) +- Set custom x-value spacing in graph [\#1254](https://github.com/danielgindi/Charts/issues/1254) +- Hide specific labels on y axis [\#1253](https://github.com/danielgindi/Charts/issues/1253) +- Marker near edges got clipped [\#1251](https://github.com/danielgindi/Charts/issues/1251) +- Custom label for LineChart [\#1248](https://github.com/danielgindi/Charts/issues/1248) +- Chart in TableViewCell [\#1247](https://github.com/danielgindi/Charts/issues/1247) +- Line Chart : Can I drag a vertical line to any point on the screen and get values? Instead of individual touches [\#1246](https://github.com/danielgindi/Charts/issues/1246) +- Line Chart label count not calculating properly [\#1244](https://github.com/danielgindi/Charts/issues/1244) +- CandleChartView screen show count limit [\#1243](https://github.com/danielgindi/Charts/issues/1243) +- addEntryOrdered behavior - clarification [\#1242](https://github.com/danielgindi/Charts/issues/1242) +- Display Max Value on X-axis [\#1241](https://github.com/danielgindi/Charts/issues/1241) +- Value not display for Multiple DataSet in LineChart [\#1240](https://github.com/danielgindi/Charts/issues/1240) +- rightAxis are rounded [\#1238](https://github.com/danielgindi/Charts/issues/1238) +- Now working if “Compile Sources As” option to “Objective C++” [\#1237](https://github.com/danielgindi/Charts/issues/1237) +- Line is drawn below the x axis when the drawCubicEnabled is YES. [\#1236](https://github.com/danielgindi/Charts/issues/1236) +- Label value is cut off in horizontal bar [\#1235](https://github.com/danielgindi/Charts/issues/1235) +- ChartValueSelected Only While Finger Pressed [\#1234](https://github.com/danielgindi/Charts/issues/1234) +- YAxis Labels are clipped with some settings [\#1233](https://github.com/danielgindi/Charts/issues/1233) +- xVals隐藏问题 [\#1232](https://github.com/danielgindi/Charts/issues/1232) +- About the Lable number of x and y [\#1231](https://github.com/danielgindi/Charts/issues/1231) +- How to control not draws a specified point [\#1229](https://github.com/danielgindi/Charts/issues/1229) +- Location have a little problem [\#1228](https://github.com/danielgindi/Charts/issues/1228) +- BarChartView bars do not start at the x-axis. [\#1225](https://github.com/danielgindi/Charts/issues/1225) +- Unable to run on iOS/tvOS 10.0 beta [\#1223](https://github.com/danielgindi/Charts/issues/1223) +- two CombinedChartView's in the same screen changes axis format in the first [\#1222](https://github.com/danielgindi/Charts/issues/1222) +- Horizontal bar chart crashing after tap when more than one data set [\#1221](https://github.com/danielgindi/Charts/issues/1221) +- no suitable image found. [\#1220](https://github.com/danielgindi/Charts/issues/1220) +- wrong offset when using mutiple bar chart in combined chart [\#1219](https://github.com/danielgindi/Charts/issues/1219) +- UnsafeMutablePointer.moveInitializeFrom with negative count [\#1218](https://github.com/danielgindi/Charts/issues/1218) +- Is there any way to hide the label of a DataSet? [\#1217](https://github.com/danielgindi/Charts/issues/1217) +- How can I not be highlighted when I touch ended ? [\#1216](https://github.com/danielgindi/Charts/issues/1216) +- poor styling documentation, how can i make my charts look beautiful? [\#1215](https://github.com/danielgindi/Charts/issues/1215) +- X Axis for Candle Sticks from Realm [\#1214](https://github.com/danielgindi/Charts/issues/1214) +- drawHighlighted\(\) not calling [\#1212](https://github.com/danielgindi/Charts/issues/1212) +- how to set marker for line chart [\#1211](https://github.com/danielgindi/Charts/issues/1211) +- Error when using Charts library with Xcode 8 bet and Swift 3.0 [\#1210](https://github.com/danielgindi/Charts/issues/1210) +- I have an immature small suggestion [\#1209](https://github.com/danielgindi/Charts/issues/1209) +- I have a question BarChart [\#1208](https://github.com/danielgindi/Charts/issues/1208) +- HorizontalBarChart in Combined Chart [\#1207](https://github.com/danielgindi/Charts/issues/1207) +- drawvalue when stack is selected [\#1200](https://github.com/danielgindi/Charts/issues/1200) +- Remove labels from Radar Chart [\#1199](https://github.com/danielgindi/Charts/issues/1199) +- reduce height of grids [\#1198](https://github.com/danielgindi/Charts/issues/1198) +- reduce grid size [\#1194](https://github.com/danielgindi/Charts/issues/1194) +- ChartsView [\#1189](https://github.com/danielgindi/Charts/issues/1189) +- Custom LineChart marker image [\#1188](https://github.com/danielgindi/Charts/issues/1188) +- moveViewToAnimatedWithXIndex high cpu usage [\#1186](https://github.com/danielgindi/Charts/issues/1186) +- can we implement group bar chart and line chart as combined chart [\#1184](https://github.com/danielgindi/Charts/issues/1184) +- Such a difficult chart, can be realized? [\#1183](https://github.com/danielgindi/Charts/issues/1183) +- How to achieve the effect of the picture? Please look carefully [\#1182](https://github.com/danielgindi/Charts/issues/1182) +- Designed initializer of BarChartDataSet crash [\#1180](https://github.com/danielgindi/Charts/issues/1180) +- To judge whether the initial state [\#1178](https://github.com/danielgindi/Charts/issues/1178) +- use cocoa pods mistakes [\#1177](https://github.com/danielgindi/Charts/issues/1177) +- hide description label on charts [\#1176](https://github.com/danielgindi/Charts/issues/1176) +- axis values are rounded [\#1175](https://github.com/danielgindi/Charts/issues/1175) +- how can i add a % on leftAxis [\#1174](https://github.com/danielgindi/Charts/issues/1174) +- Add percent label for pie chart [\#1172](https://github.com/danielgindi/Charts/issues/1172) +- can't add swipe gesture [\#1170](https://github.com/danielgindi/Charts/issues/1170) +- Chart not drawing completely left to right [\#1168](https://github.com/danielgindi/Charts/issues/1168) +- Horizontal-BarChart: change color of bar's value [\#1167](https://github.com/danielgindi/Charts/issues/1167) +- ScatterChartData not working in Swift? [\#1166](https://github.com/danielgindi/Charts/issues/1166) +- Compile error on iPhone 4s simulator [\#1165](https://github.com/danielgindi/Charts/issues/1165) +- Adding an average line to a BarChartView [\#1162](https://github.com/danielgindi/Charts/issues/1162) +- About Swift3.0 [\#1161](https://github.com/danielgindi/Charts/issues/1161) +- How to add images on some points? [\#1160](https://github.com/danielgindi/Charts/issues/1160) +- Suggest combo type chart support gouped bar type [\#1159](https://github.com/danielgindi/Charts/issues/1159) +- Adding Entries dynamicly [\#1157](https://github.com/danielgindi/Charts/issues/1157) +- how can i add a button in redmark and i can click .. [\#1156](https://github.com/danielgindi/Charts/issues/1156) +- How can I select the close value in the candle chart view? [\#1155](https://github.com/danielgindi/Charts/issues/1155) +- Charts setup in Obj C project question [\#1154](https://github.com/danielgindi/Charts/issues/1154) +- I want datasetvalues according leftAxis and RigthAxis different display [\#1153](https://github.com/danielgindi/Charts/issues/1153) +- Unable to build project in new environment and it shows build error [\#1152](https://github.com/danielgindi/Charts/issues/1152) +- Chart Clipping [\#1149](https://github.com/danielgindi/Charts/issues/1149) +- How to handle small interval [\#1147](https://github.com/danielgindi/Charts/issues/1147) +- How to show the label [\#1146](https://github.com/danielgindi/Charts/issues/1146) +- specify certain point custom color [\#1144](https://github.com/danielgindi/Charts/issues/1144) +- when scaled touch move can't toggle highlight [\#1141](https://github.com/danielgindi/Charts/issues/1141) +- Support Swift 3.0 \(Xcode 8\) [\#1140](https://github.com/danielgindi/Charts/issues/1140) +- How to show bar chart value labels only on selection [\#1139](https://github.com/danielgindi/Charts/issues/1139) +- BalloonMarker overlapping issue [\#1137](https://github.com/danielgindi/Charts/issues/1137) +- Customize Axis visible distance [\#1135](https://github.com/danielgindi/Charts/issues/1135) +- Different width for stacked charts [\#1134](https://github.com/danielgindi/Charts/issues/1134) +- Properly setting up a fork of this project [\#1133](https://github.com/danielgindi/Charts/issues/1133) +- Issues with xcode 8.0 beta [\#1132](https://github.com/danielgindi/Charts/issues/1132) +- Disable touch events, so do not show Label [\#1129](https://github.com/danielgindi/Charts/issues/1129) +- custom chart label layout [\#1128](https://github.com/danielgindi/Charts/issues/1128) +- BarChartView yAxis origin y are not start from y:0.0? [\#1127](https://github.com/danielgindi/Charts/issues/1127) +- Space at the bottom of the Line Chart View in landscape view [\#1125](https://github.com/danielgindi/Charts/issues/1125) +- Failing to build the project [\#1124](https://github.com/danielgindi/Charts/issues/1124) +- Rounding error on Y-axis when all Y values are zeroes [\#1123](https://github.com/danielgindi/Charts/issues/1123) +- Can't hide small slice labels from pie chart. [\#1122](https://github.com/danielgindi/Charts/issues/1122) +- Customizing the x-axes labels. [\#1120](https://github.com/danielgindi/Charts/issues/1120) +- Using prebuilt frameworks is not recommended [\#1118](https://github.com/danielgindi/Charts/issues/1118) +- chartValueSelected on TVOS [\#1117](https://github.com/danielgindi/Charts/issues/1117) +- Single LineChartDataSet in LineChartView [\#1116](https://github.com/danielgindi/Charts/issues/1116) +- how to show only positive values in barchart? [\#1114](https://github.com/danielgindi/Charts/issues/1114) +- Slow Build Time [\#1113](https://github.com/danielgindi/Charts/issues/1113) +- BarChartDataEntry with Int instead of Double [\#1112](https://github.com/danielgindi/Charts/issues/1112) +- Embedded Binaries charts.framewor But nothing happen! [\#1111](https://github.com/danielgindi/Charts/issues/1111) +- How to draw Combined Chart on the left [\#1110](https://github.com/danielgindi/Charts/issues/1110) +- BarChartDataSet.values is a get-only [\#1108](https://github.com/danielgindi/Charts/issues/1108) +- 有没有 oc版的? [\#1107](https://github.com/danielgindi/Charts/issues/1107) +- Change color of highlight in chart [\#1106](https://github.com/danielgindi/Charts/issues/1106) +- Sync selected value in 2 chart [\#1105](https://github.com/danielgindi/Charts/issues/1105) +- Are two charts can be linked ? [\#1103](https://github.com/danielgindi/Charts/issues/1103) +- BarChart bottom not on the Xaxis [\#1102](https://github.com/danielgindi/Charts/issues/1102) +- BUG::: leftAxis.axisMinValue !!!=== 0.0 [\#1101](https://github.com/danielgindi/Charts/issues/1101) +- CandleStickView Memory leak [\#1100](https://github.com/danielgindi/Charts/issues/1100) +- application doesn't compile for iphone 4s and iphone 5 device. [\#1098](https://github.com/danielgindi/Charts/issues/1098) +- ChartHighlight init data in function of highlightValue error [\#1096](https://github.com/danielgindi/Charts/issues/1096) +- improvement: custom labels on BarChart [\#1095](https://github.com/danielgindi/Charts/issues/1095) +- Missing alternate x-axis labels in vertical bar chart [\#1093](https://github.com/danielgindi/Charts/issues/1093) +- ChartHighlight class initialization is error in ChartViewBase [\#1090](https://github.com/danielgindi/Charts/issues/1090) +- how can I change the mark view [\#1086](https://github.com/danielgindi/Charts/issues/1086) +- Pie Chart with value lines [\#1085](https://github.com/danielgindi/Charts/issues/1085) +- Chart Demo not Compiling [\#1083](https://github.com/danielgindi/Charts/issues/1083) +- set the Y range [\#1079](https://github.com/danielgindi/Charts/issues/1079) +- Sync zoom in 2 chart [\#1078](https://github.com/danielgindi/Charts/issues/1078) +- The rotated xAxis label out of the view [\#1068](https://github.com/danielgindi/Charts/issues/1068) +- visibleXRangeMaximum not refreshing [\#1037](https://github.com/danielgindi/Charts/issues/1037) +- Fill area between two line in Line chart [\#1032](https://github.com/danielgindi/Charts/issues/1032) +- Left Axis not showing labels after update to Swift 2.3 [\#997](https://github.com/danielgindi/Charts/issues/997) +- highestVisibleXIndex has regression issue [\#985](https://github.com/danielgindi/Charts/issues/985) +- Problem with bitcode [\#979](https://github.com/danielgindi/Charts/issues/979) +- BarChartView height is not reflecting the values assigned to it. [\#977](https://github.com/danielgindi/Charts/issues/977) +- I use the RadarChartView,when displaying two sets of data [\#974](https://github.com/danielgindi/Charts/issues/974) +- Overlapping with multiple data styles [\#972](https://github.com/danielgindi/Charts/issues/972) +- XAxis Values label rotation [\#953](https://github.com/danielgindi/Charts/issues/953) +- Custom Y Value Formatter [\#943](https://github.com/danielgindi/Charts/issues/943) +- Bar chart missing y axis label [\#858](https://github.com/danielgindi/Charts/issues/858) +- Overlapping bar chart [\#857](https://github.com/danielgindi/Charts/issues/857) +- iOS-charts Get Currently visible bars for MultipleBarChartViewController demo [\#782](https://github.com/danielgindi/Charts/issues/782) +- Live data Line Chart [\#754](https://github.com/danielgindi/Charts/issues/754) +- Support custom formatting of chart labels [\#750](https://github.com/danielgindi/Charts/issues/750) +- Horizontally flipped x-axis [\#738](https://github.com/danielgindi/Charts/issues/738) +- Annotations issues and asking for supporting more types of markers [\#722](https://github.com/danielgindi/Charts/issues/722) +- Drop iOS 7 support in readme [\#601](https://github.com/danielgindi/Charts/issues/601) +- HorizontalBarChartView displays bar shadow when left and right axis hidden [\#311](https://github.com/danielgindi/Charts/issues/311) +- Making X-Values Properly Scaled \(Not Equidistant\) [\#194](https://github.com/danielgindi/Charts/issues/194) +- LineChart Axis Inset? [\#46](https://github.com/danielgindi/Charts/issues/46) + +**Merged pull requests:** + +- bump Charts version to 3.0.0 [\#1505](https://github.com/danielgindi/Charts/pull/1505) ([liuxuan30](https://github.com/liuxuan30)) +- porting \#1452 into master [\#1486](https://github.com/danielgindi/Charts/pull/1486) ([liuxuan30](https://github.com/liuxuan30)) +- Don't override project settings in targets [\#1484](https://github.com/danielgindi/Charts/pull/1484) ([petester42](https://github.com/petester42)) +- change Charts baseSDK to iOS 10 [\#1467](https://github.com/danielgindi/Charts/pull/1467) ([liuxuan30](https://github.com/liuxuan30)) +- migrate more ChartsDemo project setting to swift 3.0 [\#1466](https://github.com/danielgindi/Charts/pull/1466) ([liuxuan30](https://github.com/liuxuan30)) +- Fix bar layout bug, pie callback bug [\#1452](https://github.com/danielgindi/Charts/pull/1452) ([aoverholtzer](https://github.com/aoverholtzer)) +- Update project structure for simplicity and fixing carthage [\#1422](https://github.com/danielgindi/Charts/pull/1422) ([petester42](https://github.com/petester42)) +- \[swift 3.0 specific\]fix linear line chart additional line segments wile zooming in [\#1420](https://github.com/danielgindi/Charts/pull/1420) ([liuxuan30](https://github.com/liuxuan30)) +- fix attempt for Realm support [\#1414](https://github.com/danielgindi/Charts/pull/1414) ([liuxuan30](https://github.com/liuxuan30)) +- migrate Chart v3 code in master to swift 2.3 branch [\#1389](https://github.com/danielgindi/Charts/pull/1389) ([liuxuan30](https://github.com/liuxuan30)) +- fix bridgedObjCGetStringArray warning and more copyWithZone\(\_ zone: NSZone?\) -\> AnyObject errors [\#1379](https://github.com/danielgindi/Charts/pull/1379) ([liuxuan30](https://github.com/liuxuan30)) +- migrate `public` to `open` [\#1378](https://github.com/danielgindi/Charts/pull/1378) ([liuxuan30](https://github.com/liuxuan30)) +- Swift 3.0 beta 6 \(acegreen's branch, but with fixes for OS X\) [\#1353](https://github.com/danielgindi/Charts/pull/1353) ([pixelspark](https://github.com/pixelspark)) +- Conforms to Swift 3 - Xcode 8 beta 6 [\#1342](https://github.com/danielgindi/Charts/pull/1342) ([acegreen](https://github.com/acegreen)) +- When only one of scaleXEnabled or scaleYEnabled is effective [\#1319](https://github.com/danielgindi/Charts/pull/1319) ([essoecc](https://github.com/essoecc)) +- V3 [\#1318](https://github.com/danielgindi/Charts/pull/1318) ([vishaldeshai](https://github.com/vishaldeshai)) +- convert RunLoopMode to swift 3.0 syntax [\#1296](https://github.com/danielgindi/Charts/pull/1296) ([liuxuan30](https://github.com/liuxuan30)) +- fix more ChartsDemo complains [\#1295](https://github.com/danielgindi/Charts/pull/1295) ([liuxuan30](https://github.com/liuxuan30)) +- just fix all Xcode beta 4 complains, except for Realm bug [\#1294](https://github.com/danielgindi/Charts/pull/1294) ([liuxuan30](https://github.com/liuxuan30)) +- Swift 3.0 - Xcode 8 Beta 4 [\#1290](https://github.com/danielgindi/Charts/pull/1290) ([acegreen](https://github.com/acegreen)) +- Few more changes needed to build with Swift 2.3 [\#1281](https://github.com/danielgindi/Charts/pull/1281) ([EpicDraws](https://github.com/EpicDraws)) +- fix Realm pod spec typo [\#1271](https://github.com/danielgindi/Charts/pull/1271) ([liuxuan30](https://github.com/liuxuan30)) +- support Realm 1.0.2 [\#1270](https://github.com/danielgindi/Charts/pull/1270) ([liuxuan30](https://github.com/liuxuan30)) +- upgrade Realm to 1.0.2 [\#1268](https://github.com/danielgindi/Charts/pull/1268) ([liuxuan30](https://github.com/liuxuan30)) +- Typo fix, our of range =\> out of range [\#1264](https://github.com/danielgindi/Charts/pull/1264) ([chris-gunawardena](https://github.com/chris-gunawardena)) +- Fix Swift 3 compilation errors for iOS [\#1258](https://github.com/danielgindi/Charts/pull/1258) ([puthirith](https://github.com/puthirith)) +- remove brew upgrade carthage for travis and update ios-snapshot-test-case to 2.1.2 [\#1249](https://github.com/danielgindi/Charts/pull/1249) ([liuxuan30](https://github.com/liuxuan30)) +- improve comment to warn users how to use setVisibleRange APIs [\#1245](https://github.com/danielgindi/Charts/pull/1245) ([liuxuan30](https://github.com/liuxuan30)) +- for \#1208, seems drawBarShadowEnabled should be false by default [\#1226](https://github.com/danielgindi/Charts/pull/1226) ([liuxuan30](https://github.com/liuxuan30)) +- BUGFIX: fix infinite recursive call of getXIndex\(\_:\) [\#1213](https://github.com/danielgindi/Charts/pull/1213) ([AntiMoron](https://github.com/AntiMoron)) +- Add missing imports for iOS 7 support [\#1205](https://github.com/danielgindi/Charts/pull/1205) ([VincentSit](https://github.com/VincentSit)) +- upgrade carthage, resolve test failure config [\#1203](https://github.com/danielgindi/Charts/pull/1203) ([liuxuan30](https://github.com/liuxuan30)) +- update iso-snapshot-test-case to master to have the fix for now [\#1202](https://github.com/danielgindi/Charts/pull/1202) ([liuxuan30](https://github.com/liuxuan30)) +- Migrate to Swift 3 \(now targeted at the Swift-3.0 branch\) [\#1171](https://github.com/danielgindi/Charts/pull/1171) ([pixelspark](https://github.com/pixelspark)) +- Swift 2.3 [\#1163](https://github.com/danielgindi/Charts/pull/1163) ([liuxuan30](https://github.com/liuxuan30)) +- Ignoring .DS\_Store files [\#1130](https://github.com/danielgindi/Charts/pull/1130) ([einsteinx2](https://github.com/einsteinx2)) + +## [v2.2.5](https://github.com/danielgindi/Charts/tree/v2.2.5) (2016-05-30) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.2.4...v2.2.5) + +**Implemented enhancements:** + +- Support for Xamarin.Forms [\#606](https://github.com/danielgindi/Charts/issues/606) + +**Fixed bugs:** + +- fatal error: stride size must not be zero [\#981](https://github.com/danielgindi/Charts/issues/981) +- highestVisibleXIndex is smaller than lowestVisibleXIndex [\#940](https://github.com/danielgindi/Charts/issues/940) +- Crash on zoom [\#931](https://github.com/danielgindi/Charts/issues/931) +- ChartLegend yEntrySpace not work [\#886](https://github.com/danielgindi/Charts/issues/886) +- Selection on bubble chart [\#654](https://github.com/danielgindi/Charts/issues/654) +- Cubic Line goes too much over the top or below bottom. Needs flattening. [\#407](https://github.com/danielgindi/Charts/issues/407) + +**Closed issues:** + +- Podspec prepare command fails on `pod install` [\#1080](https://github.com/danielgindi/Charts/issues/1080) +- Why not the same as Android and IOS parameters? RendererBase.calcXBounds\(\) [\#1077](https://github.com/danielgindi/Charts/issues/1077) +- Why not the same parameters ?RendererBase.calcXBounds\(\) [\#1076](https://github.com/danielgindi/Charts/issues/1076) +- Crash: fatal error: Can't form Range with end \< start [\#1075](https://github.com/danielgindi/Charts/issues/1075) +- automatically calculated labels with a custom roof \(axisMaxValue only if exceeding it\) [\#1074](https://github.com/danielgindi/Charts/issues/1074) +- Swift Version [\#1073](https://github.com/danielgindi/Charts/issues/1073) +- CodeSign for "Framework" in SDK "iOS 9.3" [\#1072](https://github.com/danielgindi/Charts/issues/1072) +- Changing size of centre section - pie chart [\#1071](https://github.com/danielgindi/Charts/issues/1071) +- PieChartView does not draw chart ! [\#1070](https://github.com/danielgindi/Charts/issues/1070) +- Real-time Charts [\#1069](https://github.com/danielgindi/Charts/issues/1069) +- swift2.2, I have a pieChartView problem [\#1067](https://github.com/danielgindi/Charts/issues/1067) +- carthage compatibility [\#1064](https://github.com/danielgindi/Charts/issues/1064) +- LineChart set a great amount data to LineChartDataSet, cpu increase highly to 97% [\#1063](https://github.com/danielgindi/Charts/issues/1063) +- Realm.io Horizontal combine bar chart - iOS [\#1062](https://github.com/danielgindi/Charts/issues/1062) +- Line chart font size problem [\#1061](https://github.com/danielgindi/Charts/issues/1061) +- BarChart won't sit on bottom of screen for some datasets, Why? How to fix? [\#1059](https://github.com/danielgindi/Charts/issues/1059) +- Very odd line at top of graph [\#1058](https://github.com/danielgindi/Charts/issues/1058) +- After upgrading to Xcode 7.3.1, getting bridging issue [\#1057](https://github.com/danielgindi/Charts/issues/1057) +- How can I remove the gap between the bar [\#1056](https://github.com/danielgindi/Charts/issues/1056) +- Pie Chart label position [\#1055](https://github.com/danielgindi/Charts/issues/1055) +- Cant understand .axisMaxValue [\#1054](https://github.com/danielgindi/Charts/issues/1054) +- Is there a way to get a different background colour for different values of the x axis? [\#1053](https://github.com/danielgindi/Charts/issues/1053) +- Without drawLimitLinesBehindDataEnabled, limit lines go outside chart area [\#1052](https://github.com/danielgindi/Charts/issues/1052) +- The horizontal line that forms the grid of the LineChartView are not the same color [\#1051](https://github.com/danielgindi/Charts/issues/1051) +- Issue with coloring grouped datasets in barchart [\#1050](https://github.com/danielgindi/Charts/issues/1050) +- Issues with y axis values [\#1047](https://github.com/danielgindi/Charts/issues/1047) +- Marker out of view [\#1046](https://github.com/danielgindi/Charts/issues/1046) +- How to draw OHLC chart \( Open high low close \) ? [\#1045](https://github.com/danielgindi/Charts/issues/1045) +- How to achieve this effect [\#1044](https://github.com/danielgindi/Charts/issues/1044) +- Changing the size of the interception \(dots\) font in Line Chart ? [\#1043](https://github.com/danielgindi/Charts/issues/1043) +- Multiple entries of the same item in legend [\#1042](https://github.com/danielgindi/Charts/issues/1042) +- How to draw this bar Chart [\#1039](https://github.com/danielgindi/Charts/issues/1039) +- Right axis display decimals [\#1036](https://github.com/danielgindi/Charts/issues/1036) +- Crash on getMarkerPosition [\#1034](https://github.com/danielgindi/Charts/issues/1034) +- Set the bar at the top of the number animation [\#1033](https://github.com/danielgindi/Charts/issues/1033) +- Bar height is calculated wrong [\#1031](https://github.com/danielgindi/Charts/issues/1031) +- How to draw gridBackground by Dashed Line [\#1030](https://github.com/danielgindi/Charts/issues/1030) +- setVisibleYRangeMaximum puts line data off screen [\#1029](https://github.com/danielgindi/Charts/issues/1029) +- How to set max value of xAxis is last object of xVals [\#1028](https://github.com/danielgindi/Charts/issues/1028) +- Can't set text of Legend? [\#1027](https://github.com/danielgindi/Charts/issues/1027) +- conflict between auto scale and axis.axisMin/MaxValue [\#1026](https://github.com/danielgindi/Charts/issues/1026) +- Extend beyond values \(feature request\) [\#1025](https://github.com/danielgindi/Charts/issues/1025) +- Error: "Assignment to readonly property" when updating charts data [\#1024](https://github.com/danielgindi/Charts/issues/1024) +- Scrolling in a scroll view is blocked if the chart in the scroll view is not fully zoomed out. [\#1023](https://github.com/danielgindi/Charts/issues/1023) +- Print statements \(Logs\) [\#1021](https://github.com/danielgindi/Charts/issues/1021) +- How to get to the origin of the chartView.marker? [\#1020](https://github.com/danielgindi/Charts/issues/1020) +- Target Line for Bar Chart [\#1019](https://github.com/danielgindi/Charts/issues/1019) +- Different code between github and pod [\#1018](https://github.com/danielgindi/Charts/issues/1018) +- BarChart Can‘t display Markers [\#1017](https://github.com/danielgindi/Charts/issues/1017) +- Can't buliding in XCode7.1 [\#1016](https://github.com/danielgindi/Charts/issues/1016) +- Show Bar Borders in Combined Chart Demo Crash [\#1014](https://github.com/danielgindi/Charts/issues/1014) +- ChartDataEntry can't initialize with float value [\#1013](https://github.com/danielgindi/Charts/issues/1013) +- Override with Wrong Argument Label? [\#1009](https://github.com/danielgindi/Charts/issues/1009) +- On Y Axis "0" may be displayed as "-0" [\#1008](https://github.com/danielgindi/Charts/issues/1008) +- Change x-axis in bubble chart [\#1007](https://github.com/danielgindi/Charts/issues/1007) +- Change the width of chart [\#1005](https://github.com/danielgindi/Charts/issues/1005) +- OC project BalloonMarker.swift error [\#1004](https://github.com/danielgindi/Charts/issues/1004) +- How to let the Y axis shows is not only a number, but the custom string [\#1003](https://github.com/danielgindi/Charts/issues/1003) +- ask questions about CombinedChartViewController.h [\#1001](https://github.com/danielgindi/Charts/issues/1001) +- Crash when debug build, works on release build [\#999](https://github.com/danielgindi/Charts/issues/999) +- Demo crashed when running on phone\( iOS 9.0\),but can run on iPhone \(iOS 7.0\) [\#998](https://github.com/danielgindi/Charts/issues/998) +- Emergency Problem [\#996](https://github.com/danielgindi/Charts/issues/996) +- Radar Chart- Setting the maximum Y-Axis value. [\#994](https://github.com/danielgindi/Charts/issues/994) +- Y-Axis labels zooming issue [\#991](https://github.com/danielgindi/Charts/issues/991) +- XY Bubble Chart [\#990](https://github.com/danielgindi/Charts/issues/990) +- Adding text labels to Y- Axis? [\#988](https://github.com/danielgindi/Charts/issues/988) +- Build Failed: expression in list of expression [\#987](https://github.com/danielgindi/Charts/issues/987) +- autoScaleMinMaxEnabled does not work with Candle Charts [\#986](https://github.com/danielgindi/Charts/issues/986) +- gesture conflict when lineChartView in tableView [\#984](https://github.com/danielgindi/Charts/issues/984) +- Conflicting other pod depencies [\#983](https://github.com/danielgindi/Charts/issues/983) +- NaN makes highestVisibleXIndex crash [\#980](https://github.com/danielgindi/Charts/issues/980) +- Draw Horiztontal Line on Bar Chart [\#976](https://github.com/danielgindi/Charts/issues/976) +- Show empty Chart when there are no data [\#975](https://github.com/danielgindi/Charts/issues/975) +- Unexpected problem with Import Charts [\#973](https://github.com/danielgindi/Charts/issues/973) +- In which file can I edit the yaxis maximum??? [\#971](https://github.com/danielgindi/Charts/issues/971) +- Help with customizing [\#970](https://github.com/danielgindi/Charts/issues/970) +- Where and how can I set a y axis custom max value? [\#968](https://github.com/danielgindi/Charts/issues/968) +- The horizontal bar graph data values are exceeding the graph space. [\#967](https://github.com/danielgindi/Charts/issues/967) +- Where can I add data to my bar chart? [\#966](https://github.com/danielgindi/Charts/issues/966) +- Getting Error cannot load underlying module XCTest [\#965](https://github.com/danielgindi/Charts/issues/965) +- Don't show the horizontal line [\#964](https://github.com/danielgindi/Charts/issues/964) +- Where do I use the import line? [\#963](https://github.com/danielgindi/Charts/issues/963) +- changing bottom 'key' label? [\#962](https://github.com/danielgindi/Charts/issues/962) +- move "{" to the right side of last line [\#961](https://github.com/danielgindi/Charts/issues/961) +- Overriding Highlight [\#960](https://github.com/danielgindi/Charts/issues/960) +- hide values under 10% [\#959](https://github.com/danielgindi/Charts/issues/959) +- x axis label gets cut [\#958](https://github.com/danielgindi/Charts/issues/958) +- enlarge the spacing between the x axis labels to the y axis labels [\#957](https://github.com/danielgindi/Charts/issues/957) +- Cubic line chart is not full bleed [\#956](https://github.com/danielgindi/Charts/issues/956) +- Several properties work in emulator but don't \(or crash\) on iPhone [\#955](https://github.com/danielgindi/Charts/issues/955) +- Cannot pass in struct to ChartDataEntry [\#954](https://github.com/danielgindi/Charts/issues/954) +- A "divide by 0" bug [\#952](https://github.com/danielgindi/Charts/issues/952) +- Line Chart Dynamic Updating [\#951](https://github.com/danielgindi/Charts/issues/951) +- Updating version alters bar chart layout [\#950](https://github.com/danielgindi/Charts/issues/950) +- Bar chart floating y position [\#947](https://github.com/danielgindi/Charts/issues/947) +- setVisibleXRangeMinimum cause crash [\#946](https://github.com/danielgindi/Charts/issues/946) +- Carthage [\#942](https://github.com/danielgindi/Charts/issues/942) +- How to draw 2 lineCharts in a combinedChart? [\#939](https://github.com/danielgindi/Charts/issues/939) +- highlight last data in bar chart [\#938](https://github.com/danielgindi/Charts/issues/938) +- 我想用charts显示的数据为'int'类型 [\#936](https://github.com/danielgindi/Charts/issues/936) +- Don't see updates in PieChartDataSet from 2.2.4 [\#933](https://github.com/danielgindi/Charts/issues/933) +- Bubbles size of bubble chart [\#930](https://github.com/danielgindi/Charts/issues/930) +- Binding for Xamarin [\#929](https://github.com/danielgindi/Charts/issues/929) +- Line chart with 2 colours [\#928](https://github.com/danielgindi/Charts/issues/928) +- Disable top/bottom YAxis line drawing [\#927](https://github.com/danielgindi/Charts/issues/927) +- Coloring by bars and not by stacks in a StackBar chart [\#925](https://github.com/danielgindi/Charts/issues/925) +- How to set the scaling for the left/right axis. [\#924](https://github.com/danielgindi/Charts/issues/924) +- Use of undeclared 'CGFloat' [\#923](https://github.com/danielgindi/Charts/issues/923) +- Diffrent X-axis label color [\#921](https://github.com/danielgindi/Charts/issues/921) +- Vertical bar chart: capture of scrollView delegate callbacks and load additional data [\#920](https://github.com/danielgindi/Charts/issues/920) +- groupspace doesn't work [\#919](https://github.com/danielgindi/Charts/issues/919) +- Could the label of the LineChartDataSet be hidden [\#918](https://github.com/danielgindi/Charts/issues/918) +- if use pod Charts/Realm ,than @import Charts: could not build module "Charts" [\#917](https://github.com/danielgindi/Charts/issues/917) +- @import Charts: could not build module "Charts" [\#916](https://github.com/danielgindi/Charts/issues/916) +- LineChard with different color for filling [\#915](https://github.com/danielgindi/Charts/issues/915) +- start animation at minimum visible y-Position [\#914](https://github.com/danielgindi/Charts/issues/914) +- Line chart yAxis data interval [\#912](https://github.com/danielgindi/Charts/issues/912) +- Unable to display empty bars in barcharts [\#911](https://github.com/danielgindi/Charts/issues/911) +- Bar chart y axis interval digits [\#910](https://github.com/danielgindi/Charts/issues/910) +- How to use any chart in My App. [\#909](https://github.com/danielgindi/Charts/issues/909) +- Specifiy axisMinimum and axisMaximum range [\#908](https://github.com/danielgindi/Charts/issues/908) +- Symbol not Found on Xcode 7.3 [\#907](https://github.com/danielgindi/Charts/issues/907) +- noDataTextDescription not display [\#906](https://github.com/danielgindi/Charts/issues/906) +- Bar chart starting point non zero [\#905](https://github.com/danielgindi/Charts/issues/905) +- Do pod install with cocoapods [\#904](https://github.com/danielgindi/Charts/issues/904) +- Feature request :\) blur shadow for line chart [\#903](https://github.com/danielgindi/Charts/issues/903) +- Add Lines between labels [\#902](https://github.com/danielgindi/Charts/issues/902) +- Real number x axis line for BarChartView [\#901](https://github.com/danielgindi/Charts/issues/901) +- Piechart with vertical legend [\#840](https://github.com/danielgindi/Charts/issues/840) +- ChartEasingOption causes entire background to be filled with color [\#826](https://github.com/danielgindi/Charts/issues/826) +- Could not cast value of type 'Charts.BarChartData' \(0x10bbd31f0\) to 'MYPROJ.BarChartData' \(0x10aeed700\). [\#825](https://github.com/danielgindi/Charts/issues/825) +- BarChartView: Rectangle with borders and without filling color [\#822](https://github.com/danielgindi/Charts/issues/822) +- Is there any possibility for grouping x axis values in line chart? [\#798](https://github.com/danielgindi/Charts/issues/798) +- Being OSX too, should we rename repo to just `Charts`? [\#787](https://github.com/danielgindi/Charts/issues/787) +- Missing a piece of data to the left [\#785](https://github.com/danielgindi/Charts/issues/785) +- How to remove these white/gray lines [\#758](https://github.com/danielgindi/Charts/issues/758) +- If data is not set \(e.g. public var noDataText = "No chart data available."\) [\#756](https://github.com/danielgindi/Charts/issues/756) +- ChartEasingOption properties \(animate\) [\#726](https://github.com/danielgindi/Charts/issues/726) +- Moving pie chart location \(legend overlaps chart\) [\#707](https://github.com/danielgindi/Charts/issues/707) +- CombinedChartView bubbleData size not working [\#692](https://github.com/danielgindi/Charts/issues/692) +- Stop axis labels duplicating. [\#315](https://github.com/danielgindi/Charts/issues/315) +- Can we show Pie chart Value out of slice instead showing inside the slice ? [\#90](https://github.com/danielgindi/Charts/issues/90) +- Double tap to zoom into the chart should center to Point that was tapped [\#83](https://github.com/danielgindi/Charts/issues/83) + +**Merged pull requests:** + +- Revert "Simple changes to allow OS X 10.10 support" [\#1088](https://github.com/danielgindi/Charts/pull/1088) ([danielgindi](https://github.com/danielgindi)) +- Simple changes to allow OS X 10.10 support [\#1087](https://github.com/danielgindi/Charts/pull/1087) ([einsteinx2](https://github.com/einsteinx2)) +- Fix \#1014: fix combined chart crash while toggle bar borders [\#1015](https://github.com/danielgindi/Charts/pull/1015) ([liuxuan30](https://github.com/liuxuan30)) +- Highlight enhancements \(Closes \#654, closes \#702\) [\#1012](https://github.com/danielgindi/Charts/pull/1012) ([danielgindi](https://github.com/danielgindi)) +- Fix typo [\#949](https://github.com/danielgindi/Charts/pull/949) ([emiranda04](https://github.com/emiranda04)) +- fix \#940. another loop bounds crash [\#941](https://github.com/danielgindi/Charts/pull/941) ([liuxuan30](https://github.com/liuxuan30)) +- Fix a crash when using markers with a PieChart [\#937](https://github.com/danielgindi/Charts/pull/937) ([rofreg](https://github.com/rofreg)) +- Horizontal cubic line [\#935](https://github.com/danielgindi/Charts/pull/935) ([danielgindi](https://github.com/danielgindi)) +- Property circleHoleRadius added to ILineChartDataSet protocol. [\#934](https://github.com/danielgindi/Charts/pull/934) ([olbartek](https://github.com/olbartek)) +- replace old github link to latest https://github.com/danielgindi/Charts [\#932](https://github.com/danielgindi/Charts/pull/932) ([liuxuan30](https://github.com/liuxuan30)) +- Some minor nits [\#913](https://github.com/danielgindi/Charts/pull/913) ([ruurd](https://github.com/ruurd)) +- add a switch whether to draw limit line's labels. default is true [\#887](https://github.com/danielgindi/Charts/pull/887) ([liuxuan30](https://github.com/liuxuan30)) + +## [v2.2.4](https://github.com/danielgindi/Charts/tree/v2.2.4) (2016-03-31) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.2.3...v2.2.4) + +**Fixed bugs:** + +- Cubic line goes over the last point [\#683](https://github.com/danielgindi/Charts/issues/683) +- drawCubicEnabled on LineChartView is missing points when Y Values are missing [\#157](https://github.com/danielgindi/Charts/issues/157) + +**Closed issues:** + +- can not run ChartsDemo. [\#900](https://github.com/danielgindi/Charts/issues/900) +- Barchart xAxis always displaying [\#899](https://github.com/danielgindi/Charts/issues/899) +- Multiple 'Charts.framework'. Build fails due to dependencies. [\#897](https://github.com/danielgindi/Charts/issues/897) +- Custom X Axis for BarChartView [\#896](https://github.com/danielgindi/Charts/issues/896) +- UISwipeGestureRecognizer for BarChartView [\#895](https://github.com/danielgindi/Charts/issues/895) +- The view hierarchy is not prepared for the constraint [\#893](https://github.com/danielgindi/Charts/issues/893) +- Could not find `Charts.framework` in the "Embedded Binaries" [\#891](https://github.com/danielgindi/Charts/issues/891) +- Barchart with diffrent width bar [\#890](https://github.com/danielgindi/Charts/issues/890) +- Weird numbers on BarChart [\#889](https://github.com/danielgindi/Charts/issues/889) +- Two line in X-Axis [\#888](https://github.com/danielgindi/Charts/issues/888) +- Set the leftAxis label color differently [\#885](https://github.com/danielgindi/Charts/issues/885) +- Could leftAxis and rightAxis's border be hidden? [\#884](https://github.com/danielgindi/Charts/issues/884) +- The barchart data not filled the whole container [\#883](https://github.com/danielgindi/Charts/issues/883) +- Barchart positive negtive label and xAxis overlapping [\#882](https://github.com/danielgindi/Charts/issues/882) +- How to remove the edge's border of time line chart filled shaped [\#881](https://github.com/danielgindi/Charts/issues/881) +- Master branch is not compiling [\#879](https://github.com/danielgindi/Charts/issues/879) +- App Submission - API analysis file too large [\#878](https://github.com/danielgindi/Charts/issues/878) +- Swift 2.2 [\#877](https://github.com/danielgindi/Charts/issues/877) +- avoidFirstLastClippingEnabled Still be clipped in CombinedChartView [\#876](https://github.com/danielgindi/Charts/issues/876) +- How to make the ChartXAxis has an offset between the zero point [\#875](https://github.com/danielgindi/Charts/issues/875) +- Carthage & Xcode 7.3 Pre-Built Binaries Error [\#874](https://github.com/danielgindi/Charts/issues/874) +- Scrolling glitch [\#873](https://github.com/danielgindi/Charts/issues/873) +- Request for enhancement: combined chart\(BarChart \(grouped DataSets\) and linechart\) [\#871](https://github.com/danielgindi/Charts/issues/871) +- CandleStickChartView.shadowColor [\#870](https://github.com/danielgindi/Charts/issues/870) +- Marker behind line limit [\#867](https://github.com/danielgindi/Charts/issues/867) +- Horizontal Chart Issue [\#866](https://github.com/danielgindi/Charts/issues/866) +- How to move data points with finger drag at run time. [\#865](https://github.com/danielgindi/Charts/issues/865) +- Chart customAxisMax and customAxisMin doesn't update correctly [\#864](https://github.com/danielgindi/Charts/issues/864) +- auto scale min/max option doesn't seem to change anything [\#863](https://github.com/danielgindi/Charts/issues/863) +- Confused as to how to install using CocoaPods [\#862](https://github.com/danielgindi/Charts/issues/862) +- Different spacing between same width bars in BarChartView [\#860](https://github.com/danielgindi/Charts/issues/860) +- Get color of the specify data? [\#859](https://github.com/danielgindi/Charts/issues/859) +- DrawCubicEnabled line starts from wrong position [\#855](https://github.com/danielgindi/Charts/issues/855) +- How to prevent xAxis values and dataset value get overlapped ? [\#854](https://github.com/danielgindi/Charts/issues/854) +- Program crash [\#853](https://github.com/danielgindi/Charts/issues/853) +- Zoomin Graphview [\#852](https://github.com/danielgindi/Charts/issues/852) +- Make ChartXAxisRenderer calculate labelsWidth based on string output by custom ChartXAxisValueFormatter [\#851](https://github.com/danielgindi/Charts/issues/851) +- Zooming an already zoomed view [\#850](https://github.com/danielgindi/Charts/issues/850) +- BarChart adds double x axis [\#849](https://github.com/danielgindi/Charts/issues/849) +- Remove text above dot in iOS Charts [\#848](https://github.com/danielgindi/Charts/issues/848) +- how to start graph from \(0,0\) points instead of 60 on y-Axis? [\#846](https://github.com/danielgindi/Charts/issues/846) +- Change dataSet axis dependency [\#845](https://github.com/danielgindi/Charts/issues/845) +- integrate native chart display incorrectly [\#842](https://github.com/danielgindi/Charts/issues/842) +- How can I draw bubble charts in swift project. [\#841](https://github.com/danielgindi/Charts/issues/841) +- Making HorizontalBarChartView scrolling vertically [\#839](https://github.com/danielgindi/Charts/issues/839) +- custom BallonMaker text [\#838](https://github.com/danielgindi/Charts/issues/838) +- Horizontal zoom in line chart [\#837](https://github.com/danielgindi/Charts/issues/837) +- ScatterChart - Is it possible to create a background color like this? [\#835](https://github.com/danielgindi/Charts/issues/835) +- How to create Stacked Bar Chart and Grouped Bar Chart [\#834](https://github.com/danielgindi/Charts/issues/834) +- fatal error: unexpectedly found nil while unwrapping an Optional value error when I set barChartView.noDataText [\#833](https://github.com/danielgindi/Charts/issues/833) +- Can I change fonts of labels on x And y axis in a bar graph. [\#832](https://github.com/danielgindi/Charts/issues/832) +- LineChartView avoid painting 0 values [\#830](https://github.com/danielgindi/Charts/issues/830) +- \[Feature\] Double-tap Gesture [\#829](https://github.com/danielgindi/Charts/issues/829) +- How to draw a rectangle,or how to get the last point's CGPoint? [\#827](https://github.com/danielgindi/Charts/issues/827) +- Changing width of the bar in bar chart [\#820](https://github.com/danielgindi/Charts/issues/820) +- The return value is a problem with the calculateMinimumRadiusForSpacedSlice method [\#819](https://github.com/danielgindi/Charts/issues/819) +- import Charts: Error No Such Module Charts? [\#818](https://github.com/danielgindi/Charts/issues/818) +- Can we define minor and major grid lines 
with specification like \(line color, line thickness, on/off \)? [\#817](https://github.com/danielgindi/Charts/issues/817) +- LineChart Delegate for line values [\#816](https://github.com/danielgindi/Charts/issues/816) +- Linechart X Labels overlap feature [\#813](https://github.com/danielgindi/Charts/issues/813) +- Can we support 2 more than y scales/ multiple Y axis ? [\#812](https://github.com/danielgindi/Charts/issues/812) +- Codesign error to physical device on latest [\#810](https://github.com/danielgindi/Charts/issues/810) +- Programatically scroll to end of line chart [\#809](https://github.com/danielgindi/Charts/issues/809) +- BalloonMarker - display X data [\#808](https://github.com/danielgindi/Charts/issues/808) +- multiple datasets with different x-values in chart [\#807](https://github.com/danielgindi/Charts/issues/807) +- Will ios-charts supoprt non-uniform data [\#806](https://github.com/danielgindi/Charts/issues/806) +- Not able to build for iPhone 6 [\#805](https://github.com/danielgindi/Charts/issues/805) +- Gap issues on latest version [\#804](https://github.com/danielgindi/Charts/issues/804) +- Error in 'ChartPlatform.swift' while compiling : Expected \#else or \#endif at the end of configuration block [\#803](https://github.com/danielgindi/Charts/issues/803) +- In iOS-Chart how to hide the x and y axis and all the grid lines. [\#801](https://github.com/danielgindi/Charts/issues/801) +- Create Chart from data in Firebase db [\#800](https://github.com/danielgindi/Charts/issues/800) +- How to make the chart and the other chart with the same translation [\#799](https://github.com/danielgindi/Charts/issues/799) +- Color of crosshairs? [\#796](https://github.com/danielgindi/Charts/issues/796) +- How to make horizontal dotted line to solid line same as vertical line. [\#793](https://github.com/danielgindi/Charts/issues/793) +- ios 8.1 fatal error:value failed to bridge from Swift type to a Objective-C type [\#792](https://github.com/danielgindi/Charts/issues/792) +- xAxis end label is cutting down in Line chart [\#791](https://github.com/danielgindi/Charts/issues/791) +- Is there a way to have multi line labels in x axis. [\#790](https://github.com/danielgindi/Charts/issues/790) +- help! [\#788](https://github.com/danielgindi/Charts/issues/788) +- Positioning on changing of the screen orientation [\#786](https://github.com/danielgindi/Charts/issues/786) +- Scatter chart data set color not working [\#784](https://github.com/danielgindi/Charts/issues/784) +- fatal error: value failed to bridge from Swift type to a Objective-C type [\#783](https://github.com/danielgindi/Charts/issues/783) +- Error on RadarChart \(drawFilledEnabled set to true\) [\#760](https://github.com/danielgindi/Charts/issues/760) +- Can't set x axis offset [\#677](https://github.com/danielgindi/Charts/issues/677) +- Right Y-Axis values displaying incorrectly in LineChartDemo [\#665](https://github.com/danielgindi/Charts/issues/665) +- Y - Axis Values stick together [\#608](https://github.com/danielgindi/Charts/issues/608) +- Charts over scrollview not scrolling in iPad only [\#550](https://github.com/danielgindi/Charts/issues/550) +- Stepped line charts [\#539](https://github.com/danielgindi/Charts/issues/539) +- Line chart circle positions [\#535](https://github.com/danielgindi/Charts/issues/535) +- Y-Axis values "stick together" occasionally [\#469](https://github.com/danielgindi/Charts/issues/469) +- Feature : initial display of the graph [\#468](https://github.com/danielgindi/Charts/issues/468) +- Candle Stick not filled make the stick and the gridline show within the candle [\#444](https://github.com/danielgindi/Charts/issues/444) +- Unit tests? ;\) [\#414](https://github.com/danielgindi/Charts/issues/414) +- How to draw a line only for the 5th value of dataset along x axis? [\#409](https://github.com/danielgindi/Charts/issues/409) +- Data Showing 0 and 1 only in y-axis if array contains only 0.0 double values. [\#338](https://github.com/danielgindi/Charts/issues/338) +- Extending lines between data points when zoomed and panning [\#330](https://github.com/danielgindi/Charts/issues/330) +- lowestVisibleXIndex never gets zero after zooming out [\#294](https://github.com/danielgindi/Charts/issues/294) +- on candle graph, when the candle is small then its not showing [\#281](https://github.com/danielgindi/Charts/issues/281) +- Bar Chart \> Range bar [\#100](https://github.com/danielgindi/Charts/issues/100) +- General discussion & news [\#92](https://github.com/danielgindi/Charts/issues/92) +- Core Data interfacing? [\#15](https://github.com/danielgindi/Charts/issues/15) + +**Merged pull requests:** + +- remove duplicated statement [\#894](https://github.com/danielgindi/Charts/pull/894) ([liuxuan30](https://github.com/liuxuan30)) +- Add new pie chart renderer with polyline indicate [\#869](https://github.com/danielgindi/Charts/pull/869) ([wjacker](https://github.com/wjacker)) +- Add a Gitter chat badge to README.md [\#861](https://github.com/danielgindi/Charts/pull/861) ([gitter-badger](https://github.com/gitter-badger)) +- Type bug in PieChartData [\#847](https://github.com/danielgindi/Charts/pull/847) ([leoMehlig](https://github.com/leoMehlig)) +- Supporting borders on bars, Fixes issue \#822 [\#844](https://github.com/danielgindi/Charts/pull/844) ([AndreasIgelCC](https://github.com/AndreasIgelCC)) +- Update Readme [\#828](https://github.com/danielgindi/Charts/pull/828) ([PhilJay](https://github.com/PhilJay)) +- Keep position on rotation [\#824](https://github.com/danielgindi/Charts/pull/824) ([leoMehlig](https://github.com/leoMehlig)) +- Set code signing identity for iOS targets [\#811](https://github.com/danielgindi/Charts/pull/811) ([krbarnes](https://github.com/krbarnes)) +- Add trailing newline for preprocessor statement [\#795](https://github.com/danielgindi/Charts/pull/795) ([boourns](https://github.com/boourns)) + +## [v2.2.3](https://github.com/danielgindi/Charts/tree/v2.2.3) (2016-02-29) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.2.2...v2.2.3) + +**Closed issues:** + +- How to create the chartmarker with swift? [\#776](https://github.com/danielgindi/Charts/issues/776) +- CombinedChartView: Wrong positions of bars when using multiple Bar and Graph -Datasets [\#775](https://github.com/danielgindi/Charts/issues/775) +- Getting co-ordinates of all plotted points in LineChartView [\#774](https://github.com/danielgindi/Charts/issues/774) +- Multiline label on xAxis cutting off [\#773](https://github.com/danielgindi/Charts/issues/773) +- Can't set ChartViewBase's data property back to nil to clear out data [\#771](https://github.com/danielgindi/Charts/issues/771) +- How to set position label radar chart. in Swift . [\#770](https://github.com/danielgindi/Charts/issues/770) +- How to control which entries on xAxis be shown? [\#768](https://github.com/danielgindi/Charts/issues/768) +- Tests failing after startAtZero was removed [\#767](https://github.com/danielgindi/Charts/issues/767) +- When a value repeats, bars are not showed [\#766](https://github.com/danielgindi/Charts/issues/766) +- Proposal: shall we unify yAxis.entries and yAxis.axisRange to have same max and min value? [\#763](https://github.com/danielgindi/Charts/issues/763) +- Ability to set linechart with fixed amount of x values shown and pan to other data points [\#762](https://github.com/danielgindi/Charts/issues/762) +- PieChart setMaxAngle [\#757](https://github.com/danielgindi/Charts/issues/757) +- Simply not installing [\#749](https://github.com/danielgindi/Charts/issues/749) +- Line charts have unintended breaks when next or previous point not visible. [\#748](https://github.com/danielgindi/Charts/issues/748) +- Remove border around linechart with gradient fill [\#747](https://github.com/danielgindi/Charts/issues/747) +- Old graphics not removed when adding new data [\#745](https://github.com/danielgindi/Charts/issues/745) +- Display values outside of the piechart [\#743](https://github.com/danielgindi/Charts/issues/743) +- Cubic line charts don't get filled correctly if data doesn't start at index 0 [\#711](https://github.com/danielgindi/Charts/issues/711) +- Center text vertically [\#682](https://github.com/danielgindi/Charts/issues/682) +- Animated moveViewToX\(\) [\#318](https://github.com/danielgindi/Charts/issues/318) +- Any chance of porting this to OSX? [\#43](https://github.com/danielgindi/Charts/issues/43) + +**Merged pull requests:** + +- Add "Toggle Data" option to demo charts. \(\#771 Support\) [\#781](https://github.com/danielgindi/Charts/pull/781) ([ospr](https://github.com/ospr)) +- Add missing UIKit imports for iOS 7 [\#780](https://github.com/danielgindi/Charts/pull/780) ([asmarques](https://github.com/asmarques)) +- Feature \#539 Stepped line charts [\#778](https://github.com/danielgindi/Charts/pull/778) ([ezamagni](https://github.com/ezamagni)) +- Make ChartViewBase's \_data optional. \(Fixes \#771\) [\#772](https://github.com/danielgindi/Charts/pull/772) ([ospr](https://github.com/ospr)) +- Add Carthage compatibility badge [\#769](https://github.com/danielgindi/Charts/pull/769) ([Bogidon](https://github.com/Bogidon)) +- update cocoapods url [\#755](https://github.com/danielgindi/Charts/pull/755) ([stevenedds](https://github.com/stevenedds)) +- add ci status [\#752](https://github.com/danielgindi/Charts/pull/752) ([petester42](https://github.com/petester42)) +- Correct the spelling of CocoaPods in README [\#751](https://github.com/danielgindi/Charts/pull/751) ([ReadmeCritic](https://github.com/ReadmeCritic)) +- LineChartRenderer context bug [\#746](https://github.com/danielgindi/Charts/pull/746) ([leoMehlig](https://github.com/leoMehlig)) +- Fix for cubic line chart fill when charts that don't start at x-index 0 \#711 [\#712](https://github.com/danielgindi/Charts/pull/712) ([gunterhager](https://github.com/gunterhager)) +- add support for lineCap setting for line chart [\#658](https://github.com/danielgindi/Charts/pull/658) ([liuxuan30](https://github.com/liuxuan30)) + +## [v2.2.2](https://github.com/danielgindi/Charts/tree/v2.2.2) (2016-02-09) +[Full Changelog](https://github.com/danielgindi/Charts/compare/2.2.1...v2.2.2) + +**Fixed bugs:** + +- Using BarChartDataSet default initializer causes a crash [\#734](https://github.com/danielgindi/Charts/issues/734) + +**Closed issues:** + +- Display dataSet labels on axis for horizontal bar [\#741](https://github.com/danielgindi/Charts/issues/741) +- Getting x,y values of points in LineChart [\#739](https://github.com/danielgindi/Charts/issues/739) +- Module 'Realm' not found in v2.2.1 [\#735](https://github.com/danielgindi/Charts/issues/735) +- cannot compile ios charts because of Ream environment missing. [\#733](https://github.com/danielgindi/Charts/issues/733) +- Issue in valueFormatter [\#732](https://github.com/danielgindi/Charts/issues/732) +- Multi colors for linechart's circles [\#730](https://github.com/danielgindi/Charts/issues/730) +- LineChartData omits and misaligns values when data isn't continuous [\#728](https://github.com/danielgindi/Charts/issues/728) +- Apache license and correct attribution in an iOS app? [\#678](https://github.com/danielgindi/Charts/issues/678) + +## [2.2.1](https://github.com/danielgindi/Charts/tree/2.2.1) (2016-02-01) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.2.1...2.2.1) + +## [v2.2.1](https://github.com/danielgindi/Charts/tree/v2.2.1) (2016-02-01) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.2.0...v2.2.1) + +**Fixed bugs:** + +- Can't set hole color to nil for Pie Chart [\#646](https://github.com/danielgindi/Charts/issues/646) + +**Closed issues:** + +- X-Axis at bottom of chart? [\#727](https://github.com/danielgindi/Charts/issues/727) +- 2.2.0 not published yet [\#723](https://github.com/danielgindi/Charts/issues/723) +- Highlight selected line by changing line width or line color [\#721](https://github.com/danielgindi/Charts/issues/721) +- Draw a Line that connects dots in Scatter Chart \(Simulate Line Chart not equidistant\) [\#720](https://github.com/danielgindi/Charts/issues/720) +- drawCubicEnabled performance issues [\#717](https://github.com/danielgindi/Charts/issues/717) +- how to disable zooming of graph on double click? [\#716](https://github.com/danielgindi/Charts/issues/716) +- Convert it to percent bar graph system [\#674](https://github.com/danielgindi/Charts/issues/674) +- Refresh charts view when the data change [\#672](https://github.com/danielgindi/Charts/issues/672) +- The most top label of ChartYAxis doesn't render which seems a bug. [\#647](https://github.com/danielgindi/Charts/issues/647) +- RadarChart animation [\#574](https://github.com/danielgindi/Charts/issues/574) +- Having the area below a line graph be gradient layer instead of background color [\#186](https://github.com/danielgindi/Charts/issues/186) + +**Merged pull requests:** + +- Update podspec for realm and 2.2.0 [\#725](https://github.com/danielgindi/Charts/pull/725) ([petester42](https://github.com/petester42)) + +## [v2.2.0](https://github.com/danielgindi/Charts/tree/v2.2.0) (2016-01-26) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.1.6...v2.2.0) + +**Fixed bugs:** + +- ChartDataSet calcYValueSum\(\) bug [\#604](https://github.com/danielgindi/Charts/issues/604) + +**Closed issues:** + +- Realm module not found when using a static library of Realm in my pod project in Objective-C [\#714](https://github.com/danielgindi/Charts/issues/714) +- how to get a custom legend [\#710](https://github.com/danielgindi/Charts/issues/710) +- I can't change the default grey background on the line chart [\#706](https://github.com/danielgindi/Charts/issues/706) +- I couldn't find Charts.xcodeproj [\#705](https://github.com/danielgindi/Charts/issues/705) +- Background Colour Changes [\#701](https://github.com/danielgindi/Charts/issues/701) +- Continuing the last closed \#695 [\#700](https://github.com/danielgindi/Charts/issues/700) +- Realm error [\#699](https://github.com/danielgindi/Charts/issues/699) +- Grid with constant width cells [\#697](https://github.com/danielgindi/Charts/issues/697) +- Pie chart is too small in tableview header view [\#696](https://github.com/danielgindi/Charts/issues/696) +- The delegate method is not getting called [\#695](https://github.com/danielgindi/Charts/issues/695) +- Not compatible with app extensions as a framework [\#693](https://github.com/danielgindi/Charts/issues/693) +- Set label for each column in group bar chart [\#691](https://github.com/danielgindi/Charts/issues/691) +- How to custom XAxis [\#689](https://github.com/danielgindi/Charts/issues/689) +- Need Help to setup this library on application with Objective C\(No auto layout\) with deployment target iOS 7.0 [\#688](https://github.com/danielgindi/Charts/issues/688) +- RadarChartView - Unknown type name [\#687](https://github.com/danielgindi/Charts/issues/687) +- How to make CandleStickChart and BarChart do the same action [\#685](https://github.com/danielgindi/Charts/issues/685) +- Issue with x-axis fixed label width [\#684](https://github.com/danielgindi/Charts/issues/684) +- Can I package the project in a dynamic library \(.framework\)? [\#681](https://github.com/danielgindi/Charts/issues/681) +- Dynamic LineChartView [\#680](https://github.com/danielgindi/Charts/issues/680) +- Horizontal Bar Chart Rounding [\#676](https://github.com/danielgindi/Charts/issues/676) +- Line Chart Highlight Styling [\#671](https://github.com/danielgindi/Charts/issues/671) +- Allow control of circle line width in Line Chart. [\#669](https://github.com/danielgindi/Charts/issues/669) +- Programatically highlight a data point in line chart [\#668](https://github.com/danielgindi/Charts/issues/668) +- Question: X-Axis set range of displayed entries, LineChart [\#667](https://github.com/danielgindi/Charts/issues/667) +- "No such module" error for archive with custom configuration in objc project. [\#664](https://github.com/danielgindi/Charts/issues/664) +- How to run this chart in iOS7? [\#663](https://github.com/danielgindi/Charts/issues/663) +- draw only the maximum and minimum values on the LineChartView [\#662](https://github.com/danielgindi/Charts/issues/662) +- Combine horizontal bar chart and line chart [\#661](https://github.com/danielgindi/Charts/issues/661) +- Can't import charts in Swift [\#659](https://github.com/danielgindi/Charts/issues/659) +- Realtime data [\#657](https://github.com/danielgindi/Charts/issues/657) +- xcode7.2 iOS 9 crash [\#656](https://github.com/danielgindi/Charts/issues/656) +- draw line chart with Gradient background [\#653](https://github.com/danielgindi/Charts/issues/653) +- Draw Straight Line on Line Chart with 2 fingers and show the Gradient of it [\#652](https://github.com/danielgindi/Charts/issues/652) +- Add To existing project and that too for iOS 7 [\#650](https://github.com/danielgindi/Charts/issues/650) +- xcode 7.1 error at xctest [\#644](https://github.com/danielgindi/Charts/issues/644) +- How to work out this in objective c [\#642](https://github.com/danielgindi/Charts/issues/642) +- 【StackedBarChartView】How to handle 0? [\#637](https://github.com/danielgindi/Charts/issues/637) +- Not able to archive build : Command failed due to signal: Segmentation fault: 11 [\#634](https://github.com/danielgindi/Charts/issues/634) +- Xcode7.1.1 contains error [\#633](https://github.com/danielgindi/Charts/issues/633) +- ChartDataSet's entryCount computed property raises a signal when \_yVals is nil [\#631](https://github.com/danielgindi/Charts/issues/631) +- Not able to set custom class as a BarChartViewController in objective c [\#628](https://github.com/danielgindi/Charts/issues/628) +- I want to know the project name - swift. h class of how to generate [\#627](https://github.com/danielgindi/Charts/issues/627) +- LineChart xAxis can't match the point [\#626](https://github.com/danielgindi/Charts/issues/626) +- set width of highlight in pie [\#625](https://github.com/danielgindi/Charts/issues/625) +- what's wrong with:\_OBJC\_CLASS\_$\_\_TtC6Charts13LineChartView [\#623](https://github.com/danielgindi/Charts/issues/623) +- How to draw a LineChartDataSet skipping certain data points [\#622](https://github.com/danielgindi/Charts/issues/622) +- Show % Percentage value with Legend data [\#621](https://github.com/danielgindi/Charts/issues/621) +- \[Enhancement\] avoidFirstLastClipping should keep the labels centered [\#619](https://github.com/danielgindi/Charts/issues/619) +- yAxis label shows only when i touch the view [\#618](https://github.com/danielgindi/Charts/issues/618) +- Legend colors not correct [\#617](https://github.com/danielgindi/Charts/issues/617) +- \[suggestion\] Warning when wrong ChartDataSet is used for view [\#616](https://github.com/danielgindi/Charts/issues/616) +- How to make the chart and the other chart with the same action [\#615](https://github.com/danielgindi/Charts/issues/615) +- touchesEnded event in BarChartView not called [\#613](https://github.com/danielgindi/Charts/issues/613) +- I put the deployment of XCODE target to 8.0 is an error, but change to 8.3 won't go wrong, what's the matter? [\#612](https://github.com/danielgindi/Charts/issues/612) +- why drawValues has some condition which uses break, some uses continue? [\#611](https://github.com/danielgindi/Charts/issues/611) +- Real Time Data and Moving X happens automatically ? [\#610](https://github.com/danielgindi/Charts/issues/610) +- A way to add data to chart data entries in real time ? [\#609](https://github.com/danielgindi/Charts/issues/609) +- Min and max number of horizontal lines [\#603](https://github.com/danielgindi/Charts/issues/603) +- Pie Chart only one Legend data is visible [\#602](https://github.com/danielgindi/Charts/issues/602) +- Myproject-swift.h has not founded in my project why?? [\#599](https://github.com/danielgindi/Charts/issues/599) +- Charts pulled from cocoapods is still of version 2.1.3 and it has compile errors against Swift 2.0 [\#598](https://github.com/danielgindi/Charts/issues/598) +- Fetch Stack Label at the click of the stack bar in the bar chart [\#596](https://github.com/danielgindi/Charts/issues/596) +- Cannot load underlying module for 'XCTest' when i am using charts in xcode7.1 [\#595](https://github.com/danielgindi/Charts/issues/595) +- setLabelsToSkip does not seem to function properly [\#594](https://github.com/danielgindi/Charts/issues/594) +- Work around for scalable xaxis for line chart [\#593](https://github.com/danielgindi/Charts/issues/593) +- unknown class Issue [\#592](https://github.com/danielgindi/Charts/issues/592) +- Selective fill colors on LineChartView [\#591](https://github.com/danielgindi/Charts/issues/591) +- how to set the YAxis or XAxis for custom value [\#590](https://github.com/danielgindi/Charts/issues/590) +- Finger drawing \(draw values into the chart with touch-gesture\) implemented? [\#589](https://github.com/danielgindi/Charts/issues/589) +- how to limit the YAxis Label's width? [\#588](https://github.com/danielgindi/Charts/issues/588) +- how to combine chart as follows [\#587](https://github.com/danielgindi/Charts/issues/587) +- no data available [\#585](https://github.com/danielgindi/Charts/issues/585) +- Is there a way to add arrows to highlight line? [\#584](https://github.com/danielgindi/Charts/issues/584) +- Getting question \(?\) mark while importing the library. How to get it resolved [\#583](https://github.com/danielgindi/Charts/issues/583) +- Mixed Font Style for Line Chart of X-Axis [\#581](https://github.com/danielgindi/Charts/issues/581) +- How to remove background gridlines from Bar Chart [\#579](https://github.com/danielgindi/Charts/issues/579) +- Question: Gesture Detection [\#578](https://github.com/danielgindi/Charts/issues/578) +- Crash originating in ChartViewPortHandler [\#576](https://github.com/danielgindi/Charts/issues/576) +- Add gaps in LineChart [\#572](https://github.com/danielgindi/Charts/issues/572) +- Cannot call getBarBounds from objective-c [\#570](https://github.com/danielgindi/Charts/issues/570) +- issue with Bar width [\#569](https://github.com/danielgindi/Charts/issues/569) +- UIPanGesture blocked while zoomed out completely [\#566](https://github.com/danielgindi/Charts/issues/566) +- Using Charts library for real-time plotting [\#565](https://github.com/danielgindi/Charts/issues/565) +- iOS-Charts not working on Jenkins [\#564](https://github.com/danielgindi/Charts/issues/564) +- Swift 2 \(Xcode 7\) Bad address on accessing chart view [\#563](https://github.com/danielgindi/Charts/issues/563) +- Custom offsets [\#562](https://github.com/danielgindi/Charts/issues/562) +- iOS 7 && Xcode 7.1.1 build not success, 'Charts' Module no found [\#560](https://github.com/danielgindi/Charts/issues/560) +- ChartYAxisValueFormatter in iOS [\#559](https://github.com/danielgindi/Charts/issues/559) +- can i add this? [\#557](https://github.com/danielgindi/Charts/issues/557) +- Problem uploading the archive. [\#556](https://github.com/danielgindi/Charts/issues/556) +- A strange issue when the APP second launch in debug mode [\#554](https://github.com/danielgindi/Charts/issues/554) +- Auto-adjusting graph scale on moving [\#553](https://github.com/danielgindi/Charts/issues/553) +- Bar Chart view group in Swift [\#551](https://github.com/danielgindi/Charts/issues/551) +- how to change the bar width [\#549](https://github.com/danielgindi/Charts/issues/549) +- Calculating space \(in px\) between two points [\#548](https://github.com/danielgindi/Charts/issues/548) +- CocoaPods can only install Charts with Version `2.1.3` [\#547](https://github.com/danielgindi/Charts/issues/547) +- App didn't started with Charts [\#546](https://github.com/danielgindi/Charts/issues/546) +- Setting custom values on top of bar chart [\#545](https://github.com/danielgindi/Charts/issues/545) +- Issues submitting app to Apple store [\#544](https://github.com/danielgindi/Charts/issues/544) +- Guidance on scrollable/pannable charts [\#543](https://github.com/danielgindi/Charts/issues/543) +- Line chart in tableview cell [\#542](https://github.com/danielgindi/Charts/issues/542) +- center lineChart value label to circle [\#541](https://github.com/danielgindi/Charts/issues/541) +- Use LineChartView create chartview will not slide, [\#540](https://github.com/danielgindi/Charts/issues/540) +- Getting some interesting errors when trying to upload our project to ITC with the latest ios-charts. [\#538](https://github.com/danielgindi/Charts/issues/538) +- Running demo direct error, this is how it happened [\#536](https://github.com/danielgindi/Charts/issues/536) +- StackLabels [\#534](https://github.com/danielgindi/Charts/issues/534) +- Legend at bottom of graph show on more than one line. [\#532](https://github.com/danielgindi/Charts/issues/532) +- Do we have any static library for ios-charts? [\#531](https://github.com/danielgindi/Charts/issues/531) +- Highlight a label in xAxis [\#530](https://github.com/danielgindi/Charts/issues/530) +- BalloonMarker shows float number with many digits after '.' [\#529](https://github.com/danielgindi/Charts/issues/529) +- Get the visible max and min yAxis values [\#528](https://github.com/danielgindi/Charts/issues/528) +- Scale and displacement by code [\#527](https://github.com/danielgindi/Charts/issues/527) +- My own app is crashed and got error is fatal error: value failed to bridge from Swift type to a Objective-C type [\#525](https://github.com/danielgindi/Charts/issues/525) +- if I want to set the RadarLabel like this! [\#524](https://github.com/danielgindi/Charts/issues/524) +- Pie Chart Legends Missing with the dynamically filled data. [\#518](https://github.com/danielgindi/Charts/issues/518) +- Resize chart due to data update [\#517](https://github.com/danielgindi/Charts/issues/517) +- How to detect end of chart event? [\#508](https://github.com/danielgindi/Charts/issues/508) +- Cannot distribute inhouse build with ios-charts library embedded to my project [\#486](https://github.com/danielgindi/Charts/issues/486) +- Excessive Printing to Console [\#417](https://github.com/danielgindi/Charts/issues/417) +- Module is not extensible [\#357](https://github.com/danielgindi/Charts/issues/357) + +**Merged pull requests:** + +- Activate require app extension safe API to be able to use library inside an app extension [\#708](https://github.com/danielgindi/Charts/pull/708) ([adonaire-sage](https://github.com/adonaire-sage)) +- fix code indent problem in ChartYAxisRendererRadarChart, ChartYAxisRenderer, BarChartDataSet, RadarChartView [\#675](https://github.com/danielgindi/Charts/pull/675) ([liuxuan30](https://github.com/liuxuan30)) +- add an option to set line cap of axis grid line [\#660](https://github.com/danielgindi/Charts/pull/660) ([mconintet](https://github.com/mconintet)) +- Fix minor typo in BarLineChartViewBase [\#651](https://github.com/danielgindi/Charts/pull/651) ([patrickreynolds](https://github.com/patrickreynolds)) +- Stop axis labels duplicating. \#315 \[Pending squash and cleanup\] [\#648](https://github.com/danielgindi/Charts/pull/648) ([noais](https://github.com/noais)) +- Adapted ChartLegendRenderer class to upcoming Swift 3 changes and improved code readability [\#643](https://github.com/danielgindi/Charts/pull/643) ([zntfdr](https://github.com/zntfdr)) +- Remove verbose semicolons [\#639](https://github.com/danielgindi/Charts/pull/639) ([AntiMoron](https://github.com/AntiMoron)) +- Adds CI [\#636](https://github.com/danielgindi/Charts/pull/636) ([petester42](https://github.com/petester42)) +- Add missing images for bar chart tests [\#635](https://github.com/danielgindi/Charts/pull/635) ([petester42](https://github.com/petester42)) +- Use nil coalescing in ChartDataSet's entryCount \(Fixes \#631\) [\#632](https://github.com/danielgindi/Charts/pull/632) ([aarondaub](https://github.com/aarondaub)) +- add highlight circle for radar chart [\#630](https://github.com/danielgindi/Charts/pull/630) ([liuxuan30](https://github.com/liuxuan30)) +- Remove useless parentheses causing swift build error [\#614](https://github.com/danielgindi/Charts/pull/614) ([chanil1218](https://github.com/chanil1218)) +- Add change log file. [\#605](https://github.com/danielgindi/Charts/pull/605) ([skywinder](https://github.com/skywinder)) +- add initialize dataSets in setter [\#600](https://github.com/danielgindi/Charts/pull/600) ([liuxuan30](https://github.com/liuxuan30)) +- Bar chart tests [\#580](https://github.com/danielgindi/Charts/pull/580) ([alvesjtiago](https://github.com/alvesjtiago)) +- Make getBarBounds callable from Objective-C code \(Fixes \#570\) [\#571](https://github.com/danielgindi/Charts/pull/571) ([adonaire-sage](https://github.com/adonaire-sage)) +- round the float value before we cast to Int [\#558](https://github.com/danielgindi/Charts/pull/558) ([liuxuan30](https://github.com/liuxuan30)) + +## [v2.1.6](https://github.com/danielgindi/Charts/tree/v2.1.6) (2015-11-02) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.1.5...v2.1.6) + +**Implemented enhancements:** + +- X axis names visibility \(Rotation\) [\#61](https://github.com/danielgindi/Charts/issues/61) + +**Closed issues:** + +- hello,this library is very great!!! [\#523](https://github.com/danielgindi/Charts/issues/523) +- \[BUG\] highlight when triggering pan gesture in default scale not working [\#520](https://github.com/danielgindi/Charts/issues/520) +- Implementing Gestures [\#519](https://github.com/danielgindi/Charts/issues/519) +- Does ios-charts work for Mac Cocoa programming? [\#516](https://github.com/danielgindi/Charts/issues/516) +- No 'setHighlightPerTapEnabled\(boolean enabled\)' in iosCharts? [\#515](https://github.com/danielgindi/Charts/issues/515) +- This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release. [\#514](https://github.com/danielgindi/Charts/issues/514) +- How to set position of description? [\#512](https://github.com/danielgindi/Charts/issues/512) +- Can't update library to 2.1.5 by cocoapods [\#511](https://github.com/danielgindi/Charts/issues/511) +- How in your chart on the basis of the modified? [\#510](https://github.com/danielgindi/Charts/issues/510) +- How can I reset bargraph total width ? [\#509](https://github.com/danielgindi/Charts/issues/509) +- ComboChartView highlight [\#507](https://github.com/danielgindi/Charts/issues/507) +- Making a line chart set with images on the chart [\#506](https://github.com/danielgindi/Charts/issues/506) +- the text rotation (Cry for help) [\#505](https://github.com/danielgindi/Charts/issues/505) +- StackedBar Chart highlighting complete single bar [\#504](https://github.com/danielgindi/Charts/issues/504) +- LineChart crashes if no entries [\#496](https://github.com/danielgindi/Charts/issues/496) +- Background color and floats on Y axis. [\#495](https://github.com/danielgindi/Charts/issues/495) +- Facing problem while achieving the build on Xcode7 [\#492](https://github.com/danielgindi/Charts/issues/492) +- About method setCircleColor & setCircleHoleColor [\#491](https://github.com/danielgindi/Charts/issues/491) +- inner web lines missing. [\#490](https://github.com/danielgindi/Charts/issues/490) +- Positioning using screen points instead of xIndex [\#487](https://github.com/danielgindi/Charts/issues/487) +- Selectable marker view & images at Y axis [\#485](https://github.com/danielgindi/Charts/issues/485) +- Could you draw a discontinuous line? [\#484](https://github.com/danielgindi/Charts/issues/484) +- Using image as marker in the chart [\#483](https://github.com/danielgindi/Charts/issues/483) +- Line chart can set the position of the x axis, such as in the chart below [\#482](https://github.com/danielgindi/Charts/issues/482) +- ```xAxis.avoidFirstLastClippingEnabled=YES``` problem.Version 2.1.4a [\#479](https://github.com/danielgindi/Charts/issues/479) +- Zombie exception [\#477](https://github.com/danielgindi/Charts/issues/477) +- chartView does't overlay with dark color highlighted value in bar chart [\#449](https://github.com/danielgindi/Charts/issues/449) +- viewPortHandler.setMaximumScaleX not working for horizontal bar chart [\#256](https://github.com/danielgindi/Charts/issues/256) + +**Merged pull requests:** + +- Implemented support for rotated labels on the x-axis [\#513](https://github.com/danielgindi/Charts/pull/513) ([danielgindi](https://github.com/danielgindi)) +- update targets to build framework with same name [\#501](https://github.com/danielgindi/Charts/pull/501) ([petester42](https://github.com/petester42)) +- Adds test support without cocoapods [\#500](https://github.com/danielgindi/Charts/pull/500) ([petester42](https://github.com/petester42)) +- Fixed drag offset panning bug [\#498](https://github.com/danielgindi/Charts/pull/498) ([leoMehlig](https://github.com/leoMehlig)) +- Revert "BUGFIX:fix xAxis labels of bar chart" [\#497](https://github.com/danielgindi/Charts/pull/497) ([danielgindi](https://github.com/danielgindi)) +- if only line data exists and no other data, turn \_deltaX to 1.0 [\#493](https://github.com/danielgindi/Charts/pull/493) ([liuxuan30](https://github.com/liuxuan30)) +- BUGFIX:fix xAxis labels of bar chart [\#489](https://github.com/danielgindi/Charts/pull/489) ([AntiMoron](https://github.com/AntiMoron)) +- Fix issue related to PhilJay/MPAndroidChart\#1121 [\#488](https://github.com/danielgindi/Charts/pull/488) ([PhilJay](https://github.com/PhilJay)) +- Approved, pending styling: Fix Scroll issue when the graph is in a UITableView [\#464](https://github.com/danielgindi/Charts/pull/464) ([coupgar](https://github.com/coupgar)) +- Add ability to turn off antialias for grid lines [\#462](https://github.com/danielgindi/Charts/pull/462) ([vvit](https://github.com/vvit)) + +## [v2.1.5](https://github.com/danielgindi/Charts/tree/v2.1.5) (2015-10-15) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.1.4a...v2.1.5) + +**Fixed bugs:** + +- chart is scrolling to top when reach maxScaleY and try zoom in again [\#463](https://github.com/danielgindi/Charts/issues/463) +- Pie chart does not work well with separate animations on x and y axis simultaneously [\#456](https://github.com/danielgindi/Charts/issues/456) + +**Closed issues:** + +- YAxis size calculations [\#480](https://github.com/danielgindi/Charts/issues/480) +- Can't install app due to non matching architecture. [\#476](https://github.com/danielgindi/Charts/issues/476) +- compiling for iPhone4s gives error like \#344 [\#475](https://github.com/danielgindi/Charts/issues/475) +- Compilation issue [\#473](https://github.com/danielgindi/Charts/issues/473) +- Problem with marker in Swift [\#472](https://github.com/danielgindi/Charts/issues/472) +- Crash: function signature specialization \ of Charts.BarLineChartViewBase.calcModulus \(Charts.BarLineChartViewBase\)\(\) -\> \(\), line 444 [\#471](https://github.com/danielgindi/Charts/issues/471) +- Pinch to Zoom is not being disabled properly. [\#470](https://github.com/danielgindi/Charts/issues/470) +- how to draw a graph having x value but no values in y [\#467](https://github.com/danielgindi/Charts/issues/467) +- Why set barRect.size.height = bottom - top to be negative? [\#465](https://github.com/danielgindi/Charts/issues/465) +- swift 1.2 branch [\#459](https://github.com/danielgindi/Charts/issues/459) +- Has anyone meet the '\# has been removed from swift' problem under XCode version 7.0.1? [\#458](https://github.com/danielgindi/Charts/issues/458) +- Multiple negative-able values in Stack bar chart [\#455](https://github.com/danielgindi/Charts/issues/455) +- Limit Line Label Text Color [\#454](https://github.com/danielgindi/Charts/issues/454) +- problems using autoScaleMinMaxEnabled [\#453](https://github.com/danielgindi/Charts/issues/453) +- how to update the ios-charts in existing projects. [\#452](https://github.com/danielgindi/Charts/issues/452) +- Provide callbacks on ChartViewDelegate to better handle dragging, touch, etc [\#451](https://github.com/danielgindi/Charts/issues/451) +- moveViewToX problem [\#450](https://github.com/danielgindi/Charts/issues/450) +- bar width [\#448](https://github.com/danielgindi/Charts/issues/448) +- Can we show title of Axis? [\#447](https://github.com/danielgindi/Charts/issues/447) +- Make \_chart in CombinedChartRenderer internal [\#446](https://github.com/danielgindi/Charts/issues/446) +- Dynamic graph display [\#445](https://github.com/danielgindi/Charts/issues/445) +- Demo project is not working [\#443](https://github.com/danielgindi/Charts/issues/443) +- xcode 7 issue? - non-existent file for the CFBundleExecutable key [\#442](https://github.com/danielgindi/Charts/issues/442) +- Custom Y Axis entries with String values [\#441](https://github.com/danielgindi/Charts/issues/441) +- Change size of the view that contain the chart [\#440](https://github.com/danielgindi/Charts/issues/440) +- Label lines with different style, larger and not for all lines in grid [\#439](https://github.com/danielgindi/Charts/issues/439) +- Pie chart data labels not in correct position. [\#436](https://github.com/danielgindi/Charts/issues/436) +- Glitch while scrolling [\#430](https://github.com/danielgindi/Charts/issues/430) +- A field crash issue for highestVisibleXIndex [\#329](https://github.com/danielgindi/Charts/issues/329) +- Empty configuration over full configuration [\#308](https://github.com/danielgindi/Charts/issues/308) +- \[BarChart\] single dataSet + force groupSpace=0.8 leads to wrong xAxis label rendering and highlight [\#284](https://github.com/danielgindi/Charts/issues/284) +- Prebuilt Frameworks & Tagged Releases [\#217](https://github.com/danielgindi/Charts/issues/217) + +**Merged pull requests:** + +- Changed \_chart access modifier from private to internal [\#478](https://github.com/danielgindi/Charts/pull/478) ([AlBirdie](https://github.com/AlBirdie)) +- fixed noDataText and NoDataTextDescription texts ovelapping issue [\#457](https://github.com/danielgindi/Charts/pull/457) ([zntfdr](https://github.com/zntfdr)) +- Only alow scaling further if the user can still zoom \(Fixes \#437\) [\#438](https://github.com/danielgindi/Charts/pull/438) ([iangmaia](https://github.com/iangmaia)) +- Make the ChartXAxisRenderer more flexible: now possible to overwrite drawing the line or label of the ChartLimitLine [\#432](https://github.com/danielgindi/Charts/pull/432) ([pajai](https://github.com/pajai)) + +## [v2.1.4a](https://github.com/danielgindi/Charts/tree/v2.1.4a) (2015-10-02) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.1.4...v2.1.4a) + +**Fixed bugs:** + +- CGContextAddLineToPoint no current point. [\#419](https://github.com/danielgindi/Charts/issues/419) +- Crash by initialize\(\) of CombinedChartView [\#406](https://github.com/danielgindi/Charts/issues/406) +- Radar chart + Bar Line chart Base + startAtZeroEnabled = false + negative values [\#166](https://github.com/danielgindi/Charts/issues/166) + +**Closed issues:** + +- RadarChart \(spider web chart\) issue [\#435](https://github.com/danielgindi/Charts/issues/435) +- dyld\_fatal\_error [\#434](https://github.com/danielgindi/Charts/issues/434) +- Xcode 6.4 compilation errors [\#433](https://github.com/danielgindi/Charts/issues/433) +- Error: Can't build demo project with XCode Version 6.4 \(6E35b\) [\#431](https://github.com/danielgindi/Charts/issues/431) +- Custom ChartXAxisValueFormatter not Being Called with Data containing NSObjects [\#429](https://github.com/danielgindi/Charts/issues/429) +- Error Swift 2 - ChartViewBase.swift [\#428](https://github.com/danielgindi/Charts/issues/428) +- How to return xIndex that be selected in chart? [\#427](https://github.com/danielgindi/Charts/issues/427) +- always return 0 in chartValueSelected function [\#426](https://github.com/danielgindi/Charts/issues/426) +- Radar Chart can not open in Charts Demo project [\#424](https://github.com/danielgindi/Charts/issues/424) +- ScatterChartRenderer - create a custom shape [\#423](https://github.com/danielgindi/Charts/issues/423) +- How to add custom text to the diagram [\#421](https://github.com/danielgindi/Charts/issues/421) +- App/Xcode crashing when charts are loaded [\#410](https://github.com/danielgindi/Charts/issues/410) +- Max Y value sometimes get clipped [\#405](https://github.com/danielgindi/Charts/issues/405) +- Display X-axis and y-axis names and Can i display x axis values vertically [\#403](https://github.com/danielgindi/Charts/issues/403) +- How to show time values in horizontal Bar chart? [\#402](https://github.com/danielgindi/Charts/issues/402) +- ios 9 - xcode 7 [\#400](https://github.com/danielgindi/Charts/issues/400) +- bar chart with gradient [\#398](https://github.com/danielgindi/Charts/issues/398) +- Multiple Lines in LineChart. [\#397](https://github.com/danielgindi/Charts/issues/397) +- Line Graph error [\#396](https://github.com/danielgindi/Charts/issues/396) +- Charts running on Simulator only [\#381](https://github.com/danielgindi/Charts/issues/381) +- Multiple axis - line charts drawing [\#366](https://github.com/danielgindi/Charts/issues/366) +- Marker frame adjustment according to bounds [\#364](https://github.com/danielgindi/Charts/issues/364) +- Sequencing of legend titles [\#363](https://github.com/danielgindi/Charts/issues/363) +- Legend has only one label [\#361](https://github.com/danielgindi/Charts/issues/361) +- Can add the missing value support [\#355](https://github.com/danielgindi/Charts/issues/355) +- CombinedChartView line + bar [\#353](https://github.com/danielgindi/Charts/issues/353) +- drawFillEnabled in line chart bug? [\#351](https://github.com/danielgindi/Charts/issues/351) +- \[BUG\] highlighted bar animation on Y Axis for all bar charts is wrong and not same speed [\#349](https://github.com/danielgindi/Charts/issues/349) +- HELP : some problem never met about iOS-charts [\#341](https://github.com/danielgindi/Charts/issues/341) +- Multiple line Chart, same view [\#340](https://github.com/danielgindi/Charts/issues/340) +- Position Pie Chart over the View [\#337](https://github.com/danielgindi/Charts/issues/337) +- Having multiple colour bands with an area that changes dynamically over time [\#336](https://github.com/danielgindi/Charts/issues/336) +- Adding Large number of data points -- addEntry\(\) [\#333](https://github.com/danielgindi/Charts/issues/333) +- Can I implement this kind of chart with this library? [\#328](https://github.com/danielgindi/Charts/issues/328) +- iOS Chart Y-Axis High Limit [\#317](https://github.com/danielgindi/Charts/issues/317) +- how to place the Y axis label at the bottom of the chart? [\#314](https://github.com/danielgindi/Charts/issues/314) +- Real-time Charts [\#263](https://github.com/danielgindi/Charts/issues/263) +- Drawing circles for values on the radar chart [\#138](https://github.com/danielgindi/Charts/issues/138) + +**Merged pull requests:** + +- Start of pan gesture should not be cancelled by no drag [\#420](https://github.com/danielgindi/Charts/pull/420) ([niraj-rayalla](https://github.com/niraj-rayalla)) +- Allow the minimum offset to be customized [\#395](https://github.com/danielgindi/Charts/pull/395) ([icecrystal23](https://github.com/icecrystal23)) +- Add support for a legend above the chart [\#393](https://github.com/danielgindi/Charts/pull/393) ([icecrystal23](https://github.com/icecrystal23)) +- Add target for tvOS and get it to compile [\#392](https://github.com/danielgindi/Charts/pull/392) ([icecrystal23](https://github.com/icecrystal23)) +- be explicit on how to install 'Charts' when using CocoaPods since [\#376](https://github.com/danielgindi/Charts/pull/376) ([codeHatcher](https://github.com/codeHatcher)) + +## [v2.1.4](https://github.com/danielgindi/Charts/tree/v2.1.4) (2015-09-21) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.1.3...v2.1.4) + +**Fixed bugs:** + +- UIPanGestureRecognizer causes index out of bounds crash [\#327](https://github.com/danielgindi/Charts/issues/327) +- Radar chart radius is still affected by label size when label drawing is disabled [\#153](https://github.com/danielgindi/Charts/issues/153) +- XGrid not in sync for identical x values but different chart types [\#99](https://github.com/danielgindi/Charts/issues/99) + +**Closed issues:** + +- Xcode 7 and iOS 9 Support \(Deployment Target iOS 7.0\) [\#404](https://github.com/danielgindi/Charts/issues/404) +- Legend titles aren't printing if there are more than 5 [\#401](https://github.com/danielgindi/Charts/issues/401) +- Swift 2.0 branch not found [\#399](https://github.com/danielgindi/Charts/issues/399) +- Values are not drawn in the correct location when the y-axis does not start at zero [\#391](https://github.com/danielgindi/Charts/issues/391) +- Swift-2.0 branch runtime crashes after distributed on the TestFlight [\#390](https://github.com/danielgindi/Charts/issues/390) +- ios-charts Integration problem [\#389](https://github.com/danielgindi/Charts/issues/389) +- Can't change X-axis label color [\#387](https://github.com/danielgindi/Charts/issues/387) +- StackedBarChart in horizontal manner [\#384](https://github.com/danielgindi/Charts/issues/384) +- Add ios-charts to existing project in XCode 7 [\#383](https://github.com/danielgindi/Charts/issues/383) +- Xcode7 Swift 2.0 issue \[ChartSelectionDetail.swift\] [\#380](https://github.com/danielgindi/Charts/issues/380) +- Installing ios-charts in an existing project [\#379](https://github.com/danielgindi/Charts/issues/379) +- I upgraded my UXcode 7,I can't use charts framework. [\#378](https://github.com/danielgindi/Charts/issues/378) +- How to achieve 0 spacing between bars? [\#365](https://github.com/danielgindi/Charts/issues/365) +- Xcode 7.0 and Swift 2.0 issue [\#358](https://github.com/danielgindi/Charts/issues/358) +- Unable to run a demo [\#356](https://github.com/danielgindi/Charts/issues/356) +- Using Embedded Binaries giving build failed error in xcode 7 ? [\#354](https://github.com/danielgindi/Charts/issues/354) +- is there a object-c version this project? [\#352](https://github.com/danielgindi/Charts/issues/352) +- adding cross platform feature [\#350](https://github.com/danielgindi/Charts/issues/350) +- Some problems about CandleStickChart [\#348](https://github.com/danielgindi/Charts/issues/348) +- Some problems about CandleStickChart [\#347](https://github.com/danielgindi/Charts/issues/347) +- Pie chart is getting drawn again and again on rotation in iOS [\#346](https://github.com/danielgindi/Charts/issues/346) +- 对于高于限制线的点,我怎么改变点的样式和颜色呢? [\#345](https://github.com/danielgindi/Charts/issues/345) +- Swift-2.0 Branch Error [\#344](https://github.com/danielgindi/Charts/issues/344) +- Multiple lines [\#342](https://github.com/danielgindi/Charts/issues/342) +- Daniel are you really fit? [\#339](https://github.com/danielgindi/Charts/issues/339) +- For CandleStickChart, how can I limit according to the count of candles [\#334](https://github.com/danielgindi/Charts/issues/334) +- how can i disable the doubles? i only need the chat show int data [\#332](https://github.com/danielgindi/Charts/issues/332) +- Bug: Xcode 7 beta 5: dyld: Library not loaded: @rpath/Charts.framework/Charts [\#326](https://github.com/danielgindi/Charts/issues/326) +- Disappearing Line Segment when scrolling [\#325](https://github.com/danielgindi/Charts/issues/325) +- CombinedChart with BarChartData cuts the first and last bars in half [\#323](https://github.com/danielgindi/Charts/issues/323) +- Bug \(?\) in CandleStickChartRenderer when showing empty dataset among multiple datasets [\#320](https://github.com/danielgindi/Charts/issues/320) +- Xcode 7 Beta 6 print\(.. appendNewLine\) - Swift 2.0 branch [\#316](https://github.com/danielgindi/Charts/issues/316) +- Ability to disable legends completely [\#312](https://github.com/danielgindi/Charts/issues/312) +- BarChart draws additional horizontal grid lines when setting custom customAxisMax/labelCount [\#310](https://github.com/danielgindi/Charts/issues/310) +- Take selectionShift into account when displaying pie chart [\#309](https://github.com/danielgindi/Charts/issues/309) +- Line Chart Line is not drawing properly for the large yValues [\#307](https://github.com/danielgindi/Charts/issues/307) +- Zero valued slices overlap [\#305](https://github.com/danielgindi/Charts/issues/305) +- setVisibleXRangeMaximum working differently than expected [\#304](https://github.com/danielgindi/Charts/issues/304) +- MyProject-Swift.h header not found when embedding framework into ObjectiveC project [\#303](https://github.com/danielgindi/Charts/issues/303) +- Using NSNumberFormatter or .getBarBounds\(\) to Display Custom Values [\#302](https://github.com/danielgindi/Charts/issues/302) +- Unknown class \_TtC6Charts12BarChartView in Interface Builder file. [\#301](https://github.com/danielgindi/Charts/issues/301) +- Possible regression because of recent `startAtZeroEnabled` changes [\#300](https://github.com/danielgindi/Charts/issues/300) +- Axis titles? [\#299](https://github.com/danielgindi/Charts/issues/299) +- xcode 6.4 , Swift 1.2 build fail [\#298](https://github.com/danielgindi/Charts/issues/298) +- it has this problem "'\#' has been removed from Swift" in many places [\#296](https://github.com/danielgindi/Charts/issues/296) +- chartScaled not so useful without the touch location [\#295](https://github.com/danielgindi/Charts/issues/295) +- ChartMarker don't draw [\#293](https://github.com/danielgindi/Charts/issues/293) +- Multiple line charts on the same graph [\#292](https://github.com/danielgindi/Charts/issues/292) +- Release Version 2.1.3 on CocoaPods [\#289](https://github.com/danielgindi/Charts/issues/289) +- saveToCameraRoll strange behavior [\#288](https://github.com/danielgindi/Charts/issues/288) +- ios-charts for swift 2.0 cannot compile on XCode7 beta 5 - self.dynamicType.allocWithZone\(zone\) issue [\#287](https://github.com/danielgindi/Charts/issues/287) +- installing with cocoapods [\#283](https://github.com/danielgindi/Charts/issues/283) +- iOS 9 Won't Compile \(Also, no such module 'Charts'\) [\#282](https://github.com/danielgindi/Charts/issues/282) +- Allow to align the Legend! [\#279](https://github.com/danielgindi/Charts/issues/279) +- Demo chart for Swift? [\#278](https://github.com/danielgindi/Charts/issues/278) +- Cocoapods support [\#277](https://github.com/danielgindi/Charts/issues/277) +- ios-charts different plotting activity than MKAndroidChart [\#276](https://github.com/danielgindi/Charts/issues/276) +- Highlight Doest'n work properly on UIPageViewController in LineChart. [\#275](https://github.com/danielgindi/Charts/issues/275) +- command failed due to signal: Abort trap: 6 charts [\#271](https://github.com/danielgindi/Charts/issues/271) +- having hard time to put working on version iOS 7.1 [\#270](https://github.com/danielgindi/Charts/issues/270) +- Library not found while building application through distribution certificate [\#266](https://github.com/danielgindi/Charts/issues/266) +- Crash on one entry point in charts [\#265](https://github.com/danielgindi/Charts/issues/265) +- when add points dynamicly, scale is changeing, [\#264](https://github.com/danielgindi/Charts/issues/264) +- About Auto-scaling on axis [\#259](https://github.com/danielgindi/Charts/issues/259) +- \[CombinedChart\] Grouped Bars + line chart [\#252](https://github.com/danielgindi/Charts/issues/252) +- \*\*\* Announcements \*\*\* [\#236](https://github.com/danielgindi/Charts/issues/236) +- \[BUG\] xAxis label too long causes radar chart cannot render correctly [\#205](https://github.com/danielgindi/Charts/issues/205) + +**Merged pull requests:** + +- Allow setting maximum y-scale factor [\#388](https://github.com/danielgindi/Charts/pull/388) ([noais](https://github.com/noais)) +- Swift 2.0 [\#386](https://github.com/danielgindi/Charts/pull/386) ([danielgindi](https://github.com/danielgindi)) +- Fix default value of forceLabelsEnabled [\#360](https://github.com/danielgindi/Charts/pull/360) ([yas375](https://github.com/yas375)) +- Update BarLineChartViewBase.swift [\#359](https://github.com/danielgindi/Charts/pull/359) ([Ewg777](https://github.com/Ewg777)) +- combined chart - seems we should use same chartXMin and chartXMax even there is no bubble data [\#324](https://github.com/danielgindi/Charts/pull/324) ([liuxuan30](https://github.com/liuxuan30)) +- fix pie chart clipping [\#313](https://github.com/danielgindi/Charts/pull/313) ([petester42](https://github.com/petester42)) +- Changed Release signing configuration to "iOS Developer" to improve Carthage compatibility [\#297](https://github.com/danielgindi/Charts/pull/297) ([JaviSoto](https://github.com/JaviSoto)) +- Fixes xcode beta 5 compile errors [\#291](https://github.com/danielgindi/Charts/pull/291) ([petester42](https://github.com/petester42)) +- bump podspec to 2.1.3 [\#290](https://github.com/danielgindi/Charts/pull/290) ([petester42](https://github.com/petester42)) +- Minor refactor for BarLineChartViewBase [\#268](https://github.com/danielgindi/Charts/pull/268) ([liuxuan30](https://github.com/liuxuan30)) +- Enhanced label positioning at limit lines \(enum ChartLimitLabelPosition\) [\#243](https://github.com/danielgindi/Charts/pull/243) ([SvenMuc](https://github.com/SvenMuc)) + +## [v2.1.3](https://github.com/danielgindi/Charts/tree/v2.1.3) (2015-08-05) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.1.2...v2.1.3) + +**Closed issues:** + +- Limit Legend for combined charts [\#272](https://github.com/danielgindi/Charts/issues/272) +- Default zoom level at a position. [\#267](https://github.com/danielgindi/Charts/issues/267) +- drawValuesForWholeStackEnabled deprecated? [\#261](https://github.com/danielgindi/Charts/issues/261) +- Another Command failed due to signal: Segmentation fault: 11 [\#260](https://github.com/danielgindi/Charts/issues/260) +- moveViewToX [\#258](https://github.com/danielgindi/Charts/issues/258) +- How to add point dynamicly [\#257](https://github.com/danielgindi/Charts/issues/257) +- Real time graph - X-axis moving? [\#255](https://github.com/danielgindi/Charts/issues/255) +- 2.1.2 Not Yet in CocoaPods Master Repo [\#251](https://github.com/danielgindi/Charts/issues/251) +- Heads up [\#250](https://github.com/danielgindi/Charts/issues/250) +- Disable HorizontalHighlightIndicator on LineChart. [\#249](https://github.com/danielgindi/Charts/issues/249) +- double vision in the chart [\#245](https://github.com/danielgindi/Charts/issues/245) +- Can't find anything like "isWordWrapEnabled" in PieChart [\#244](https://github.com/danielgindi/Charts/issues/244) +- Grouped columns misplaced [\#242](https://github.com/danielgindi/Charts/issues/242) +- Swift2 upgrade problem "Redundant conformance of 'ChartDataEntry' to protocol 'Equatable'" [\#241](https://github.com/danielgindi/Charts/issues/241) +- App created by Archive cannot run on devices. [\#240](https://github.com/danielgindi/Charts/issues/240) +- What's the differences between setAxisMaximum and customAxisMax [\#239](https://github.com/danielgindi/Charts/issues/239) +- Problem importing framework to Xcode 6.4 in Swift Project [\#233](https://github.com/danielgindi/Charts/issues/233) +- PieChartData initialisers ambiguous when xVals parameter is nil [\#224](https://github.com/danielgindi/Charts/issues/224) +- \[BUG\] all-negative Stacked horizontal Bar Chart size is not correct [\#222](https://github.com/danielgindi/Charts/issues/222) +- \[BUG\] Bar Chart incorrect rendering for special data [\#214](https://github.com/danielgindi/Charts/issues/214) +- Projects using Charts [\#145](https://github.com/danielgindi/Charts/issues/145) +- Legend Height Adjustment [\#81](https://github.com/danielgindi/Charts/issues/81) +- Multiple legend entrys will be rendered outside of the view [\#80](https://github.com/danielgindi/Charts/issues/80) + +**Merged pull requests:** + +- Add a Code Hunt vote badge to README.md [\#262](https://github.com/danielgindi/Charts/pull/262) ([CodeHuntIO](https://github.com/CodeHuntIO)) +- Updated podspec [\#254](https://github.com/danielgindi/Charts/pull/254) ([petester42](https://github.com/petester42)) +- try to fix bar chart + Horizontal Bar chart wrong render + highlight position bug for issue \#214 and \#242. [\#248](https://github.com/danielgindi/Charts/pull/248) ([liuxuan30](https://github.com/liuxuan30)) + +## [v2.1.2](https://github.com/danielgindi/Charts/tree/v2.1.2) (2015-07-26) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.1.1...v2.1.2) + +## [v2.1.1](https://github.com/danielgindi/Charts/tree/v2.1.1) (2015-07-26) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.1.0...v2.1.1) + +**Fixed bugs:** + +- Render Crash Due to Rect NAN from rectValueToPixel in BarChartRenderer.swift [\#177](https://github.com/danielgindi/Charts/issues/177) +- Can we add nil values to a dataset yet? [\#113](https://github.com/danielgindi/Charts/issues/113) +- Incorrect chart view adjustment after moveViewtoX\(xIndex: Int\) [\#82](https://github.com/danielgindi/Charts/issues/82) +- Margin insets not changing during zoom when formatter changes output width [\#72](https://github.com/danielgindi/Charts/issues/72) +- Line chart crashes with a big float [\#62](https://github.com/danielgindi/Charts/issues/62) + +**Closed issues:** + +- App is crashing when line chart is scrolled into view and then back out. [\#238](https://github.com/danielgindi/Charts/issues/238) +- Demo Project: In BalloonMarker.swift : "Error: No such module 'charts' " XCode 6.4 [\#237](https://github.com/danielgindi/Charts/issues/237) +- How to draw Line segments in one Line Chart. [\#235](https://github.com/danielgindi/Charts/issues/235) +- How to disable the continuos selection in chart with swipe? [\#234](https://github.com/danielgindi/Charts/issues/234) +- Podspec 3 months old [\#231](https://github.com/danielgindi/Charts/issues/231) +- Setting background in Objective C [\#230](https://github.com/danielgindi/Charts/issues/230) +- ChartYAxis valueFormatter NSFormatter instead of NSNumberFormatter [\#228](https://github.com/danielgindi/Charts/issues/228) +- How to setup up y-axis with min, max value and a fixed step between the grid lines? [\#227](https://github.com/danielgindi/Charts/issues/227) +- What's the proper way to manually set chart's scale and scroll offset? [\#226](https://github.com/danielgindi/Charts/issues/226) +- How could you set the Y values at the bottom in LineChart? [\#223](https://github.com/danielgindi/Charts/issues/223) +- Is there guidance to beginner to use this? [\#220](https://github.com/danielgindi/Charts/issues/220) +- Chart's PanGesture conflicts with UITableView PanGesture [\#219](https://github.com/danielgindi/Charts/issues/219) +- \(swift-2.0 branch\) building Charts.xcodeproj fails \(exit code 65\) with Release configuration [\#218](https://github.com/danielgindi/Charts/issues/218) +- Crash on device - iOS 8.3 [\#216](https://github.com/danielgindi/Charts/issues/216) +- Remove dependencies warning [\#215](https://github.com/danielgindi/Charts/issues/215) +- Update Podspec to reflect commits since early May? [\#213](https://github.com/danielgindi/Charts/issues/213) +- \[BUG\]negative values rendering +highlight rect rendering not correct for stacked bar + stacked horizontal bar chart [\#212](https://github.com/danielgindi/Charts/issues/212) +- \[BUG\]postive bars in demo Stack BarChart Negative disappear after scrolling [\#211](https://github.com/danielgindi/Charts/issues/211) +- Horizontal bar chart in combined bar chart. [\#210](https://github.com/danielgindi/Charts/issues/210) +- Can I use this library in an objective-c project targeting iOS 7 & 8? [\#206](https://github.com/danielgindi/Charts/issues/206) +- When animating charts after reload, chart is shown fully drawn before animating. [\#204](https://github.com/danielgindi/Charts/issues/204) +- Array index out of range when removing entries from DataSet [\#203](https://github.com/danielgindi/Charts/issues/203) +- Issue while displaying the chart \(HorizontalBarChartView\) [\#202](https://github.com/danielgindi/Charts/issues/202) +- Charts stuttering when reloaded [\#201](https://github.com/danielgindi/Charts/issues/201) +- Scaling Yaxis [\#199](https://github.com/danielgindi/Charts/issues/199) +- Don't draw zero value label [\#197](https://github.com/danielgindi/Charts/issues/197) +- Library not loaded: @rpath/Charts.framework/Charts [\#196](https://github.com/danielgindi/Charts/issues/196) +- How can i get this chart? [\#195](https://github.com/danielgindi/Charts/issues/195) +- Crashing on adding the null value to and array [\#193](https://github.com/danielgindi/Charts/issues/193) +- ChartDataEntry not drawn after certain xIndex [\#190](https://github.com/danielgindi/Charts/issues/190) +- Highlight multiple values [\#187](https://github.com/danielgindi/Charts/issues/187) +- ChartData.removeEntryByXIndex removes the wrong entry [\#182](https://github.com/danielgindi/Charts/issues/182) +- Label on Limit Lines cause crash [\#181](https://github.com/danielgindi/Charts/issues/181) +- \[feature request\] render xAxis like yAxis style Namely from discrete way to continuous way [\#176](https://github.com/danielgindi/Charts/issues/176) +- Annotation label support? [\#175](https://github.com/danielgindi/Charts/issues/175) +- Multiple DataSet Error [\#174](https://github.com/danielgindi/Charts/issues/174) +- AddEntry issue in ChartData [\#173](https://github.com/danielgindi/Charts/issues/173) +- Bar Chart Bars Disappears On Zoom And Highlight Bars Don't Match [\#172](https://github.com/danielgindi/Charts/issues/172) +- Clearing all highlighted values [\#171](https://github.com/danielgindi/Charts/issues/171) +- BarChartView work with TableView [\#167](https://github.com/danielgindi/Charts/issues/167) +- Make scroll to graph without pinch [\#164](https://github.com/danielgindi/Charts/issues/164) +- When i set valueformatter , Have problem. [\#163](https://github.com/danielgindi/Charts/issues/163) +- Combined Chart With array of line charts [\#162](https://github.com/danielgindi/Charts/issues/162) +- Issues with chart rendering... [\#161](https://github.com/danielgindi/Charts/issues/161) +- How to set yAxis to normal number [\#160](https://github.com/danielgindi/Charts/issues/160) +- How to set yValue display 0 2 3 5 [\#159](https://github.com/danielgindi/Charts/issues/159) +- \[BUG\] \_yAxis.entries will not be cleaned up in computeAxisValues in radar chart [\#158](https://github.com/danielgindi/Charts/issues/158) +- \[feature request\] support fixed yAxis interval and xAxis labelCount [\#155](https://github.com/danielgindi/Charts/issues/155) +- app crashes at launch as in house release build on iPhone - but debugging is fine [\#154](https://github.com/danielgindi/Charts/issues/154) +- \[feature request\] enable legend view scrollable [\#151](https://github.com/danielgindi/Charts/issues/151) +- \[feature request\] support custom handler for gestures [\#148](https://github.com/danielgindi/Charts/issues/148) +- unsuccessful at installing for ios 7.0 [\#144](https://github.com/danielgindi/Charts/issues/144) +- cannot po swift local variable in my Objective-C project [\#143](https://github.com/danielgindi/Charts/issues/143) +- Real time line chart [\#142](https://github.com/danielgindi/Charts/issues/142) +- Bar chart some values \< 0 [\#141](https://github.com/danielgindi/Charts/issues/141) +- Any demo in swift ? [\#139](https://github.com/danielgindi/Charts/issues/139) +- compiling time costs 2-3 minutes after import swift code files, is it normal? [\#137](https://github.com/danielgindi/Charts/issues/137) +- iOS7 can't build success [\#136](https://github.com/danielgindi/Charts/issues/136) +- Warnings on the comments [\#135](https://github.com/danielgindi/Charts/issues/135) +- Still seeing undeclared UIColor, CGFloat error with latest code [\#133](https://github.com/danielgindi/Charts/issues/133) +- Error while drawing radar chart [\#132](https://github.com/danielgindi/Charts/issues/132) +- Cannot assign a value of type 'ChartLimitLabelPosition' to a value of type 'ChartLimitLine.ChartLimitLabelPosition' [\#131](https://github.com/danielgindi/Charts/issues/131) +- Data disappearing while zooming/panning when y-values are not ordered by x [\#130](https://github.com/danielgindi/Charts/issues/130) +- Cannot load underlying module for 'Charts' [\#129](https://github.com/danielgindi/Charts/issues/129) +- Any way to add/use image for xVals? [\#126](https://github.com/danielgindi/Charts/issues/126) +- Install with cocoapod into project supporting iOS 7 and later [\#125](https://github.com/danielgindi/Charts/issues/125) +- Lines clipping top and bottom with lineWidth \> 1 [\#123](https://github.com/danielgindi/Charts/issues/123) +- Candle chart - make the shadow same color as an increasing/decreasing candle color [\#122](https://github.com/danielgindi/Charts/issues/122) +- Down-casted Array element failed to match the target type [\#121](https://github.com/danielgindi/Charts/issues/121) +- y axis spaces between labels are too wide [\#120](https://github.com/danielgindi/Charts/issues/120) +- Different colors for single data set in Bar Chart [\#118](https://github.com/danielgindi/Charts/issues/118) +- The new version demo has a problem. [\#117](https://github.com/danielgindi/Charts/issues/117) +- non-public selectors while submitting app [\#116](https://github.com/danielgindi/Charts/issues/116) +- Adding a minimum parameter to setVisibleXRange [\#115](https://github.com/danielgindi/Charts/issues/115) +- Add 'drawHighlightEnabled' to ChartDataSet [\#114](https://github.com/danielgindi/Charts/issues/114) +- Pull to refresh [\#112](https://github.com/danielgindi/Charts/issues/112) +- Can we create thumb for each chart? [\#111](https://github.com/danielgindi/Charts/issues/111) +- Issue setting the chartView.delegate to self. [\#110](https://github.com/danielgindi/Charts/issues/110) +- combine swift in Objective-C project [\#108](https://github.com/danielgindi/Charts/issues/108) +- get X translation distance on the x-axis [\#105](https://github.com/danielgindi/Charts/issues/105) +- Horizontal Bar Chart Screenshot on README is Broken [\#103](https://github.com/danielgindi/Charts/issues/103) +- Bars [\#102](https://github.com/danielgindi/Charts/issues/102) +- Crash when redraw graph from 2 lines to 1 line with click on highlight [\#101](https://github.com/danielgindi/Charts/issues/101) +- Release Bug [\#98](https://github.com/danielgindi/Charts/issues/98) +- Add '@objc' to ChartViewPortHandler [\#97](https://github.com/danielgindi/Charts/issues/97) +- Bar Chart Delegate. [\#96](https://github.com/danielgindi/Charts/issues/96) +- Cannot turn off Barchart Zoom Propertry [\#91](https://github.com/danielgindi/Charts/issues/91) +- calcMinMax\(\) during scrolling / panning [\#89](https://github.com/danielgindi/Charts/issues/89) +- defaultTouchEventsEnabled [\#88](https://github.com/danielgindi/Charts/issues/88) +- 'chartsample-Swift.h' file not found [\#87](https://github.com/danielgindi/Charts/issues/87) +- Infinite loop when setting data on ChartDataEntry object [\#86](https://github.com/danielgindi/Charts/issues/86) +- Custom text over bar chart. [\#84](https://github.com/danielgindi/Charts/issues/84) +- Stop hiding of xAxis label. [\#79](https://github.com/danielgindi/Charts/issues/79) +- Consider draw map chart without location, navigation stuff? [\#78](https://github.com/danielgindi/Charts/issues/78) +- Line Chart - Simple Design [\#77](https://github.com/danielgindi/Charts/issues/77) +- Can you give me a swift's demo [\#75](https://github.com/danielgindi/Charts/issues/75) +- What files exactly should I drag to my project to make it work on iOS 7.0? [\#73](https://github.com/danielgindi/Charts/issues/73) +- How to check chart is zoomed in ? [\#71](https://github.com/danielgindi/Charts/issues/71) +- Changing descriptionTextColor not possible [\#70](https://github.com/danielgindi/Charts/issues/70) +- Confused by this snippet code [\#69](https://github.com/danielgindi/Charts/issues/69) +- XAxis Co-Ordination with Y Axis [\#68](https://github.com/danielgindi/Charts/issues/68) +- Is there a way can make LineDataSets not selected when their visible property is no? [\#67](https://github.com/danielgindi/Charts/issues/67) +- Multiple Chart View Within ScrollView [\#65](https://github.com/danielgindi/Charts/issues/65) + +**Merged pull requests:** + +- Fixes to allow the code to compile with Swift 2.0 [\#232](https://github.com/danielgindi/Charts/pull/232) ([jmacmullin](https://github.com/jmacmullin)) +- fix radar chart negative value rendering bug if startAtZeroEnabled is false for issue \#166 [\#207](https://github.com/danielgindi/Charts/pull/207) ([liuxuan30](https://github.com/liuxuan30)) +- Fixes for beta 3 [\#200](https://github.com/danielgindi/Charts/pull/200) ([petester42](https://github.com/petester42)) +- Performance Enhancements \#29 - candle chart [\#192](https://github.com/danielgindi/Charts/pull/192) ([dorsoft](https://github.com/dorsoft)) +- Candle chart - make the shadow same color as an candle color \#122 [\#191](https://github.com/danielgindi/Charts/pull/191) ([dorsoft](https://github.com/dorsoft)) +- ChartData.removeEntryByXIndex removes the wrong entry \#182 [\#185](https://github.com/danielgindi/Charts/pull/185) ([dorsoft](https://github.com/dorsoft)) +- The line charts have started to properly display balloon markers [\#179](https://github.com/danielgindi/Charts/pull/179) ([Maxim-38RUS-Zabelin](https://github.com/Maxim-38RUS-Zabelin)) +- Fix a silly bug. should check if first is -0.0 [\#165](https://github.com/danielgindi/Charts/pull/165) ([liuxuan30](https://github.com/liuxuan30)) +- add NaN check to allow non-digits handling for radar chart [\#152](https://github.com/danielgindi/Charts/pull/152) ([liuxuan30](https://github.com/liuxuan30)) +- optional protocol method should not be force unwrapped [\#147](https://github.com/danielgindi/Charts/pull/147) ([liuxuan30](https://github.com/liuxuan30)) +- add missing module CoreGraphics for BubbleChartView [\#146](https://github.com/danielgindi/Charts/pull/146) ([liuxuan30](https://github.com/liuxuan30)) +- Adding a minimum parameter to setVisibleXRange [\#119](https://github.com/danielgindi/Charts/pull/119) ([dorsoft](https://github.com/dorsoft)) +- Added support for setting a custom width that is wider than the longe… [\#107](https://github.com/danielgindi/Charts/pull/107) ([AlBirdie](https://github.com/AlBirdie)) +- Offset adjustment when drawLabels on the x axis is disabled. [\#106](https://github.com/danielgindi/Charts/pull/106) ([AlBirdie](https://github.com/AlBirdie)) +- AutoScaling yAxis during panning / zooming [\#95](https://github.com/danielgindi/Charts/pull/95) ([AlBirdie](https://github.com/AlBirdie)) +- Allow access to setLabelsToSkip from Objective-C. [\#93](https://github.com/danielgindi/Charts/pull/93) ([mkubenka](https://github.com/mkubenka)) +- Changing iOS deployment target to 8.0 from 8.1 [\#74](https://github.com/danielgindi/Charts/pull/74) ([michaelmcguire](https://github.com/michaelmcguire)) + +## [v2.1.0](https://github.com/danielgindi/Charts/tree/v2.1.0) (2015-05-05) +[Full Changelog](https://github.com/danielgindi/Charts/compare/v2.0.9...v2.1.0) + +**Implemented enhancements:** + +- Drawing CubicLineChart based on NSDates [\#38](https://github.com/danielgindi/Charts/issues/38) +- Skip first and last value [\#23](https://github.com/danielgindi/Charts/issues/23) + +**Fixed bugs:** + +- Chart Line vanishes on pinch to zoom [\#63](https://github.com/danielgindi/Charts/issues/63) + +**Closed issues:** + +- Expose chartYMin and chartYMax to rendererDelegates [\#64](https://github.com/danielgindi/Charts/issues/64) +- dyld\_fatal\_error [\#60](https://github.com/danielgindi/Charts/issues/60) +- Unknown class LineChartView in Interface Builder file [\#59](https://github.com/danielgindi/Charts/issues/59) +- Is there any inertia effect in the library? [\#58](https://github.com/danielgindi/Charts/issues/58) +- Library not loaded: @rpath/Charts.framework/Charts Xcode 6.3.1, iOS 8.3 [\#57](https://github.com/danielgindi/Charts/issues/57) +- i am getting this issue? [\#55](https://github.com/danielgindi/Charts/issues/55) +- sample swift project of danielgindi/ios-charts? [\#54](https://github.com/danielgindi/Charts/issues/54) +- i want develop charts in swift? [\#53](https://github.com/danielgindi/Charts/issues/53) +- When I used iOS-charts in iOS 7 project [\#52](https://github.com/danielgindi/Charts/issues/52) +- Changing the specific data point \(circle color\) in Line Chart [\#51](https://github.com/danielgindi/Charts/issues/51) +- When i use ios-charts with swift .. [\#50](https://github.com/danielgindi/Charts/issues/50) +- Charts won't draw unless initialized with a frame [\#49](https://github.com/danielgindi/Charts/issues/49) +- PieChart chartValueSelected don't return the good entry [\#48](https://github.com/danielgindi/Charts/issues/48) +- Cannot find this repo through Cocoapods.org [\#47](https://github.com/danielgindi/Charts/issues/47) +- Use of undeclared type 'CGFloat' [\#44](https://github.com/danielgindi/Charts/issues/44) +- CandleChartData isn't combinable with other data types [\#42](https://github.com/danielgindi/Charts/issues/42) +- Two graphs overlaying each other [\#41](https://github.com/danielgindi/Charts/issues/41) +- Charts with long Title [\#40](https://github.com/danielgindi/Charts/issues/40) +- piechart - yOffset [\#39](https://github.com/danielgindi/Charts/issues/39) +- Two different-scale axis support for different data sets [\#36](https://github.com/danielgindi/Charts/issues/36) +- IBInspectable support? [\#34](https://github.com/danielgindi/Charts/issues/34) +- ChartsDemo-swift.h file not found [\#31](https://github.com/danielgindi/Charts/issues/31) +- Pinch zoom release triggers pan [\#30](https://github.com/danielgindi/Charts/issues/30) +- UISwipeGestureRecognizer [\#28](https://github.com/danielgindi/Charts/issues/28) +- pod not support iOS 7.0 ??? [\#27](https://github.com/danielgindi/Charts/issues/27) +- How to add a line-chart view in UITableViewCell ? [\#26](https://github.com/danielgindi/Charts/issues/26) +- Charts/Charts.h file not found [\#24](https://github.com/danielgindi/Charts/issues/24) +- Carthage support [\#21](https://github.com/danielgindi/Charts/issues/21) +- Unresolved identifier `CGFloat` in iOS 7 project [\#19](https://github.com/danielgindi/Charts/issues/19) +- Last item's visibility issue when zooming [\#18](https://github.com/danielgindi/Charts/issues/18) +- Unable to hide Y values [\#17](https://github.com/danielgindi/Charts/issues/17) + +**Merged pull requests:** + +- Fix x-axis limit line render issue. [\#66](https://github.com/danielgindi/Charts/pull/66) ([mkubenka](https://github.com/mkubenka)) +- Added possibility to set the axisLabelModulus manually. [\#56](https://github.com/danielgindi/Charts/pull/56) ([webventil](https://github.com/webventil)) +- Add missing UIKit imports for iOS 7 support [\#45](https://github.com/danielgindi/Charts/pull/45) ([msanders](https://github.com/msanders)) +- Add 'init' to PieChartData to be used from Swift [\#37](https://github.com/danielgindi/Charts/pull/37) ([jmnavarro](https://github.com/jmnavarro)) +- Bubble chart work by @petester42 [\#32](https://github.com/danielgindi/Charts/pull/32) ([danielgindi](https://github.com/danielgindi)) +- Added Bubble Chart Type [\#25](https://github.com/danielgindi/Charts/pull/25) ([petester42](https://github.com/petester42)) +- Shared Charts.framework scheme [\#22](https://github.com/danielgindi/Charts/pull/22) ([zenkimoto](https://github.com/zenkimoto)) +- Add missing UIKit [\#20](https://github.com/danielgindi/Charts/pull/20) ([mkalmes](https://github.com/mkalmes)) + +## [v2.0.9](https://github.com/danielgindi/Charts/tree/v2.0.9) (2015-04-08) +[Full Changelog](https://github.com/danielgindi/Charts/compare/0.0.1...v2.0.9) + +**Closed issues:** + +- Import with Swift\(not objc\) not working [\#14](https://github.com/danielgindi/Charts/issues/14) + +**Merged pull requests:** + +- Added a podspec [\#13](https://github.com/danielgindi/Charts/pull/13) ([petester42](https://github.com/petester42)) + +## [0.0.1](https://github.com/danielgindi/Charts/tree/0.0.1) (2015-04-07) +**Closed issues:** + +- Need Version to be compatible with Xcode 6.2 [\#12](https://github.com/danielgindi/Charts/issues/12) +- Can't import "module-swift.h" [\#11](https://github.com/danielgindi/Charts/issues/11) +- A lot of compile errors. [\#10](https://github.com/danielgindi/Charts/issues/10) +- 357 Compile Errors on framework files [\#8](https://github.com/danielgindi/Charts/issues/8) +- demo crashes, and no swift examples? [\#7](https://github.com/danielgindi/Charts/issues/7) +- xcode complains ChartsDemo-Swift.h can't be found [\#6](https://github.com/danielgindi/Charts/issues/6) +- Cocoapod [\#4](https://github.com/danielgindi/Charts/issues/4) +- Trying to compile demo code,but tons of compiler errors [\#3](https://github.com/danielgindi/Charts/issues/3) +- Command failed due to signal: Segmentation fault: 11 [\#2](https://github.com/danielgindi/Charts/issues/2) + +**Merged pull requests:** + +- Fix README typo [\#5](https://github.com/danielgindi/Charts/pull/5) ([nwest](https://github.com/nwest)) +- Add a Bitdeli Badge to README [\#1](https://github.com/danielgindi/Charts/pull/1) ([bitdeli-chef](https://github.com/bitdeli-chef)) + + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/Carthage/Checkouts/Charts/CONTRIBUTING.md b/Carthage/Checkouts/Charts/CONTRIBUTING.md new file mode 100644 index 00000000000..5b66f22f8fb --- /dev/null +++ b/Carthage/Checkouts/Charts/CONTRIBUTING.md @@ -0,0 +1,49 @@ +# How to contribute + +Bug-fixes and features often come from users of the Charts framework, and improving it greatly. We want to keep it as easy as possible to contribute changes that improve the experience for users all around the world. There are a few guidelines that we +need contributors to follow so that we can have a chance of keeping on +top of things. + +## Simple issues and bug reports + +If you are reporting a bug which can be observed visually, please add to your issue either: + +* Screenshots, if the bug is easily explainable +* A working sample project that we can compile, run, and immediately observe the issue + +## Getting Started with Contributions + +* Make sure you have a [GitHub account](https://github.com/signup/free) +* Submit a ticket for your issue, assuming one does not already exist. + * Clearly describe the issue including steps to reproduce when it is a bug. + * Make sure you fill in the earliest version (or commit number) that you know has the issue. +* Fork the repository on GitHub + +## Making Changes + +* Create a topic branch from where you want to base your work. This is usually the master branch. +* Make commits of logical units. +* Make sure your code conforms to the code style around it. It's easy, just look around! +* If you have made changes back and forth, or have made merges, your commit history might look messy and hard to understand. A single issue or change should still be in one commit. So please squash those commits together and rebase them however you need to - to make our lives easier when reading it later. +* Check for unnecessary whitespace with `git diff --check` before committing. +* Make sure your commit messages are in the proper format. + +```` + First line must be up to 50 chars (Fixes #1234) + + The first line should be a short statement as to what have changed, and should also include an issue number, prefixed with a hash. + The body of the message comes after an empty new line, and describes the changes + more thoroughly, especially if there was a special case handled there, + or maybe some trickery that only code wizards can understand. +```` + +* Make sure you have tested your changes well. +* If your changes could theoretically affect some other component or case, which you do not necessarily use, you still have to test it. +* Create a Pull Request from your topic branch to the relevant branch in the main repo. If you go to the main repo of the framework, you'll see a big green button which pretty much prepares the PR for you. You just have to hit it. + +## Making Trivial Changes + +For changes of a trivial nature to comments and documentation, it is not +always necessary to create a new ticket. In this case, it is +appropriate to start the first line of a commit with '(doc)' instead of +a ticket number. Even the default commit message the GitHub generates is fine with us. diff --git a/Carthage/Checkouts/Charts/Cartfile.private b/Carthage/Checkouts/Charts/Cartfile.private new file mode 100644 index 00000000000..ca931038c5c --- /dev/null +++ b/Carthage/Checkouts/Charts/Cartfile.private @@ -0,0 +1 @@ +github "uber/ios-snapshot-test-case" diff --git a/Carthage/Checkouts/Charts/Cartfile.resolved b/Carthage/Checkouts/Charts/Cartfile.resolved new file mode 100644 index 00000000000..7c08e7ba555 --- /dev/null +++ b/Carthage/Checkouts/Charts/Cartfile.resolved @@ -0,0 +1 @@ +github "uber/ios-snapshot-test-case" "6.0.3" diff --git a/Carthage/Checkouts/Charts/Charts.podspec b/Carthage/Checkouts/Charts/Charts.podspec new file mode 100644 index 00000000000..b40042a3058 --- /dev/null +++ b/Carthage/Checkouts/Charts/Charts.podspec @@ -0,0 +1,19 @@ +Pod::Spec.new do |s| + s.name = "Charts" + s.version = "3.3.0" + s.summary = "Charts is a powerful & easy to use chart library for iOS, tvOS and OSX (and Android)" + s.homepage = "https://github.com/danielgindi/Charts" + s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" } + s.authors = "Daniel Cohen Gindi", "Philipp Jahoda" + s.ios.deployment_target = "8.0" + s.tvos.deployment_target = "9.0" + s.osx.deployment_target = "10.11" + s.source = { :git => "https://github.com/danielgindi/Charts.git", :tag => "v#{s.version}" } + s.default_subspec = "Core" + s.swift_version = '5.0' + s.cocoapods_version = '>= 1.5.0' + + s.subspec "Core" do |ss| + ss.source_files = "Source/Charts/**/*.swift" + end +end diff --git a/Carthage/Checkouts/Charts/Charts.xcodeproj/project.pbxproj b/Carthage/Checkouts/Charts/Charts.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..61309fb5800 --- /dev/null +++ b/Carthage/Checkouts/Charts/Charts.xcodeproj/project.pbxproj @@ -0,0 +1,1260 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 00B8BF5901C2D220357B0B2A /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 41DDB768A1D033A34F0EF9E0 /* Media.xcassets */; }; + 00BC23EF0E04E17188344403 /* BarChartDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D7184C8A5A60A3522AB9B05 /* BarChartDataProvider.swift */; }; + 02A6E6E1A82A27A66B8D08C4 /* MoveViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 266E162DA8B29D9AEB6A9397 /* MoveViewJob.swift */; }; + 03960E8148C6AEDACE4B77CC /* IMarker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 596963A429D485E3894C4666 /* IMarker.swift */; }; + 0511E43EF3FD2CDE7F7F15DB /* ScatterChartDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FD37A55B4D85D883E29C744 /* ScatterChartDataProvider.swift */; }; + 05253AFC448C107DEF54C2FE /* CombinedChartRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52265C1B343CCC41AF2300E3 /* CombinedChartRenderer.swift */; }; + 0529DD51622C8769C1121F90 /* CrossShapeRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 823F7DB281C6C6F069A69605 /* CrossShapeRenderer.swift */; }; + 0577C2B38BCE4C871F262714 /* AnimatedZoomViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C2EA58CB336967198D30D20 /* AnimatedZoomViewJob.swift */; }; + 064989461F5C99C7006E8BB3 /* Snapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 064989451F5C99C7006E8BB3 /* Snapshot.swift */; }; + 0A772AEC08246FEC480673E5 /* PieRadarChartViewBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A6C9631C69B2D772BBD9232 /* PieRadarChartViewBase.swift */; }; + 0C52C70C6E6EA09BD7426386 /* RadarChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB57D6FA41029B08F26D7B /* RadarChartData.swift */; }; + 0CAF514A280FF6A14E2A1A23 /* CombinedChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11EF1FE22549E885C8F40738 /* CombinedChartView.swift */; }; + 0D8A89398F9BD5DCC8D7F976 /* ICandleChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18BFB0A14A5C47A302A597D9 /* ICandleChartDataSet.swift */; }; + 11F68AA2EBF822D7208EE002 /* YAxisRendererRadarChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA5A16F4A382813C4FE8BDF9 /* YAxisRendererRadarChart.swift */; }; + 1311BEC21E9CC264E971EFAF /* ILineRadarChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F7E6A99D82E6AE3804D5A39 /* ILineRadarChartDataSet.swift */; }; + 135F11CE20425AF600D655A3 /* PieChartTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 135F11CD20425AF600D655A3 /* PieChartTests.swift */; }; + 146EE16342C2BADC92E45BF2 /* ILineScatterCandleRadarChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9249AD9AEC8C85772365A128 /* ILineScatterCandleRadarChartDataSet.swift */; }; + 17E994DA88777AA1D8CCFC58 /* BarChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C31AA65EA27776F8C653C7E8 /* BarChartDataSet.swift */; }; + 203A39685CC96FC625F616E4 /* IHighlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 998F2BFE318471AFC05B50AC /* IHighlighter.swift */; }; + 219192CA6B4895319AB49DCA /* BarLineScatterCandleBubbleRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1C588E9DF6FFD56D7ADF8E /* BarLineScatterCandleBubbleRenderer.swift */; }; + 224EFF991FBAAC4700CF9B3B /* EquatableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 224EFF981FBAAC4700CF9B3B /* EquatableTests.swift */; }; + 23649EFC635A76022F07FFA6 /* PieChartDataEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD02157CF8CEE1189BF681DA /* PieChartDataEntry.swift */; }; + 23FA50B2730D8C7ACA091C4F /* BarChartRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75F279974FE650E57A061B09 /* BarChartRenderer.swift */; }; + 24151B0729D77251A8494D70 /* LineRadarRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 105FFC9D3773A9C7A60A897F /* LineRadarRenderer.swift */; }; + 2876E17AEB1D92D7BBC4C38A /* PieChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DCD13D558BA177D5952AD66 /* PieChartView.swift */; }; + 28FEE609C5B22FD64C7E5D10 /* BarLineScatterCandleBubbleChartDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FF03960A871A092F5B54315 /* BarLineScatterCandleBubbleChartDataProvider.swift */; }; + 2A94F1724FEA9E16A81A8E1F /* XAxisRendererHorizontalBarChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F3D55A7E6176D52DC957D27 /* XAxisRendererHorizontalBarChart.swift */; }; + 2B791E64E7C4523B1A63F72A /* ScatterChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7AD2FC320A16CA1EE0A52F4 /* ScatterChartData.swift */; }; + 2B821AAC3EBD60A73EACBCE6 /* LegendRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F715DB2C56C9E0615542625B /* LegendRenderer.swift */; }; + 2BA03CEC36BADCF682F1328B /* LineChartDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFABD027DAF6851088F002AC /* LineChartDataProvider.swift */; }; + 2BF85BEA981B359A65E9BF67 /* LineChartTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1819D72CD7B6C4A4E8048 /* LineChartTests.swift */; }; + 2C40CFFC8D88BEA70E0A50B0 /* IBubbleChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3788EC55EF908B0805D7C2F /* IBubbleChartDataSet.swift */; }; + 2C879FC24D7A15D70BE4063F /* PieChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E03A4987F72414A02A0631B /* PieChartData.swift */; }; + 2FBA7E982EB57932B9F3E9B5 /* YAxis.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB92A80F861C1362EED8D946 /* YAxis.swift */; }; + 3097296AC7FFA994FE4AD312 /* PieRadarHighlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F7B9DF1F2D66E7279771D4 /* PieRadarHighlighter.swift */; }; + 30DCC4BAA5601B154ABADA13 /* CandleChartDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F8146ABC9FC311AF8CA699C /* CandleChartDataProvider.swift */; }; + 331AA2C4BC34F56C23012F02 /* CombinedChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DDE409E9ECF54D2C146A6F0 /* CombinedChartData.swift */; }; + 3395682A1E27756651FF6F4D /* BarChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0108D5925E21A47DA36A66AA /* BarChartData.swift */; }; + 369DEB23452CB436A3A1A644 /* MarkerImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392AAEB02DD7B351D92907C2 /* MarkerImage.swift */; }; + 383D68A13E1C3D6A251E5147 /* CandleChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274116834B1B0345D622E027 /* CandleChartDataSet.swift */; }; + 3B11556EB7DC034E2FC958E4 /* BarChartTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C3F5E1A69EC06E86505F7B1 /* BarChartTests.swift */; }; + 3CBE95F1E9394FA08CDCF31E /* BarHighlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 543729805D897CC03E5F78D3 /* BarHighlighter.swift */; }; + 40C82F2209E1BA9E41E8F3DA /* ChartColorTemplates.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6227A646166E248F90F86AD /* ChartColorTemplates.swift */; }; + 41B13F3179ACB5A3837C6E55 /* YAxisRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 688B80F1AA88AE54152BE768 /* YAxisRenderer.swift */; }; + 41BEBF8BDB9DC403B5697D67 /* XAxisRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C02C3AF5C92FCFC18224C35 /* XAxisRenderer.swift */; }; + 4272DA5D44AF7DA05A5A8287 /* BubbleChartDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDEAF554FD0D68EA4C0E7E49 /* BubbleChartDataProvider.swift */; }; + 4390D74986A92DEF4F4F2BF0 /* ChartLimitLine.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6DEBFAB1D73E944ED430B4F /* ChartLimitLine.swift */; }; + 45C459FA25DFCBE62FA6A06C /* BarChartDataEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3F8BFF1CBC58D5B9DBFFB9B /* BarChartDataEntry.swift */; }; + 48E875BBD6540BDE1C1B7D3D /* AxisBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B7AEFBF4D85B9D2EAAB3071 /* AxisBase.swift */; }; + 4E98788ABEF6496C23F3E6C6 /* HorizontalBarHighlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33BE9A97FFA41D3D85CAFFC7 /* HorizontalBarHighlighter.swift */; }; + 4FACC6FD308AFB231EB4A93D /* XAxisRendererRadarChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC19DC2434D65FFB446A61B7 /* XAxisRendererRadarChart.swift */; }; + 50476F8E6662CAFC1EFE0723 /* IScatterChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 219BC9CEA037F897E92E45D1 /* IScatterChartDataSet.swift */; }; + 515E286E6C47594D3FFA3DD1 /* ViewPortHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72EAEBB7CF73E33565FC2896 /* ViewPortHandler.swift */; }; + 53A91F6F86740E26FE733639 /* BarLineScatterCandleBubbleChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D717F0808DE7EC8A4AE9C2A /* BarLineScatterCandleBubbleChartDataSet.swift */; }; + 56E0F5EA9255B9B92876E040 /* BubbleChartRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2194AA554712E6BA2677F114 /* BubbleChartRenderer.swift */; }; + 5C457D9A50DA20869AD1739D /* ScatterChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18462BFDD9DEE76D51D40503 /* ScatterChartView.swift */; }; + 5DC9BC1B6C128B2C9995AB84 /* ScatterChartRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80D5B764EC0AE1E17E55DC67 /* ScatterChartRenderer.swift */; }; + 5F96E95C7073D21EFE02BCF7 /* LineChartRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DABDBBCCE6B3620C967F04A /* LineChartRenderer.swift */; }; + 60EDF735AAB7195DCFA5FE4D /* CandleStickChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA1A58428DC4780BAB4EAADC /* CandleStickChartView.swift */; }; + 6303DBDEE4FAB8E40D023BCE /* RadarChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2440DB759AB93B4A928A3F6F /* RadarChartView.swift */; }; + 63C0A21D145BFEDED5406E4D /* BubbleChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = B44829AF0ADA583F1F0279B7 /* BubbleChartDataSet.swift */; }; + 64FA1EDB4DC1F65727D52D10 /* CombinedHighlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2465CB73738EBAFB46C57288 /* CombinedHighlighter.swift */; }; + 65EA404AE098EBCE8D5DE04B /* CombinedChartDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = A140F644332704916947B58C /* CombinedChartDataProvider.swift */; }; + 66A18A8EEBAAAC2EDA31ABEC /* ChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CEC0C69C89CE9B99F3B4409 /* ChartDataSet.swift */; }; + 69EA073EDF75D49ABE1715D6 /* RadarChartRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC9C3D69ACB5BDE22421E15 /* RadarChartRenderer.swift */; }; + 73EDF662AD989E930D365B72 /* PieHighlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7036F11832C017E26AC750A4 /* PieHighlighter.swift */; }; + 758EB1C75063ED3373542F3B /* Highlight.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D64616883374310C505EC39 /* Highlight.swift */; }; + 779B46E9F13A087BFA47D539 /* DefaultAxisValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A4770E0F75EFFC30707A7C8 /* DefaultAxisValueFormatter.swift */; }; + 78084A4F1D850D5775BC139E /* XAxis.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5225ABC3C0C2F65FC094EEBB /* XAxis.swift */; }; + 795E100895C24049509F1EDE /* PieChartRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46D8013D44629521B1746364 /* PieChartRenderer.swift */; }; + 796D3E63A37A95FD9D1AB9A1 /* ChevronDownShapeRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C52E8344160B5E689DA3C25C /* ChevronDownShapeRenderer.swift */; }; + 7C9CE6718D18859A35146098 /* BarLineScatterCandleBubbleChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 559DB735FEA17AB90676D6CA /* BarLineScatterCandleBubbleChartData.swift */; }; + 7CB7F74752619B0270CCB0A9 /* LineRadarChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45E31A4356CC6F283C29954B /* LineRadarChartDataSet.swift */; }; + 7D546013F3A14FF5BB7F3294 /* ChartDataEntryBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12409C3EA15787C11AF0D2BC /* ChartDataEntryBase.swift */; }; + 7E7561DE19DC7CABBE0B2D3A /* LineChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0619A877C69A95ECCC440A44 /* LineChartView.swift */; }; + 7EE6EFE70CF4D8B09CAFCD01 /* AnimatedMoveViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA157EFF2F952192C11DF937 /* AnimatedMoveViewJob.swift */; }; + 8102A555DD6C93AC1290EA7C /* Fill.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A4CFFFB65819121595F06F1 /* Fill.swift */; }; + 81892994002C0640AD858748 /* ChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = E120E76C6F1B5877D56126DD /* ChartData.swift */; }; + 83BBAF3EDC31FD452F8BF1DB /* IRadarChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EAD807534620E3B53327F04 /* IRadarChartDataSet.swift */; }; + 846AC09831FA93F66732591B /* YAxisRendererHorizontalBarChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAE417AAA0FCA0DD00E77489 /* YAxisRendererHorizontalBarChart.swift */; }; + 8A463E2947F211C594CA5E95 /* TransformerHorizontalBarChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = 324C9127B53A8D39C8B49277 /* TransformerHorizontalBarChart.swift */; }; + 8A9FF54E2075A9047CC8E953 /* IShapeRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA1D3D13180C2E3893A82546 /* IShapeRenderer.swift */; }; + 8BCCD709AACC565613D9DA68 /* CandleStickChartRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD5C6D20243EC2F19069AACD /* CandleStickChartRenderer.swift */; }; + 8E1192F7A7152E9DA92C56A9 /* ChartUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AB9062A28AAB9469752A954 /* ChartUtilsTests.swift */; }; + 8EF7B3FBE37F72CC030CD865 /* SquareShapeRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32FC01A016DFF1BA73AF9182 /* SquareShapeRenderer.swift */; }; + 8F4B1A9060472764073DFA0B /* TriangleShapeRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8FB6219B143F8F7DA762950 /* TriangleShapeRenderer.swift */; }; + 9360348A04723E653FBC8B18 /* MarkerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48164CCD83C51B496533CB77 /* MarkerView.swift */; }; + 93A94E1FF55041A6032891FE /* XShapeRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23D35CF6F9177D77B6B97AE1 /* XShapeRenderer.swift */; }; + 9400725714D0DA707DDECD2E /* ViewPortJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA7BDB22C97F39A4B33E38A7 /* ViewPortJob.swift */; }; + 95B6D6F35684292A62DBEA74 /* LineChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5A75AA73C5AA381DA517959 /* LineChartDataSet.swift */; }; + 967EE2EDDE3337C5C4337C59 /* IndexAxisValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DD0A02E3CF611BD11EBA9B /* IndexAxisValueFormatter.swift */; }; + 97AD2D4620AF917100F9C24A /* Platform+Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97AD2D4520AF917100F9C24A /* Platform+Accessibility.swift */; }; + 97E033CC0ABEF0F448DAFA8E /* DataApproximator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93EF9709CF635BEE70D1ABC5 /* DataApproximator.swift */; }; + 98E2EEF45E8933E4AD182D58 /* ChartViewBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30EFAD7920F76360ADB3B5F5 /* ChartViewBase.swift */; }; + 9A26C8DB1F87B01700367599 /* DataApproximator+N.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A26C8DA1F87B01700367599 /* DataApproximator+N.swift */; }; + 9C91C151608E2D6E19B1EAD1 /* Range.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F099502DA50C56204E7B744 /* Range.swift */; }; + 9F760570BCECB0BF5727AF90 /* BarLineChartViewBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45C6D3723C4E001B119CA0C8 /* BarLineChartViewBase.swift */; }; + A40ACF0CCE96EEE104B0463D /* IValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EAA8AA30C377D54D22A577A /* IValueFormatter.swift */; }; + A692D8BDE42717F69DB790BE /* HorizontalBarChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6021C9E424C36116AEA78CC9 /* HorizontalBarChartView.swift */; }; + AEE9C4E4AC02B8FB3CD21975 /* ZoomViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB3A4F5987E58F3E5BE855F9 /* ZoomViewJob.swift */; }; + AF4AAF3709ED9DDF6362EAE8 /* IBarLineScatterCandleBubbleChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5649B272BF3EBFC8A1EF0C1 /* IBarLineScatterCandleBubbleChartDataSet.swift */; }; + B0D28C68BB9A958DC56EB214 /* DefaultValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 107D8F8163EE54D6D9E916B0 /* DefaultValueFormatter.swift */; }; + B13C74B4FF705D7B595D01EF /* IAxisValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BD9DF16AF59680A3BB49452 /* IAxisValueFormatter.swift */; }; + B539114951455C35BADAE3F3 /* PieChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4FB5E3761EF8B4D1E1E1014 /* PieChartDataSet.swift */; }; + B66817462241E3CC00017CF1 /* HorizontalBarChartTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B66817452241E3CC00017CF1 /* HorizontalBarChartTests.swift */; }; + B6BF9A561F91993A00E62A5D /* CombinedChartTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6BF9A551F91993A00E62A5D /* CombinedChartTests.swift */; }; + B6C9F450D937B87224D29D5C /* IFillFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818AC6B12505B7C0A53D62F9 /* IFillFormatter.swift */; }; + B6DCC229615EFE706F64A37D /* LineScatterCandleRadarRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 923206233CA89FD03565FF87 /* LineScatterCandleRadarRenderer.swift */; }; + B85DEB06B4C1AFFC8A0E3295 /* CircleShapeRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECE1B1623D3AF69CECAE8562 /* CircleShapeRenderer.swift */; }; + BEFD9518F3A74ACF8FA33308 /* Charts.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F9922F0641F7955DC6CD324 /* Charts.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C04D269AD4A373FD2B621C43 /* LineChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C978F31F23C7D21197DC2A1 /* LineChartData.swift */; }; + C09E91F67A4AC43C277E7D82 /* BubbleChartDataEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD8ED233775EEC31243A6919 /* BubbleChartDataEntry.swift */; }; + C20A62D8CB9120523D5FB650 /* LegendEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E7C673B9ED4340F550A9283 /* LegendEntry.swift */; }; + C2EFB4EC8C97FA9987F1B50D /* RadarChartDataEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91EEEDE2AB8F2DA3AFCF0733 /* RadarChartDataEntry.swift */; }; + C33E1AF5471A60BA42DAF52E /* RadarHighlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F368CF209744D8F3B85B1028 /* RadarHighlighter.swift */; }; + C3F0DDB7F0A922F0BB7EDB8A /* IBarChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A53A9E42FC07FFDACA937C1 /* IBarChartDataSet.swift */; }; + C7B150D740255670DEB9F455 /* Charts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65AD9E95D9ED4DC0BD73A743 /* Charts.framework */; }; + CB785FE9B6B312408D17BC3B /* ChartUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FDA09EF973925A110506799 /* ChartUtils.swift */; }; + CC7F8198A13249B5DEBBF25E /* AnimatedViewPortJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 710D7C9B2F1DB4A331EE405A /* AnimatedViewPortJob.swift */; }; + CEF68F42A5390A73113F3663 /* Renderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F66B32AD8A878CBD6DB6ED2 /* Renderer.swift */; }; + D29BBEF55C9CC90114919CD2 /* BarChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E783CFB4889A767C76510917 /* BarChartView.swift */; }; + D326491E8BCDE54A0921E137 /* ChartHighlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5983826927D825EF5F855C28 /* ChartHighlighter.swift */; }; + D50B0EC2BB2245F32E757C50 /* CandleChartDataEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E698FF540029B70AC97AD7 /* CandleChartDataEntry.swift */; }; + D819331DA581C7E0AC5F8CEF /* Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3976E5F9D60E30CD94CE6156 /* Animator.swift */; }; + DBC9DB402CC9BB84B76968C4 /* Description.swift in Sources */ = {isa = PBXBuildFile; fileRef = B137428B41C143D5115726C4 /* Description.swift */; }; + DDE704689FDF2C0E0338488B /* CandleChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4785FEACAE4367F36FB8868 /* CandleChartData.swift */; }; + DE0F434FE8C24C52B023370F /* Transformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF475B9593B9898853814340 /* Transformer.swift */; }; + E3B28EA1E21279DF3889BCE8 /* RadarChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1BA6B21CBDF77A15848994F /* RadarChartDataSet.swift */; }; + E4B2F363414E84C4D4B8A885 /* BubbleChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EED352A98860E031F13AFB7 /* BubbleChartView.swift */; }; + E50D291A6B6E69BF0B56A67C /* ChartBaseDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9FE42E868A225C116537368 /* ChartBaseDataSet.swift */; }; + E68CA3DC66EB638C956E09B8 /* BubbleChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EDA3AD550AEFC93C8D15B9C /* BubbleChartData.swift */; }; + E8F0F4F47CD7D72B4EE5A794 /* IChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A32510073A303CBB38E094A /* IChartDataSet.swift */; }; + E9FF0ECB5E0CA92DBF4C1BC4 /* Platform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED23C354AFE81818D78E645 /* Platform.swift */; }; + EAEA60D22CA8C1B7E18D3F7D /* ChartDataEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = F22750328058DEC2F019646F /* ChartDataEntry.swift */; }; + EB56849433A76B08606B73EB /* ScatterChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB1DD1A0F64266A10EE94194 /* ScatterChartDataSet.swift */; }; + ECE7EAE7179A7F57CE9BBD8F /* Legend.swift in Sources */ = {isa = PBXBuildFile; fileRef = E64A75540C627E09080B402A /* Legend.swift */; }; + ECECC58CEF03B1718F8267E8 /* AxisRendererBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = C75935E899183DDFA181E2CC /* AxisRendererBase.swift */; }; + F100D68395F169B93590FA96 /* HorizontalBarChartRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 539382766378B702660FDFB2 /* HorizontalBarChartRenderer.swift */; }; + F103D90FC5DEEA0D7BB4407E /* ChevronUpShapeRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA70259ED16FF80D8EEB0F94 /* ChevronUpShapeRenderer.swift */; }; + F37B07008B8AE7F3909FFB9C /* ChartDataRendererBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0216EDC6A1FE272F4EB19FCF /* ChartDataRendererBase.swift */; }; + F5A209116FAC68F5903D0B46 /* ChartAnimationEasing.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB762958EE8E6521563665D /* ChartAnimationEasing.swift */; }; + F744C510DA9B85C228BBB335 /* DefaultFillFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C1BEFDF17404666C7B6054 /* DefaultFillFormatter.swift */; }; + F941C88BF814DF51C465CB95 /* ILineChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 429E88F2729735DC092EE556 /* ILineChartDataSet.swift */; }; + FA07D034D9C3BC7795184ACA /* LineScatterCandleRadarChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C58BD7B14BEA440783ED8D2B /* LineScatterCandleRadarChartDataSet.swift */; }; + FAAD9FF6565DED2652188584 /* IPieChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA2AA6CC89F809DCCD7605B4 /* IPieChartDataSet.swift */; }; + FD37AAC0270F390FFC470A65 /* ChartDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62B73FCEDD3841E7B958F6A9 /* ChartDataProvider.swift */; }; + FDBDAFA7A5337C6E3992DACE /* ComponentBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8C9A105A7DB64F39DDA648B /* ComponentBase.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + C2005F425A98942473657ED2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 193FC8DF32D250560C5F5D77 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A58A4ED274A941CA248EA921; + remoteInfo = Charts; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 0108D5925E21A47DA36A66AA /* BarChartData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarChartData.swift; path = Source/Charts/Data/Implementations/Standard/BarChartData.swift; sourceTree = ""; }; + 0216EDC6A1FE272F4EB19FCF /* ChartDataRendererBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartDataRendererBase.swift; path = Source/Charts/Renderers/ChartDataRendererBase.swift; sourceTree = ""; }; + 04F7B9DF1F2D66E7279771D4 /* PieRadarHighlighter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PieRadarHighlighter.swift; path = Source/Charts/Highlight/PieRadarHighlighter.swift; sourceTree = ""; }; + 0619A877C69A95ECCC440A44 /* LineChartView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LineChartView.swift; path = Source/Charts/Charts/LineChartView.swift; sourceTree = ""; }; + 064989451F5C99C7006E8BB3 /* Snapshot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Snapshot.swift; path = Tests/Charts/Snapshot.swift; sourceTree = ""; }; + 0BD9DF16AF59680A3BB49452 /* IAxisValueFormatter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IAxisValueFormatter.swift; path = Source/Charts/Formatters/IAxisValueFormatter.swift; sourceTree = ""; }; + 0DABDBBCCE6B3620C967F04A /* LineChartRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LineChartRenderer.swift; path = Source/Charts/Renderers/LineChartRenderer.swift; sourceTree = ""; }; + 0DDE409E9ECF54D2C146A6F0 /* CombinedChartData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CombinedChartData.swift; path = Source/Charts/Data/Implementations/Standard/CombinedChartData.swift; sourceTree = ""; }; + 0F099502DA50C56204E7B744 /* Range.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Range.swift; path = Source/Charts/Highlight/Range.swift; sourceTree = ""; }; + 105FFC9D3773A9C7A60A897F /* LineRadarRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LineRadarRenderer.swift; path = Source/Charts/Renderers/LineRadarRenderer.swift; sourceTree = ""; }; + 107D8F8163EE54D6D9E916B0 /* DefaultValueFormatter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DefaultValueFormatter.swift; path = Source/Charts/Formatters/DefaultValueFormatter.swift; sourceTree = ""; }; + 10DD0A02E3CF611BD11EBA9B /* IndexAxisValueFormatter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IndexAxisValueFormatter.swift; path = Source/Charts/Formatters/IndexAxisValueFormatter.swift; sourceTree = ""; }; + 11EF1FE22549E885C8F40738 /* CombinedChartView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CombinedChartView.swift; path = Source/Charts/Charts/CombinedChartView.swift; sourceTree = ""; }; + 12409C3EA15787C11AF0D2BC /* ChartDataEntryBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartDataEntryBase.swift; path = Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift; sourceTree = ""; }; + 135F11CD20425AF600D655A3 /* PieChartTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PieChartTests.swift; path = Tests/Charts/PieChartTests.swift; sourceTree = ""; }; + 18462BFDD9DEE76D51D40503 /* ScatterChartView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScatterChartView.swift; path = Source/Charts/Charts/ScatterChartView.swift; sourceTree = ""; }; + 18BFB0A14A5C47A302A597D9 /* ICandleChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ICandleChartDataSet.swift; path = Source/Charts/Data/Interfaces/ICandleChartDataSet.swift; sourceTree = ""; }; + 1C02C3AF5C92FCFC18224C35 /* XAxisRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = XAxisRenderer.swift; path = Source/Charts/Renderers/XAxisRenderer.swift; sourceTree = ""; }; + 1CBBC58C6CE1EBEE9852CE41 /* ChartsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ChartsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 1F3D55A7E6176D52DC957D27 /* XAxisRendererHorizontalBarChart.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = XAxisRendererHorizontalBarChart.swift; path = Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift; sourceTree = ""; }; + 2194AA554712E6BA2677F114 /* BubbleChartRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BubbleChartRenderer.swift; path = Source/Charts/Renderers/BubbleChartRenderer.swift; sourceTree = ""; }; + 219BC9CEA037F897E92E45D1 /* IScatterChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IScatterChartDataSet.swift; path = Source/Charts/Data/Interfaces/IScatterChartDataSet.swift; sourceTree = ""; }; + 224EFF981FBAAC4700CF9B3B /* EquatableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = EquatableTests.swift; path = Tests/Charts/EquatableTests.swift; sourceTree = ""; }; + 23D35CF6F9177D77B6B97AE1 /* XShapeRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = XShapeRenderer.swift; path = Source/Charts/Renderers/Scatter/XShapeRenderer.swift; sourceTree = ""; }; + 2440DB759AB93B4A928A3F6F /* RadarChartView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RadarChartView.swift; path = Source/Charts/Charts/RadarChartView.swift; sourceTree = ""; }; + 2465CB73738EBAFB46C57288 /* CombinedHighlighter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CombinedHighlighter.swift; path = Source/Charts/Highlight/CombinedHighlighter.swift; sourceTree = ""; }; + 266E162DA8B29D9AEB6A9397 /* MoveViewJob.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MoveViewJob.swift; path = Source/Charts/Jobs/MoveViewJob.swift; sourceTree = ""; }; + 274116834B1B0345D622E027 /* CandleChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CandleChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift; sourceTree = ""; }; + 2EAD807534620E3B53327F04 /* IRadarChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IRadarChartDataSet.swift; path = Source/Charts/Data/Interfaces/IRadarChartDataSet.swift; sourceTree = ""; }; + 2FD37A55B4D85D883E29C744 /* ScatterChartDataProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScatterChartDataProvider.swift; path = Source/Charts/Interfaces/ScatterChartDataProvider.swift; sourceTree = ""; }; + 30EFAD7920F76360ADB3B5F5 /* ChartViewBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartViewBase.swift; path = Source/Charts/Charts/ChartViewBase.swift; sourceTree = ""; }; + 324C9127B53A8D39C8B49277 /* TransformerHorizontalBarChart.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TransformerHorizontalBarChart.swift; path = Source/Charts/Utils/TransformerHorizontalBarChart.swift; sourceTree = ""; }; + 32FC01A016DFF1BA73AF9182 /* SquareShapeRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SquareShapeRenderer.swift; path = Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift; sourceTree = ""; }; + 33BE9A97FFA41D3D85CAFFC7 /* HorizontalBarHighlighter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HorizontalBarHighlighter.swift; path = Source/Charts/Highlight/HorizontalBarHighlighter.swift; sourceTree = ""; }; + 392AAEB02DD7B351D92907C2 /* MarkerImage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MarkerImage.swift; path = Source/Charts/Components/MarkerImage.swift; sourceTree = ""; }; + 3976E5F9D60E30CD94CE6156 /* Animator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Animator.swift; path = Source/Charts/Animation/Animator.swift; sourceTree = ""; }; + 3A32510073A303CBB38E094A /* IChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IChartDataSet.swift; path = Source/Charts/Data/Interfaces/IChartDataSet.swift; sourceTree = ""; }; + 3D64616883374310C505EC39 /* Highlight.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Highlight.swift; path = Source/Charts/Highlight/Highlight.swift; sourceTree = ""; }; + 3ED23C354AFE81818D78E645 /* Platform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.swift; path = Source/Charts/Utils/Platform.swift; sourceTree = ""; }; + 3F8146ABC9FC311AF8CA699C /* CandleChartDataProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CandleChartDataProvider.swift; path = Source/Charts/Interfaces/CandleChartDataProvider.swift; sourceTree = ""; }; + 3FDA09EF973925A110506799 /* ChartUtils.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartUtils.swift; path = Source/Charts/Utils/ChartUtils.swift; sourceTree = ""; }; + 41DDB768A1D033A34F0EF9E0 /* Media.xcassets */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = folder.assetcatalog; name = Media.xcassets; path = "Tests/Supporting Files/Media.xcassets"; sourceTree = ""; }; + 429E88F2729735DC092EE556 /* ILineChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ILineChartDataSet.swift; path = Source/Charts/Data/Interfaces/ILineChartDataSet.swift; sourceTree = ""; }; + 45C6D3723C4E001B119CA0C8 /* BarLineChartViewBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarLineChartViewBase.swift; path = Source/Charts/Charts/BarLineChartViewBase.swift; sourceTree = ""; }; + 45E31A4356CC6F283C29954B /* LineRadarChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LineRadarChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift; sourceTree = ""; }; + 46D8013D44629521B1746364 /* PieChartRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PieChartRenderer.swift; path = Source/Charts/Renderers/PieChartRenderer.swift; sourceTree = ""; }; + 48164CCD83C51B496533CB77 /* MarkerView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MarkerView.swift; path = Source/Charts/Components/MarkerView.swift; sourceTree = ""; }; + 4A6C9631C69B2D772BBD9232 /* PieRadarChartViewBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PieRadarChartViewBase.swift; path = Source/Charts/Charts/PieRadarChartViewBase.swift; sourceTree = ""; }; + 4B7AEFBF4D85B9D2EAAB3071 /* AxisBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AxisBase.swift; path = Source/Charts/Components/AxisBase.swift; sourceTree = ""; }; + 4BBB57D6FA41029B08F26D7B /* RadarChartData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RadarChartData.swift; path = Source/Charts/Data/Implementations/Standard/RadarChartData.swift; sourceTree = ""; }; + 4C2EA58CB336967198D30D20 /* AnimatedZoomViewJob.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnimatedZoomViewJob.swift; path = Source/Charts/Jobs/AnimatedZoomViewJob.swift; sourceTree = ""; }; + 4C978F31F23C7D21197DC2A1 /* LineChartData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LineChartData.swift; path = Source/Charts/Data/Implementations/Standard/LineChartData.swift; sourceTree = ""; }; + 4EAA8AA30C377D54D22A577A /* IValueFormatter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IValueFormatter.swift; path = Source/Charts/Formatters/IValueFormatter.swift; sourceTree = ""; }; + 4EED352A98860E031F13AFB7 /* BubbleChartView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BubbleChartView.swift; path = Source/Charts/Charts/BubbleChartView.swift; sourceTree = ""; }; + 4F7E6A99D82E6AE3804D5A39 /* ILineRadarChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ILineRadarChartDataSet.swift; path = Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift; sourceTree = ""; }; + 4F9922F0641F7955DC6CD324 /* Charts.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Charts.h; path = "Source/Supporting Files/Charts.h"; sourceTree = ""; }; + 5225ABC3C0C2F65FC094EEBB /* XAxis.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = XAxis.swift; path = Source/Charts/Components/XAxis.swift; sourceTree = ""; }; + 52265C1B343CCC41AF2300E3 /* CombinedChartRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CombinedChartRenderer.swift; path = Source/Charts/Renderers/CombinedChartRenderer.swift; sourceTree = ""; }; + 539382766378B702660FDFB2 /* HorizontalBarChartRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HorizontalBarChartRenderer.swift; path = Source/Charts/Renderers/HorizontalBarChartRenderer.swift; sourceTree = ""; }; + 543729805D897CC03E5F78D3 /* BarHighlighter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarHighlighter.swift; path = Source/Charts/Highlight/BarHighlighter.swift; sourceTree = ""; }; + 559DB735FEA17AB90676D6CA /* BarLineScatterCandleBubbleChartData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarLineScatterCandleBubbleChartData.swift; path = Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift; sourceTree = ""; }; + 596963A429D485E3894C4666 /* IMarker.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IMarker.swift; path = Source/Charts/Components/IMarker.swift; sourceTree = ""; }; + 5983826927D825EF5F855C28 /* ChartHighlighter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartHighlighter.swift; path = Source/Charts/Highlight/ChartHighlighter.swift; sourceTree = ""; }; + 5A4CFFFB65819121595F06F1 /* Fill.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Fill.swift; path = Source/Charts/Utils/Fill.swift; sourceTree = ""; }; + 5B1C588E9DF6FFD56D7ADF8E /* BarLineScatterCandleBubbleRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarLineScatterCandleBubbleRenderer.swift; path = Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift; sourceTree = ""; }; + 5C3F5E1A69EC06E86505F7B1 /* BarChartTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarChartTests.swift; path = Tests/Charts/BarChartTests.swift; sourceTree = ""; }; + 6021C9E424C36116AEA78CC9 /* HorizontalBarChartView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HorizontalBarChartView.swift; path = Source/Charts/Charts/HorizontalBarChartView.swift; sourceTree = ""; }; + 62B73FCEDD3841E7B958F6A9 /* ChartDataProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartDataProvider.swift; path = Source/Charts/Interfaces/ChartDataProvider.swift; sourceTree = ""; }; + 65AD9E95D9ED4DC0BD73A743 /* Charts.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Charts.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 688B80F1AA88AE54152BE768 /* YAxisRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = YAxisRenderer.swift; path = Source/Charts/Renderers/YAxisRenderer.swift; sourceTree = ""; }; + 6A4770E0F75EFFC30707A7C8 /* DefaultAxisValueFormatter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DefaultAxisValueFormatter.swift; path = Source/Charts/Formatters/DefaultAxisValueFormatter.swift; sourceTree = ""; }; + 6CEC0C69C89CE9B99F3B4409 /* ChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/ChartDataSet.swift; sourceTree = ""; }; + 6D717F0808DE7EC8A4AE9C2A /* BarLineScatterCandleBubbleChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarLineScatterCandleBubbleChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift; sourceTree = ""; }; + 6E03A4987F72414A02A0631B /* PieChartData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PieChartData.swift; path = Source/Charts/Data/Implementations/Standard/PieChartData.swift; sourceTree = ""; }; + 6F66B32AD8A878CBD6DB6ED2 /* Renderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Renderer.swift; path = Source/Charts/Renderers/Renderer.swift; sourceTree = ""; }; + 7036F11832C017E26AC750A4 /* PieHighlighter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PieHighlighter.swift; path = Source/Charts/Highlight/PieHighlighter.swift; sourceTree = ""; }; + 710D7C9B2F1DB4A331EE405A /* AnimatedViewPortJob.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnimatedViewPortJob.swift; path = Source/Charts/Jobs/AnimatedViewPortJob.swift; sourceTree = ""; }; + 72EAEBB7CF73E33565FC2896 /* ViewPortHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ViewPortHandler.swift; path = Source/Charts/Utils/ViewPortHandler.swift; sourceTree = ""; }; + 75F279974FE650E57A061B09 /* BarChartRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarChartRenderer.swift; path = Source/Charts/Renderers/BarChartRenderer.swift; sourceTree = ""; }; + 7A53A9E42FC07FFDACA937C1 /* IBarChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IBarChartDataSet.swift; path = Source/Charts/Data/Interfaces/IBarChartDataSet.swift; sourceTree = ""; }; + 7AB9062A28AAB9469752A954 /* ChartUtilsTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartUtilsTests.swift; path = Tests/Charts/ChartUtilsTests.swift; sourceTree = ""; }; + 7AC9C3D69ACB5BDE22421E15 /* RadarChartRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RadarChartRenderer.swift; path = Source/Charts/Renderers/RadarChartRenderer.swift; sourceTree = ""; }; + 7EDA3AD550AEFC93C8D15B9C /* BubbleChartData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BubbleChartData.swift; path = Source/Charts/Data/Implementations/Standard/BubbleChartData.swift; sourceTree = ""; }; + 80D5B764EC0AE1E17E55DC67 /* ScatterChartRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScatterChartRenderer.swift; path = Source/Charts/Renderers/ScatterChartRenderer.swift; sourceTree = ""; }; + 818AC6B12505B7C0A53D62F9 /* IFillFormatter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IFillFormatter.swift; path = Source/Charts/Formatters/IFillFormatter.swift; sourceTree = ""; }; + 823F7DB281C6C6F069A69605 /* CrossShapeRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CrossShapeRenderer.swift; path = Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift; sourceTree = ""; }; + 8FF03960A871A092F5B54315 /* BarLineScatterCandleBubbleChartDataProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarLineScatterCandleBubbleChartDataProvider.swift; path = Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift; sourceTree = ""; }; + 910DBFE1DA1B2CA237A736DF /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = Info.plist; path = "Source/Supporting Files/Info.plist"; sourceTree = ""; }; + 91EEEDE2AB8F2DA3AFCF0733 /* RadarChartDataEntry.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RadarChartDataEntry.swift; path = Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift; sourceTree = ""; }; + 923206233CA89FD03565FF87 /* LineScatterCandleRadarRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LineScatterCandleRadarRenderer.swift; path = Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift; sourceTree = ""; }; + 9249AD9AEC8C85772365A128 /* ILineScatterCandleRadarChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ILineScatterCandleRadarChartDataSet.swift; path = Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift; sourceTree = ""; }; + 93EF9709CF635BEE70D1ABC5 /* DataApproximator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DataApproximator.swift; path = Source/Charts/Filters/DataApproximator.swift; sourceTree = ""; }; + 97AD2D4520AF917100F9C24A /* Platform+Accessibility.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Platform+Accessibility.swift"; path = "Source/Charts/Utils/Platform+Accessibility.swift"; sourceTree = ""; }; + 998F2BFE318471AFC05B50AC /* IHighlighter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IHighlighter.swift; path = Source/Charts/Highlight/IHighlighter.swift; sourceTree = ""; }; + 9A26C8DA1F87B01700367599 /* DataApproximator+N.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "DataApproximator+N.swift"; path = "Source/Charts/Filters/DataApproximator+N.swift"; sourceTree = ""; }; + 9D7184C8A5A60A3522AB9B05 /* BarChartDataProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarChartDataProvider.swift; path = Source/Charts/Interfaces/BarChartDataProvider.swift; sourceTree = ""; }; + 9DCD13D558BA177D5952AD66 /* PieChartView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PieChartView.swift; path = Source/Charts/Charts/PieChartView.swift; sourceTree = ""; }; + 9E7C673B9ED4340F550A9283 /* LegendEntry.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LegendEntry.swift; path = Source/Charts/Components/LegendEntry.swift; sourceTree = ""; }; + A140F644332704916947B58C /* CombinedChartDataProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CombinedChartDataProvider.swift; path = Source/Charts/Interfaces/CombinedChartDataProvider.swift; sourceTree = ""; }; + A4FB5E3761EF8B4D1E1E1014 /* PieChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PieChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift; sourceTree = ""; }; + A5649B272BF3EBFC8A1EF0C1 /* IBarLineScatterCandleBubbleChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IBarLineScatterCandleBubbleChartDataSet.swift; path = Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift; sourceTree = ""; }; + A5A75AA73C5AA381DA517959 /* LineChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LineChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift; sourceTree = ""; }; + AA5A16F4A382813C4FE8BDF9 /* YAxisRendererRadarChart.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = YAxisRendererRadarChart.swift; path = Source/Charts/Renderers/YAxisRendererRadarChart.swift; sourceTree = ""; }; + AA70259ED16FF80D8EEB0F94 /* ChevronUpShapeRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChevronUpShapeRenderer.swift; path = Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift; sourceTree = ""; }; + B137428B41C143D5115726C4 /* Description.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Description.swift; path = Source/Charts/Components/Description.swift; sourceTree = ""; }; + B1BA6B21CBDF77A15848994F /* RadarChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RadarChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift; sourceTree = ""; }; + B44829AF0ADA583F1F0279B7 /* BubbleChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BubbleChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift; sourceTree = ""; }; + B66817452241E3CC00017CF1 /* HorizontalBarChartTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = HorizontalBarChartTests.swift; path = Tests/Charts/HorizontalBarChartTests.swift; sourceTree = ""; }; + B6BF9A551F91993A00E62A5D /* CombinedChartTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = CombinedChartTests.swift; path = Tests/Charts/CombinedChartTests.swift; sourceTree = ""; }; + BA157EFF2F952192C11DF937 /* AnimatedMoveViewJob.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnimatedMoveViewJob.swift; path = Source/Charts/Jobs/AnimatedMoveViewJob.swift; sourceTree = ""; }; + BA1A58428DC4780BAB4EAADC /* CandleStickChartView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CandleStickChartView.swift; path = Source/Charts/Charts/CandleStickChartView.swift; sourceTree = ""; }; + BC19DC2434D65FFB446A61B7 /* XAxisRendererRadarChart.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = XAxisRendererRadarChart.swift; path = Source/Charts/Renderers/XAxisRendererRadarChart.swift; sourceTree = ""; }; + BD02157CF8CEE1189BF681DA /* PieChartDataEntry.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PieChartDataEntry.swift; path = Source/Charts/Data/Implementations/Standard/PieChartDataEntry.swift; sourceTree = ""; }; + BD5C6D20243EC2F19069AACD /* CandleStickChartRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CandleStickChartRenderer.swift; path = Source/Charts/Renderers/CandleStickChartRenderer.swift; sourceTree = ""; }; + BFABD027DAF6851088F002AC /* LineChartDataProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LineChartDataProvider.swift; path = Source/Charts/Interfaces/LineChartDataProvider.swift; sourceTree = ""; }; + C31AA65EA27776F8C653C7E8 /* BarChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift; sourceTree = ""; }; + C52E8344160B5E689DA3C25C /* ChevronDownShapeRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChevronDownShapeRenderer.swift; path = Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift; sourceTree = ""; }; + C574E1BC7E12D937A5471EF8 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = Info.plist; path = "Tests/Supporting Files/Info.plist"; sourceTree = ""; }; + C58BD7B14BEA440783ED8D2B /* LineScatterCandleRadarChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LineScatterCandleRadarChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift; sourceTree = ""; }; + C75935E899183DDFA181E2CC /* AxisRendererBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AxisRendererBase.swift; path = Source/Charts/Renderers/AxisRendererBase.swift; sourceTree = ""; }; + C8C9A105A7DB64F39DDA648B /* ComponentBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ComponentBase.swift; path = Source/Charts/Components/ComponentBase.swift; sourceTree = ""; }; + C8FB6219B143F8F7DA762950 /* TriangleShapeRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TriangleShapeRenderer.swift; path = Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift; sourceTree = ""; }; + C9FE42E868A225C116537368 /* ChartBaseDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartBaseDataSet.swift; path = Source/Charts/Data/Implementations/ChartBaseDataSet.swift; sourceTree = ""; }; + CB1DD1A0F64266A10EE94194 /* ScatterChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScatterChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift; sourceTree = ""; }; + D2E1819D72CD7B6C4A4E8048 /* LineChartTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LineChartTests.swift; path = Tests/Charts/LineChartTests.swift; sourceTree = ""; }; + D2E698FF540029B70AC97AD7 /* CandleChartDataEntry.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CandleChartDataEntry.swift; path = Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift; sourceTree = ""; }; + D6C1BEFDF17404666C7B6054 /* DefaultFillFormatter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DefaultFillFormatter.swift; path = Source/Charts/Formatters/DefaultFillFormatter.swift; sourceTree = ""; }; + DA2AA6CC89F809DCCD7605B4 /* IPieChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IPieChartDataSet.swift; path = Source/Charts/Data/Interfaces/IPieChartDataSet.swift; sourceTree = ""; }; + DD8ED233775EEC31243A6919 /* BubbleChartDataEntry.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BubbleChartDataEntry.swift; path = Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift; sourceTree = ""; }; + DFB762958EE8E6521563665D /* ChartAnimationEasing.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartAnimationEasing.swift; path = Source/Charts/Animation/ChartAnimationEasing.swift; sourceTree = ""; }; + E120E76C6F1B5877D56126DD /* ChartData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartData.swift; path = Source/Charts/Data/Implementations/Standard/ChartData.swift; sourceTree = ""; }; + E3F8BFF1CBC58D5B9DBFFB9B /* BarChartDataEntry.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarChartDataEntry.swift; path = Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift; sourceTree = ""; }; + E64A75540C627E09080B402A /* Legend.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Legend.swift; path = Source/Charts/Components/Legend.swift; sourceTree = ""; }; + E783CFB4889A767C76510917 /* BarChartView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BarChartView.swift; path = Source/Charts/Charts/BarChartView.swift; sourceTree = ""; }; + E7AD2FC320A16CA1EE0A52F4 /* ScatterChartData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScatterChartData.swift; path = Source/Charts/Data/Implementations/Standard/ScatterChartData.swift; sourceTree = ""; }; + EAE417AAA0FCA0DD00E77489 /* YAxisRendererHorizontalBarChart.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = YAxisRendererHorizontalBarChart.swift; path = Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift; sourceTree = ""; }; + ECE1B1623D3AF69CECAE8562 /* CircleShapeRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CircleShapeRenderer.swift; path = Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift; sourceTree = ""; }; + EDEAF554FD0D68EA4C0E7E49 /* BubbleChartDataProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BubbleChartDataProvider.swift; path = Source/Charts/Interfaces/BubbleChartDataProvider.swift; sourceTree = ""; }; + F22750328058DEC2F019646F /* ChartDataEntry.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartDataEntry.swift; path = Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift; sourceTree = ""; }; + F368CF209744D8F3B85B1028 /* RadarHighlighter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RadarHighlighter.swift; path = Source/Charts/Highlight/RadarHighlighter.swift; sourceTree = ""; }; + F3788EC55EF908B0805D7C2F /* IBubbleChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IBubbleChartDataSet.swift; path = Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift; sourceTree = ""; }; + F4785FEACAE4367F36FB8868 /* CandleChartData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CandleChartData.swift; path = Source/Charts/Data/Implementations/Standard/CandleChartData.swift; sourceTree = ""; }; + F6227A646166E248F90F86AD /* ChartColorTemplates.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartColorTemplates.swift; path = Source/Charts/Utils/ChartColorTemplates.swift; sourceTree = ""; }; + F6DEBFAB1D73E944ED430B4F /* ChartLimitLine.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChartLimitLine.swift; path = Source/Charts/Components/ChartLimitLine.swift; sourceTree = ""; }; + F715DB2C56C9E0615542625B /* LegendRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LegendRenderer.swift; path = Source/Charts/Renderers/LegendRenderer.swift; sourceTree = ""; }; + FA1D3D13180C2E3893A82546 /* IShapeRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IShapeRenderer.swift; path = Source/Charts/Renderers/Scatter/IShapeRenderer.swift; sourceTree = ""; }; + FA7BDB22C97F39A4B33E38A7 /* ViewPortJob.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ViewPortJob.swift; path = Source/Charts/Jobs/ViewPortJob.swift; sourceTree = ""; }; + FB3A4F5987E58F3E5BE855F9 /* ZoomViewJob.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ZoomViewJob.swift; path = Source/Charts/Jobs/ZoomViewJob.swift; sourceTree = ""; }; + FB92A80F861C1362EED8D946 /* YAxis.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = YAxis.swift; path = Source/Charts/Components/YAxis.swift; sourceTree = ""; }; + FF475B9593B9898853814340 /* Transformer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Transformer.swift; path = Source/Charts/Utils/Transformer.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 77997192275C47C45A0A2E9A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C7B150D740255670DEB9F455 /* Charts.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C16A09321DC2DCF289FF0E3B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 031D7C33F3BF172E30664862 /* Interfaces */ = { + isa = PBXGroup; + children = ( + 9D7184C8A5A60A3522AB9B05 /* BarChartDataProvider.swift */, + 8FF03960A871A092F5B54315 /* BarLineScatterCandleBubbleChartDataProvider.swift */, + EDEAF554FD0D68EA4C0E7E49 /* BubbleChartDataProvider.swift */, + 3F8146ABC9FC311AF8CA699C /* CandleChartDataProvider.swift */, + 62B73FCEDD3841E7B958F6A9 /* ChartDataProvider.swift */, + A140F644332704916947B58C /* CombinedChartDataProvider.swift */, + BFABD027DAF6851088F002AC /* LineChartDataProvider.swift */, + 2FD37A55B4D85D883E29C744 /* ScatterChartDataProvider.swift */, + ); + name = Interfaces; + sourceTree = ""; + }; + 033FD152BB2F906750106A85 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; + 098621EDFBF928494B94BEA1 /* Data */ = { + isa = PBXGroup; + children = ( + 3B9DD76FCE8D873300A822C7 /* Implementations */, + DB2D9648877455028EBEAA8F /* Interfaces */, + ); + name = Data; + sourceTree = ""; + }; + 20C350D33133A4D89BB365B1 /* Source */ = { + isa = PBXGroup; + children = ( + E9F158C8C566B26AFD775911 /* Supporting Files */, + 2647844720BC6574A544A337 /* Charts */, + ); + name = Source; + sourceTree = ""; + }; + 2647844720BC6574A544A337 /* Charts */ = { + isa = PBXGroup; + children = ( + A49C1F0F9CCD6E5C143C29F4 /* Animation */, + 8C531E3F3C3DE5843C93C3DA /* Charts */, + 51EF1986C9884C25EED1C2CB /* Components */, + 098621EDFBF928494B94BEA1 /* Data */, + AA79AB82B0ADCA926510B73E /* Filters */, + 74A391010038924F637D6752 /* Formatters */, + 42824E1F334B0C484AF4C594 /* Highlight */, + 031D7C33F3BF172E30664862 /* Interfaces */, + AD1224C45A29A5C88D6B7450 /* Jobs */, + E7589D3E7C2BD2449960AD59 /* Renderers */, + D047819AB7170595896D6FE8 /* Utils */, + ); + name = Charts; + sourceTree = ""; + }; + 3B9DD76FCE8D873300A822C7 /* Implementations */ = { + isa = PBXGroup; + children = ( + C9FE42E868A225C116537368 /* ChartBaseDataSet.swift */, + 740017197A160047EBB8A9A0 /* Standard */, + ); + name = Implementations; + sourceTree = ""; + }; + 42824E1F334B0C484AF4C594 /* Highlight */ = { + isa = PBXGroup; + children = ( + 543729805D897CC03E5F78D3 /* BarHighlighter.swift */, + 5983826927D825EF5F855C28 /* ChartHighlighter.swift */, + 2465CB73738EBAFB46C57288 /* CombinedHighlighter.swift */, + 3D64616883374310C505EC39 /* Highlight.swift */, + 33BE9A97FFA41D3D85CAFFC7 /* HorizontalBarHighlighter.swift */, + 998F2BFE318471AFC05B50AC /* IHighlighter.swift */, + 7036F11832C017E26AC750A4 /* PieHighlighter.swift */, + 04F7B9DF1F2D66E7279771D4 /* PieRadarHighlighter.swift */, + F368CF209744D8F3B85B1028 /* RadarHighlighter.swift */, + 0F099502DA50C56204E7B744 /* Range.swift */, + ); + name = Highlight; + sourceTree = ""; + }; + 51EF1986C9884C25EED1C2CB /* Components */ = { + isa = PBXGroup; + children = ( + 4B7AEFBF4D85B9D2EAAB3071 /* AxisBase.swift */, + F6DEBFAB1D73E944ED430B4F /* ChartLimitLine.swift */, + C8C9A105A7DB64F39DDA648B /* ComponentBase.swift */, + B137428B41C143D5115726C4 /* Description.swift */, + 596963A429D485E3894C4666 /* IMarker.swift */, + E64A75540C627E09080B402A /* Legend.swift */, + 9E7C673B9ED4340F550A9283 /* LegendEntry.swift */, + 392AAEB02DD7B351D92907C2 /* MarkerImage.swift */, + 48164CCD83C51B496533CB77 /* MarkerView.swift */, + 5225ABC3C0C2F65FC094EEBB /* XAxis.swift */, + FB92A80F861C1362EED8D946 /* YAxis.swift */, + ); + name = Components; + sourceTree = ""; + }; + 740017197A160047EBB8A9A0 /* Standard */ = { + isa = PBXGroup; + children = ( + 0108D5925E21A47DA36A66AA /* BarChartData.swift */, + E3F8BFF1CBC58D5B9DBFFB9B /* BarChartDataEntry.swift */, + C31AA65EA27776F8C653C7E8 /* BarChartDataSet.swift */, + 559DB735FEA17AB90676D6CA /* BarLineScatterCandleBubbleChartData.swift */, + 6D717F0808DE7EC8A4AE9C2A /* BarLineScatterCandleBubbleChartDataSet.swift */, + 7EDA3AD550AEFC93C8D15B9C /* BubbleChartData.swift */, + DD8ED233775EEC31243A6919 /* BubbleChartDataEntry.swift */, + B44829AF0ADA583F1F0279B7 /* BubbleChartDataSet.swift */, + F4785FEACAE4367F36FB8868 /* CandleChartData.swift */, + D2E698FF540029B70AC97AD7 /* CandleChartDataEntry.swift */, + 274116834B1B0345D622E027 /* CandleChartDataSet.swift */, + E120E76C6F1B5877D56126DD /* ChartData.swift */, + F22750328058DEC2F019646F /* ChartDataEntry.swift */, + 12409C3EA15787C11AF0D2BC /* ChartDataEntryBase.swift */, + 6CEC0C69C89CE9B99F3B4409 /* ChartDataSet.swift */, + 0DDE409E9ECF54D2C146A6F0 /* CombinedChartData.swift */, + 4C978F31F23C7D21197DC2A1 /* LineChartData.swift */, + A5A75AA73C5AA381DA517959 /* LineChartDataSet.swift */, + 45E31A4356CC6F283C29954B /* LineRadarChartDataSet.swift */, + C58BD7B14BEA440783ED8D2B /* LineScatterCandleRadarChartDataSet.swift */, + 6E03A4987F72414A02A0631B /* PieChartData.swift */, + BD02157CF8CEE1189BF681DA /* PieChartDataEntry.swift */, + A4FB5E3761EF8B4D1E1E1014 /* PieChartDataSet.swift */, + 4BBB57D6FA41029B08F26D7B /* RadarChartData.swift */, + 91EEEDE2AB8F2DA3AFCF0733 /* RadarChartDataEntry.swift */, + B1BA6B21CBDF77A15848994F /* RadarChartDataSet.swift */, + E7AD2FC320A16CA1EE0A52F4 /* ScatterChartData.swift */, + CB1DD1A0F64266A10EE94194 /* ScatterChartDataSet.swift */, + ); + name = Standard; + sourceTree = ""; + }; + 74A391010038924F637D6752 /* Formatters */ = { + isa = PBXGroup; + children = ( + 6A4770E0F75EFFC30707A7C8 /* DefaultAxisValueFormatter.swift */, + D6C1BEFDF17404666C7B6054 /* DefaultFillFormatter.swift */, + 107D8F8163EE54D6D9E916B0 /* DefaultValueFormatter.swift */, + 0BD9DF16AF59680A3BB49452 /* IAxisValueFormatter.swift */, + 818AC6B12505B7C0A53D62F9 /* IFillFormatter.swift */, + 10DD0A02E3CF611BD11EBA9B /* IndexAxisValueFormatter.swift */, + 4EAA8AA30C377D54D22A577A /* IValueFormatter.swift */, + ); + name = Formatters; + sourceTree = ""; + }; + 865A1CF149F52850CAB7F177 = { + isa = PBXGroup; + children = ( + AB2D554102718F209377399E /* Products */, + 033FD152BB2F906750106A85 /* Frameworks */, + 20C350D33133A4D89BB365B1 /* Source */, + D2C26AC015E753014C7571E4 /* Tests */, + ); + sourceTree = ""; + }; + 8C531E3F3C3DE5843C93C3DA /* Charts */ = { + isa = PBXGroup; + children = ( + E783CFB4889A767C76510917 /* BarChartView.swift */, + 45C6D3723C4E001B119CA0C8 /* BarLineChartViewBase.swift */, + 4EED352A98860E031F13AFB7 /* BubbleChartView.swift */, + BA1A58428DC4780BAB4EAADC /* CandleStickChartView.swift */, + 30EFAD7920F76360ADB3B5F5 /* ChartViewBase.swift */, + 11EF1FE22549E885C8F40738 /* CombinedChartView.swift */, + 6021C9E424C36116AEA78CC9 /* HorizontalBarChartView.swift */, + 0619A877C69A95ECCC440A44 /* LineChartView.swift */, + 9DCD13D558BA177D5952AD66 /* PieChartView.swift */, + 4A6C9631C69B2D772BBD9232 /* PieRadarChartViewBase.swift */, + 2440DB759AB93B4A928A3F6F /* RadarChartView.swift */, + 18462BFDD9DEE76D51D40503 /* ScatterChartView.swift */, + ); + name = Charts; + sourceTree = ""; + }; + 9613A7C800C7F065A823D587 /* Charts */ = { + isa = PBXGroup; + children = ( + 5C3F5E1A69EC06E86505F7B1 /* BarChartTests.swift */, + B66817452241E3CC00017CF1 /* HorizontalBarChartTests.swift */, + 224EFF981FBAAC4700CF9B3B /* EquatableTests.swift */, + 7AB9062A28AAB9469752A954 /* ChartUtilsTests.swift */, + B6BF9A551F91993A00E62A5D /* CombinedChartTests.swift */, + D2E1819D72CD7B6C4A4E8048 /* LineChartTests.swift */, + 135F11CD20425AF600D655A3 /* PieChartTests.swift */, + 064989451F5C99C7006E8BB3 /* Snapshot.swift */, + ); + name = Charts; + sourceTree = ""; + }; + A49C1F0F9CCD6E5C143C29F4 /* Animation */ = { + isa = PBXGroup; + children = ( + 3976E5F9D60E30CD94CE6156 /* Animator.swift */, + DFB762958EE8E6521563665D /* ChartAnimationEasing.swift */, + ); + name = Animation; + sourceTree = ""; + }; + AA79AB82B0ADCA926510B73E /* Filters */ = { + isa = PBXGroup; + children = ( + 93EF9709CF635BEE70D1ABC5 /* DataApproximator.swift */, + 9A26C8DA1F87B01700367599 /* DataApproximator+N.swift */, + ); + name = Filters; + sourceTree = ""; + }; + AB2D554102718F209377399E /* Products */ = { + isa = PBXGroup; + children = ( + 65AD9E95D9ED4DC0BD73A743 /* Charts.framework */, + 1CBBC58C6CE1EBEE9852CE41 /* ChartsTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + AD1224C45A29A5C88D6B7450 /* Jobs */ = { + isa = PBXGroup; + children = ( + BA157EFF2F952192C11DF937 /* AnimatedMoveViewJob.swift */, + 710D7C9B2F1DB4A331EE405A /* AnimatedViewPortJob.swift */, + 4C2EA58CB336967198D30D20 /* AnimatedZoomViewJob.swift */, + 266E162DA8B29D9AEB6A9397 /* MoveViewJob.swift */, + FA7BDB22C97F39A4B33E38A7 /* ViewPortJob.swift */, + FB3A4F5987E58F3E5BE855F9 /* ZoomViewJob.swift */, + ); + name = Jobs; + sourceTree = ""; + }; + BF662941E21BC049994B2598 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + C574E1BC7E12D937A5471EF8 /* Info.plist */, + 41DDB768A1D033A34F0EF9E0 /* Media.xcassets */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + D047819AB7170595896D6FE8 /* Utils */ = { + isa = PBXGroup; + children = ( + F6227A646166E248F90F86AD /* ChartColorTemplates.swift */, + 3FDA09EF973925A110506799 /* ChartUtils.swift */, + 5A4CFFFB65819121595F06F1 /* Fill.swift */, + 3ED23C354AFE81818D78E645 /* Platform.swift */, + 97AD2D4520AF917100F9C24A /* Platform+Accessibility.swift */, + FF475B9593B9898853814340 /* Transformer.swift */, + 324C9127B53A8D39C8B49277 /* TransformerHorizontalBarChart.swift */, + 72EAEBB7CF73E33565FC2896 /* ViewPortHandler.swift */, + ); + name = Utils; + sourceTree = ""; + }; + D2C26AC015E753014C7571E4 /* Tests */ = { + isa = PBXGroup; + children = ( + BF662941E21BC049994B2598 /* Supporting Files */, + 9613A7C800C7F065A823D587 /* Charts */, + ); + name = Tests; + sourceTree = ""; + }; + DB2D9648877455028EBEAA8F /* Interfaces */ = { + isa = PBXGroup; + children = ( + 7A53A9E42FC07FFDACA937C1 /* IBarChartDataSet.swift */, + A5649B272BF3EBFC8A1EF0C1 /* IBarLineScatterCandleBubbleChartDataSet.swift */, + F3788EC55EF908B0805D7C2F /* IBubbleChartDataSet.swift */, + 18BFB0A14A5C47A302A597D9 /* ICandleChartDataSet.swift */, + 3A32510073A303CBB38E094A /* IChartDataSet.swift */, + 429E88F2729735DC092EE556 /* ILineChartDataSet.swift */, + 4F7E6A99D82E6AE3804D5A39 /* ILineRadarChartDataSet.swift */, + 9249AD9AEC8C85772365A128 /* ILineScatterCandleRadarChartDataSet.swift */, + DA2AA6CC89F809DCCD7605B4 /* IPieChartDataSet.swift */, + 2EAD807534620E3B53327F04 /* IRadarChartDataSet.swift */, + 219BC9CEA037F897E92E45D1 /* IScatterChartDataSet.swift */, + ); + name = Interfaces; + sourceTree = ""; + }; + E7589D3E7C2BD2449960AD59 /* Renderers */ = { + isa = PBXGroup; + children = ( + C75935E899183DDFA181E2CC /* AxisRendererBase.swift */, + 75F279974FE650E57A061B09 /* BarChartRenderer.swift */, + 5B1C588E9DF6FFD56D7ADF8E /* BarLineScatterCandleBubbleRenderer.swift */, + 2194AA554712E6BA2677F114 /* BubbleChartRenderer.swift */, + BD5C6D20243EC2F19069AACD /* CandleStickChartRenderer.swift */, + 0216EDC6A1FE272F4EB19FCF /* ChartDataRendererBase.swift */, + 52265C1B343CCC41AF2300E3 /* CombinedChartRenderer.swift */, + 539382766378B702660FDFB2 /* HorizontalBarChartRenderer.swift */, + F715DB2C56C9E0615542625B /* LegendRenderer.swift */, + 0DABDBBCCE6B3620C967F04A /* LineChartRenderer.swift */, + 105FFC9D3773A9C7A60A897F /* LineRadarRenderer.swift */, + 923206233CA89FD03565FF87 /* LineScatterCandleRadarRenderer.swift */, + 46D8013D44629521B1746364 /* PieChartRenderer.swift */, + 7AC9C3D69ACB5BDE22421E15 /* RadarChartRenderer.swift */, + 6F66B32AD8A878CBD6DB6ED2 /* Renderer.swift */, + F7059584CB30EF419CFB3335 /* Scatter */, + 80D5B764EC0AE1E17E55DC67 /* ScatterChartRenderer.swift */, + 1C02C3AF5C92FCFC18224C35 /* XAxisRenderer.swift */, + 1F3D55A7E6176D52DC957D27 /* XAxisRendererHorizontalBarChart.swift */, + BC19DC2434D65FFB446A61B7 /* XAxisRendererRadarChart.swift */, + 688B80F1AA88AE54152BE768 /* YAxisRenderer.swift */, + EAE417AAA0FCA0DD00E77489 /* YAxisRendererHorizontalBarChart.swift */, + AA5A16F4A382813C4FE8BDF9 /* YAxisRendererRadarChart.swift */, + ); + name = Renderers; + sourceTree = ""; + }; + E9F158C8C566B26AFD775911 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 910DBFE1DA1B2CA237A736DF /* Info.plist */, + 4F9922F0641F7955DC6CD324 /* Charts.h */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + F7059584CB30EF419CFB3335 /* Scatter */ = { + isa = PBXGroup; + children = ( + C52E8344160B5E689DA3C25C /* ChevronDownShapeRenderer.swift */, + AA70259ED16FF80D8EEB0F94 /* ChevronUpShapeRenderer.swift */, + ECE1B1623D3AF69CECAE8562 /* CircleShapeRenderer.swift */, + 823F7DB281C6C6F069A69605 /* CrossShapeRenderer.swift */, + FA1D3D13180C2E3893A82546 /* IShapeRenderer.swift */, + 32FC01A016DFF1BA73AF9182 /* SquareShapeRenderer.swift */, + C8FB6219B143F8F7DA762950 /* TriangleShapeRenderer.swift */, + 23D35CF6F9177D77B6B97AE1 /* XShapeRenderer.swift */, + ); + name = Scatter; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + B2B2DD73E237562739EE1F83 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + BEFD9518F3A74ACF8FA33308 /* Charts.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + A58A4ED274A941CA248EA921 /* Charts */ = { + isa = PBXNativeTarget; + buildConfigurationList = F1D4AA9E26EA32041FC0E3B6 /* Build configuration list for PBXNativeTarget "Charts" */; + buildPhases = ( + B2B2DD73E237562739EE1F83 /* Headers */, + B5996DB2D9B6F0DB0E9D3F3E /* Sources */, + E257C254E738A8AE047C6FB6 /* Resources */, + C16A09321DC2DCF289FF0E3B /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Charts; + productName = Charts; + productReference = 65AD9E95D9ED4DC0BD73A743 /* Charts.framework */; + productType = "com.apple.product-type.framework"; + }; + F2749BD5443C1CB5FE2080C2 /* ChartsTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = E61E9728E2BF9CC4048B13D5 /* Build configuration list for PBXNativeTarget "ChartsTests" */; + buildPhases = ( + D6BF00523905132F162A7710 /* Build Dependencies */, + E356A2384A2368AB3D2C7912 /* Sources */, + 5B102E31AA8399941CC6248D /* Resources */, + 77997192275C47C45A0A2E9A /* Frameworks */, + 6BA68666BDA3FCF79C2A6801 /* Copy Carthage Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 8676F8A013D87F9961E92465 /* PBXTargetDependency */, + ); + name = ChartsTests; + productName = ChartsTests; + productReference = 1CBBC58C6CE1EBEE9852CE41 /* ChartsTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 193FC8DF32D250560C5F5D77 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0830; + LastUpgradeCheck = 1020; + TargetAttributes = { + A58A4ED274A941CA248EA921 = { + LastSwiftMigration = 0900; + }; + F2749BD5443C1CB5FE2080C2 = { + LastSwiftMigration = 0900; + }; + }; + }; + buildConfigurationList = 493FF4FB1D40FC7C51DDDA6B /* Build configuration list for PBXProject "Charts" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + English, + en, + ); + mainGroup = 865A1CF149F52850CAB7F177; + productRefGroup = AB2D554102718F209377399E /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A58A4ED274A941CA248EA921 /* Charts */, + F2749BD5443C1CB5FE2080C2 /* ChartsTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 5B102E31AA8399941CC6248D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 00B8BF5901C2D220357B0B2A /* Media.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E257C254E738A8AE047C6FB6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 6BA68666BDA3FCF79C2A6801 /* Copy Carthage Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + FBSnapshotTestCase.framework, + ); + name = "Copy Carthage Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = " exec \"${SRCROOT}/scripts/copy-carthage-frameworks.sh\""; + }; + D6BF00523905132F162A7710 /* Build Dependencies */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + name = "Build Dependencies"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec \"${SRCROOT}/scripts/build-dependencies.sh\""; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + B5996DB2D9B6F0DB0E9D3F3E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D819331DA581C7E0AC5F8CEF /* Animator.swift in Sources */, + F5A209116FAC68F5903D0B46 /* ChartAnimationEasing.swift in Sources */, + D29BBEF55C9CC90114919CD2 /* BarChartView.swift in Sources */, + 9F760570BCECB0BF5727AF90 /* BarLineChartViewBase.swift in Sources */, + E4B2F363414E84C4D4B8A885 /* BubbleChartView.swift in Sources */, + 60EDF735AAB7195DCFA5FE4D /* CandleStickChartView.swift in Sources */, + 98E2EEF45E8933E4AD182D58 /* ChartViewBase.swift in Sources */, + 0CAF514A280FF6A14E2A1A23 /* CombinedChartView.swift in Sources */, + A692D8BDE42717F69DB790BE /* HorizontalBarChartView.swift in Sources */, + 7E7561DE19DC7CABBE0B2D3A /* LineChartView.swift in Sources */, + 2876E17AEB1D92D7BBC4C38A /* PieChartView.swift in Sources */, + 0A772AEC08246FEC480673E5 /* PieRadarChartViewBase.swift in Sources */, + 6303DBDEE4FAB8E40D023BCE /* RadarChartView.swift in Sources */, + 5C457D9A50DA20869AD1739D /* ScatterChartView.swift in Sources */, + 48E875BBD6540BDE1C1B7D3D /* AxisBase.swift in Sources */, + 4390D74986A92DEF4F4F2BF0 /* ChartLimitLine.swift in Sources */, + FDBDAFA7A5337C6E3992DACE /* ComponentBase.swift in Sources */, + DBC9DB402CC9BB84B76968C4 /* Description.swift in Sources */, + 03960E8148C6AEDACE4B77CC /* IMarker.swift in Sources */, + ECE7EAE7179A7F57CE9BBD8F /* Legend.swift in Sources */, + C20A62D8CB9120523D5FB650 /* LegendEntry.swift in Sources */, + 369DEB23452CB436A3A1A644 /* MarkerImage.swift in Sources */, + 9360348A04723E653FBC8B18 /* MarkerView.swift in Sources */, + 78084A4F1D850D5775BC139E /* XAxis.swift in Sources */, + 2FBA7E982EB57932B9F3E9B5 /* YAxis.swift in Sources */, + E50D291A6B6E69BF0B56A67C /* ChartBaseDataSet.swift in Sources */, + 3395682A1E27756651FF6F4D /* BarChartData.swift in Sources */, + 45C459FA25DFCBE62FA6A06C /* BarChartDataEntry.swift in Sources */, + 17E994DA88777AA1D8CCFC58 /* BarChartDataSet.swift in Sources */, + 7C9CE6718D18859A35146098 /* BarLineScatterCandleBubbleChartData.swift in Sources */, + 53A91F6F86740E26FE733639 /* BarLineScatterCandleBubbleChartDataSet.swift in Sources */, + E68CA3DC66EB638C956E09B8 /* BubbleChartData.swift in Sources */, + C09E91F67A4AC43C277E7D82 /* BubbleChartDataEntry.swift in Sources */, + 63C0A21D145BFEDED5406E4D /* BubbleChartDataSet.swift in Sources */, + DDE704689FDF2C0E0338488B /* CandleChartData.swift in Sources */, + D50B0EC2BB2245F32E757C50 /* CandleChartDataEntry.swift in Sources */, + 383D68A13E1C3D6A251E5147 /* CandleChartDataSet.swift in Sources */, + 81892994002C0640AD858748 /* ChartData.swift in Sources */, + EAEA60D22CA8C1B7E18D3F7D /* ChartDataEntry.swift in Sources */, + 7D546013F3A14FF5BB7F3294 /* ChartDataEntryBase.swift in Sources */, + 66A18A8EEBAAAC2EDA31ABEC /* ChartDataSet.swift in Sources */, + 331AA2C4BC34F56C23012F02 /* CombinedChartData.swift in Sources */, + C04D269AD4A373FD2B621C43 /* LineChartData.swift in Sources */, + 95B6D6F35684292A62DBEA74 /* LineChartDataSet.swift in Sources */, + 7CB7F74752619B0270CCB0A9 /* LineRadarChartDataSet.swift in Sources */, + FA07D034D9C3BC7795184ACA /* LineScatterCandleRadarChartDataSet.swift in Sources */, + 2C879FC24D7A15D70BE4063F /* PieChartData.swift in Sources */, + 23649EFC635A76022F07FFA6 /* PieChartDataEntry.swift in Sources */, + B539114951455C35BADAE3F3 /* PieChartDataSet.swift in Sources */, + 0C52C70C6E6EA09BD7426386 /* RadarChartData.swift in Sources */, + C2EFB4EC8C97FA9987F1B50D /* RadarChartDataEntry.swift in Sources */, + E3B28EA1E21279DF3889BCE8 /* RadarChartDataSet.swift in Sources */, + 9A26C8DB1F87B01700367599 /* DataApproximator+N.swift in Sources */, + 2B791E64E7C4523B1A63F72A /* ScatterChartData.swift in Sources */, + EB56849433A76B08606B73EB /* ScatterChartDataSet.swift in Sources */, + C3F0DDB7F0A922F0BB7EDB8A /* IBarChartDataSet.swift in Sources */, + AF4AAF3709ED9DDF6362EAE8 /* IBarLineScatterCandleBubbleChartDataSet.swift in Sources */, + 2C40CFFC8D88BEA70E0A50B0 /* IBubbleChartDataSet.swift in Sources */, + 0D8A89398F9BD5DCC8D7F976 /* ICandleChartDataSet.swift in Sources */, + E8F0F4F47CD7D72B4EE5A794 /* IChartDataSet.swift in Sources */, + F941C88BF814DF51C465CB95 /* ILineChartDataSet.swift in Sources */, + 1311BEC21E9CC264E971EFAF /* ILineRadarChartDataSet.swift in Sources */, + 146EE16342C2BADC92E45BF2 /* ILineScatterCandleRadarChartDataSet.swift in Sources */, + FAAD9FF6565DED2652188584 /* IPieChartDataSet.swift in Sources */, + 83BBAF3EDC31FD452F8BF1DB /* IRadarChartDataSet.swift in Sources */, + 50476F8E6662CAFC1EFE0723 /* IScatterChartDataSet.swift in Sources */, + 97E033CC0ABEF0F448DAFA8E /* DataApproximator.swift in Sources */, + 779B46E9F13A087BFA47D539 /* DefaultAxisValueFormatter.swift in Sources */, + F744C510DA9B85C228BBB335 /* DefaultFillFormatter.swift in Sources */, + B0D28C68BB9A958DC56EB214 /* DefaultValueFormatter.swift in Sources */, + B13C74B4FF705D7B595D01EF /* IAxisValueFormatter.swift in Sources */, + B6C9F450D937B87224D29D5C /* IFillFormatter.swift in Sources */, + 967EE2EDDE3337C5C4337C59 /* IndexAxisValueFormatter.swift in Sources */, + A40ACF0CCE96EEE104B0463D /* IValueFormatter.swift in Sources */, + 3CBE95F1E9394FA08CDCF31E /* BarHighlighter.swift in Sources */, + D326491E8BCDE54A0921E137 /* ChartHighlighter.swift in Sources */, + 64FA1EDB4DC1F65727D52D10 /* CombinedHighlighter.swift in Sources */, + 758EB1C75063ED3373542F3B /* Highlight.swift in Sources */, + 4E98788ABEF6496C23F3E6C6 /* HorizontalBarHighlighter.swift in Sources */, + 203A39685CC96FC625F616E4 /* IHighlighter.swift in Sources */, + 73EDF662AD989E930D365B72 /* PieHighlighter.swift in Sources */, + 3097296AC7FFA994FE4AD312 /* PieRadarHighlighter.swift in Sources */, + C33E1AF5471A60BA42DAF52E /* RadarHighlighter.swift in Sources */, + 9C91C151608E2D6E19B1EAD1 /* Range.swift in Sources */, + 00BC23EF0E04E17188344403 /* BarChartDataProvider.swift in Sources */, + 28FEE609C5B22FD64C7E5D10 /* BarLineScatterCandleBubbleChartDataProvider.swift in Sources */, + 4272DA5D44AF7DA05A5A8287 /* BubbleChartDataProvider.swift in Sources */, + 30DCC4BAA5601B154ABADA13 /* CandleChartDataProvider.swift in Sources */, + FD37AAC0270F390FFC470A65 /* ChartDataProvider.swift in Sources */, + 65EA404AE098EBCE8D5DE04B /* CombinedChartDataProvider.swift in Sources */, + 2BA03CEC36BADCF682F1328B /* LineChartDataProvider.swift in Sources */, + 0511E43EF3FD2CDE7F7F15DB /* ScatterChartDataProvider.swift in Sources */, + 7EE6EFE70CF4D8B09CAFCD01 /* AnimatedMoveViewJob.swift in Sources */, + CC7F8198A13249B5DEBBF25E /* AnimatedViewPortJob.swift in Sources */, + 0577C2B38BCE4C871F262714 /* AnimatedZoomViewJob.swift in Sources */, + 02A6E6E1A82A27A66B8D08C4 /* MoveViewJob.swift in Sources */, + 9400725714D0DA707DDECD2E /* ViewPortJob.swift in Sources */, + AEE9C4E4AC02B8FB3CD21975 /* ZoomViewJob.swift in Sources */, + ECECC58CEF03B1718F8267E8 /* AxisRendererBase.swift in Sources */, + 23FA50B2730D8C7ACA091C4F /* BarChartRenderer.swift in Sources */, + 219192CA6B4895319AB49DCA /* BarLineScatterCandleBubbleRenderer.swift in Sources */, + 56E0F5EA9255B9B92876E040 /* BubbleChartRenderer.swift in Sources */, + 8BCCD709AACC565613D9DA68 /* CandleStickChartRenderer.swift in Sources */, + F37B07008B8AE7F3909FFB9C /* ChartDataRendererBase.swift in Sources */, + 05253AFC448C107DEF54C2FE /* CombinedChartRenderer.swift in Sources */, + F100D68395F169B93590FA96 /* HorizontalBarChartRenderer.swift in Sources */, + 2B821AAC3EBD60A73EACBCE6 /* LegendRenderer.swift in Sources */, + 5F96E95C7073D21EFE02BCF7 /* LineChartRenderer.swift in Sources */, + 24151B0729D77251A8494D70 /* LineRadarRenderer.swift in Sources */, + B6DCC229615EFE706F64A37D /* LineScatterCandleRadarRenderer.swift in Sources */, + 795E100895C24049509F1EDE /* PieChartRenderer.swift in Sources */, + 97AD2D4620AF917100F9C24A /* Platform+Accessibility.swift in Sources */, + 69EA073EDF75D49ABE1715D6 /* RadarChartRenderer.swift in Sources */, + CEF68F42A5390A73113F3663 /* Renderer.swift in Sources */, + 796D3E63A37A95FD9D1AB9A1 /* ChevronDownShapeRenderer.swift in Sources */, + F103D90FC5DEEA0D7BB4407E /* ChevronUpShapeRenderer.swift in Sources */, + B85DEB06B4C1AFFC8A0E3295 /* CircleShapeRenderer.swift in Sources */, + 0529DD51622C8769C1121F90 /* CrossShapeRenderer.swift in Sources */, + 8A9FF54E2075A9047CC8E953 /* IShapeRenderer.swift in Sources */, + 8EF7B3FBE37F72CC030CD865 /* SquareShapeRenderer.swift in Sources */, + 8F4B1A9060472764073DFA0B /* TriangleShapeRenderer.swift in Sources */, + 93A94E1FF55041A6032891FE /* XShapeRenderer.swift in Sources */, + 5DC9BC1B6C128B2C9995AB84 /* ScatterChartRenderer.swift in Sources */, + 41BEBF8BDB9DC403B5697D67 /* XAxisRenderer.swift in Sources */, + 2A94F1724FEA9E16A81A8E1F /* XAxisRendererHorizontalBarChart.swift in Sources */, + 4FACC6FD308AFB231EB4A93D /* XAxisRendererRadarChart.swift in Sources */, + 41B13F3179ACB5A3837C6E55 /* YAxisRenderer.swift in Sources */, + 846AC09831FA93F66732591B /* YAxisRendererHorizontalBarChart.swift in Sources */, + 11F68AA2EBF822D7208EE002 /* YAxisRendererRadarChart.swift in Sources */, + 40C82F2209E1BA9E41E8F3DA /* ChartColorTemplates.swift in Sources */, + CB785FE9B6B312408D17BC3B /* ChartUtils.swift in Sources */, + 8102A555DD6C93AC1290EA7C /* Fill.swift in Sources */, + E9FF0ECB5E0CA92DBF4C1BC4 /* Platform.swift in Sources */, + DE0F434FE8C24C52B023370F /* Transformer.swift in Sources */, + 8A463E2947F211C594CA5E95 /* TransformerHorizontalBarChart.swift in Sources */, + 515E286E6C47594D3FFA3DD1 /* ViewPortHandler.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E356A2384A2368AB3D2C7912 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3B11556EB7DC034E2FC958E4 /* BarChartTests.swift in Sources */, + 8E1192F7A7152E9DA92C56A9 /* ChartUtilsTests.swift in Sources */, + B6BF9A561F91993A00E62A5D /* CombinedChartTests.swift in Sources */, + 2BF85BEA981B359A65E9BF67 /* LineChartTests.swift in Sources */, + B66817462241E3CC00017CF1 /* HorizontalBarChartTests.swift in Sources */, + 135F11CE20425AF600D655A3 /* PieChartTests.swift in Sources */, + 064989461F5C99C7006E8BB3 /* Snapshot.swift in Sources */, + 224EFF991FBAAC4700CF9B3B /* EquatableTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 8676F8A013D87F9961E92465 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Charts; + target = A58A4ED274A941CA248EA921 /* Charts */; + targetProxy = C2005F425A98942473657ED2 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 0EF2164C35AB4D391B503317 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Source/Supporting Files/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.dcg.Charts; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TVOS_DEPLOYMENT_TARGET = 9.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 4DD0BFDA94D4BC68192A1895 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + "FRAMEWORK_SEARCH_PATHS[sdk=appletv*]" = ( + "$(SRCROOT)/Carthage/Build/tvOS/", + "$(inherited)", + ); + "FRAMEWORK_SEARCH_PATHS[sdk=iphone*]" = ( + "$(SRCROOT)/Carthage/Build/iOS/", + "$(inherited)", + ); + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Tests/Supporting Files/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.dcg.ChartsTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator appletvos appletvsimulator"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Debug; + }; + A17F60813C38081A2F1803D4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = ""; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,3,4"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + C5C79E736CA16C93F421E934 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = ""; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,3,4"; + }; + name = Debug; + }; + D9365FBCFFEE9FCFC79EC4C7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Source/Supporting Files/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = com.dcg.Charts; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; + TVOS_DEPLOYMENT_TARGET = 9.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + FA978B0A385680C0086D4D49 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + "FRAMEWORK_SEARCH_PATHS[sdk=appletv*]" = ( + "$(SRCROOT)/Carthage/Build/tvOS/", + "$(inherited)", + ); + "FRAMEWORK_SEARCH_PATHS[sdk=iphone*]" = ( + "$(SRCROOT)/Carthage/Build/iOS/", + "$(inherited)", + ); + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Tests/Supporting Files/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = com.dcg.ChartsTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator appletvos appletvsimulator"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 493FF4FB1D40FC7C51DDDA6B /* Build configuration list for PBXProject "Charts" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C5C79E736CA16C93F421E934 /* Debug */, + A17F60813C38081A2F1803D4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E61E9728E2BF9CC4048B13D5 /* Build configuration list for PBXNativeTarget "ChartsTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA978B0A385680C0086D4D49 /* Release */, + 4DD0BFDA94D4BC68192A1895 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F1D4AA9E26EA32041FC0E3B6 /* Build configuration list for PBXNativeTarget "Charts" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D9365FBCFFEE9FCFC79EC4C7 /* Release */, + 0EF2164C35AB4D391B503317 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 193FC8DF32D250560C5F5D77 /* Project object */; +} diff --git a/Carthage/Checkouts/Charts/Charts.xcodeproj/xcshareddata/xcschemes/Charts.xcscheme b/Carthage/Checkouts/Charts/Charts.xcodeproj/xcshareddata/xcschemes/Charts.xcscheme new file mode 100644 index 00000000000..433e05112e4 --- /dev/null +++ b/Carthage/Checkouts/Charts/Charts.xcodeproj/xcshareddata/xcschemes/Charts.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/Charts.xcodeproj/xcshareddata/xcschemes/ChartsTests.xcscheme b/Carthage/Checkouts/Charts/Charts.xcodeproj/xcshareddata/xcschemes/ChartsTests.xcscheme new file mode 100644 index 00000000000..b3f7d608ae1 --- /dev/null +++ b/Carthage/Checkouts/Charts/Charts.xcodeproj/xcshareddata/xcschemes/ChartsTests.xcscheme @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/Charts.xcworkspace/contents.xcworkspacedata b/Carthage/Checkouts/Charts/Charts.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..088d4b73294 --- /dev/null +++ b/Carthage/Checkouts/Charts/Charts.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/Charts.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Carthage/Checkouts/Charts/Charts.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000000..18d981003d6 --- /dev/null +++ b/Carthage/Checkouts/Charts/Charts.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/ChartsDemo-iOS.xcodeproj/project.pbxproj b/Carthage/Checkouts/Charts/ChartsDemo-iOS/ChartsDemo-iOS.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..bf95f7b8695 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/ChartsDemo-iOS.xcodeproj/project.pbxproj @@ -0,0 +1,1119 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 0439A3541C9FF95F00496F83 /* PiePolylineChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0439A3521C9FF95F00496F83 /* PiePolylineChartViewController.m */; }; + 0471CBFC1CA1090A00E52DBC /* PiePolylineChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0471CBFB1CA1090A00E52DBC /* PiePolylineChartViewController.xib */; }; + 0630AE511D81271B008859B0 /* Charts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0630AE411D8126C0008859B0 /* Charts.framework */; }; + 0630AE521D81271B008859B0 /* Charts.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0630AE411D8126C0008859B0 /* Charts.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 068A9B191FBBF351003CF1AD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5B8EAF2F1AB32E15009697AA /* Images.xcassets */; }; + 068A9B1A1FBBF355003CF1AD /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B64D06EA1FB199130067418D /* Launch Screen.storyboard */; }; + 068A9B1B1FBBF366003CF1AD /* radar_marker@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 5B613DA31D526AD5000F1E98 /* radar_marker@3x.png */; }; + 225B36201F6EB9A50005B3D5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B361F1F6EB9A50005B3D5 /* AppDelegate.swift */; }; + 225B36311F6EB9EE0005B3D5 /* DemoBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B362F1F6EB9EE0005B3D5 /* DemoBaseViewController.swift */; }; + 225B36321F6EB9EE0005B3D5 /* DemoListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36301F6EB9EE0005B3D5 /* DemoListViewController.swift */; }; + 225B36381F6EBA040005B3D5 /* IntAxisValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36341F6EB9FE0005B3D5 /* IntAxisValueFormatter.swift */; }; + 225B36391F6EBA040005B3D5 /* DayAxisValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36351F6EB9FE0005B3D5 /* DayAxisValueFormatter.swift */; }; + 225B363A1F6EBA040005B3D5 /* DateValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36361F6EB9FE0005B3D5 /* DateValueFormatter.swift */; }; + 225B363B1F6EBA040005B3D5 /* LargeValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36371F6EB9FE0005B3D5 /* LargeValueFormatter.swift */; }; + 225B36401F6EBA1D0005B3D5 /* XYMarkerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B363D1F6EBA180005B3D5 /* XYMarkerView.swift */; }; + 225B36411F6EBA1D0005B3D5 /* BalloonMarker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B363E1F6EBA180005B3D5 /* BalloonMarker.swift */; }; + 225B36421F6EBA1D0005B3D5 /* RadarMarkerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B363F1F6EBA180005B3D5 /* RadarMarkerView.swift */; }; + 225B365B1F6EBA470005B3D5 /* MultipleLinesChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36441F6EBA410005B3D5 /* MultipleLinesChartViewController.swift */; }; + 225B365C1F6EBA470005B3D5 /* MultipleBarChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36451F6EBA410005B3D5 /* MultipleBarChartViewController.swift */; }; + 225B365D1F6EBA470005B3D5 /* HalfPieChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36461F6EBA410005B3D5 /* HalfPieChartViewController.swift */; }; + 225B365E1F6EBA470005B3D5 /* LineChartTimeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36471F6EBA410005B3D5 /* LineChartTimeViewController.swift */; }; + 225B365F1F6EBA470005B3D5 /* ColoredLineChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36481F6EBA410005B3D5 /* ColoredLineChartViewController.swift */; }; + 225B36601F6EBA470005B3D5 /* LineChart2ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36491F6EBA410005B3D5 /* LineChart2ViewController.swift */; }; + 225B36611F6EBA470005B3D5 /* LineChart1ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B364A1F6EBA410005B3D5 /* LineChart1ViewController.swift */; }; + 225B36621F6EBA470005B3D5 /* NegativeStackedBarChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B364B1F6EBA410005B3D5 /* NegativeStackedBarChartViewController.swift */; }; + 225B36631F6EBA470005B3D5 /* ScatterChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B364C1F6EBA410005B3D5 /* ScatterChartViewController.swift */; }; + 225B36641F6EBA470005B3D5 /* StackedBarChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B364D1F6EBA410005B3D5 /* StackedBarChartViewController.swift */; }; + 225B36651F6EBA470005B3D5 /* BubbleChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B364E1F6EBA410005B3D5 /* BubbleChartViewController.swift */; }; + 225B36661F6EBA470005B3D5 /* LineChartFilledViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B364F1F6EBA410005B3D5 /* LineChartFilledViewController.swift */; }; + 225B36671F6EBA470005B3D5 /* PositiveNegativeBarChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36501F6EBA410005B3D5 /* PositiveNegativeBarChartViewController.swift */; }; + 225B36681F6EBA470005B3D5 /* AnotherBarChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36511F6EBA410005B3D5 /* AnotherBarChartViewController.swift */; }; + 225B36691F6EBA470005B3D5 /* PieChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36521F6EBA410005B3D5 /* PieChartViewController.swift */; }; + 225B366A1F6EBA470005B3D5 /* CubicLineChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36531F6EBA410005B3D5 /* CubicLineChartViewController.swift */; }; + 225B366B1F6EBA470005B3D5 /* RadarChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36541F6EBA410005B3D5 /* RadarChartViewController.swift */; }; + 225B366C1F6EBA470005B3D5 /* HorizontalBarChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36551F6EBA410005B3D5 /* HorizontalBarChartViewController.swift */; }; + 225B366D1F6EBA470005B3D5 /* PiePolylineChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36561F6EBA410005B3D5 /* PiePolylineChartViewController.swift */; }; + 225B366E1F6EBA470005B3D5 /* CombinedChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36571F6EBA410005B3D5 /* CombinedChartViewController.swift */; }; + 225B366F1F6EBA470005B3D5 /* BarChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36581F6EBA410005B3D5 /* BarChartViewController.swift */; }; + 225B36701F6EBA470005B3D5 /* SinusBarChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B36591F6EBA410005B3D5 /* SinusBarChartViewController.swift */; }; + 225B36711F6EBA470005B3D5 /* CandleStickChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 225B365A1F6EBA410005B3D5 /* CandleStickChartViewController.swift */; }; + 225B36721F6EBA5E0005B3D5 /* DemoListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B8EAF231AB3271B009697AA /* DemoListViewController.xib */; }; + 225B36731F6EBA5E0005B3D5 /* RadarMarkerView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B613DB41D526EA8000F1E98 /* RadarMarkerView.xib */; }; + 225B36741F6EBA640005B3D5 /* AnotherBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED111ABBFB2B0013F194 /* AnotherBarChartViewController.xib */; }; + 225B36751F6EBA640005B3D5 /* BarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BD47E641ABB424E008FCEC6 /* BarChartViewController.xib */; }; + 225B36761F6EBA640005B3D5 /* BubbleChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55E3564D1ADC638F00A57971 /* BubbleChartViewController.xib */; }; + 225B36771F6EBA640005B3D5 /* CandleStickChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED2B1ABC160F0013F194 /* CandleStickChartViewController.xib */; }; + 225B36781F6EBA640005B3D5 /* ColoredLineChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED3A1ABC199F0013F194 /* ColoredLineChartViewController.xib */; }; + 225B36791F6EBA640005B3D5 /* CombinedChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BDEDC461ABB871E007D3A60 /* CombinedChartViewController.xib */; }; + 225B367A1F6EBA640005B3D5 /* CubicLineChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED301ABC18F00013F194 /* CubicLineChartViewController.xib */; }; + 225B367B1F6EBA640005B3D5 /* HalfPieChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BE6737F1D5B496500A87BA2 /* HalfPieChartViewController.xib */; }; + 225B367C1F6EBA640005B3D5 /* HorizontalBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BDEDC401ABB7F73007D3A60 /* HorizontalBarChartViewController.xib */; }; + 225B367D1F6EBA640005B3D5 /* LineChart1ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BD8F0731AB89CE500566E05 /* LineChart1ViewController.xib */; }; + 225B367E1F6EBA640005B3D5 /* LineChart2ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BD47E5F1ABB3C91008FCEC6 /* LineChart2ViewController.xib */; }; + 225B367F1F6EBA640005B3D5 /* LineChartFilledViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BE6738E1D5B4E0900A87BA2 /* LineChartFilledViewController.xib */; }; + 225B36801F6EBA640005B3D5 /* LineChartTimeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BE673911D5B4E0900A87BA2 /* LineChartTimeViewController.xib */; }; + 225B36811F6EBA640005B3D5 /* MultipleBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED211ABC0BE20013F194 /* MultipleBarChartViewController.xib */; }; + 225B36821F6EBA640005B3D5 /* MultipleLinesChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED241ABC0BE20013F194 /* MultipleLinesChartViewController.xib */; }; + 225B36831F6EBA640005B3D5 /* NegativeStackedBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B9624401B38608C007763E2 /* NegativeStackedBarChartViewController.xib */; }; + 225B36841F6EBA640005B3D5 /* PieChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B0CC7841ABB875400665592 /* PieChartViewController.xib */; }; + 225B36851F6EBA640005B3D5 /* PiePolylineChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0471CBFB1CA1090A00E52DBC /* PiePolylineChartViewController.xib */; }; + 225B36861F6EBA640005B3D5 /* PositiveNegativeBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BE7E7611C693098000A0377 /* PositiveNegativeBarChartViewController.xib */; }; + 225B36871F6EBA640005B3D5 /* RadarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED351ABC192F0013F194 /* RadarChartViewController.xib */; }; + 225B36881F6EBA640005B3D5 /* RealmDemosViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B1B5DA91E911A15006D1375 /* RealmDemosViewController.xib */; }; + 225B36891F6EBA640005B3D5 /* ScatterChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED171ABBFB340013F194 /* ScatterChartViewController.xib */; }; + 225B368A1F6EBA640005B3D5 /* SinusBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED3F1ABC1AC60013F194 /* SinusBarChartViewController.xib */; }; + 225B368B1F6EBA640005B3D5 /* StackedBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED1A1ABBFB340013F194 /* StackedBarChartViewController.xib */; }; + 225B368C1F6EBBB00005B3D5 /* Charts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0630AE411D8126C0008859B0 /* Charts.framework */; }; + 225B368D1F6EBBB00005B3D5 /* Charts.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0630AE411D8126C0008859B0 /* Charts.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 55E356501ADC638F00A57971 /* BubbleChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55E3564D1ADC638F00A57971 /* BubbleChartViewController.xib */; }; + 55E356511ADC638F00A57971 /* BubbleChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55E3564F1ADC638F00A57971 /* BubbleChartViewController.m */; }; + 5B0CC7851ABB875400665592 /* PieChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B0CC7831ABB875400665592 /* PieChartViewController.m */; }; + 5B0CC7861ABB875400665592 /* PieChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B0CC7841ABB875400665592 /* PieChartViewController.xib */; }; + 5B1B5DAB1E911A15006D1375 /* RealmDemosViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B1B5DA91E911A15006D1375 /* RealmDemosViewController.xib */; }; + 5B57BBB51A9B26AA0036A6CC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B57BBB41A9B26AA0036A6CC /* main.m */; }; + 5B57BBB81A9B26AA0036A6CC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B57BBB71A9B26AA0036A6CC /* AppDelegate.m */; }; + 5B57BBBB1A9B26AA0036A6CC /* DemoListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B57BBBA1A9B26AA0036A6CC /* DemoListViewController.m */; }; + 5B613DA41D526AD5000F1E98 /* radar_marker@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 5B613DA31D526AD5000F1E98 /* radar_marker@3x.png */; }; + 5B613DB31D526DED000F1E98 /* RadarMarkerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B613DB21D526DED000F1E98 /* RadarMarkerView.swift */; }; + 5B613DB51D526EA8000F1E98 /* RadarMarkerView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B613DB41D526EA8000F1E98 /* RadarMarkerView.xib */; }; + 5B613DF01D5A50B6000F1E98 /* XYMarkerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B613DEF1D5A50B6000F1E98 /* XYMarkerView.swift */; }; + 5B613DF21D5A60DF000F1E98 /* LargeValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B613DF11D5A60DF000F1E98 /* LargeValueFormatter.swift */; }; + 5B8EAF241AB3271B009697AA /* DemoListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B8EAF231AB3271B009697AA /* DemoListViewController.xib */; }; + 5B8EAF281AB32CF5009697AA /* DemoBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B8EAF261AB32CF5009697AA /* DemoBaseViewController.m */; }; + 5B8EAF301AB32E15009697AA /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5B8EAF2F1AB32E15009697AA /* Images.xcassets */; }; + 5B9624411B38608C007763E2 /* NegativeStackedBarChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B96243F1B38608C007763E2 /* NegativeStackedBarChartViewController.m */; }; + 5B9624421B38608C007763E2 /* NegativeStackedBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5B9624401B38608C007763E2 /* NegativeStackedBarChartViewController.xib */; }; + 5BD47E5B1ABB0263008FCEC6 /* BalloonMarker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BD47E5A1ABB0263008FCEC6 /* BalloonMarker.swift */; }; + 5BD47E601ABB3C91008FCEC6 /* LineChart2ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BD47E5E1ABB3C91008FCEC6 /* LineChart2ViewController.m */; }; + 5BD47E611ABB3C91008FCEC6 /* LineChart2ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BD47E5F1ABB3C91008FCEC6 /* LineChart2ViewController.xib */; }; + 5BD47E651ABB424E008FCEC6 /* BarChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BD47E631ABB424E008FCEC6 /* BarChartViewController.m */; }; + 5BD47E661ABB424E008FCEC6 /* BarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BD47E641ABB424E008FCEC6 /* BarChartViewController.xib */; }; + 5BD8F0741AB89CE500566E05 /* LineChart1ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BD8F0721AB89CE500566E05 /* LineChart1ViewController.m */; }; + 5BD8F0751AB89CE500566E05 /* LineChart1ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BD8F0731AB89CE500566E05 /* LineChart1ViewController.xib */; }; + 5BDEDC411ABB7F73007D3A60 /* HorizontalBarChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BDEDC3F1ABB7F73007D3A60 /* HorizontalBarChartViewController.m */; }; + 5BDEDC421ABB7F73007D3A60 /* HorizontalBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BDEDC401ABB7F73007D3A60 /* HorizontalBarChartViewController.xib */; }; + 5BDEDC471ABB871E007D3A60 /* CombinedChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BDEDC451ABB871E007D3A60 /* CombinedChartViewController.m */; }; + 5BDEDC481ABB871E007D3A60 /* CombinedChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BDEDC461ABB871E007D3A60 /* CombinedChartViewController.xib */; }; + 5BE377DE1D425151006EB34F /* DayAxisValueFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BE377DD1D425151006EB34F /* DayAxisValueFormatter.m */; }; + 5BE377F21D47FDF1006EB34F /* IntAxisValueFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BE377F11D47FDF1006EB34F /* IntAxisValueFormatter.m */; }; + 5BE673801D5B496500A87BA2 /* HalfPieChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BE6737E1D5B496500A87BA2 /* HalfPieChartViewController.m */; }; + 5BE673811D5B496500A87BA2 /* HalfPieChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BE6737F1D5B496500A87BA2 /* HalfPieChartViewController.xib */; }; + 5BE673921D5B4E0900A87BA2 /* LineChartFilledViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BE6738D1D5B4E0900A87BA2 /* LineChartFilledViewController.m */; }; + 5BE673931D5B4E0900A87BA2 /* LineChartFilledViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BE6738E1D5B4E0900A87BA2 /* LineChartFilledViewController.xib */; }; + 5BE673941D5B4E0900A87BA2 /* LineChartTimeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BE673901D5B4E0900A87BA2 /* LineChartTimeViewController.m */; }; + 5BE673951D5B4E0900A87BA2 /* LineChartTimeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BE673911D5B4E0900A87BA2 /* LineChartTimeViewController.xib */; }; + 5BE6739A1D5BAD7E00A87BA2 /* DateValueFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BE673991D5BAD7E00A87BA2 /* DateValueFormatter.m */; }; + 5BE7E7621C693098000A0377 /* PositiveNegativeBarChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BE7E7601C693098000A0377 /* PositiveNegativeBarChartViewController.m */; }; + 5BE7E7631C693098000A0377 /* PositiveNegativeBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BE7E7611C693098000A0377 /* PositiveNegativeBarChartViewController.xib */; }; + 5BEAED121ABBFB2B0013F194 /* AnotherBarChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BEAED101ABBFB2B0013F194 /* AnotherBarChartViewController.m */; }; + 5BEAED131ABBFB2B0013F194 /* AnotherBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED111ABBFB2B0013F194 /* AnotherBarChartViewController.xib */; }; + 5BEAED1B1ABBFB340013F194 /* ScatterChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BEAED161ABBFB340013F194 /* ScatterChartViewController.m */; }; + 5BEAED1C1ABBFB340013F194 /* ScatterChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED171ABBFB340013F194 /* ScatterChartViewController.xib */; }; + 5BEAED1D1ABBFB340013F194 /* StackedBarChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BEAED191ABBFB340013F194 /* StackedBarChartViewController.m */; }; + 5BEAED1E1ABBFB340013F194 /* StackedBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED1A1ABBFB340013F194 /* StackedBarChartViewController.xib */; }; + 5BEAED251ABC0BE20013F194 /* MultipleBarChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BEAED201ABC0BE20013F194 /* MultipleBarChartViewController.m */; }; + 5BEAED261ABC0BE20013F194 /* MultipleBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED211ABC0BE20013F194 /* MultipleBarChartViewController.xib */; }; + 5BEAED271ABC0BE20013F194 /* MultipleLinesChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BEAED231ABC0BE20013F194 /* MultipleLinesChartViewController.m */; }; + 5BEAED281ABC0BE20013F194 /* MultipleLinesChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED241ABC0BE20013F194 /* MultipleLinesChartViewController.xib */; }; + 5BEAED2C1ABC160F0013F194 /* CandleStickChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BEAED2A1ABC160F0013F194 /* CandleStickChartViewController.m */; }; + 5BEAED2D1ABC160F0013F194 /* CandleStickChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED2B1ABC160F0013F194 /* CandleStickChartViewController.xib */; }; + 5BEAED311ABC18F00013F194 /* CubicLineChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BEAED2F1ABC18F00013F194 /* CubicLineChartViewController.m */; }; + 5BEAED321ABC18F00013F194 /* CubicLineChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED301ABC18F00013F194 /* CubicLineChartViewController.xib */; }; + 5BEAED361ABC192F0013F194 /* RadarChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BEAED341ABC192F0013F194 /* RadarChartViewController.m */; }; + 5BEAED371ABC192F0013F194 /* RadarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED351ABC192F0013F194 /* RadarChartViewController.xib */; }; + 5BEAED3B1ABC199F0013F194 /* ColoredLineChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BEAED391ABC199F0013F194 /* ColoredLineChartViewController.m */; }; + 5BEAED3C1ABC199F0013F194 /* ColoredLineChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED3A1ABC199F0013F194 /* ColoredLineChartViewController.xib */; }; + 5BEAED401ABC1AC60013F194 /* SinusBarChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BEAED3E1ABC1AC60013F194 /* SinusBarChartViewController.m */; }; + 5BEAED411ABC1AC60013F194 /* SinusBarChartViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BEAED3F1ABC1AC60013F194 /* SinusBarChartViewController.xib */; }; + B64D06EB1FB199130067418D /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B64D06EA1FB199130067418D /* Launch Screen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 0630AE401D8126C0008859B0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0630AE391D8126C0008859B0 /* Charts.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 06165F241D8110E600722320; + remoteInfo = Charts; + }; + 0630AE421D8126C0008859B0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0630AE391D8126C0008859B0 /* Charts.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 06165F2E1D8110E600722320; + remoteInfo = ChartsTests; + }; + 0630AE531D81271B008859B0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0630AE391D8126C0008859B0 /* Charts.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = A58A4ED274A941CA248EA921; + remoteInfo = Charts; + }; + 225B368E1F6EBBB00005B3D5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0630AE391D8126C0008859B0 /* Charts.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = A58A4ED274A941CA248EA921; + remoteInfo = Charts; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 225B36901F6EBBB10005B3D5 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 225B368D1F6EBBB00005B3D5 /* Charts.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + 5BB4B0751ACA710D00E2EF4D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 0630AE521D81271B008859B0 /* Charts.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0439A3511C9FF95F00496F83 /* PiePolylineChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PiePolylineChartViewController.h; sourceTree = ""; }; + 0439A3521C9FF95F00496F83 /* PiePolylineChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PiePolylineChartViewController.m; sourceTree = ""; }; + 0471CBFB1CA1090A00E52DBC /* PiePolylineChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PiePolylineChartViewController.xib; sourceTree = ""; }; + 0630AE391D8126C0008859B0 /* Charts.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Charts.xcodeproj; path = ../Charts.xcodeproj; sourceTree = ""; }; + 225B361D1F6EB9A50005B3D5 /* ChartsDemo-iOS-Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ChartsDemo-iOS-Swift.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 225B361F1F6EB9A50005B3D5 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 225B362F1F6EB9EE0005B3D5 /* DemoBaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoBaseViewController.swift; sourceTree = ""; }; + 225B36301F6EB9EE0005B3D5 /* DemoListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoListViewController.swift; sourceTree = ""; }; + 225B36341F6EB9FE0005B3D5 /* IntAxisValueFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntAxisValueFormatter.swift; sourceTree = ""; }; + 225B36351F6EB9FE0005B3D5 /* DayAxisValueFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DayAxisValueFormatter.swift; sourceTree = ""; }; + 225B36361F6EB9FE0005B3D5 /* DateValueFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateValueFormatter.swift; sourceTree = ""; }; + 225B36371F6EB9FE0005B3D5 /* LargeValueFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LargeValueFormatter.swift; sourceTree = ""; }; + 225B363D1F6EBA180005B3D5 /* XYMarkerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XYMarkerView.swift; sourceTree = ""; }; + 225B363E1F6EBA180005B3D5 /* BalloonMarker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BalloonMarker.swift; sourceTree = ""; }; + 225B363F1F6EBA180005B3D5 /* RadarMarkerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadarMarkerView.swift; sourceTree = ""; }; + 225B36441F6EBA410005B3D5 /* MultipleLinesChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultipleLinesChartViewController.swift; sourceTree = ""; }; + 225B36451F6EBA410005B3D5 /* MultipleBarChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultipleBarChartViewController.swift; sourceTree = ""; }; + 225B36461F6EBA410005B3D5 /* HalfPieChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HalfPieChartViewController.swift; sourceTree = ""; }; + 225B36471F6EBA410005B3D5 /* LineChartTimeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineChartTimeViewController.swift; sourceTree = ""; }; + 225B36481F6EBA410005B3D5 /* ColoredLineChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColoredLineChartViewController.swift; sourceTree = ""; }; + 225B36491F6EBA410005B3D5 /* LineChart2ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineChart2ViewController.swift; sourceTree = ""; }; + 225B364A1F6EBA410005B3D5 /* LineChart1ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineChart1ViewController.swift; sourceTree = ""; }; + 225B364B1F6EBA410005B3D5 /* NegativeStackedBarChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NegativeStackedBarChartViewController.swift; sourceTree = ""; }; + 225B364C1F6EBA410005B3D5 /* ScatterChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScatterChartViewController.swift; sourceTree = ""; }; + 225B364D1F6EBA410005B3D5 /* StackedBarChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StackedBarChartViewController.swift; sourceTree = ""; }; + 225B364E1F6EBA410005B3D5 /* BubbleChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BubbleChartViewController.swift; sourceTree = ""; }; + 225B364F1F6EBA410005B3D5 /* LineChartFilledViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineChartFilledViewController.swift; sourceTree = ""; }; + 225B36501F6EBA410005B3D5 /* PositiveNegativeBarChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositiveNegativeBarChartViewController.swift; sourceTree = ""; }; + 225B36511F6EBA410005B3D5 /* AnotherBarChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnotherBarChartViewController.swift; sourceTree = ""; }; + 225B36521F6EBA410005B3D5 /* PieChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PieChartViewController.swift; sourceTree = ""; }; + 225B36531F6EBA410005B3D5 /* CubicLineChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CubicLineChartViewController.swift; sourceTree = ""; }; + 225B36541F6EBA410005B3D5 /* RadarChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadarChartViewController.swift; sourceTree = ""; }; + 225B36551F6EBA410005B3D5 /* HorizontalBarChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HorizontalBarChartViewController.swift; sourceTree = ""; }; + 225B36561F6EBA410005B3D5 /* PiePolylineChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiePolylineChartViewController.swift; sourceTree = ""; }; + 225B36571F6EBA410005B3D5 /* CombinedChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CombinedChartViewController.swift; sourceTree = ""; }; + 225B36581F6EBA410005B3D5 /* BarChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarChartViewController.swift; sourceTree = ""; }; + 225B36591F6EBA410005B3D5 /* SinusBarChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SinusBarChartViewController.swift; sourceTree = ""; }; + 225B365A1F6EBA410005B3D5 /* CandleStickChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CandleStickChartViewController.swift; sourceTree = ""; }; + 55E3564D1ADC638F00A57971 /* BubbleChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BubbleChartViewController.xib; sourceTree = ""; }; + 55E3564E1ADC638F00A57971 /* BubbleChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BubbleChartViewController.h; sourceTree = ""; }; + 55E3564F1ADC638F00A57971 /* BubbleChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BubbleChartViewController.m; sourceTree = ""; }; + 5B0CC7821ABB875400665592 /* PieChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PieChartViewController.h; sourceTree = ""; }; + 5B0CC7831ABB875400665592 /* PieChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PieChartViewController.m; sourceTree = ""; }; + 5B0CC7841ABB875400665592 /* PieChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PieChartViewController.xib; sourceTree = ""; }; + 5B1B5DA91E911A15006D1375 /* RealmDemosViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = RealmDemosViewController.xib; path = XIBs/Demos/RealmDemosViewController.xib; sourceTree = SOURCE_ROOT; }; + 5B57BBAF1A9B26AA0036A6CC /* ChartsDemo-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ChartsDemo-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 5B57BBB31A9B26AA0036A6CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 5B57BBB41A9B26AA0036A6CC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 5B57BBB61A9B26AA0036A6CC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 5B57BBB71A9B26AA0036A6CC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 5B57BBB91A9B26AA0036A6CC /* DemoListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DemoListViewController.h; sourceTree = ""; }; + 5B57BBBA1A9B26AA0036A6CC /* DemoListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DemoListViewController.m; sourceTree = ""; }; + 5B613DA31D526AD5000F1E98 /* radar_marker@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "radar_marker@3x.png"; sourceTree = ""; }; + 5B613DB21D526DED000F1E98 /* RadarMarkerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadarMarkerView.swift; sourceTree = ""; }; + 5B613DB41D526EA8000F1E98 /* RadarMarkerView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RadarMarkerView.xib; sourceTree = ""; }; + 5B613DEF1D5A50B6000F1E98 /* XYMarkerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XYMarkerView.swift; sourceTree = ""; }; + 5B613DF11D5A60DF000F1E98 /* LargeValueFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LargeValueFormatter.swift; sourceTree = ""; }; + 5B8EAF231AB3271B009697AA /* DemoListViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DemoListViewController.xib; sourceTree = ""; }; + 5B8EAF251AB32CF5009697AA /* DemoBaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoBaseViewController.h; sourceTree = ""; }; + 5B8EAF261AB32CF5009697AA /* DemoBaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoBaseViewController.m; sourceTree = ""; }; + 5B8EAF2F1AB32E15009697AA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 5B96243E1B38608C007763E2 /* NegativeStackedBarChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NegativeStackedBarChartViewController.h; sourceTree = ""; }; + 5B96243F1B38608C007763E2 /* NegativeStackedBarChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NegativeStackedBarChartViewController.m; sourceTree = ""; }; + 5B9624401B38608C007763E2 /* NegativeStackedBarChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NegativeStackedBarChartViewController.xib; sourceTree = ""; }; + 5BD47E5A1ABB0263008FCEC6 /* BalloonMarker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BalloonMarker.swift; sourceTree = ""; }; + 5BD47E5C1ABB0273008FCEC6 /* ChartsDemo-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ChartsDemo-Bridging-Header.h"; sourceTree = ""; }; + 5BD47E5D1ABB3C91008FCEC6 /* LineChart2ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineChart2ViewController.h; sourceTree = ""; }; + 5BD47E5E1ABB3C91008FCEC6 /* LineChart2ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LineChart2ViewController.m; sourceTree = ""; }; + 5BD47E5F1ABB3C91008FCEC6 /* LineChart2ViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LineChart2ViewController.xib; sourceTree = ""; }; + 5BD47E621ABB424E008FCEC6 /* BarChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BarChartViewController.h; sourceTree = ""; }; + 5BD47E631ABB424E008FCEC6 /* BarChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BarChartViewController.m; sourceTree = ""; }; + 5BD47E641ABB424E008FCEC6 /* BarChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BarChartViewController.xib; sourceTree = ""; }; + 5BD8F0711AB89CE500566E05 /* LineChart1ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineChart1ViewController.h; sourceTree = ""; }; + 5BD8F0721AB89CE500566E05 /* LineChart1ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LineChart1ViewController.m; sourceTree = ""; }; + 5BD8F0731AB89CE500566E05 /* LineChart1ViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LineChart1ViewController.xib; sourceTree = ""; }; + 5BDEDC3E1ABB7F73007D3A60 /* HorizontalBarChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HorizontalBarChartViewController.h; sourceTree = ""; }; + 5BDEDC3F1ABB7F73007D3A60 /* HorizontalBarChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HorizontalBarChartViewController.m; sourceTree = ""; }; + 5BDEDC401ABB7F73007D3A60 /* HorizontalBarChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HorizontalBarChartViewController.xib; sourceTree = ""; }; + 5BDEDC441ABB871E007D3A60 /* CombinedChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CombinedChartViewController.h; sourceTree = ""; }; + 5BDEDC451ABB871E007D3A60 /* CombinedChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CombinedChartViewController.m; sourceTree = ""; }; + 5BDEDC461ABB871E007D3A60 /* CombinedChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CombinedChartViewController.xib; sourceTree = ""; }; + 5BE377DC1D425151006EB34F /* DayAxisValueFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DayAxisValueFormatter.h; sourceTree = ""; }; + 5BE377DD1D425151006EB34F /* DayAxisValueFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DayAxisValueFormatter.m; sourceTree = ""; }; + 5BE377F01D47FDF1006EB34F /* IntAxisValueFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntAxisValueFormatter.h; sourceTree = ""; }; + 5BE377F11D47FDF1006EB34F /* IntAxisValueFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IntAxisValueFormatter.m; sourceTree = ""; }; + 5BE6737D1D5B496500A87BA2 /* HalfPieChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HalfPieChartViewController.h; sourceTree = ""; }; + 5BE6737E1D5B496500A87BA2 /* HalfPieChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HalfPieChartViewController.m; sourceTree = ""; }; + 5BE6737F1D5B496500A87BA2 /* HalfPieChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HalfPieChartViewController.xib; sourceTree = ""; }; + 5BE6738C1D5B4E0900A87BA2 /* LineChartFilledViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineChartFilledViewController.h; sourceTree = ""; }; + 5BE6738D1D5B4E0900A87BA2 /* LineChartFilledViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LineChartFilledViewController.m; sourceTree = ""; }; + 5BE6738E1D5B4E0900A87BA2 /* LineChartFilledViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LineChartFilledViewController.xib; sourceTree = ""; }; + 5BE6738F1D5B4E0900A87BA2 /* LineChartTimeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineChartTimeViewController.h; sourceTree = ""; }; + 5BE673901D5B4E0900A87BA2 /* LineChartTimeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LineChartTimeViewController.m; sourceTree = ""; }; + 5BE673911D5B4E0900A87BA2 /* LineChartTimeViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LineChartTimeViewController.xib; sourceTree = ""; }; + 5BE673981D5BAD7E00A87BA2 /* DateValueFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateValueFormatter.h; sourceTree = ""; }; + 5BE673991D5BAD7E00A87BA2 /* DateValueFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DateValueFormatter.m; sourceTree = ""; }; + 5BE7E75F1C693098000A0377 /* PositiveNegativeBarChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PositiveNegativeBarChartViewController.h; sourceTree = ""; }; + 5BE7E7601C693098000A0377 /* PositiveNegativeBarChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PositiveNegativeBarChartViewController.m; sourceTree = ""; }; + 5BE7E7611C693098000A0377 /* PositiveNegativeBarChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PositiveNegativeBarChartViewController.xib; sourceTree = ""; }; + 5BEAED0F1ABBFB2B0013F194 /* AnotherBarChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnotherBarChartViewController.h; sourceTree = ""; }; + 5BEAED101ABBFB2B0013F194 /* AnotherBarChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnotherBarChartViewController.m; sourceTree = ""; }; + 5BEAED111ABBFB2B0013F194 /* AnotherBarChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AnotherBarChartViewController.xib; sourceTree = ""; }; + 5BEAED151ABBFB340013F194 /* ScatterChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScatterChartViewController.h; sourceTree = ""; }; + 5BEAED161ABBFB340013F194 /* ScatterChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScatterChartViewController.m; sourceTree = ""; }; + 5BEAED171ABBFB340013F194 /* ScatterChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ScatterChartViewController.xib; sourceTree = ""; }; + 5BEAED181ABBFB340013F194 /* StackedBarChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackedBarChartViewController.h; sourceTree = ""; }; + 5BEAED191ABBFB340013F194 /* StackedBarChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StackedBarChartViewController.m; sourceTree = ""; }; + 5BEAED1A1ABBFB340013F194 /* StackedBarChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = StackedBarChartViewController.xib; sourceTree = ""; }; + 5BEAED1F1ABC0BE20013F194 /* MultipleBarChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultipleBarChartViewController.h; sourceTree = ""; }; + 5BEAED201ABC0BE20013F194 /* MultipleBarChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MultipleBarChartViewController.m; sourceTree = ""; }; + 5BEAED211ABC0BE20013F194 /* MultipleBarChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MultipleBarChartViewController.xib; sourceTree = ""; }; + 5BEAED221ABC0BE20013F194 /* MultipleLinesChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultipleLinesChartViewController.h; sourceTree = ""; }; + 5BEAED231ABC0BE20013F194 /* MultipleLinesChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MultipleLinesChartViewController.m; sourceTree = ""; }; + 5BEAED241ABC0BE20013F194 /* MultipleLinesChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MultipleLinesChartViewController.xib; sourceTree = ""; }; + 5BEAED291ABC160F0013F194 /* CandleStickChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CandleStickChartViewController.h; sourceTree = ""; }; + 5BEAED2A1ABC160F0013F194 /* CandleStickChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CandleStickChartViewController.m; sourceTree = ""; }; + 5BEAED2B1ABC160F0013F194 /* CandleStickChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CandleStickChartViewController.xib; sourceTree = ""; }; + 5BEAED2E1ABC18F00013F194 /* CubicLineChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CubicLineChartViewController.h; sourceTree = ""; }; + 5BEAED2F1ABC18F00013F194 /* CubicLineChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CubicLineChartViewController.m; sourceTree = ""; }; + 5BEAED301ABC18F00013F194 /* CubicLineChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CubicLineChartViewController.xib; sourceTree = ""; }; + 5BEAED331ABC192F0013F194 /* RadarChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RadarChartViewController.h; sourceTree = ""; }; + 5BEAED341ABC192F0013F194 /* RadarChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RadarChartViewController.m; sourceTree = ""; }; + 5BEAED351ABC192F0013F194 /* RadarChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RadarChartViewController.xib; sourceTree = ""; }; + 5BEAED381ABC199F0013F194 /* ColoredLineChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColoredLineChartViewController.h; sourceTree = ""; }; + 5BEAED391ABC199F0013F194 /* ColoredLineChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ColoredLineChartViewController.m; sourceTree = ""; }; + 5BEAED3A1ABC199F0013F194 /* ColoredLineChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ColoredLineChartViewController.xib; sourceTree = ""; }; + 5BEAED3D1ABC1AC60013F194 /* SinusBarChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SinusBarChartViewController.h; sourceTree = ""; }; + 5BEAED3E1ABC1AC60013F194 /* SinusBarChartViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SinusBarChartViewController.m; sourceTree = ""; }; + 5BEAED3F1ABC1AC60013F194 /* SinusBarChartViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SinusBarChartViewController.xib; sourceTree = ""; }; + B64D06EA1FB199130067418D /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 225B361A1F6EB9A50005B3D5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 225B368C1F6EBBB00005B3D5 /* Charts.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5B57BBAC1A9B26AA0036A6CC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0630AE511D81271B008859B0 /* Charts.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0630AE3A1D8126C0008859B0 /* Products */ = { + isa = PBXGroup; + children = ( + 0630AE411D8126C0008859B0 /* Charts.framework */, + 0630AE431D8126C0008859B0 /* ChartsTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 225B361E1F6EB9A50005B3D5 /* Swift */ = { + isa = PBXGroup; + children = ( + 225B361F1F6EB9A50005B3D5 /* AppDelegate.swift */, + 225B362F1F6EB9EE0005B3D5 /* DemoBaseViewController.swift */, + 225B36301F6EB9EE0005B3D5 /* DemoListViewController.swift */, + 225B363C1F6EBA180005B3D5 /* Components */, + 225B36331F6EB9FE0005B3D5 /* Formatters */, + 225B36431F6EBA410005B3D5 /* Demos */, + ); + path = Swift; + sourceTree = ""; + }; + 225B36331F6EB9FE0005B3D5 /* Formatters */ = { + isa = PBXGroup; + children = ( + 225B36351F6EB9FE0005B3D5 /* DayAxisValueFormatter.swift */, + 225B36361F6EB9FE0005B3D5 /* DateValueFormatter.swift */, + 225B36341F6EB9FE0005B3D5 /* IntAxisValueFormatter.swift */, + 225B36371F6EB9FE0005B3D5 /* LargeValueFormatter.swift */, + ); + path = Formatters; + sourceTree = ""; + }; + 225B363C1F6EBA180005B3D5 /* Components */ = { + isa = PBXGroup; + children = ( + 225B363E1F6EBA180005B3D5 /* BalloonMarker.swift */, + 225B363F1F6EBA180005B3D5 /* RadarMarkerView.swift */, + 225B363D1F6EBA180005B3D5 /* XYMarkerView.swift */, + ); + path = Components; + sourceTree = ""; + }; + 225B36431F6EBA410005B3D5 /* Demos */ = { + isa = PBXGroup; + children = ( + 225B36511F6EBA410005B3D5 /* AnotherBarChartViewController.swift */, + 225B36581F6EBA410005B3D5 /* BarChartViewController.swift */, + 225B364E1F6EBA410005B3D5 /* BubbleChartViewController.swift */, + 225B365A1F6EBA410005B3D5 /* CandleStickChartViewController.swift */, + 225B36481F6EBA410005B3D5 /* ColoredLineChartViewController.swift */, + 225B36571F6EBA410005B3D5 /* CombinedChartViewController.swift */, + 225B36531F6EBA410005B3D5 /* CubicLineChartViewController.swift */, + 225B36461F6EBA410005B3D5 /* HalfPieChartViewController.swift */, + 225B36551F6EBA410005B3D5 /* HorizontalBarChartViewController.swift */, + 225B364A1F6EBA410005B3D5 /* LineChart1ViewController.swift */, + 225B36491F6EBA410005B3D5 /* LineChart2ViewController.swift */, + 225B364F1F6EBA410005B3D5 /* LineChartFilledViewController.swift */, + 225B36471F6EBA410005B3D5 /* LineChartTimeViewController.swift */, + 225B36441F6EBA410005B3D5 /* MultipleLinesChartViewController.swift */, + 225B36451F6EBA410005B3D5 /* MultipleBarChartViewController.swift */, + 225B364B1F6EBA410005B3D5 /* NegativeStackedBarChartViewController.swift */, + 225B36521F6EBA410005B3D5 /* PieChartViewController.swift */, + 225B36561F6EBA410005B3D5 /* PiePolylineChartViewController.swift */, + 225B36501F6EBA410005B3D5 /* PositiveNegativeBarChartViewController.swift */, + 225B36541F6EBA410005B3D5 /* RadarChartViewController.swift */, + 225B364C1F6EBA410005B3D5 /* ScatterChartViewController.swift */, + 225B36591F6EBA410005B3D5 /* SinusBarChartViewController.swift */, + 225B364D1F6EBA410005B3D5 /* StackedBarChartViewController.swift */, + ); + path = Demos; + sourceTree = ""; + }; + 227136F41F6EB665006D2A11 /* XIBs */ = { + isa = PBXGroup; + children = ( + 5B8EAF231AB3271B009697AA /* DemoListViewController.xib */, + 5B613DB41D526EA8000F1E98 /* RadarMarkerView.xib */, + 227136F61F6EB69D006D2A11 /* Demos */, + ); + path = XIBs; + sourceTree = ""; + }; + 227136F61F6EB69D006D2A11 /* Demos */ = { + isa = PBXGroup; + children = ( + 5BEAED111ABBFB2B0013F194 /* AnotherBarChartViewController.xib */, + 5BD47E641ABB424E008FCEC6 /* BarChartViewController.xib */, + 55E3564D1ADC638F00A57971 /* BubbleChartViewController.xib */, + 5BEAED2B1ABC160F0013F194 /* CandleStickChartViewController.xib */, + 5BEAED3A1ABC199F0013F194 /* ColoredLineChartViewController.xib */, + 5BDEDC461ABB871E007D3A60 /* CombinedChartViewController.xib */, + 5BEAED301ABC18F00013F194 /* CubicLineChartViewController.xib */, + 5BE6737F1D5B496500A87BA2 /* HalfPieChartViewController.xib */, + 5BDEDC401ABB7F73007D3A60 /* HorizontalBarChartViewController.xib */, + 5BD8F0731AB89CE500566E05 /* LineChart1ViewController.xib */, + 5BD47E5F1ABB3C91008FCEC6 /* LineChart2ViewController.xib */, + 5BE6738E1D5B4E0900A87BA2 /* LineChartFilledViewController.xib */, + 5BE673911D5B4E0900A87BA2 /* LineChartTimeViewController.xib */, + 5BEAED211ABC0BE20013F194 /* MultipleBarChartViewController.xib */, + 5BEAED241ABC0BE20013F194 /* MultipleLinesChartViewController.xib */, + 5B9624401B38608C007763E2 /* NegativeStackedBarChartViewController.xib */, + 5B0CC7841ABB875400665592 /* PieChartViewController.xib */, + 0471CBFB1CA1090A00E52DBC /* PiePolylineChartViewController.xib */, + 5BE7E7611C693098000A0377 /* PositiveNegativeBarChartViewController.xib */, + 5BEAED351ABC192F0013F194 /* RadarChartViewController.xib */, + 5B1B5DA91E911A15006D1375 /* RealmDemosViewController.xib */, + 5BEAED171ABBFB340013F194 /* ScatterChartViewController.xib */, + 5BEAED3F1ABC1AC60013F194 /* SinusBarChartViewController.xib */, + 5BEAED1A1ABBFB340013F194 /* StackedBarChartViewController.xib */, + ); + path = Demos; + sourceTree = ""; + }; + 5B57BBA61A9B26AA0036A6CC = { + isa = PBXGroup; + children = ( + 5B57BBB11A9B26AA0036A6CC /* Objective-C */, + 225B361E1F6EB9A50005B3D5 /* Swift */, + 227136F41F6EB665006D2A11 /* XIBs */, + 5B8EAF2E1AB32E15009697AA /* Resources */, + 5B57BBB21A9B26AA0036A6CC /* Supporting Files */, + 5B57BBB01A9B26AA0036A6CC /* Products */, + 0630AE391D8126C0008859B0 /* Charts.xcodeproj */, + ); + sourceTree = ""; + }; + 5B57BBB01A9B26AA0036A6CC /* Products */ = { + isa = PBXGroup; + children = ( + 5B57BBAF1A9B26AA0036A6CC /* ChartsDemo-iOS.app */, + 225B361D1F6EB9A50005B3D5 /* ChartsDemo-iOS-Swift.app */, + ); + name = Products; + sourceTree = ""; + }; + 5B57BBB11A9B26AA0036A6CC /* Objective-C */ = { + isa = PBXGroup; + children = ( + 5B57BBB61A9B26AA0036A6CC /* AppDelegate.h */, + 5B57BBB71A9B26AA0036A6CC /* AppDelegate.m */, + 5B57BBB91A9B26AA0036A6CC /* DemoListViewController.h */, + 5B57BBBA1A9B26AA0036A6CC /* DemoListViewController.m */, + 5B8EAF251AB32CF5009697AA /* DemoBaseViewController.h */, + 5B8EAF261AB32CF5009697AA /* DemoBaseViewController.m */, + 5BE377D41D42511A006EB34F /* Formatters */, + 5BD47E541ABB0177008FCEC6 /* Components */, + 5BD8F06F1AB89C7100566E05 /* Demos */, + ); + path = "Objective-C"; + sourceTree = ""; + }; + 5B57BBB21A9B26AA0036A6CC /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 5B57BBB31A9B26AA0036A6CC /* Info.plist */, + 5B57BBB41A9B26AA0036A6CC /* main.m */, + 5BD47E5C1ABB0273008FCEC6 /* ChartsDemo-Bridging-Header.h */, + ); + path = "Supporting Files"; + sourceTree = ""; + }; + 5B613DA21D526AD5000F1E98 /* markers */ = { + isa = PBXGroup; + children = ( + 5B613DA31D526AD5000F1E98 /* radar_marker@3x.png */, + ); + path = markers; + sourceTree = ""; + }; + 5B8EAF2E1AB32E15009697AA /* Resources */ = { + isa = PBXGroup; + children = ( + B64D06EA1FB199130067418D /* Launch Screen.storyboard */, + 5B8EAF2F1AB32E15009697AA /* Images.xcassets */, + 5B613DA21D526AD5000F1E98 /* markers */, + ); + path = Resources; + sourceTree = ""; + }; + 5BD47E541ABB0177008FCEC6 /* Components */ = { + isa = PBXGroup; + children = ( + 5BD47E5A1ABB0263008FCEC6 /* BalloonMarker.swift */, + 5B613DB21D526DED000F1E98 /* RadarMarkerView.swift */, + 5B613DEF1D5A50B6000F1E98 /* XYMarkerView.swift */, + ); + path = Components; + sourceTree = ""; + }; + 5BD8F06F1AB89C7100566E05 /* Demos */ = { + isa = PBXGroup; + children = ( + 5BEAED0F1ABBFB2B0013F194 /* AnotherBarChartViewController.h */, + 5BEAED101ABBFB2B0013F194 /* AnotherBarChartViewController.m */, + 5BD47E621ABB424E008FCEC6 /* BarChartViewController.h */, + 5BD47E631ABB424E008FCEC6 /* BarChartViewController.m */, + 55E3564E1ADC638F00A57971 /* BubbleChartViewController.h */, + 55E3564F1ADC638F00A57971 /* BubbleChartViewController.m */, + 5BEAED291ABC160F0013F194 /* CandleStickChartViewController.h */, + 5BEAED2A1ABC160F0013F194 /* CandleStickChartViewController.m */, + 5BEAED381ABC199F0013F194 /* ColoredLineChartViewController.h */, + 5BEAED391ABC199F0013F194 /* ColoredLineChartViewController.m */, + 5BDEDC441ABB871E007D3A60 /* CombinedChartViewController.h */, + 5BDEDC451ABB871E007D3A60 /* CombinedChartViewController.m */, + 5BEAED2E1ABC18F00013F194 /* CubicLineChartViewController.h */, + 5BEAED2F1ABC18F00013F194 /* CubicLineChartViewController.m */, + 5BE6737D1D5B496500A87BA2 /* HalfPieChartViewController.h */, + 5BE6737E1D5B496500A87BA2 /* HalfPieChartViewController.m */, + 5BDEDC3E1ABB7F73007D3A60 /* HorizontalBarChartViewController.h */, + 5BDEDC3F1ABB7F73007D3A60 /* HorizontalBarChartViewController.m */, + 5BD8F0711AB89CE500566E05 /* LineChart1ViewController.h */, + 5BD8F0721AB89CE500566E05 /* LineChart1ViewController.m */, + 5BD47E5D1ABB3C91008FCEC6 /* LineChart2ViewController.h */, + 5BD47E5E1ABB3C91008FCEC6 /* LineChart2ViewController.m */, + 5BE6738C1D5B4E0900A87BA2 /* LineChartFilledViewController.h */, + 5BE6738D1D5B4E0900A87BA2 /* LineChartFilledViewController.m */, + 5BE6738F1D5B4E0900A87BA2 /* LineChartTimeViewController.h */, + 5BE673901D5B4E0900A87BA2 /* LineChartTimeViewController.m */, + 5BEAED1F1ABC0BE20013F194 /* MultipleBarChartViewController.h */, + 5BEAED201ABC0BE20013F194 /* MultipleBarChartViewController.m */, + 5BEAED221ABC0BE20013F194 /* MultipleLinesChartViewController.h */, + 5BEAED231ABC0BE20013F194 /* MultipleLinesChartViewController.m */, + 5B96243E1B38608C007763E2 /* NegativeStackedBarChartViewController.h */, + 5B96243F1B38608C007763E2 /* NegativeStackedBarChartViewController.m */, + 5B0CC7821ABB875400665592 /* PieChartViewController.h */, + 5B0CC7831ABB875400665592 /* PieChartViewController.m */, + 0439A3511C9FF95F00496F83 /* PiePolylineChartViewController.h */, + 0439A3521C9FF95F00496F83 /* PiePolylineChartViewController.m */, + 5BE7E75F1C693098000A0377 /* PositiveNegativeBarChartViewController.h */, + 5BE7E7601C693098000A0377 /* PositiveNegativeBarChartViewController.m */, + 5BEAED331ABC192F0013F194 /* RadarChartViewController.h */, + 5BEAED341ABC192F0013F194 /* RadarChartViewController.m */, + 5BEAED151ABBFB340013F194 /* ScatterChartViewController.h */, + 5BEAED161ABBFB340013F194 /* ScatterChartViewController.m */, + 5BEAED3D1ABC1AC60013F194 /* SinusBarChartViewController.h */, + 5BEAED3E1ABC1AC60013F194 /* SinusBarChartViewController.m */, + 5BEAED181ABBFB340013F194 /* StackedBarChartViewController.h */, + 5BEAED191ABBFB340013F194 /* StackedBarChartViewController.m */, + ); + path = Demos; + sourceTree = ""; + }; + 5BE377D41D42511A006EB34F /* Formatters */ = { + isa = PBXGroup; + children = ( + 5BE377DC1D425151006EB34F /* DayAxisValueFormatter.h */, + 5BE377DD1D425151006EB34F /* DayAxisValueFormatter.m */, + 5BE377F01D47FDF1006EB34F /* IntAxisValueFormatter.h */, + 5BE377F11D47FDF1006EB34F /* IntAxisValueFormatter.m */, + 5B613DF11D5A60DF000F1E98 /* LargeValueFormatter.swift */, + 5BE673981D5BAD7E00A87BA2 /* DateValueFormatter.h */, + 5BE673991D5BAD7E00A87BA2 /* DateValueFormatter.m */, + ); + path = Formatters; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 225B361C1F6EB9A50005B3D5 /* ChartsDemo-iOS-Swift */ = { + isa = PBXNativeTarget; + buildConfigurationList = 225B362C1F6EB9A50005B3D5 /* Build configuration list for PBXNativeTarget "ChartsDemo-iOS-Swift" */; + buildPhases = ( + 225B36191F6EB9A50005B3D5 /* Sources */, + 225B361A1F6EB9A50005B3D5 /* Frameworks */, + 225B361B1F6EB9A50005B3D5 /* Resources */, + 225B36901F6EBBB10005B3D5 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 225B368F1F6EBBB00005B3D5 /* PBXTargetDependency */, + ); + name = "ChartsDemo-iOS-Swift"; + productName = "ChartsDemo-Swift"; + productReference = 225B361D1F6EB9A50005B3D5 /* ChartsDemo-iOS-Swift.app */; + productType = "com.apple.product-type.application"; + }; + 5B57BBAE1A9B26AA0036A6CC /* ChartsDemo-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5B57BBD21A9B26AA0036A6CC /* Build configuration list for PBXNativeTarget "ChartsDemo-iOS" */; + buildPhases = ( + 5B57BBAB1A9B26AA0036A6CC /* Sources */, + 5B57BBAC1A9B26AA0036A6CC /* Frameworks */, + 5B57BBAD1A9B26AA0036A6CC /* Resources */, + 5BB4B0751ACA710D00E2EF4D /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 0630AE541D81271B008859B0 /* PBXTargetDependency */, + ); + name = "ChartsDemo-iOS"; + productName = chartstest; + productReference = 5B57BBAF1A9B26AA0036A6CC /* ChartsDemo-iOS.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 5B57BBA71A9B26AA0036A6CC /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftMigration = 0700; + LastSwiftUpdateCheck = 0700; + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = dcg; + TargetAttributes = { + 225B361C1F6EB9A50005B3D5 = { + CreatedOnToolsVersion = 9.0; + LastSwiftMigration = 1000; + }; + 5B57BBAE1A9B26AA0036A6CC = { + CreatedOnToolsVersion = 6.1.1; + LastSwiftMigration = 0900; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 5B57BBAA1A9B26AA0036A6CC /* Build configuration list for PBXProject "ChartsDemo-iOS" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + English, + en, + Base, + ); + mainGroup = 5B57BBA61A9B26AA0036A6CC; + productRefGroup = 5B57BBB01A9B26AA0036A6CC /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 0630AE3A1D8126C0008859B0 /* Products */; + ProjectRef = 0630AE391D8126C0008859B0 /* Charts.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 5B57BBAE1A9B26AA0036A6CC /* ChartsDemo-iOS */, + 225B361C1F6EB9A50005B3D5 /* ChartsDemo-iOS-Swift */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 0630AE411D8126C0008859B0 /* Charts.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Charts.framework; + remoteRef = 0630AE401D8126C0008859B0 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 0630AE431D8126C0008859B0 /* ChartsTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ChartsTests.xctest; + remoteRef = 0630AE421D8126C0008859B0 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 225B361B1F6EB9A50005B3D5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 225B367C1F6EBA640005B3D5 /* HorizontalBarChartViewController.xib in Resources */, + 225B36841F6EBA640005B3D5 /* PieChartViewController.xib in Resources */, + 225B36741F6EBA640005B3D5 /* AnotherBarChartViewController.xib in Resources */, + 225B36781F6EBA640005B3D5 /* ColoredLineChartViewController.xib in Resources */, + 225B36791F6EBA640005B3D5 /* CombinedChartViewController.xib in Resources */, + 225B367B1F6EBA640005B3D5 /* HalfPieChartViewController.xib in Resources */, + 068A9B1A1FBBF355003CF1AD /* Launch Screen.storyboard in Resources */, + 225B367A1F6EBA640005B3D5 /* CubicLineChartViewController.xib in Resources */, + 225B368B1F6EBA640005B3D5 /* StackedBarChartViewController.xib in Resources */, + 225B36821F6EBA640005B3D5 /* MultipleLinesChartViewController.xib in Resources */, + 068A9B191FBBF351003CF1AD /* Images.xcassets in Resources */, + 225B36751F6EBA640005B3D5 /* BarChartViewController.xib in Resources */, + 225B367F1F6EBA640005B3D5 /* LineChartFilledViewController.xib in Resources */, + 225B36801F6EBA640005B3D5 /* LineChartTimeViewController.xib in Resources */, + 225B36811F6EBA640005B3D5 /* MultipleBarChartViewController.xib in Resources */, + 225B367D1F6EBA640005B3D5 /* LineChart1ViewController.xib in Resources */, + 068A9B1B1FBBF366003CF1AD /* radar_marker@3x.png in Resources */, + 225B36721F6EBA5E0005B3D5 /* DemoListViewController.xib in Resources */, + 225B36891F6EBA640005B3D5 /* ScatterChartViewController.xib in Resources */, + 225B36851F6EBA640005B3D5 /* PiePolylineChartViewController.xib in Resources */, + 225B36771F6EBA640005B3D5 /* CandleStickChartViewController.xib in Resources */, + 225B36871F6EBA640005B3D5 /* RadarChartViewController.xib in Resources */, + 225B368A1F6EBA640005B3D5 /* SinusBarChartViewController.xib in Resources */, + 225B36731F6EBA5E0005B3D5 /* RadarMarkerView.xib in Resources */, + 225B367E1F6EBA640005B3D5 /* LineChart2ViewController.xib in Resources */, + 225B36881F6EBA640005B3D5 /* RealmDemosViewController.xib in Resources */, + 225B36861F6EBA640005B3D5 /* PositiveNegativeBarChartViewController.xib in Resources */, + 225B36831F6EBA640005B3D5 /* NegativeStackedBarChartViewController.xib in Resources */, + 225B36761F6EBA640005B3D5 /* BubbleChartViewController.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5B57BBAD1A9B26AA0036A6CC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5B8EAF301AB32E15009697AA /* Images.xcassets in Resources */, + 5BE673931D5B4E0900A87BA2 /* LineChartFilledViewController.xib in Resources */, + 5BEAED2D1ABC160F0013F194 /* CandleStickChartViewController.xib in Resources */, + 5B613DB51D526EA8000F1E98 /* RadarMarkerView.xib in Resources */, + 5BD47E611ABB3C91008FCEC6 /* LineChart2ViewController.xib in Resources */, + 5BEAED131ABBFB2B0013F194 /* AnotherBarChartViewController.xib in Resources */, + 5BEAED411ABC1AC60013F194 /* SinusBarChartViewController.xib in Resources */, + 5BEAED371ABC192F0013F194 /* RadarChartViewController.xib in Resources */, + 5B8EAF241AB3271B009697AA /* DemoListViewController.xib in Resources */, + 5BEAED261ABC0BE20013F194 /* MultipleBarChartViewController.xib in Resources */, + 5BEAED3C1ABC199F0013F194 /* ColoredLineChartViewController.xib in Resources */, + 5BEAED321ABC18F00013F194 /* CubicLineChartViewController.xib in Resources */, + 5BEAED281ABC0BE20013F194 /* MultipleLinesChartViewController.xib in Resources */, + 5B9624421B38608C007763E2 /* NegativeStackedBarChartViewController.xib in Resources */, + 5B613DA41D526AD5000F1E98 /* radar_marker@3x.png in Resources */, + 5BE7E7631C693098000A0377 /* PositiveNegativeBarChartViewController.xib in Resources */, + 5B0CC7861ABB875400665592 /* PieChartViewController.xib in Resources */, + 5BEAED1C1ABBFB340013F194 /* ScatterChartViewController.xib in Resources */, + 0471CBFC1CA1090A00E52DBC /* PiePolylineChartViewController.xib in Resources */, + 5BD8F0751AB89CE500566E05 /* LineChart1ViewController.xib in Resources */, + 5BE673811D5B496500A87BA2 /* HalfPieChartViewController.xib in Resources */, + B64D06EB1FB199130067418D /* Launch Screen.storyboard in Resources */, + 5BD47E661ABB424E008FCEC6 /* BarChartViewController.xib in Resources */, + 5BDEDC421ABB7F73007D3A60 /* HorizontalBarChartViewController.xib in Resources */, + 5BDEDC481ABB871E007D3A60 /* CombinedChartViewController.xib in Resources */, + 5BE673951D5B4E0900A87BA2 /* LineChartTimeViewController.xib in Resources */, + 5BEAED1E1ABBFB340013F194 /* StackedBarChartViewController.xib in Resources */, + 5B1B5DAB1E911A15006D1375 /* RealmDemosViewController.xib in Resources */, + 55E356501ADC638F00A57971 /* BubbleChartViewController.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 225B36191F6EB9A50005B3D5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 225B365E1F6EBA470005B3D5 /* LineChartTimeViewController.swift in Sources */, + 225B36311F6EB9EE0005B3D5 /* DemoBaseViewController.swift in Sources */, + 225B36391F6EBA040005B3D5 /* DayAxisValueFormatter.swift in Sources */, + 225B36661F6EBA470005B3D5 /* LineChartFilledViewController.swift in Sources */, + 225B366A1F6EBA470005B3D5 /* CubicLineChartViewController.swift in Sources */, + 225B36671F6EBA470005B3D5 /* PositiveNegativeBarChartViewController.swift in Sources */, + 225B363A1F6EBA040005B3D5 /* DateValueFormatter.swift in Sources */, + 225B366D1F6EBA470005B3D5 /* PiePolylineChartViewController.swift in Sources */, + 225B366F1F6EBA470005B3D5 /* BarChartViewController.swift in Sources */, + 225B36601F6EBA470005B3D5 /* LineChart2ViewController.swift in Sources */, + 225B36411F6EBA1D0005B3D5 /* BalloonMarker.swift in Sources */, + 225B366C1F6EBA470005B3D5 /* HorizontalBarChartViewController.swift in Sources */, + 225B36401F6EBA1D0005B3D5 /* XYMarkerView.swift in Sources */, + 225B36421F6EBA1D0005B3D5 /* RadarMarkerView.swift in Sources */, + 225B366B1F6EBA470005B3D5 /* RadarChartViewController.swift in Sources */, + 225B36611F6EBA470005B3D5 /* LineChart1ViewController.swift in Sources */, + 225B36691F6EBA470005B3D5 /* PieChartViewController.swift in Sources */, + 225B365B1F6EBA470005B3D5 /* MultipleLinesChartViewController.swift in Sources */, + 225B365F1F6EBA470005B3D5 /* ColoredLineChartViewController.swift in Sources */, + 225B36201F6EB9A50005B3D5 /* AppDelegate.swift in Sources */, + 225B36321F6EB9EE0005B3D5 /* DemoListViewController.swift in Sources */, + 225B36711F6EBA470005B3D5 /* CandleStickChartViewController.swift in Sources */, + 225B36631F6EBA470005B3D5 /* ScatterChartViewController.swift in Sources */, + 225B365C1F6EBA470005B3D5 /* MultipleBarChartViewController.swift in Sources */, + 225B366E1F6EBA470005B3D5 /* CombinedChartViewController.swift in Sources */, + 225B36641F6EBA470005B3D5 /* StackedBarChartViewController.swift in Sources */, + 225B36651F6EBA470005B3D5 /* BubbleChartViewController.swift in Sources */, + 225B36381F6EBA040005B3D5 /* IntAxisValueFormatter.swift in Sources */, + 225B365D1F6EBA470005B3D5 /* HalfPieChartViewController.swift in Sources */, + 225B36701F6EBA470005B3D5 /* SinusBarChartViewController.swift in Sources */, + 225B36681F6EBA470005B3D5 /* AnotherBarChartViewController.swift in Sources */, + 225B36621F6EBA470005B3D5 /* NegativeStackedBarChartViewController.swift in Sources */, + 225B363B1F6EBA040005B3D5 /* LargeValueFormatter.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5B57BBAB1A9B26AA0036A6CC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5B613DF21D5A60DF000F1E98 /* LargeValueFormatter.swift in Sources */, + 5BEAED1B1ABBFB340013F194 /* ScatterChartViewController.m in Sources */, + 5B0CC7851ABB875400665592 /* PieChartViewController.m in Sources */, + 0439A3541C9FF95F00496F83 /* PiePolylineChartViewController.m in Sources */, + 5B57BBBB1A9B26AA0036A6CC /* DemoListViewController.m in Sources */, + 5BD47E651ABB424E008FCEC6 /* BarChartViewController.m in Sources */, + 5BDEDC471ABB871E007D3A60 /* CombinedChartViewController.m in Sources */, + 5BE377F21D47FDF1006EB34F /* IntAxisValueFormatter.m in Sources */, + 5BD8F0741AB89CE500566E05 /* LineChart1ViewController.m in Sources */, + 5BE377DE1D425151006EB34F /* DayAxisValueFormatter.m in Sources */, + 5BEAED401ABC1AC60013F194 /* SinusBarChartViewController.m in Sources */, + 5BE7E7621C693098000A0377 /* PositiveNegativeBarChartViewController.m in Sources */, + 5B613DB31D526DED000F1E98 /* RadarMarkerView.swift in Sources */, + 5BEAED251ABC0BE20013F194 /* MultipleBarChartViewController.m in Sources */, + 5B57BBB81A9B26AA0036A6CC /* AppDelegate.m in Sources */, + 55E356511ADC638F00A57971 /* BubbleChartViewController.m in Sources */, + 5BD47E5B1ABB0263008FCEC6 /* BalloonMarker.swift in Sources */, + 5BEAED2C1ABC160F0013F194 /* CandleStickChartViewController.m in Sources */, + 5BEAED271ABC0BE20013F194 /* MultipleLinesChartViewController.m in Sources */, + 5BE6739A1D5BAD7E00A87BA2 /* DateValueFormatter.m in Sources */, + 5BE673801D5B496500A87BA2 /* HalfPieChartViewController.m in Sources */, + 5BE673921D5B4E0900A87BA2 /* LineChartFilledViewController.m in Sources */, + 5B8EAF281AB32CF5009697AA /* DemoBaseViewController.m in Sources */, + 5BE673941D5B4E0900A87BA2 /* LineChartTimeViewController.m in Sources */, + 5B613DF01D5A50B6000F1E98 /* XYMarkerView.swift in Sources */, + 5BEAED3B1ABC199F0013F194 /* ColoredLineChartViewController.m in Sources */, + 5BDEDC411ABB7F73007D3A60 /* HorizontalBarChartViewController.m in Sources */, + 5BEAED121ABBFB2B0013F194 /* AnotherBarChartViewController.m in Sources */, + 5BEAED311ABC18F00013F194 /* CubicLineChartViewController.m in Sources */, + 5BEAED1D1ABBFB340013F194 /* StackedBarChartViewController.m in Sources */, + 5BD47E601ABB3C91008FCEC6 /* LineChart2ViewController.m in Sources */, + 5B57BBB51A9B26AA0036A6CC /* main.m in Sources */, + 5BEAED361ABC192F0013F194 /* RadarChartViewController.m in Sources */, + 5B9624411B38608C007763E2 /* NegativeStackedBarChartViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 0630AE541D81271B008859B0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Charts; + targetProxy = 0630AE531D81271B008859B0 /* PBXContainerItemProxy */; + }; + 225B368F1F6EBBB00005B3D5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Charts; + targetProxy = 225B368E1F6EBBB00005B3D5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 225B362D1F6EB9A50005B3D5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.ChartsDemo-Swift"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + 225B362E1F6EB9A50005B3D5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.ChartsDemo-Swift"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Release; + }; + 5B57BBD01A9B26AA0036A6CC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 5B57BBD11A9B26AA0036A6CC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 5B57BBD31A9B26AA0036A6CC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + FRAMEWORK_SEARCH_PATHS = "$(SOURCE_ROOT)/../Carthage/Build/iOS"; + INFOPLIST_FILE = "Supporting Files/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "ChartsDemo-iOS"; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvsimulator appletvos"; + SWIFT_OBJC_BRIDGING_HEADER = "Supporting Files/ChartsDemo-Bridging-Header.h"; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 5B57BBD41A9B26AA0036A6CC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + FRAMEWORK_SEARCH_PATHS = "$(SOURCE_ROOT)/../Carthage/Build/iOS"; + INFOPLIST_FILE = "Supporting Files/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "ChartsDemo-iOS"; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvsimulator appletvos"; + SWIFT_OBJC_BRIDGING_HEADER = "Supporting Files/ChartsDemo-Bridging-Header.h"; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift.h"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 225B362C1F6EB9A50005B3D5 /* Build configuration list for PBXNativeTarget "ChartsDemo-iOS-Swift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 225B362D1F6EB9A50005B3D5 /* Debug */, + 225B362E1F6EB9A50005B3D5 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5B57BBAA1A9B26AA0036A6CC /* Build configuration list for PBXProject "ChartsDemo-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5B57BBD01A9B26AA0036A6CC /* Debug */, + 5B57BBD11A9B26AA0036A6CC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5B57BBD21A9B26AA0036A6CC /* Build configuration list for PBXNativeTarget "ChartsDemo-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5B57BBD31A9B26AA0036A6CC /* Debug */, + 5B57BBD41A9B26AA0036A6CC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 5B57BBA71A9B26AA0036A6CC /* Project object */; +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/AppDelegate.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/AppDelegate.h new file mode 100644 index 00000000000..f519086a1a4 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/AppDelegate.h @@ -0,0 +1,20 @@ +// +// AppDelegate.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/AppDelegate.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/AppDelegate.m new file mode 100644 index 00000000000..35ffcc3c072 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/AppDelegate.m @@ -0,0 +1,56 @@ +// +// AppDelegate.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "AppDelegate.h" +#import "DemoListViewController.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + + DemoListViewController *vc = [[DemoListViewController alloc] init]; + UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc]; + + _window.rootViewController = nvc; + [_window makeKeyAndVisible]; + + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Components/BalloonMarker.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Components/BalloonMarker.swift new file mode 100644 index 00000000000..9965b893240 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Components/BalloonMarker.swift @@ -0,0 +1,207 @@ +// +// BalloonMarker.swift +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import Charts + + +open class BalloonMarker: MarkerImage +{ + @objc open var color: UIColor + @objc open var arrowSize = CGSize(width: 15, height: 11) + @objc open var font: UIFont + @objc open var textColor: UIColor + @objc open var insets: UIEdgeInsets + @objc open var minimumSize = CGSize() + + fileprivate var label: String? + fileprivate var _labelSize: CGSize = CGSize() + fileprivate var _paragraphStyle: NSMutableParagraphStyle? + fileprivate var _drawAttributes = [NSAttributedString.Key : Any]() + + @objc public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets) + { + self.color = color + self.font = font + self.textColor = textColor + self.insets = insets + + _paragraphStyle = NSParagraphStyle.default.mutableCopy() as? NSMutableParagraphStyle + _paragraphStyle?.alignment = .center + super.init() + } + + open override func offsetForDrawing(atPoint point: CGPoint) -> CGPoint + { + var offset = self.offset + var size = self.size + + if size.width == 0.0 && image != nil + { + size.width = image!.size.width + } + if size.height == 0.0 && image != nil + { + size.height = image!.size.height + } + + let width = size.width + let height = size.height + let padding: CGFloat = 8.0 + + var origin = point + origin.x -= width / 2 + origin.y -= height + + if origin.x + offset.x < 0.0 + { + offset.x = -origin.x + padding + } + else if let chart = chartView, + origin.x + width + offset.x > chart.bounds.size.width + { + offset.x = chart.bounds.size.width - origin.x - width - padding + } + + if origin.y + offset.y < 0 + { + offset.y = height + padding; + } + else if let chart = chartView, + origin.y + height + offset.y > chart.bounds.size.height + { + offset.y = chart.bounds.size.height - origin.y - height - padding + } + + return offset + } + + open override func draw(context: CGContext, point: CGPoint) + { + guard let label = label else { return } + + let offset = self.offsetForDrawing(atPoint: point) + let size = self.size + + var rect = CGRect( + origin: CGPoint( + x: point.x + offset.x, + y: point.y + offset.y), + size: size) + rect.origin.x -= size.width / 2.0 + rect.origin.y -= size.height + + context.saveGState() + + context.setFillColor(color.cgColor) + + if offset.y > 0 + { + context.beginPath() + context.move(to: CGPoint( + x: rect.origin.x, + y: rect.origin.y + arrowSize.height)) + context.addLine(to: CGPoint( + x: rect.origin.x + (rect.size.width - arrowSize.width) / 2.0, + y: rect.origin.y + arrowSize.height)) + //arrow vertex + context.addLine(to: CGPoint( + x: point.x, + y: point.y)) + context.addLine(to: CGPoint( + x: rect.origin.x + (rect.size.width + arrowSize.width) / 2.0, + y: rect.origin.y + arrowSize.height)) + context.addLine(to: CGPoint( + x: rect.origin.x + rect.size.width, + y: rect.origin.y + arrowSize.height)) + context.addLine(to: CGPoint( + x: rect.origin.x + rect.size.width, + y: rect.origin.y + rect.size.height)) + context.addLine(to: CGPoint( + x: rect.origin.x, + y: rect.origin.y + rect.size.height)) + context.addLine(to: CGPoint( + x: rect.origin.x, + y: rect.origin.y + arrowSize.height)) + context.fillPath() + } + else + { + context.beginPath() + context.move(to: CGPoint( + x: rect.origin.x, + y: rect.origin.y)) + context.addLine(to: CGPoint( + x: rect.origin.x + rect.size.width, + y: rect.origin.y)) + context.addLine(to: CGPoint( + x: rect.origin.x + rect.size.width, + y: rect.origin.y + rect.size.height - arrowSize.height)) + context.addLine(to: CGPoint( + x: rect.origin.x + (rect.size.width + arrowSize.width) / 2.0, + y: rect.origin.y + rect.size.height - arrowSize.height)) + //arrow vertex + context.addLine(to: CGPoint( + x: point.x, + y: point.y)) + context.addLine(to: CGPoint( + x: rect.origin.x + (rect.size.width - arrowSize.width) / 2.0, + y: rect.origin.y + rect.size.height - arrowSize.height)) + context.addLine(to: CGPoint( + x: rect.origin.x, + y: rect.origin.y + rect.size.height - arrowSize.height)) + context.addLine(to: CGPoint( + x: rect.origin.x, + y: rect.origin.y)) + context.fillPath() + } + + if offset.y > 0 { + rect.origin.y += self.insets.top + arrowSize.height + } else { + rect.origin.y += self.insets.top + } + + rect.size.height -= self.insets.top + self.insets.bottom + + UIGraphicsPushContext(context) + + label.draw(in: rect, withAttributes: _drawAttributes) + + UIGraphicsPopContext() + + context.restoreGState() + } + + open override func refreshContent(entry: ChartDataEntry, highlight: Highlight) + { + setLabel(String(entry.y)) + } + + @objc open func setLabel(_ newLabel: String) + { + label = newLabel + + _drawAttributes.removeAll() + _drawAttributes[.font] = self.font + _drawAttributes[.paragraphStyle] = _paragraphStyle + _drawAttributes[.foregroundColor] = self.textColor + + _labelSize = label?.size(withAttributes: _drawAttributes) ?? CGSize.zero + + var size = CGSize() + size.width = _labelSize.width + self.insets.left + self.insets.right + size.height = _labelSize.height + self.insets.top + self.insets.bottom + size.width = max(minimumSize.width, size.width) + size.height = max(minimumSize.height, size.height) + self.size = size + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Components/RadarMarkerView.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Components/RadarMarkerView.swift new file mode 100644 index 00000000000..6f286bf0134 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Components/RadarMarkerView.swift @@ -0,0 +1,30 @@ +// +// RadarMarkerView.swift +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import Charts + +open class RadarMarkerView: MarkerView +{ + @IBOutlet var label: UILabel? + + open override func awakeFromNib() + { + self.offset.x = -self.frame.size.width / 2.0 + self.offset.y = -self.frame.size.height - 7.0 + } + + open override func refreshContent(entry: ChartDataEntry, highlight: Highlight) + { + label?.text = String.init(format: "%d %%", Int(round(entry.y))) + layoutIfNeeded() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Components/XYMarkerView.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Components/XYMarkerView.swift new file mode 100644 index 00000000000..bc77c822061 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Components/XYMarkerView.swift @@ -0,0 +1,29 @@ +// +// XYMarkerView.swift +// ChartsDemo +// Copyright © 2016 dcg. All rights reserved. +// + +import Foundation +import Charts + +open class XYMarkerView: BalloonMarker +{ + @objc open var xAxisValueFormatter: IAxisValueFormatter? + fileprivate var yFormatter = NumberFormatter() + + @objc public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets, + xAxisValueFormatter: IAxisValueFormatter) + { + super.init(color: color, font: font, textColor: textColor, insets: insets) + self.xAxisValueFormatter = xAxisValueFormatter + yFormatter.minimumFractionDigits = 1 + yFormatter.maximumFractionDigits = 1 + } + + open override func refreshContent(entry: ChartDataEntry, highlight: Highlight) + { + setLabel("x: " + xAxisValueFormatter!.stringForValue(entry.x, axis: nil) + ", y: " + yFormatter.string(from: NSNumber(floatLiteral: entry.y))!) + } + +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/DemoBaseViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/DemoBaseViewController.h new file mode 100644 index 00000000000..fd31bfd7da9 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/DemoBaseViewController.h @@ -0,0 +1,34 @@ +// +// DemoBaseViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "ChartsDemo_iOS-Swift.h" + +@interface DemoBaseViewController : UIViewController +{ +@protected + NSArray *parties; +} + +@property (nonatomic, strong) IBOutlet UIButton *optionsButton; +@property (nonatomic, strong) IBOutlet NSArray *options; + +@property (nonatomic, assign) BOOL shouldHideData; + +- (void)handleOption:(NSString *)key forChartView:(ChartViewBase *)chartView; + +- (void)updateChartData; + +- (void)setupPieChartView:(PieChartView *)chartView; +- (void)setupRadarChartView:(RadarChartView *)chartView; +- (void)setupBarLineChartView:(BarLineChartViewBase *)chartView; + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/DemoBaseViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/DemoBaseViewController.m new file mode 100644 index 00000000000..4e6392a91de --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/DemoBaseViewController.m @@ -0,0 +1,329 @@ +// +// DemoBaseViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "DemoBaseViewController.h" + +@interface DemoBaseViewController () + +@property (nonatomic, strong) UITableView *optionsTableView; + +@end + +@implementation DemoBaseViewController + +- (id)initWithCoder:(NSCoder *)aDecoder +{ + self = [super initWithCoder:aDecoder]; + if (self) + { + [self initialize]; + } + return self; +} + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) + { + [self initialize]; + } + return self; +} + +- (void)initialize +{ + self.edgesForExtendedLayout = UIRectEdgeNone; + + parties = @[ + @"Party A", @"Party B", @"Party C", @"Party D", @"Party E", @"Party F", + @"Party G", @"Party H", @"Party I", @"Party J", @"Party K", @"Party L", + @"Party M", @"Party N", @"Party O", @"Party P", @"Party Q", @"Party R", + @"Party S", @"Party T", @"Party U", @"Party V", @"Party W", @"Party X", + @"Party Y", @"Party Z" + ]; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)optionTapped:(NSString *)key +{ + +} + +#pragma mark - Common option actions + +- (void)handleOption:(NSString *)key forChartView:(ChartViewBase *)chartView +{ + if ([key isEqualToString:@"toggleValues"]) + { + for (id set in chartView.data.dataSets) + { + set.drawValuesEnabled = !set.isDrawValuesEnabled; + } + + [chartView setNeedsDisplay]; + } + + if ([key isEqualToString:@"toggleIcons"]) + { + for (id set in chartView.data.dataSets) + { + set.drawIconsEnabled = !set.isDrawIconsEnabled; + } + + [chartView setNeedsDisplay]; + } + + if ([key isEqualToString:@"toggleHighlight"]) + { + chartView.data.highlightEnabled = !chartView.data.isHighlightEnabled; + [chartView setNeedsDisplay]; + } + + if ([key isEqualToString:@"animateX"]) + { + [chartView animateWithXAxisDuration:3.0]; + } + + if ([key isEqualToString:@"animateY"]) + { + [chartView animateWithYAxisDuration:3.0]; + } + + if ([key isEqualToString:@"animateXY"]) + { + [chartView animateWithXAxisDuration:3.0 yAxisDuration:3.0]; + } + + if ([key isEqualToString:@"saveToGallery"]) + { + UIImageWriteToSavedPhotosAlbum([chartView getChartImageWithTransparent:NO], nil, nil, nil); + } + + if ([key isEqualToString:@"togglePinchZoom"]) + { + BarLineChartViewBase *barLineChart = (BarLineChartViewBase *)chartView; + barLineChart.pinchZoomEnabled = !barLineChart.isPinchZoomEnabled; + + [chartView setNeedsDisplay]; + } + + if ([key isEqualToString:@"toggleAutoScaleMinMax"]) + { + BarLineChartViewBase *barLineChart = (BarLineChartViewBase *)chartView; + barLineChart.autoScaleMinMaxEnabled = !barLineChart.isAutoScaleMinMaxEnabled; + + [chartView notifyDataSetChanged]; + } + + if ([key isEqualToString:@"toggleData"]) + { + _shouldHideData = !_shouldHideData; + [self updateChartData]; + } + + if ([key isEqualToString:@"toggleBarBorders"]) + { + for (id set in chartView.data.dataSets) + { + if ([set conformsToProtocol:@protocol(IBarChartDataSet)]) + { + set.barBorderWidth = set.barBorderWidth == 1.0 ? 0.0 : 1.0; + } + } + + [chartView setNeedsDisplay]; + } +} + +#pragma mark - Actions + +- (IBAction)optionsButtonTapped:(id)sender +{ + if (_optionsTableView) + { + [_optionsTableView removeFromSuperview]; + self.optionsTableView = nil; + return; + } + + self.optionsTableView = [[UITableView alloc] init]; + _optionsTableView.backgroundColor = [UIColor colorWithWhite:0.f alpha:0.9f]; + _optionsTableView.delegate = self; + _optionsTableView.dataSource = self; + [_optionsTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"]; + + _optionsTableView.translatesAutoresizingMaskIntoConstraints = NO; + + NSMutableArray *constraints = [[NSMutableArray alloc] init]; + + [constraints addObject:[NSLayoutConstraint constraintWithItem:_optionsTableView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeading multiplier:1.f constant:40.f]]; + + [constraints addObject:[NSLayoutConstraint constraintWithItem:_optionsTableView attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:sender attribute:NSLayoutAttributeTrailing multiplier:1.f constant:0]]; + + [constraints addObject:[NSLayoutConstraint constraintWithItem:_optionsTableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sender attribute:NSLayoutAttributeBottom multiplier:1.f constant:5.f]]; + + [self.view addSubview:_optionsTableView]; + + [self.view addConstraints:constraints]; + + [_optionsTableView addConstraints:@[ + [NSLayoutConstraint constraintWithItem:_optionsTableView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeHeight multiplier:1.f constant:220.f] + ]]; +} + +#pragma mark - UITableViewDelegate, UITableViewDataSource + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + if (tableView == _optionsTableView) + { + return 1; + } + + return 0; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + if (tableView == _optionsTableView) + { + return self.options.count; + } + + return 0; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (tableView == _optionsTableView) + { + return 40.0; + } + + return 44.0; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; + cell.backgroundView = nil; + cell.backgroundColor = UIColor.clearColor; + cell.textLabel.textColor = UIColor.whiteColor; + + cell.textLabel.text = self.options[indexPath.row][@"label"]; + + return cell; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (tableView == _optionsTableView) + { + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + + if (_optionsTableView) + { + [_optionsTableView removeFromSuperview]; + self.optionsTableView = nil; + } + + [self optionTapped:self.options[indexPath.row][@"key"]]; + } +} + +#pragma mark - Stubs for chart view + +- (void)updateChartData +{ + // Override this +} + +- (void)setupPieChartView:(PieChartView *)chartView +{ + chartView.usePercentValuesEnabled = YES; + chartView.drawSlicesUnderHoleEnabled = NO; + chartView.holeRadiusPercent = 0.58; + chartView.transparentCircleRadiusPercent = 0.61; + chartView.chartDescription.enabled = NO; + [chartView setExtraOffsetsWithLeft:5.f top:10.f right:5.f bottom:5.f]; + + chartView.drawCenterTextEnabled = YES; + + NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; + paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail; + paragraphStyle.alignment = NSTextAlignmentCenter; + + NSMutableAttributedString *centerText = [[NSMutableAttributedString alloc] initWithString:@"Charts\nby Daniel Cohen Gindi"]; + [centerText setAttributes:@{ + NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Light" size:13.f], + NSParagraphStyleAttributeName: paragraphStyle + } range:NSMakeRange(0, centerText.length)]; + [centerText addAttributes:@{ + NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Light" size:11.f], + NSForegroundColorAttributeName: UIColor.grayColor + } range:NSMakeRange(10, centerText.length - 10)]; + [centerText addAttributes:@{ + NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-LightItalic" size:11.f], + NSForegroundColorAttributeName: [UIColor colorWithRed:51/255.f green:181/255.f blue:229/255.f alpha:1.f] + } range:NSMakeRange(centerText.length - 19, 19)]; + chartView.centerAttributedText = centerText; + + chartView.drawHoleEnabled = YES; + chartView.rotationAngle = 0.0; + chartView.rotationEnabled = YES; + chartView.highlightPerTapEnabled = YES; + + ChartLegend *l = chartView.legend; + l.horizontalAlignment = ChartLegendHorizontalAlignmentRight; + l.verticalAlignment = ChartLegendVerticalAlignmentTop; + l.orientation = ChartLegendOrientationVertical; + l.drawInside = NO; + l.xEntrySpace = 7.0; + l.yEntrySpace = 0.0; + l.yOffset = 0.0; +} + +- (void)setupRadarChartView:(RadarChartView *)chartView +{ + chartView.chartDescription.enabled = NO; +} + +- (void)setupBarLineChartView:(BarLineChartViewBase *)chartView +{ + chartView.chartDescription.enabled = NO; + + chartView.drawGridBackgroundEnabled = NO; + + chartView.dragEnabled = YES; + [chartView setScaleEnabled:YES]; + chartView.pinchZoomEnabled = NO; + + // ChartYAxis *leftAxis = chartView.leftAxis; + + ChartXAxis *xAxis = chartView.xAxis; + xAxis.labelPosition = XAxisLabelPositionBottom; + + chartView.rightAxis.enabled = NO; +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/DemoListViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/DemoListViewController.h new file mode 100644 index 00000000000..3f119de0711 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/DemoListViewController.h @@ -0,0 +1,18 @@ +// +// DemoListViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import + +@interface DemoListViewController : UIViewController + + +@end + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/DemoListViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/DemoListViewController.m new file mode 100644 index 00000000000..77576d0321f --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/DemoListViewController.m @@ -0,0 +1,227 @@ +// +// DemoListViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "DemoListViewController.h" +#import "LineChart1ViewController.h" +#import "LineChart2ViewController.h" +#import "BarChartViewController.h" +#import "HorizontalBarChartViewController.h" +#import "CombinedChartViewController.h" +#import "PieChartViewController.h" +#import "PiePolylineChartViewController.h" +#import "ScatterChartViewController.h" +#import "StackedBarChartViewController.h" +#import "NegativeStackedBarChartViewController.h" +#import "AnotherBarChartViewController.h" +#import "MultipleLinesChartViewController.h" +#import "MultipleBarChartViewController.h" +#import "CandleStickChartViewController.h" +#import "CubicLineChartViewController.h" +#import "RadarChartViewController.h" +#import "ColoredLineChartViewController.h" +#import "SinusBarChartViewController.h" +#import "PositiveNegativeBarChartViewController.h" +#import "BubbleChartViewController.h" +#import "LineChartTimeViewController.h" +#import "LineChartFilledViewController.h" +#import "HalfPieChartViewController.h" + +@interface DemoListViewController () + +@property (nonatomic, strong) IBOutlet UITableView *tableView; +@property (nonatomic, strong) NSArray *itemDefs; +@end + +@implementation DemoListViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Charts Demonstration"; + + self.itemDefs = @[ + @{ + @"title": @"Line Chart", + @"subtitle": @"A simple demonstration of the linechart.", + @"class": LineChart1ViewController.class + }, + @{ + @"title": @"Line Chart (Dual YAxis)", + @"subtitle": @"Demonstration of the linechart with dual y-axis.", + @"class": LineChart2ViewController.class + }, + @{ + @"title": @"Bar Chart", + @"subtitle": @"A simple demonstration of the bar chart.", + @"class": BarChartViewController.class + }, + @{ + @"title": @"Horizontal Bar Chart", + @"subtitle": @"A simple demonstration of the horizontal bar chart.", + @"class": HorizontalBarChartViewController.class + }, + @{ + @"title": @"Combined Chart", + @"subtitle": @"Demonstrates how to create a combined chart (bar and line in this case).", + @"class": CombinedChartViewController.class + }, + @{ + @"title": @"Pie Chart", + @"subtitle": @"A simple demonstration of the pie chart.", + @"class": PieChartViewController.class + }, + @{ + @"title": @"Pie Chart with value lines", + @"subtitle": @"A simple demonstration of the pie chart with polyline notes.", + @"class": PiePolylineChartViewController.class + }, + @{ + @"title": @"Scatter Chart", + @"subtitle": @"A simple demonstration of the scatter chart.", + @"class": ScatterChartViewController.class + }, + @{ + @"title": @"Bubble Chart", + @"subtitle": @"A simple demonstration of the bubble chart.", + @"class": BubbleChartViewController.class + }, + @{ + @"title": @"Stacked Bar Chart", + @"subtitle": @"A simple demonstration of a bar chart with stacked bars.", + @"class": StackedBarChartViewController.class + }, + @{ + @"title": @"Stacked Bar Chart Negative", + @"subtitle": @"A simple demonstration of stacked bars with negative and positive values.", + @"class": NegativeStackedBarChartViewController.class + }, + @{ + @"title": @"Another Bar Chart", + @"subtitle": @"Implementation of a BarChart that only shows values at the bottom.", + @"class": AnotherBarChartViewController.class + }, + @{ + @"title": @"Multiple Lines Chart", + @"subtitle": @"A line chart with multiple DataSet objects. One color per DataSet.", + @"class": MultipleLinesChartViewController.class + }, + @{ + @"title": @"Multiple Bars Chart", + @"subtitle": @"A bar chart with multiple DataSet objects. One multiple colors per DataSet.", + @"class": MultipleBarChartViewController.class + }, + @{ + @"title": @"Candle Stick Chart", + @"subtitle": @"Demonstrates usage of the CandleStickChart.", + @"class": CandleStickChartViewController.class + }, + @{ + @"title": @"Cubic Line Chart", + @"subtitle": @"Demonstrates cubic lines in a LineChart.", + @"class": CubicLineChartViewController.class + }, + @{ + @"title": @"Radar Chart", + @"subtitle": @"Demonstrates the use of a spider-web like (net) chart.", + @"class": RadarChartViewController.class + }, + @{ + @"title": @"Colored Line Chart", + @"subtitle": @"Shows a LineChart with different background and line color.", + @"class": ColoredLineChartViewController.class + }, + @{ + @"title": @"Sinus Bar Chart", + @"subtitle": @"A Bar Chart plotting the sinus function with 8.000 values.", + @"class": SinusBarChartViewController.class + }, + @{ + + @"title": @"BarChart positive / negative", + @"subtitle": @"This demonstrates how to create a BarChart with positive and negative values in different colors.", + @"class": PositiveNegativeBarChartViewController.class + }, + @{ + + @"title": @"Time Line Chart", + @"subtitle": @"Simple demonstration of a time-chart. This chart draws one line entry per hour originating from the current time in milliseconds.", + @"class": LineChartTimeViewController.class + }, + @{ + + @"title": @"Filled Line Chart", + @"subtitle": @"This demonstrates how to fill an area between two LineDataSets.", + @"class": LineChartFilledViewController.class + }, + @{ + + @"title": @"Half Pie Chart", + @"subtitle": @"This demonstrates how to create a 180 degree PieChart.", + @"class": HalfPieChartViewController.class + } + ]; + //FIXME: Add TimeLineChart +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - UITableViewDataSource, UITableViewDelegate + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return self.itemDefs.count; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + return 70.f; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + NSDictionary *def = self.itemDefs[indexPath.row]; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"]; + if (!cell) + { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell"]; + } + + cell.textLabel.text = def[@"title"]; + cell.detailTextLabel.text = def[@"subtitle"]; + cell.detailTextLabel.numberOfLines = 0; + + return cell; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + NSDictionary *def = self.itemDefs[indexPath.row]; + + Class vcClass = def[@"class"]; + UIViewController *vc = [[vcClass alloc] init]; + + [self.navigationController pushViewController:vc animated:YES]; + + [tableView deselectRowAtIndexPath:indexPath animated:YES]; +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/AnotherBarChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/AnotherBarChartViewController.h new file mode 100644 index 00000000000..cc5374f6ca6 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/AnotherBarChartViewController.h @@ -0,0 +1,18 @@ +// +// AnotherBarChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface AnotherBarChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/AnotherBarChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/AnotherBarChartViewController.m new file mode 100644 index 00000000000..65439bc914f --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/AnotherBarChartViewController.m @@ -0,0 +1,149 @@ +// +// AnotherBarChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "AnotherBarChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface AnotherBarChartViewController () + +@property (nonatomic, strong) IBOutlet BarChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation AnotherBarChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Another Bar Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + @{@"key": @"toggleBarBorders", @"label": @"Show Bar Borders"}, + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.maxVisibleCount = 60; + _chartView.pinchZoomEnabled = NO; + _chartView.drawBarShadowEnabled = NO; + _chartView.drawGridBackgroundEnabled = NO; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelPosition = XAxisLabelPositionBottom; + xAxis.drawGridLinesEnabled = NO; + + _chartView.leftAxis.drawGridLinesEnabled = NO; + _chartView.rightAxis.drawGridLinesEnabled = NO; + + _chartView.legend.enabled = NO; + + _sliderX.value = 10.0; + _sliderY.value = 100.0; + [self slidersValueChanged:nil]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value + 1 range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + NSMutableArray *yVals = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + double mult = (range + 1); + double val = (double) (arc4random_uniform(mult)) + mult / 3.0; + [yVals addObject:[[BarChartDataEntry alloc] initWithX:i y:val]]; + } + + BarChartDataSet *set1 = nil; + if (_chartView.data.dataSetCount > 0) + { + set1 = (BarChartDataSet *)_chartView.data.dataSets[0]; + [set1 replaceEntries:yVals]; + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + else + { + set1 = [[BarChartDataSet alloc] initWithEntries:yVals label:@"DataSet"]; + set1.colors = ChartColorTemplates.vordiplom; + set1.drawValuesEnabled = NO; + + NSMutableArray *dataSets = [[NSMutableArray alloc] init]; + [dataSets addObject:set1]; + + BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets]; + + _chartView.data = data; + _chartView.fitBars = YES; + } + + [_chartView setNeedsDisplay]; +} + +- (void)optionTapped:(NSString *)key +{ + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/BarChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/BarChartViewController.h new file mode 100644 index 00000000000..05b7c8c96cd --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/BarChartViewController.h @@ -0,0 +1,18 @@ +// +// BarChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface BarChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/BarChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/BarChartViewController.m new file mode 100644 index 00000000000..5e1567c088e --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/BarChartViewController.m @@ -0,0 +1,200 @@ +// +// BarChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "BarChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" +#import "DayAxisValueFormatter.h" + +@interface BarChartViewController () + +@property (nonatomic, strong) IBOutlet BarChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation BarChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Bar Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleIcons", @"label": @"Toggle Icons"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + @{@"key": @"toggleBarBorders", @"label": @"Show Bar Borders"}, + ]; + + [self setupBarLineChartView:_chartView]; + + _chartView.delegate = self; + + _chartView.drawBarShadowEnabled = NO; + _chartView.drawValueAboveBarEnabled = YES; + + _chartView.maxVisibleCount = 60; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelPosition = XAxisLabelPositionBottom; + xAxis.labelFont = [UIFont systemFontOfSize:10.f]; + xAxis.drawGridLinesEnabled = NO; + xAxis.granularity = 1.0; // only intervals of 1 day + xAxis.labelCount = 7; + xAxis.valueFormatter = [[DayAxisValueFormatter alloc] initForChart:_chartView]; + + NSNumberFormatter *leftAxisFormatter = [[NSNumberFormatter alloc] init]; + leftAxisFormatter.minimumFractionDigits = 0; + leftAxisFormatter.maximumFractionDigits = 1; + leftAxisFormatter.negativeSuffix = @" $"; + leftAxisFormatter.positiveSuffix = @" $"; + + ChartYAxis *leftAxis = _chartView.leftAxis; + leftAxis.labelFont = [UIFont systemFontOfSize:10.f]; + leftAxis.labelCount = 8; + leftAxis.valueFormatter = [[ChartDefaultAxisValueFormatter alloc] initWithFormatter:leftAxisFormatter]; + leftAxis.labelPosition = YAxisLabelPositionOutsideChart; + leftAxis.spaceTop = 0.15; + leftAxis.axisMinimum = 0.0; // this replaces startAtZero = YES + + ChartYAxis *rightAxis = _chartView.rightAxis; + rightAxis.enabled = YES; + rightAxis.drawGridLinesEnabled = NO; + rightAxis.labelFont = [UIFont systemFontOfSize:10.f]; + rightAxis.labelCount = 8; + rightAxis.valueFormatter = leftAxis.valueFormatter; + rightAxis.spaceTop = 0.15; + rightAxis.axisMinimum = 0.0; // this replaces startAtZero = YES + + ChartLegend *l = _chartView.legend; + l.horizontalAlignment = ChartLegendHorizontalAlignmentLeft; + l.verticalAlignment = ChartLegendVerticalAlignmentBottom; + l.orientation = ChartLegendOrientationHorizontal; + l.drawInside = NO; + l.form = ChartLegendFormSquare; + l.formSize = 9.0; + l.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:11.f]; + l.xEntrySpace = 4.0; + + XYMarkerView *marker = [[XYMarkerView alloc] + initWithColor: [UIColor colorWithWhite:180/255. alpha:1.0] + font: [UIFont systemFontOfSize:12.0] + textColor: UIColor.whiteColor + insets: UIEdgeInsetsMake(8.0, 8.0, 20.0, 8.0) + xAxisValueFormatter: _chartView.xAxis.valueFormatter]; + marker.chartView = _chartView; + marker.minimumSize = CGSizeMake(80.f, 40.f); + _chartView.marker = marker; + + _sliderX.value = 12.0; + _sliderY.value = 50.0; + [self slidersValueChanged:nil]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value + 1 range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + double start = 1.0; + + NSMutableArray *yVals = [[NSMutableArray alloc] init]; + + for (int i = start; i < start + count + 1; i++) + { + double mult = (range + 1); + double val = (double) (arc4random_uniform(mult)); + if (arc4random_uniform(100) < 25) { + [yVals addObject:[[BarChartDataEntry alloc] initWithX:i y:val icon: [UIImage imageNamed:@"icon"]]]; + } else { + [yVals addObject:[[BarChartDataEntry alloc] initWithX:i y:val]]; + } + } + + BarChartDataSet *set1 = nil; + if (_chartView.data.dataSetCount > 0) + { + set1 = (BarChartDataSet *)_chartView.data.dataSets[0]; + [set1 replaceEntries: yVals]; + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + else + { + set1 = [[BarChartDataSet alloc] initWithEntries:yVals label:@"The year 2017"]; + [set1 setColors:ChartColorTemplates.material]; + set1.drawIconsEnabled = NO; + + NSMutableArray *dataSets = [[NSMutableArray alloc] init]; + [dataSets addObject:set1]; + + BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]]; + + data.barWidth = 0.9f; + + _chartView.data = data; + } +} + +- (void)optionTapped:(NSString *)key +{ + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value + 2) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/BubbleChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/BubbleChartViewController.h new file mode 100644 index 00000000000..e09eef79626 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/BubbleChartViewController.h @@ -0,0 +1,18 @@ +// +// BubbleChartViewController.h +// ChartsDemo +// +// Bubble chart implementation: +// Copyright 2015 Pierre-Marc Airoldi +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface BubbleChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/BubbleChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/BubbleChartViewController.m new file mode 100644 index 00000000000..9d325966745 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/BubbleChartViewController.m @@ -0,0 +1,173 @@ +// +// BubbleChartViewController.m +// ChartsDemo +// +// Bubble chart implementation: +// Copyright 2015 Pierre-Marc Airoldi +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "BubbleChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface BubbleChartViewController () + +@property (nonatomic, strong) IBOutlet BubbleChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation BubbleChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Bubble Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleIcons", @"label": @"Toggle Icons"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.drawGridBackgroundEnabled = NO; + _chartView.dragEnabled = YES; + [_chartView setScaleEnabled:YES]; + _chartView.maxVisibleCount = 200; + _chartView.pinchZoomEnabled = YES; + + ChartLegend *l = _chartView.legend; + l.horizontalAlignment = ChartLegendHorizontalAlignmentRight; + l.verticalAlignment = ChartLegendVerticalAlignmentTop; + l.orientation = ChartLegendOrientationVertical; + l.drawInside = NO; + l.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + + ChartYAxis *yl = _chartView.leftAxis; + yl.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + yl.spaceTop = 0.3; + yl.spaceBottom = 0.3; + yl.axisMinimum = 0.0; // this replaces startAtZero = YES + + _chartView.rightAxis.enabled = NO; + + ChartXAxis *xl = _chartView.xAxis; + xl.labelPosition = XAxisLabelPositionBottom; + xl.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + + _sliderX.value = 10.0; + _sliderY.value = 50.0; + [self slidersValueChanged:nil]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + NSMutableArray *yVals1 = [[NSMutableArray alloc] init]; + NSMutableArray *yVals2 = [[NSMutableArray alloc] init]; + NSMutableArray *yVals3 = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + double val = (double) (arc4random_uniform(range)); + double size = (double) (arc4random_uniform(range)); + [yVals1 addObject:[[BubbleChartDataEntry alloc] initWithX:i y:val size:size icon: [UIImage imageNamed:@"icon"]]]; + + val = (double) (arc4random_uniform(range)); + size = (double) (arc4random_uniform(range)); + [yVals2 addObject:[[BubbleChartDataEntry alloc] initWithX:i y:val size:size icon: [UIImage imageNamed:@"icon"]]]; + + val = (double) (arc4random_uniform(range)); + size = (double) (arc4random_uniform(range)); + [yVals3 addObject:[[BubbleChartDataEntry alloc] initWithX:i y:val size:size]]; + } + + BubbleChartDataSet *set1 = [[BubbleChartDataSet alloc] initWithEntries:yVals1 label:@"DS 1"]; + set1.drawIconsEnabled = NO; + [set1 setColor:ChartColorTemplates.colorful[0] alpha:0.50f]; + [set1 setDrawValuesEnabled:YES]; + + BubbleChartDataSet *set2 = [[BubbleChartDataSet alloc] initWithEntries:yVals2 label:@"DS 2"]; + set2.iconsOffset = CGPointMake(0, 15); + [set2 setColor:ChartColorTemplates.colorful[1] alpha:0.50f]; + [set2 setDrawValuesEnabled:YES]; + + BubbleChartDataSet *set3 = [[BubbleChartDataSet alloc] initWithEntries:yVals3 label:@"DS 3"]; + [set3 setColor:ChartColorTemplates.colorful[2] alpha:0.50f]; + [set3 setDrawValuesEnabled:YES]; + + NSMutableArray *dataSets = [[NSMutableArray alloc] init]; + [dataSets addObject:set1]; + [dataSets addObject:set2]; + [dataSets addObject:set3]; + + BubbleChartData *data = [[BubbleChartData alloc] initWithDataSets:dataSets]; + [data setDrawValues:NO]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:7.f]]; + [data setHighlightCircleWidth: 1.5]; + [data setValueTextColor:UIColor.whiteColor]; + + _chartView.data = data; +} + +- (void)optionTapped:(NSString *)key +{ + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull )entry dataSetIndex:(NSInteger)dataSetIndex highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CandleStickChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CandleStickChartViewController.h new file mode 100644 index 00000000000..fc3d2f66b27 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CandleStickChartViewController.h @@ -0,0 +1,18 @@ +// +// CandleStickChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface CandleStickChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CandleStickChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CandleStickChartViewController.m new file mode 100644 index 00000000000..25a0e73ca34 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CandleStickChartViewController.m @@ -0,0 +1,174 @@ +// +// CandleStickChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "CandleStickChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface CandleStickChartViewController () + +@property (nonatomic, strong) IBOutlet CandleStickChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation CandleStickChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Candle Stick Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleIcons", @"label": @"Toggle Icons"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleShadowColorSameAsCandle", @"label": @"Toggle shadow same color"}, + @{@"key": @"toggleShowCandleBar", @"label": @"Toggle show candle bar"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.maxVisibleCount = 60; + _chartView.pinchZoomEnabled = NO; + _chartView.drawGridBackgroundEnabled = NO; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelPosition = XAxisLabelPositionBottom; + xAxis.drawGridLinesEnabled = NO; + + ChartYAxis *leftAxis = _chartView.leftAxis; + leftAxis.labelCount = 7; + leftAxis.drawGridLinesEnabled = NO; + leftAxis.drawAxisLineEnabled = NO; + + ChartYAxis *rightAxis = _chartView.rightAxis; + rightAxis.enabled = NO; + + _chartView.legend.enabled = NO; + + _sliderX.value = 40.0; + _sliderY.value = 100.0; + [self slidersValueChanged:nil]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value + 1 range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + NSMutableArray *yVals1 = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + double mult = (range + 1); + double val = (double) (arc4random_uniform(40)) + mult; + double high = (double) (arc4random_uniform(9)) + 8.0; + double low = (double) (arc4random_uniform(9)) + 8.0; + double open = (double) (arc4random_uniform(6)) + 1.0; + double close = (double) (arc4random_uniform(6)) + 1.0; + BOOL even = i % 2 == 0; + [yVals1 addObject:[[CandleChartDataEntry alloc] initWithX:i shadowH:val + high shadowL:val - low open:even ? val + open : val - open close:even ? val - close : val + close icon: [UIImage imageNamed:@"icon"]]]; + } + + CandleChartDataSet *set1 = [[CandleChartDataSet alloc] initWithEntries:yVals1 label:@"Data Set"]; + set1.axisDependency = AxisDependencyLeft; + [set1 setColor:[UIColor colorWithWhite:80/255.f alpha:1.f]]; + + set1.drawIconsEnabled = NO; + + set1.shadowColor = UIColor.darkGrayColor; + set1.shadowWidth = 0.7; + set1.decreasingColor = UIColor.redColor; + set1.decreasingFilled = YES; + set1.increasingColor = [UIColor colorWithRed:122/255.f green:242/255.f blue:84/255.f alpha:1.f]; + set1.increasingFilled = NO; + set1.neutralColor = UIColor.blueColor; + + CandleChartData *data = [[CandleChartData alloc] initWithDataSet:set1]; + + _chartView.data = data; +} + +- (void)optionTapped:(NSString *)key +{ + if ([key isEqualToString:@"toggleShadowColorSameAsCandle"]) + { + for (id set in _chartView.data.dataSets) + { + set.shadowColorSameAsCandle = !set.shadowColorSameAsCandle; + } + + [_chartView notifyDataSetChanged]; + return; + } else if ([key isEqualToString:@"toggleShowCandleBar"]) + { + for (id set in _chartView.data.dataSets) + { + set.showCandleBar = !set.showCandleBar; + } + + [_chartView notifyDataSetChanged]; + return; + } + + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/ColoredLineChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/ColoredLineChartViewController.h new file mode 100644 index 00000000000..c79e3cf3146 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/ColoredLineChartViewController.h @@ -0,0 +1,18 @@ +// +// ColoredLineChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface ColoredLineChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/ColoredLineChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/ColoredLineChartViewController.m new file mode 100644 index 00000000000..520770f2068 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/ColoredLineChartViewController.m @@ -0,0 +1,114 @@ +// +// ColoredLineChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "ColoredLineChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface ColoredLineChartViewController () + +@property (nonatomic, strong) IBOutletCollection(LineChartView) NSArray *chartViews; + +@end + +@implementation ColoredLineChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Colored Line Chart"; + + for (int i = 0; i < _chartViews.count; i++) + { + LineChartData *data = [self dataWithCount:36 range:100]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:7.f]]; + + NSArray *colors = @[ + [UIColor colorWithRed:137/255.f green:230/255.f blue:81/255.f alpha:1.f], + [UIColor colorWithRed:240/255.f green:240/255.f blue:30/255.f alpha:1.f], + [UIColor colorWithRed:89/255.f green:199/255.f blue:250/255.f alpha:1.f], + [UIColor colorWithRed:250/255.f green:104/255.f blue:104/255.f alpha:1.f], + ]; + + [self setupChart:_chartViews[i] data:data color:colors[i % colors.count]]; + } +} + +- (void)setupChart:(LineChartView *)chart data:(LineChartData *)data color:(UIColor *)color +{ + [(LineChartDataSet *)[data getDataSetByIndex:0] setCircleHoleColor:color]; + + chart.delegate = self; + chart.backgroundColor = color; + + chart.chartDescription.enabled = NO; + + chart.drawGridBackgroundEnabled = NO; + chart.dragEnabled = YES; + [chart setScaleEnabled:YES]; + chart.pinchZoomEnabled = NO; + [chart setViewPortOffsetsWithLeft:10.0 top:0.0 right:10.0 bottom:0.0]; + + chart.legend.enabled = NO; + + chart.leftAxis.enabled = NO; + chart.leftAxis.spaceTop = 0.4; + chart.leftAxis.spaceBottom = 0.4; + chart.rightAxis.enabled = NO; + chart.xAxis.enabled = NO; + + chart.data = data; + + [chart animateWithXAxisDuration:2.5]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (LineChartData *)dataWithCount:(int)count range:(double)range +{ + NSMutableArray *yVals = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + double val = (double) (arc4random_uniform(range)) + 3; + [yVals addObject:[[ChartDataEntry alloc] initWithX:i y:val]]; + } + + LineChartDataSet *set1 = [[LineChartDataSet alloc] initWithEntries:yVals label:@"DataSet 1"]; + + set1.lineWidth = 1.75; + set1.circleRadius = 5.0; + set1.circleHoleRadius = 2.5f; + [set1 setColor:UIColor.whiteColor]; + [set1 setCircleColor:UIColor.whiteColor]; + set1.highlightColor = UIColor.whiteColor; + set1.drawValuesEnabled = NO; + + return [[LineChartData alloc] initWithDataSet:set1]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CombinedChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CombinedChartViewController.h new file mode 100644 index 00000000000..c6de2899e8f --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CombinedChartViewController.h @@ -0,0 +1,18 @@ +// +// CombinedChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface CombinedChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CombinedChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CombinedChartViewController.m new file mode 100644 index 00000000000..995c419210a --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CombinedChartViewController.m @@ -0,0 +1,324 @@ +// +// CombinedChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "CombinedChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +#define ITEM_COUNT 12 + +@interface CombinedChartViewController () +{ + NSArray *months; +} + +@property (nonatomic, strong) IBOutlet CombinedChartView *chartView; + +@end + +@implementation CombinedChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Combined Chart"; + + self.options = @[ + @{@"key": @"toggleLineValues", @"label": @"Toggle Line Values"}, + @{@"key": @"toggleBarValues", @"label": @"Toggle Bar Values"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + @{@"key": @"toggleBarBorders", @"label": @"Show Bar Borders"}, + @{@"key": @"removeDataSet", @"label": @"Remove random set"}, + ]; + + months = @[ + @"Jan", @"Feb", @"Mar", + @"Apr", @"May", @"Jun", + @"Jul", @"Aug", @"Sep", + @"Oct", @"Nov", @"Dec" + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.drawGridBackgroundEnabled = NO; + _chartView.drawBarShadowEnabled = NO; + _chartView.highlightFullBarEnabled = NO; + + _chartView.drawOrder = @[ + @(CombinedChartDrawOrderBar), + @(CombinedChartDrawOrderBubble), + @(CombinedChartDrawOrderCandle), + @(CombinedChartDrawOrderLine), + @(CombinedChartDrawOrderScatter) + ]; + + ChartLegend *l = _chartView.legend; + l.wordWrapEnabled = YES; + l.horizontalAlignment = ChartLegendHorizontalAlignmentCenter; + l.verticalAlignment = ChartLegendVerticalAlignmentBottom; + l.orientation = ChartLegendOrientationHorizontal; + l.drawInside = NO; + + ChartYAxis *rightAxis = _chartView.rightAxis; + rightAxis.drawGridLinesEnabled = NO; + rightAxis.axisMinimum = 0.0; // this replaces startAtZero = YES + + ChartYAxis *leftAxis = _chartView.leftAxis; + leftAxis.drawGridLinesEnabled = NO; + leftAxis.axisMinimum = 0.0; // this replaces startAtZero = YES + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelPosition = XAxisLabelPositionBothSided; + xAxis.axisMinimum = 0.0; + xAxis.granularity = 1.0; + xAxis.valueFormatter = self; + + [self updateChartData]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setChartData]; +} + +- (void)setChartData +{ + CombinedChartData *data = [[CombinedChartData alloc] init]; + data.lineData = [self generateLineData]; + data.barData = [self generateBarData]; + data.bubbleData = [self generateBubbleData]; + data.scatterData = [self generateScatterData]; + data.candleData = [self generateCandleData]; + + _chartView.xAxis.axisMaximum = data.xMax + 0.25; + + _chartView.data = data; +} + +- (void)optionTapped:(NSString *)key +{ + if ([key isEqualToString:@"toggleLineValues"]) + { + for (NSObject *set in _chartView.data.dataSets) + { + if ([set isKindOfClass:LineChartDataSet.class]) + { + set.drawValuesEnabled = !set.isDrawValuesEnabled; + } + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleBarValues"]) + { + for (NSObject *set in _chartView.data.dataSets) + { + if ([set isKindOfClass:BarChartDataSet.class]) + { + set.drawValuesEnabled = !set.isDrawValuesEnabled; + } + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"removeDataSet"]) + { + int rnd = (int)arc4random_uniform((float)_chartView.data.dataSetCount); + [_chartView.data removeDataSet:[_chartView.data getDataSetByIndex:rnd]]; + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + + [super handleOption:key forChartView:_chartView]; +} + +- (LineChartData *)generateLineData +{ + LineChartData *d = [[LineChartData alloc] init]; + + NSMutableArray *entries = [[NSMutableArray alloc] init]; + + for (int index = 0; index < ITEM_COUNT; index++) + { + [entries addObject:[[ChartDataEntry alloc] initWithX:index + 0.5 y:(arc4random_uniform(15) + 5)]]; + } + + LineChartDataSet *set = [[LineChartDataSet alloc] initWithEntries:entries label:@"Line DataSet"]; + [set setColor:[UIColor colorWithRed:240/255.f green:238/255.f blue:70/255.f alpha:1.f]]; + set.lineWidth = 2.5; + [set setCircleColor:[UIColor colorWithRed:240/255.f green:238/255.f blue:70/255.f alpha:1.f]]; + set.circleRadius = 5.0; + set.circleHoleRadius = 2.5; + set.fillColor = [UIColor colorWithRed:240/255.f green:238/255.f blue:70/255.f alpha:1.f]; + set.mode = LineChartModeCubicBezier; + set.drawValuesEnabled = YES; + set.valueFont = [UIFont systemFontOfSize:10.f]; + set.valueTextColor = [UIColor colorWithRed:240/255.f green:238/255.f blue:70/255.f alpha:1.f]; + + set.axisDependency = AxisDependencyLeft; + + [d addDataSet:set]; + + return d; +} + +- (BarChartData *)generateBarData +{ + NSMutableArray *entries1 = [[NSMutableArray alloc] init]; + NSMutableArray *entries2 = [[NSMutableArray alloc] init]; + + for (int index = 0; index < ITEM_COUNT; index++) + { + [entries1 addObject:[[BarChartDataEntry alloc] initWithX:0.0 y:(arc4random_uniform(25) + 25)]]; + + // stacked + [entries2 addObject:[[BarChartDataEntry alloc] initWithX:0.0 yValues:@[@(arc4random_uniform(13) + 12), @(arc4random_uniform(13) + 12)]]]; + } + + BarChartDataSet *set1 = [[BarChartDataSet alloc] initWithEntries:entries1 label:@"Bar 1"]; + [set1 setColor:[UIColor colorWithRed:60/255.f green:220/255.f blue:78/255.f alpha:1.f]]; + set1.valueTextColor = [UIColor colorWithRed:60/255.f green:220/255.f blue:78/255.f alpha:1.f]; + set1.valueFont = [UIFont systemFontOfSize:10.f]; + set1.axisDependency = AxisDependencyRight; + + BarChartDataSet *set2 = [[BarChartDataSet alloc] initWithEntries:entries2 label:@""]; + set2.stackLabels = @[@"Stack 1", @"Stack 2"]; + set2.colors = @[ + [UIColor colorWithRed:61/255.f green:165/255.f blue:255/255.f alpha:1.f], + [UIColor colorWithRed:23/255.f green:197/255.f blue:255/255.f alpha:1.f] + ]; + set2.valueTextColor = [UIColor colorWithRed:61/255.f green:165/255.f blue:255/255.f alpha:1.f]; + set2.valueFont = [UIFont systemFontOfSize:10.f]; + set2.axisDependency = AxisDependencyRight; + + float groupSpace = 0.06f; + float barSpace = 0.02f; // x2 dataset + float barWidth = 0.45f; // x2 dataset + // (0.45 + 0.02) * 2 + 0.06 = 1.00 -> interval per "group" + + BarChartData *d = [[BarChartData alloc] initWithDataSets:@[set1, set2]]; + d.barWidth = barWidth; + + // make this BarData object grouped + [d groupBarsFromX:0.0 groupSpace:groupSpace barSpace:barSpace]; // start at x = 0 + + return d; +} + +- (ScatterChartData *)generateScatterData +{ + ScatterChartData *d = [[ScatterChartData alloc] init]; + + NSMutableArray *entries = [[NSMutableArray alloc] init]; + + for (double index = 0; index < ITEM_COUNT; index += 0.5) + { + [entries addObject:[[ChartDataEntry alloc] initWithX:index + 0.25 y:(arc4random_uniform(10) + 55)]]; + } + + ScatterChartDataSet *set = [[ScatterChartDataSet alloc] initWithEntries:entries label:@"Scatter DataSet"]; + set.colors = ChartColorTemplates.material; + set.scatterShapeSize = 4.5; + [set setDrawValuesEnabled:NO]; + set.valueFont = [UIFont systemFontOfSize:10.f]; + + [d addDataSet:set]; + + return d; +} + +- (CandleChartData *)generateCandleData +{ + CandleChartData *d = [[CandleChartData alloc] init]; + + NSMutableArray *entries = [[NSMutableArray alloc] init]; + + for (int index = 0; index < ITEM_COUNT; index += 2) + { + [entries addObject:[[CandleChartDataEntry alloc] initWithX:index + 1 shadowH:90.0 shadowL:70.0 open:85.0 close:75.0]]; + } + + CandleChartDataSet *set = [[CandleChartDataSet alloc] initWithEntries:entries label:@"Candle DataSet"]; + [set setColor:[UIColor colorWithRed:80/255.f green:80/255.f blue:80/255.f alpha:1.f]]; + set.decreasingColor = [UIColor colorWithRed:142/255.0 green:150/255.0 blue:175/255.0 alpha:1.0]; + set.shadowColor = UIColor.darkGrayColor; + set.valueFont = [UIFont systemFontOfSize:10.f]; + [set setDrawValuesEnabled:NO]; + + [d addDataSet:set]; + + return d; +} + +- (BubbleChartData *)generateBubbleData +{ + BubbleChartData *bd = [[BubbleChartData alloc] init]; + + NSMutableArray *entries = [[NSMutableArray alloc] init]; + + for (int index = 0; index < ITEM_COUNT; index++) + { + double y = arc4random_uniform(10) + 105.0; + double size = arc4random_uniform(50) + 105.0; + [entries addObject:[[BubbleChartDataEntry alloc] initWithX:index + 0.5 y:y size:size]]; + } + + BubbleChartDataSet *set = [[BubbleChartDataSet alloc] initWithEntries:entries label:@"Bubble DataSet"]; + [set setColors:ChartColorTemplates.vordiplom]; + set.valueTextColor = UIColor.whiteColor; + set.valueFont = [UIFont systemFontOfSize:10.f]; + [set setDrawValuesEnabled:YES]; + + [bd addDataSet:set]; + + return bd; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +#pragma mark - IAxisValueFormatter + +- (NSString *)stringForValue:(double)value + axis:(ChartAxisBase *)axis +{ + return months[(int)value % months.count]; +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CubicLineChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CubicLineChartViewController.h new file mode 100644 index 00000000000..658570aaabf --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CubicLineChartViewController.h @@ -0,0 +1,18 @@ +// +// CubicLineChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface CubicLineChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CubicLineChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CubicLineChartViewController.m new file mode 100644 index 00000000000..0d590fbf1c1 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/CubicLineChartViewController.m @@ -0,0 +1,238 @@ +// +// CubicLineChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "CubicLineChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface CubicLineSampleFillFormatter : NSObject +{ +} +@end + +@implementation CubicLineSampleFillFormatter + +- (CGFloat)getFillLinePositionWithDataSet:(LineChartDataSet *)dataSet dataProvider:(id)dataProvider +{ + return -10.f; +} + +@end + +@interface CubicLineChartViewController () + +@property (nonatomic, strong) IBOutlet LineChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation CubicLineChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Cubic Line Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleFilled", @"label": @"Toggle Filled"}, + @{@"key": @"toggleCircles", @"label": @"Toggle Circles"}, + @{@"key": @"toggleCubic", @"label": @"Toggle Cubic"}, + @{@"key": @"toggleHorizontalCubic", @"label": @"Toggle Horizontal Cubic"}, + @{@"key": @"toggleStepped", @"label": @"Toggle Stepped"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + _chartView.delegate = self; + + [_chartView setViewPortOffsetsWithLeft:0.f top:20.f right:0.f bottom:0.f]; + _chartView.backgroundColor = [UIColor colorWithRed:104/255.f green:241/255.f blue:175/255.f alpha:1.f]; + + _chartView.chartDescription.enabled = NO; + + _chartView.dragEnabled = YES; + [_chartView setScaleEnabled:YES]; + _chartView.pinchZoomEnabled = NO; + _chartView.drawGridBackgroundEnabled = NO; + _chartView.maxHighlightDistance = 300.0; + + _chartView.xAxis.enabled = NO; + + ChartYAxis *yAxis = _chartView.leftAxis; + yAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:12.f]; + [yAxis setLabelCount:6 force:NO]; + yAxis.labelTextColor = UIColor.whiteColor; + yAxis.labelPosition = YAxisLabelPositionInsideChart; + yAxis.drawGridLinesEnabled = NO; + yAxis.axisLineColor = UIColor.whiteColor; + + _chartView.rightAxis.enabled = NO; + _chartView.legend.enabled = NO; + + _sliderX.value = 45.0; + _sliderY.value = 100.0; + [self slidersValueChanged:nil]; + + [_chartView animateWithXAxisDuration:2.0 yAxisDuration:2.0]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value + 1 range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + NSMutableArray *yVals1 = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + double mult = (range + 1); + double val = (double) (arc4random_uniform(mult)) + 20; + [yVals1 addObject:[[ChartDataEntry alloc] initWithX:i y:val]]; + } + + LineChartDataSet *set1 = nil; + if (_chartView.data.dataSetCount > 0) + { + set1 = (LineChartDataSet *)_chartView.data.dataSets[0]; + [set1 replaceEntries:yVals1]; + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + else + { + set1 = [[LineChartDataSet alloc] initWithEntries:yVals1 label:@"DataSet 1"]; + set1.mode = LineChartModeCubicBezier; + set1.cubicIntensity = 0.2; + set1.drawCirclesEnabled = NO; + set1.lineWidth = 1.8; + set1.circleRadius = 4.0; + [set1 setCircleColor:UIColor.whiteColor]; + set1.highlightColor = [UIColor colorWithRed:244/255.f green:117/255.f blue:117/255.f alpha:1.f]; + [set1 setColor:UIColor.whiteColor]; + set1.fillColor = UIColor.whiteColor; + set1.fillAlpha = 1.f; + set1.drawHorizontalHighlightIndicatorEnabled = NO; + set1.fillFormatter = [[CubicLineSampleFillFormatter alloc] init]; + + LineChartData *data = [[LineChartData alloc] initWithDataSet:set1]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:9.f]]; + [data setDrawValues:NO]; + + _chartView.data = data; + } +} + +- (void)optionTapped:(NSString *)key +{ + if ([key isEqualToString:@"toggleFilled"]) + { + for (id set in _chartView.data.dataSets) + { + set.drawFilledEnabled = !set.isDrawFilledEnabled; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleCircles"]) + { + for (id set in _chartView.data.dataSets) + { + set.drawCirclesEnabled = !set.isDrawCirclesEnabled; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleCubic"]) + { + for (id set in _chartView.data.dataSets) + { + set.mode = set.mode == LineChartModeCubicBezier ? LineChartModeLinear : LineChartModeCubicBezier; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleStepped"]) + { + for (id set in _chartView.data.dataSets) + { + set.mode = set.mode == LineChartModeStepped ? LineChartModeLinear : LineChartModeStepped; + } + + [_chartView setNeedsDisplay]; + } + + if ([key isEqualToString:@"toggleHorizontalCubic"]) + { + for (id set in _chartView.data.dataSets) + { + set.mode = set.mode == LineChartModeCubicBezier ? LineChartModeHorizontalBezier : LineChartModeCubicBezier; + } + + [_chartView setNeedsDisplay]; + return; + } + + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/HalfPieChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/HalfPieChartViewController.h new file mode 100644 index 00000000000..5f3ab1b1a43 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/HalfPieChartViewController.h @@ -0,0 +1,18 @@ +// +// HalfPieChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface HalfPieChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/HalfPieChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/HalfPieChartViewController.m new file mode 100644 index 00000000000..e66840c48e1 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/HalfPieChartViewController.m @@ -0,0 +1,202 @@ +// +// HalfPieChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "HalfPieChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface HalfPieChartViewController () + +@property (nonatomic, strong) IBOutlet PieChartView *chartView; + +@end + +@implementation HalfPieChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Half Pie Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Y-Values"}, + @{@"key": @"toggleXValues", @"label": @"Toggle X-Values"}, + @{@"key": @"togglePercent", @"label": @"Toggle Percent"}, + @{@"key": @"toggleHole", @"label": @"Toggle Hole"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"spin", @"label": @"Spin"}, + @{@"key": @"drawCenter", @"label": @"Draw CenterText"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + [self setupPieChartView:_chartView]; + + _chartView.delegate = self; + + _chartView.holeColor = UIColor.whiteColor; + _chartView.transparentCircleColor = [UIColor.whiteColor colorWithAlphaComponent:0.43]; + _chartView.holeRadiusPercent = 0.58; + _chartView.rotationEnabled = NO; + _chartView.highlightPerTapEnabled = YES; + + _chartView.maxAngle = 180.0; // Half chart + _chartView.rotationAngle = 180.0; // Rotate to make the half on the upper side + _chartView.centerTextOffset = CGPointMake(0.0, -20.0); + + ChartLegend *l = _chartView.legend; + l.horizontalAlignment = ChartLegendHorizontalAlignmentCenter; + l.verticalAlignment = ChartLegendVerticalAlignmentTop; + l.orientation = ChartLegendOrientationHorizontal; + l.drawInside = NO; + l.xEntrySpace = 7.0; + l.yEntrySpace = 0.0; + l.yOffset = 0.0; + + // entry label styling + _chartView.entryLabelColor = UIColor.whiteColor; + _chartView.entryLabelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:12.f]; + + [self updateChartData]; + + [_chartView animateWithXAxisDuration:1.4 easingOption:ChartEasingOptionEaseOutBack]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:4 range:100]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + double mult = range; + + NSMutableArray *values = [[NSMutableArray alloc] init]; + + // IMPORTANT: In a PieChart, no values (Entry) should have the same xIndex (even if from different DataSets), since no values can be drawn above each other. + for (int i = 0; i < count; i++) + { + [values addObject:[[PieChartDataEntry alloc] initWithValue:(arc4random_uniform(mult) + mult / 5) label:parties[i % parties.count]]]; + } + + PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithEntries:values label:@"Election Results"]; + dataSet.sliceSpace = 3.0; + dataSet.selectionShift = 5.0; + + dataSet.colors = ChartColorTemplates.material; + + PieChartData *data = [[PieChartData alloc] initWithDataSet:dataSet]; + + NSNumberFormatter *pFormatter = [[NSNumberFormatter alloc] init]; + pFormatter.numberStyle = NSNumberFormatterPercentStyle; + pFormatter.maximumFractionDigits = 1; + pFormatter.multiplier = @1.f; + pFormatter.percentSymbol = @" %"; + [data setValueFormatter:[[ChartDefaultValueFormatter alloc] initWithFormatter:pFormatter]]; + + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:11.f]]; + [data setValueTextColor:UIColor.whiteColor]; + + _chartView.data = data; + + [_chartView setNeedsDisplay]; +} + +- (void)optionTapped:(NSString *)key +{ + if ([key isEqualToString:@"toggleXValues"]) + { + _chartView.drawEntryLabelsEnabled = !_chartView.drawEntryLabelsEnabled; + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"togglePercent"]) + { + _chartView.usePercentValuesEnabled = !_chartView.isUsePercentValuesEnabled; + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleHole"]) + { + _chartView.drawHoleEnabled = !_chartView.isDrawHoleEnabled; + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"drawCenter"]) + { + _chartView.drawCenterTextEnabled = !_chartView.isDrawCenterTextEnabled; + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"animateX"]) + { + [_chartView animateWithXAxisDuration:1.4]; + return; + } + + if ([key isEqualToString:@"animateY"]) + { + [_chartView animateWithYAxisDuration:1.4]; + return; + } + + if ([key isEqualToString:@"animateXY"]) + { + [_chartView animateWithXAxisDuration:1.4 yAxisDuration:1.4]; + return; + } + + if ([key isEqualToString:@"spin"]) + { + [_chartView spinWithDuration:2.0 fromAngle:_chartView.rotationAngle toAngle:_chartView.rotationAngle + 360.f easingOption:ChartEasingOptionEaseInCubic]; + return; + } + + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Action + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/HorizontalBarChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/HorizontalBarChartViewController.h new file mode 100644 index 00000000000..4db77ab9452 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/HorizontalBarChartViewController.h @@ -0,0 +1,18 @@ +// +// HorizontalBarChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface HorizontalBarChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/HorizontalBarChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/HorizontalBarChartViewController.m new file mode 100644 index 00000000000..54899281f19 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/HorizontalBarChartViewController.m @@ -0,0 +1,178 @@ +// +// HorizontalBarChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "HorizontalBarChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface HorizontalBarChartViewController () + +@property (nonatomic, strong) IBOutlet HorizontalBarChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation HorizontalBarChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Horizontal Bar Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleIcons", @"label": @"Toggle Icons"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + @{@"key": @"toggleBarBorders", @"label": @"Show Bar Borders"}, + ]; + + [self setupBarLineChartView:_chartView]; + + _chartView.delegate = self; + + _chartView.drawBarShadowEnabled = NO; + _chartView.drawValueAboveBarEnabled = YES; + + _chartView.maxVisibleCount = 60; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelPosition = XAxisLabelPositionBottom; + xAxis.labelFont = [UIFont systemFontOfSize:10.f]; + xAxis.drawAxisLineEnabled = YES; + xAxis.drawGridLinesEnabled = NO; + xAxis.granularity = 10.0; + + ChartYAxis *leftAxis = _chartView.leftAxis; + leftAxis.labelFont = [UIFont systemFontOfSize:10.f]; + leftAxis.drawAxisLineEnabled = YES; + leftAxis.drawGridLinesEnabled = YES; + leftAxis.axisMinimum = 0.0; // this replaces startAtZero = YES + + ChartYAxis *rightAxis = _chartView.rightAxis; + rightAxis.enabled = YES; + rightAxis.labelFont = [UIFont systemFontOfSize:10.f]; + rightAxis.drawAxisLineEnabled = YES; + rightAxis.drawGridLinesEnabled = NO; + rightAxis.axisMinimum = 0.0; // this replaces startAtZero = YES + + ChartLegend *l = _chartView.legend; + l.horizontalAlignment = ChartLegendHorizontalAlignmentLeft; + l.verticalAlignment = ChartLegendVerticalAlignmentBottom; + l.orientation = ChartLegendOrientationHorizontal; + l.drawInside = NO; + l.form = ChartLegendFormSquare; + l.formSize = 8.0; + l.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:11.f]; + l.xEntrySpace = 4.0; + + _chartView.fitBars = YES; + + _sliderX.value = 12.0; + _sliderY.value = 50.0; + [self slidersValueChanged:nil]; + + [_chartView animateWithYAxisDuration:2.5]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value + 1 range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + double barWidth = 9.0; + double spaceForBar = 10.0; + + NSMutableArray *yVals = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + double mult = (range + 1); + double val = (double) (arc4random_uniform(mult)); + [yVals addObject:[[BarChartDataEntry alloc] initWithX:i * spaceForBar y:val icon: [UIImage imageNamed:@"icon"]]]; + } + + BarChartDataSet *set1 = nil; + if (_chartView.data.dataSetCount > 0) + { + set1 = (BarChartDataSet *)_chartView.data.dataSets[0]; + [set1 replaceEntries:yVals]; + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + else + { + set1 = [[BarChartDataSet alloc] initWithEntries:yVals label:@"DataSet"]; + + set1.drawIconsEnabled = NO; + + NSMutableArray *dataSets = [[NSMutableArray alloc] init]; + [dataSets addObject:set1]; + + BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]]; + data.barWidth = barWidth; + + _chartView.data = data; + } +} + +- (void)optionTapped:(NSString *)key +{ + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChart1ViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChart1ViewController.h new file mode 100644 index 00000000000..3519fd40546 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChart1ViewController.h @@ -0,0 +1,18 @@ +// +// LineChart1ViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface LineChart1ViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChart1ViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChart1ViewController.m new file mode 100644 index 00000000000..40297febdbb --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChart1ViewController.m @@ -0,0 +1,279 @@ +// +// LineChart1ViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "LineChart1ViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface LineChart1ViewController () + +@property (nonatomic, strong) IBOutlet LineChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation LineChart1ViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Line Chart 1"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleFilled", @"label": @"Toggle Filled"}, + @{@"key": @"toggleCircles", @"label": @"Toggle Circles"}, + @{@"key": @"toggleCubic", @"label": @"Toggle Cubic"}, + @{@"key": @"toggleHorizontalCubic", @"label": @"Toggle Horizontal Cubic"}, + @{@"key": @"toggleIcons", @"label": @"Toggle Icons"}, + @{@"key": @"toggleStepped", @"label": @"Toggle Stepped"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.dragEnabled = YES; + [_chartView setScaleEnabled:YES]; + _chartView.pinchZoomEnabled = YES; + _chartView.drawGridBackgroundEnabled = NO; + + // x-axis limit line + ChartLimitLine *llXAxis = [[ChartLimitLine alloc] initWithLimit:10.0 label:@"Index 10"]; + llXAxis.lineWidth = 4.0; + llXAxis.lineDashLengths = @[@(10.f), @(10.f), @(0.f)]; + llXAxis.labelPosition = ChartLimitLabelPositionBottomRight; + llXAxis.valueFont = [UIFont systemFontOfSize:10.f]; + + //[_chartView.xAxis addLimitLine:llXAxis]; + + _chartView.xAxis.gridLineDashLengths = @[@10.0, @10.0]; + _chartView.xAxis.gridLineDashPhase = 0.f; + + ChartLimitLine *ll1 = [[ChartLimitLine alloc] initWithLimit:150.0 label:@"Upper Limit"]; + ll1.lineWidth = 4.0; + ll1.lineDashLengths = @[@5.f, @5.f]; + ll1.labelPosition = ChartLimitLabelPositionTopRight; + ll1.valueFont = [UIFont systemFontOfSize:10.0]; + + ChartLimitLine *ll2 = [[ChartLimitLine alloc] initWithLimit:-30.0 label:@"Lower Limit"]; + ll2.lineWidth = 4.0; + ll2.lineDashLengths = @[@5.f, @5.f]; + ll2.labelPosition = ChartLimitLabelPositionBottomRight; + ll2.valueFont = [UIFont systemFontOfSize:10.0]; + + ChartYAxis *leftAxis = _chartView.leftAxis; + [leftAxis removeAllLimitLines]; + [leftAxis addLimitLine:ll1]; + [leftAxis addLimitLine:ll2]; + leftAxis.axisMaximum = 200.0; + leftAxis.axisMinimum = -50.0; + leftAxis.gridLineDashLengths = @[@5.f, @5.f]; + leftAxis.drawZeroLineEnabled = NO; + leftAxis.drawLimitLinesBehindDataEnabled = YES; + + _chartView.rightAxis.enabled = NO; + + //[_chartView.viewPortHandler setMaximumScaleY: 2.f]; + //[_chartView.viewPortHandler setMaximumScaleX: 2.f]; + + BalloonMarker *marker = [[BalloonMarker alloc] + initWithColor: [UIColor colorWithWhite:180/255. alpha:1.0] + font: [UIFont systemFontOfSize:12.0] + textColor: UIColor.whiteColor + insets: UIEdgeInsetsMake(8.0, 8.0, 20.0, 8.0)]; + marker.chartView = _chartView; + marker.minimumSize = CGSizeMake(80.f, 40.f); + _chartView.marker = marker; + + _chartView.legend.form = ChartLegendFormLine; + + _sliderX.value = 45.0; + _sliderY.value = 100.0; + [self slidersValueChanged:nil]; + + [_chartView animateWithXAxisDuration:2.5]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + NSMutableArray *values = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + double val = arc4random_uniform(range) + 3; + [values addObject:[[ChartDataEntry alloc] initWithX:i y:val icon: [UIImage imageNamed:@"icon"]]]; + } + + LineChartDataSet *set1 = nil; + if (_chartView.data.dataSetCount > 0) + { + set1 = (LineChartDataSet *)_chartView.data.dataSets[0]; + [set1 replaceEntries: values]; + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + else + { + set1 = [[LineChartDataSet alloc] initWithEntries:values label:@"DataSet 1"]; + + set1.drawIconsEnabled = NO; + + set1.lineDashLengths = @[@5.f, @2.5f]; + set1.highlightLineDashLengths = @[@5.f, @2.5f]; + [set1 setColor:UIColor.blackColor]; + [set1 setCircleColor:UIColor.blackColor]; + set1.lineWidth = 1.0; + set1.circleRadius = 3.0; + set1.drawCircleHoleEnabled = NO; + set1.valueFont = [UIFont systemFontOfSize:9.f]; + set1.formLineDashLengths = @[@5.f, @2.5f]; + set1.formLineWidth = 1.0; + set1.formSize = 15.0; + + NSArray *gradientColors = @[ + (id)[ChartColorTemplates colorFromString:@"#00ff0000"].CGColor, + (id)[ChartColorTemplates colorFromString:@"#ffff0000"].CGColor + ]; + CGGradientRef gradient = CGGradientCreateWithColors(nil, (CFArrayRef)gradientColors, nil); + + set1.fillAlpha = 1.f; + set1.fill = [ChartFill fillWithLinearGradient:gradient angle:90.f]; + set1.drawFilledEnabled = YES; + + CGGradientRelease(gradient); + + NSMutableArray *dataSets = [[NSMutableArray alloc] init]; + [dataSets addObject:set1]; + + LineChartData *data = [[LineChartData alloc] initWithDataSets:dataSets]; + + _chartView.data = data; + } +} + +- (void)optionTapped:(NSString *)key +{ + if ([key isEqualToString:@"toggleFilled"]) + { + for (id set in _chartView.data.dataSets) + { + set.drawFilledEnabled = !set.isDrawFilledEnabled; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleCircles"]) + { + for (id set in _chartView.data.dataSets) + { + set.drawCirclesEnabled = !set.isDrawCirclesEnabled; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleCubic"]) + { + for (id set in _chartView.data.dataSets) + { + set.mode = set.mode == LineChartModeCubicBezier ? LineChartModeLinear : LineChartModeCubicBezier; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleStepped"]) + { + for (id set in _chartView.data.dataSets) + { + switch (set.mode) { + case LineChartModeLinear: + case LineChartModeCubicBezier: + case LineChartModeHorizontalBezier: + set.mode = LineChartModeStepped; + break; + case LineChartModeStepped: set.mode = LineChartModeLinear; + } + } + + [_chartView setNeedsDisplay]; + } + + if ([key isEqualToString:@"toggleHorizontalCubic"]) + { + for (id set in _chartView.data.dataSets) + { + set.mode = set.mode == LineChartModeHorizontalBezier ? LineChartModeCubicBezier : LineChartModeHorizontalBezier; + } + + [_chartView setNeedsDisplay]; + return; + } + + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChart2ViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChart2ViewController.h new file mode 100644 index 00000000000..0c8e6d3712c --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChart2ViewController.h @@ -0,0 +1,18 @@ +// +// LineChart2ViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface LineChart2ViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChart2ViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChart2ViewController.m new file mode 100644 index 00000000000..75eceadef6f --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChart2ViewController.m @@ -0,0 +1,296 @@ +// +// LineChart2ViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "LineChart2ViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface LineChart2ViewController () + +@property (nonatomic, strong) IBOutlet LineChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation LineChart2ViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Line Chart 2"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleFilled", @"label": @"Toggle Filled"}, + @{@"key": @"toggleCircles", @"label": @"Toggle Circles"}, + @{@"key": @"toggleCubic", @"label": @"Toggle Cubic"}, + @{@"key": @"toggleHorizontalCubic", @"label": @"Toggle Horizontal Cubic"}, + @{@"key": @"toggleStepped", @"label": @"Toggle Stepped"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.dragEnabled = YES; + [_chartView setScaleEnabled:YES]; + _chartView.drawGridBackgroundEnabled = NO; + _chartView.pinchZoomEnabled = YES; + + _chartView.backgroundColor = [UIColor colorWithWhite:204/255.f alpha:1.f]; + + ChartLegend *l = _chartView.legend; + l.form = ChartLegendFormLine; + l.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:11.f]; + l.textColor = UIColor.whiteColor; + l.horizontalAlignment = ChartLegendHorizontalAlignmentLeft; + l.verticalAlignment = ChartLegendVerticalAlignmentBottom; + l.orientation = ChartLegendOrientationHorizontal; + l.drawInside = NO; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelFont = [UIFont systemFontOfSize:11.f]; + xAxis.labelTextColor = UIColor.whiteColor; + xAxis.drawGridLinesEnabled = NO; + xAxis.drawAxisLineEnabled = NO; + + ChartYAxis *leftAxis = _chartView.leftAxis; + leftAxis.labelTextColor = [UIColor colorWithRed:51/255.f green:181/255.f blue:229/255.f alpha:1.f]; + leftAxis.axisMaximum = 200.0; + leftAxis.axisMinimum = 0.0; + leftAxis.drawGridLinesEnabled = YES; + leftAxis.drawZeroLineEnabled = NO; + leftAxis.granularityEnabled = YES; + + ChartYAxis *rightAxis = _chartView.rightAxis; + rightAxis.labelTextColor = UIColor.redColor; + rightAxis.axisMaximum = 900.0; + rightAxis.axisMinimum = -200.0; + rightAxis.drawGridLinesEnabled = NO; + rightAxis.granularityEnabled = NO; + + _sliderX.value = 20.0; + _sliderY.value = 30.0; + [self slidersValueChanged:nil]; + + [_chartView animateWithXAxisDuration:2.5]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value + 1 range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + NSMutableArray *yVals1 = [[NSMutableArray alloc] init]; + NSMutableArray *yVals2 = [[NSMutableArray alloc] init]; + NSMutableArray *yVals3 = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + double mult = range / 2.0; + double val = (double) (arc4random_uniform(mult)) + 50; + [yVals1 addObject:[[ChartDataEntry alloc] initWithX:i y:val]]; + } + + for (int i = 0; i < count - 1; i++) + { + double mult = range; + double val = (double) (arc4random_uniform(mult)) + 450; + [yVals2 addObject:[[ChartDataEntry alloc] initWithX:i y:val]]; + } + + for (int i = 0; i < count; i++) + { + double mult = range; + double val = (double) (arc4random_uniform(mult)) + 500; + [yVals3 addObject:[[ChartDataEntry alloc] initWithX:i y:val]]; + } + + LineChartDataSet *set1 = nil, *set2 = nil, *set3 = nil; + + if (_chartView.data.dataSetCount > 0) + { + set1 = (LineChartDataSet *)_chartView.data.dataSets[0]; + set2 = (LineChartDataSet *)_chartView.data.dataSets[1]; + set3 = (LineChartDataSet *)_chartView.data.dataSets[2]; + [set1 replaceEntries:yVals1]; + [set2 replaceEntries:yVals2]; + [set3 replaceEntries:yVals3]; + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + else + { + set1 = [[LineChartDataSet alloc] initWithEntries:yVals1 label:@"DataSet 1"]; + set1.axisDependency = AxisDependencyLeft; + [set1 setColor:[UIColor colorWithRed:51/255.f green:181/255.f blue:229/255.f alpha:1.f]]; + [set1 setCircleColor:UIColor.whiteColor]; + set1.lineWidth = 2.0; + set1.circleRadius = 3.0; + set1.fillAlpha = 65/255.0; + set1.fillColor = [UIColor colorWithRed:51/255.f green:181/255.f blue:229/255.f alpha:1.f]; + set1.highlightColor = [UIColor colorWithRed:244/255.f green:117/255.f blue:117/255.f alpha:1.f]; + set1.drawCircleHoleEnabled = NO; + + set2 = [[LineChartDataSet alloc] initWithEntries:yVals2 label:@"DataSet 2"]; + set2.axisDependency = AxisDependencyRight; + [set2 setColor:UIColor.redColor]; + [set2 setCircleColor:UIColor.whiteColor]; + set2.lineWidth = 2.0; + set2.circleRadius = 3.0; + set2.fillAlpha = 65/255.0; + set2.fillColor = UIColor.redColor; + set2.highlightColor = [UIColor colorWithRed:244/255.f green:117/255.f blue:117/255.f alpha:1.f]; + set2.drawCircleHoleEnabled = NO; + + set3 = [[LineChartDataSet alloc] initWithEntries:yVals3 label:@"DataSet 3"]; + set3.axisDependency = AxisDependencyRight; + [set3 setColor:UIColor.yellowColor]; + [set3 setCircleColor:UIColor.whiteColor]; + set3.lineWidth = 2.0; + set3.circleRadius = 3.0; + set3.fillAlpha = 65/255.0; + set3.fillColor = [UIColor.yellowColor colorWithAlphaComponent:200/255.f]; + set3.highlightColor = [UIColor colorWithRed:244/255.f green:117/255.f blue:117/255.f alpha:1.f]; + set3.drawCircleHoleEnabled = NO; + + NSMutableArray *dataSets = [[NSMutableArray alloc] init]; + [dataSets addObject:set1]; + [dataSets addObject:set2]; + [dataSets addObject:set3]; + + LineChartData *data = [[LineChartData alloc] initWithDataSets:dataSets]; + [data setValueTextColor:UIColor.whiteColor]; + [data setValueFont:[UIFont systemFontOfSize:9.f]]; + + _chartView.data = data; + } +} + +- (void)optionTapped:(NSString *)key +{ + if ([key isEqualToString:@"toggleFilled"]) + { + for (id set in _chartView.data.dataSets) + { + set.drawFilledEnabled = !set.isDrawFilledEnabled; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleCircles"]) + { + for (id set in _chartView.data.dataSets) + { + set.drawCirclesEnabled = !set.isDrawCirclesEnabled; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleCubic"]) + { + for (id set in _chartView.data.dataSets) + { + set.mode = set.mode == LineChartModeCubicBezier ? LineChartModeLinear : LineChartModeCubicBezier; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleStepped"]) + { + for (id set in _chartView.data.dataSets) + { + switch (set.mode) { + case LineChartModeLinear: + case LineChartModeCubicBezier: + case LineChartModeHorizontalBezier: + set.mode = LineChartModeStepped; + break; + case LineChartModeStepped: set.mode = LineChartModeLinear; + } + } + + [_chartView setNeedsDisplay]; + } + + if ([key isEqualToString:@"toggleHorizontalCubic"]) + { + for (id set in _chartView.data.dataSets) + { + set.mode = set.mode == LineChartModeCubicBezier ? LineChartModeHorizontalBezier : LineChartModeCubicBezier; + } + + [_chartView setNeedsDisplay]; + return; + } + + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); + + [_chartView centerViewToAnimatedWithXValue:entry.x yValue:entry.y axis:[_chartView.data getDataSetByIndex:highlight.dataSetIndex].axisDependency duration:1.0]; + //[_chartView moveViewToAnimatedWithXValue:entry.x yValue:entry.y axis:[_chartView.data getDataSetByIndex:dataSetIndex].axisDependency duration:1.0]; + //[_chartView zoomAndCenterViewAnimatedWithScaleX:1.8 scaleY:1.8 xValue:entry.x yValue:entry.y axis:[_chartView.data getDataSetByIndex:dataSetIndex].axisDependency duration:1.0]; + +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChartFilledViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChartFilledViewController.h new file mode 100644 index 00000000000..d62d9443edc --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChartFilledViewController.h @@ -0,0 +1,18 @@ +// +// LineChartFilledViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface LineChartFilledViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChartFilledViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChartFilledViewController.m new file mode 100644 index 00000000000..f6ec793465f --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChartFilledViewController.m @@ -0,0 +1,178 @@ +// +// LineChartFilledViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "LineChartFilledViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface LineChartFilledViewController () + +@property (nonatomic, strong) IBOutlet LineChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation LineChartFilledViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Filled Line Chart"; + + _chartView.delegate = self; + + _chartView.backgroundColor = UIColor.whiteColor; + _chartView.gridBackgroundColor = [UIColor colorWithRed:51/255.0 green:181/255.0 blue:229/255.0 alpha:150/255.0]; + _chartView.drawGridBackgroundEnabled = YES; + + _chartView.drawBordersEnabled = YES; + + _chartView.chartDescription.enabled = NO; + + _chartView.pinchZoomEnabled = NO; + _chartView.dragEnabled = YES; + [_chartView setScaleEnabled:YES]; + + ChartLegend *l = _chartView.legend; + l.enabled = NO; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.enabled = NO; + + ChartYAxis *leftAxis = _chartView.leftAxis; + leftAxis.axisMaximum = 900.0; + leftAxis.axisMinimum = -250.0; + leftAxis.drawAxisLineEnabled = NO; + leftAxis.drawZeroLineEnabled = NO; + leftAxis.drawGridLinesEnabled = NO; + + _chartView.rightAxis.enabled = NO; + + _sliderX.value = 100.0; + _sliderY.value = 60.0; + [self slidersValueChanged:nil]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + NSMutableArray *yVals1 = [NSMutableArray array]; + NSMutableArray *yVals2 = [NSMutableArray array]; + + for (int i = 0; i < count; i++) + { + double val = arc4random_uniform(range) + 50; + [yVals1 addObject:[[ChartDataEntry alloc] initWithX:i y:val]]; + } + + for (int i = 0; i < count; i++) + { + double val = arc4random_uniform(range) + 450; + [yVals2 addObject:[[ChartDataEntry alloc] initWithX:i y:val]]; + } + + LineChartDataSet *set1 = nil; + LineChartDataSet *set2 = nil; + + if (_chartView.data.dataSetCount > 0) + { + set1 = (LineChartDataSet *)_chartView.data.dataSets[0]; + set2 = (LineChartDataSet *)_chartView.data.dataSets[1]; + [set1 replaceEntries:yVals1]; + [set2 replaceEntries:yVals2]; + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + else + { + set1 = [[LineChartDataSet alloc] initWithEntries:yVals1 label:@"DataSet 1"]; + set1.axisDependency = AxisDependencyLeft; + [set1 setColor:[UIColor colorWithRed:255/255.0 green:241/255.0 blue:46/255.0 alpha:1.0]]; + set1.drawCirclesEnabled = NO; + set1.lineWidth = 2.0; + set1.circleRadius = 3.0; + set1.fillAlpha = 1.0; + set1.drawFilledEnabled = YES; + set1.fillColor = UIColor.whiteColor; + set1.highlightColor = [UIColor colorWithRed:244/255.0 green:117/255.0 blue:117/255.0 alpha:1.0]; + set1.drawCircleHoleEnabled = NO; + set1.fillFormatter = [ChartDefaultFillFormatter withBlock:^CGFloat(id _Nonnull dataSet, id _Nonnull dataProvider) { + return self.chartView.leftAxis.axisMinimum; + }]; + + set2 = [[LineChartDataSet alloc] initWithEntries:yVals2 label:@"DataSet 2"]; + set2.axisDependency = AxisDependencyLeft; + [set2 setColor:[UIColor colorWithRed:255/255.0 green:241/255.0 blue:46/255.0 alpha:1.0]]; + set2.drawCirclesEnabled = NO; + set2.lineWidth = 2.0; + set2.circleRadius = 3.0; + set2.fillAlpha = 1.0; + set2.drawFilledEnabled = YES; + set2.fillColor = UIColor.whiteColor; + set2.highlightColor = [UIColor colorWithRed:244/255.0 green:117/255.0 blue:117/255.0 alpha:1.0]; + set2.drawCircleHoleEnabled = NO; + set2.fillFormatter = [ChartDefaultFillFormatter withBlock:^CGFloat(id _Nonnull dataSet, id _Nonnull dataProvider) { + return self.chartView.leftAxis.axisMaximum; + }]; + + NSMutableArray *dataSets = [[NSMutableArray alloc] init]; + [dataSets addObject:set1]; + [dataSets addObject:set2]; + + LineChartData *data = [[LineChartData alloc] initWithDataSets:dataSets]; + [data setDrawValues:NO]; + + _chartView.data = data; + } +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChartTimeViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChartTimeViewController.h new file mode 100644 index 00000000000..6edfb1ff859 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChartTimeViewController.h @@ -0,0 +1,18 @@ +// +// LineChartTimeViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface LineChartTimeViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChartTimeViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChartTimeViewController.m new file mode 100644 index 00000000000..06e6808f4fc --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/LineChartTimeViewController.m @@ -0,0 +1,244 @@ +// +// LineChartTimeViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "LineChartTimeViewController.h" +#import "ChartsDemo_iOS-Swift.h" +#import "DateValueFormatter.h" + +@interface LineChartTimeViewController () + +@property (nonatomic, strong) IBOutlet LineChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; + +@end + +@implementation LineChartTimeViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Time Line Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleFilled", @"label": @"Toggle Filled"}, + @{@"key": @"toggleCircles", @"label": @"Toggle Circles"}, + @{@"key": @"toggleCubic", @"label": @"Toggle Cubic"}, + @{@"key": @"toggleHorizontalCubic", @"label": @"Toggle Horizontal Cubic"}, + @{@"key": @"toggleStepped", @"label": @"Toggle Stepped"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.dragEnabled = YES; + [_chartView setScaleEnabled:YES]; + _chartView.pinchZoomEnabled = NO; + _chartView.drawGridBackgroundEnabled = NO; + _chartView.highlightPerDragEnabled = YES; + + _chartView.backgroundColor = UIColor.whiteColor; + + _chartView.legend.enabled = NO; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelPosition = XAxisLabelPositionTopInside; + xAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + xAxis.labelTextColor = [UIColor colorWithRed:255/255.0 green:192/255.0 blue:56/255.0 alpha:1.0]; + xAxis.drawAxisLineEnabled = NO; + xAxis.drawGridLinesEnabled = YES; + xAxis.centerAxisLabelsEnabled = YES; + xAxis.granularity = 3600.0; + xAxis.valueFormatter = [[DateValueFormatter alloc] init]; + + ChartYAxis *leftAxis = _chartView.leftAxis; + leftAxis.labelPosition = YAxisLabelPositionInsideChart; + leftAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:12.f]; + leftAxis.labelTextColor = [UIColor colorWithRed:51/255.0 green:181/255.0 blue:229/255.0 alpha:1.0]; + leftAxis.drawGridLinesEnabled = YES; + leftAxis.granularityEnabled = YES; + leftAxis.axisMinimum = 0.0; + leftAxis.axisMaximum = 170.0; + leftAxis.yOffset = -9.0; + leftAxis.labelTextColor = [UIColor colorWithRed:255/255.0 green:192/255.0 blue:56/255.0 alpha:1.0]; + + _chartView.rightAxis.enabled = NO; + + _chartView.legend.form = ChartLegendFormLine; + + _sliderX.value = 100.0; + [self slidersValueChanged:nil]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value range:30.0]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + NSTimeInterval now = [[NSDate date] timeIntervalSince1970]; + NSTimeInterval hourSeconds = 3600.0; + + NSMutableArray *values = [[NSMutableArray alloc] init]; + + NSTimeInterval from = now - (count / 2.0) * hourSeconds; + NSTimeInterval to = now + (count / 2.0) * hourSeconds; + + for (NSTimeInterval x = from; x < to; x += hourSeconds) + { + double y = arc4random_uniform(range) + 50; + [values addObject:[[ChartDataEntry alloc] initWithX:x y:y]]; + } + + LineChartDataSet *set1 = nil; + if (_chartView.data.dataSetCount > 0) + { + set1 = (LineChartDataSet *)_chartView.data.dataSets[0]; + [set1 replaceEntries: values]; + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + else + { + set1 = [[LineChartDataSet alloc] initWithEntries:values label:@"DataSet 1"]; + set1.axisDependency = AxisDependencyLeft; + set1.valueTextColor = [UIColor colorWithRed:51/255.0 green:181/255.0 blue:229/255.0 alpha:1.0]; + set1.lineWidth = 1.5; + set1.drawCirclesEnabled = NO; + set1.drawValuesEnabled = NO; + set1.fillAlpha = 0.26; + set1.fillColor = [UIColor colorWithRed:51/255.0 green:181/255.0 blue:229/255.0 alpha:1.0]; + set1.highlightColor = [UIColor colorWithRed:224/255.0 green:117/255.0 blue:117/255.0 alpha:1.0]; + set1.drawCircleHoleEnabled = NO; + + NSMutableArray *dataSets = [[NSMutableArray alloc] init]; + [dataSets addObject:set1]; + + LineChartData *data = [[LineChartData alloc] initWithDataSets:dataSets]; + [data setValueTextColor:UIColor.whiteColor]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:9.0]]; + + _chartView.data = data; + } +} + +- (void)optionTapped:(NSString *)key +{ + if ([key isEqualToString:@"toggleFilled"]) + { + for (id set in _chartView.data.dataSets) + { + set.drawFilledEnabled = !set.isDrawFilledEnabled; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleCircles"]) + { + for (id set in _chartView.data.dataSets) + { + set.drawCirclesEnabled = !set.isDrawCirclesEnabled; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleCubic"]) + { + for (id set in _chartView.data.dataSets) + { + set.mode = set.mode == LineChartModeCubicBezier ? LineChartModeLinear : LineChartModeCubicBezier; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleStepped"]) + { + for (id set in _chartView.data.dataSets) + { + switch (set.mode) { + case LineChartModeLinear: + case LineChartModeCubicBezier: + case LineChartModeHorizontalBezier: + set.mode = LineChartModeStepped; + break; + case LineChartModeStepped: set.mode = LineChartModeLinear; + } + } + + [_chartView setNeedsDisplay]; + } + + if ([key isEqualToString:@"toggleHorizontalCubic"]) + { + for (id set in _chartView.data.dataSets) + { + set.mode = set.mode == LineChartModeCubicBezier ? LineChartModeHorizontalBezier : LineChartModeCubicBezier; + } + + [_chartView setNeedsDisplay]; + return; + } + + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/MultipleBarChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/MultipleBarChartViewController.h new file mode 100644 index 00000000000..63b820c5ef8 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/MultipleBarChartViewController.h @@ -0,0 +1,18 @@ +// +// MultipleBarChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface MultipleBarChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/MultipleBarChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/MultipleBarChartViewController.m new file mode 100644 index 00000000000..ec748b8d243 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/MultipleBarChartViewController.m @@ -0,0 +1,241 @@ +// +// MultipleBarChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "MultipleBarChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" +#import "IntAxisValueFormatter.h" + +@interface MultipleBarChartViewController () + +@property (nonatomic, strong) IBOutlet BarChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation MultipleBarChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Multiple Bar Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + @{@"key": @"toggleBarBorders", @"label": @"Show Bar Borders"}, + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.pinchZoomEnabled = NO; + _chartView.drawBarShadowEnabled = NO; + _chartView.drawGridBackgroundEnabled = NO; + + BalloonMarker *marker = [[BalloonMarker alloc] + initWithColor: [UIColor colorWithWhite:180/255. alpha:1.0] + font: [UIFont systemFontOfSize:12.0] + textColor: UIColor.whiteColor + insets: UIEdgeInsetsMake(8.0, 8.0, 20.0, 8.0)]; + marker.chartView = _chartView; + marker.minimumSize = CGSizeMake(80.f, 40.f); + _chartView.marker = marker; + + ChartLegend *legend = _chartView.legend; + legend.horizontalAlignment = ChartLegendHorizontalAlignmentRight; + legend.verticalAlignment = ChartLegendVerticalAlignmentTop; + legend.orientation = ChartLegendOrientationVertical; + legend.drawInside = YES; + legend.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:8.f]; + legend.yOffset = 10.0; + legend.xOffset = 10.0; + legend.yEntrySpace = 0.0; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + xAxis.granularity = 1.f; + xAxis.centerAxisLabelsEnabled = YES; + xAxis.valueFormatter = [[IntAxisValueFormatter alloc] init]; + + NSNumberFormatter *leftAxisFormatter = [[NSNumberFormatter alloc] init]; + leftAxisFormatter.maximumFractionDigits = 1; + + ChartYAxis *leftAxis = _chartView.leftAxis; + leftAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + leftAxis.valueFormatter = [[LargeValueFormatter alloc] init]; + leftAxis.drawGridLinesEnabled = NO; + leftAxis.spaceTop = 0.35; + leftAxis.axisMinimum = 0; + + _chartView.rightAxis.enabled = NO; + + _sliderX.value = 10.0; + _sliderY.value = 100.0; + [self slidersValueChanged:nil]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + float groupSpace = 0.08f; + float barSpace = 0.03f; + float barWidth = 0.2f; + // (0.2 + 0.03) * 4 + 0.08 = 1.00 -> interval per "group" + + NSMutableArray *yVals1 = [[NSMutableArray alloc] init]; + NSMutableArray *yVals2 = [[NSMutableArray alloc] init]; + NSMutableArray *yVals3 = [[NSMutableArray alloc] init]; + NSMutableArray *yVals4 = [[NSMutableArray alloc] init]; + + double randomMultiplier = range * 100000.f; + + int groupCount = count + 1; + int startYear = 1980; + int endYear = startYear + groupCount; + + for (int i = startYear; i < endYear; i++) + { + [yVals1 addObject:[[BarChartDataEntry alloc] + initWithX:i + y:(double) (arc4random_uniform(randomMultiplier))]]; + + [yVals2 addObject:[[BarChartDataEntry alloc] + initWithX:i + y:(double) (arc4random_uniform(randomMultiplier))]]; + + [yVals3 addObject:[[BarChartDataEntry alloc] + initWithX:i + y:(double) (arc4random_uniform(randomMultiplier))]]; + + [yVals4 addObject:[[BarChartDataEntry alloc] + initWithX:i + y:(double) (arc4random_uniform(randomMultiplier))]]; + } + + BarChartDataSet *set1 = nil, *set2 = nil, *set3 = nil, *set4 = nil; + if (_chartView.data.dataSetCount > 0) + { + set1 = (BarChartDataSet *)_chartView.data.dataSets[0]; + set2 = (BarChartDataSet *)_chartView.data.dataSets[1]; + set3 = (BarChartDataSet *)_chartView.data.dataSets[2]; + set4 = (BarChartDataSet *)_chartView.data.dataSets[3]; + [set1 replaceEntries:yVals1]; + [set2 replaceEntries:yVals2]; + [set3 replaceEntries:yVals3]; + [set4 replaceEntries:yVals4]; + + BarChartData *data = _chartView.barData; + + _chartView.xAxis.axisMinimum = startYear; + _chartView.xAxis.axisMaximum = [data groupWidthWithGroupSpace:groupSpace barSpace: barSpace] * _sliderX.value + startYear; + [data groupBarsFromX: startYear groupSpace: groupSpace barSpace: barSpace]; + + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + else + { + set1 = [[BarChartDataSet alloc] initWithEntries:yVals1 label:@"Company A"]; + [set1 setColor:[UIColor colorWithRed:104/255.f green:241/255.f blue:175/255.f alpha:1.f]]; + + set2 = [[BarChartDataSet alloc] initWithEntries:yVals2 label:@"Company B"]; + [set2 setColor:[UIColor colorWithRed:164/255.f green:228/255.f blue:251/255.f alpha:1.f]]; + + set3 = [[BarChartDataSet alloc] initWithEntries:yVals3 label:@"Company C"]; + [set3 setColor:[UIColor colorWithRed:242/255.f green:247/255.f blue:158/255.f alpha:1.f]]; + + set4 = [[BarChartDataSet alloc] initWithEntries:yVals4 label:@"Company D"]; + [set4 setColor:[UIColor colorWithRed:255/255.f green:102/255.f blue:0/255.f alpha:1.f]]; + + NSMutableArray *dataSets = [[NSMutableArray alloc] init]; + [dataSets addObject:set1]; + [dataSets addObject:set2]; + [dataSets addObject:set3]; + [dataSets addObject:set4]; + + BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]]; + [data setValueFormatter:[[LargeValueFormatter alloc] init]]; + + // specify the width each bar should have + data.barWidth = barWidth; + + // restrict the x-axis range + _chartView.xAxis.axisMinimum = startYear; + + // groupWidthWithGroupSpace(...) is a helper that calculates the width each group needs based on the provided parameters + _chartView.xAxis.axisMaximum = startYear + [data groupWidthWithGroupSpace:groupSpace barSpace: barSpace] * groupCount; + + [data groupBarsFromX: startYear groupSpace: groupSpace barSpace: barSpace]; + + _chartView.data = data; + } +} + +- (void)optionTapped:(NSString *)key +{ + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + int startYear = 1980; + int endYear = startYear + _sliderX.value; + + _sliderTextX.text = [NSString stringWithFormat:@"%d-%d", startYear, endYear]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/MultipleLinesChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/MultipleLinesChartViewController.h new file mode 100644 index 00000000000..f2cc35ab9dd --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/MultipleLinesChartViewController.h @@ -0,0 +1,18 @@ +// +// MultipleLinesChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface MultipleLinesChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/MultipleLinesChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/MultipleLinesChartViewController.m new file mode 100644 index 00000000000..358a7e21eb5 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/MultipleLinesChartViewController.m @@ -0,0 +1,206 @@ +// +// MultipleLinesChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "MultipleLinesChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface MultipleLinesChartViewController () + +@property (nonatomic, strong) IBOutlet LineChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation MultipleLinesChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Multiple Lines Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleFilled", @"label": @"Toggle Filled"}, + @{@"key": @"toggleCircles", @"label": @"Toggle Circles"}, + @{@"key": @"toggleCubic", @"label": @"Toggle Cubic"}, + @{@"key": @"toggleStepped", @"label": @"Toggle Stepped"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.leftAxis.enabled = NO; + _chartView.rightAxis.drawAxisLineEnabled = NO; + _chartView.rightAxis.drawGridLinesEnabled = NO; + _chartView.xAxis.drawAxisLineEnabled = NO; + _chartView.xAxis.drawGridLinesEnabled = NO; + + _chartView.drawGridBackgroundEnabled = NO; + _chartView.drawBordersEnabled = NO; + _chartView.dragEnabled = YES; + [_chartView setScaleEnabled:YES]; + _chartView.pinchZoomEnabled = NO; + + ChartLegend *l = _chartView.legend; + l.horizontalAlignment = ChartLegendHorizontalAlignmentRight; + l.verticalAlignment = ChartLegendVerticalAlignmentTop; + l.orientation = ChartLegendOrientationVertical; + l.drawInside = NO; + + _sliderX.value = 20.0; + _sliderY.value = 100.0; + [self slidersValueChanged:nil]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + NSArray *colors = @[ChartColorTemplates.vordiplom[0], ChartColorTemplates.vordiplom[1], ChartColorTemplates.vordiplom[2]]; + + NSMutableArray *dataSets = [[NSMutableArray alloc] init]; + + for (int z = 0; z < 3; z++) + { + NSMutableArray *values = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + double val = (double) (arc4random_uniform(range) + 3); + [values addObject:[[ChartDataEntry alloc] initWithX:i y:val]]; + } + + LineChartDataSet *d = [[LineChartDataSet alloc] initWithEntries:values label:[NSString stringWithFormat:@"DataSet %d", z + 1]]; + d.lineWidth = 2.5; + d.circleRadius = 4.0; + d.circleHoleRadius = 2.0; + + UIColor *color = colors[z % colors.count]; + [d setColor:color]; + [d setCircleColor:color]; + [dataSets addObject:d]; + } + + ((LineChartDataSet *)dataSets[0]).lineDashLengths = @[@5.f, @5.f]; + ((LineChartDataSet *)dataSets[0]).colors = ChartColorTemplates.vordiplom; + ((LineChartDataSet *)dataSets[0]).circleColors = ChartColorTemplates.vordiplom; + + LineChartData *data = [[LineChartData alloc] initWithDataSets:dataSets]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:7.f]]; + _chartView.data = data; +} + +- (void)optionTapped:(NSString *)key +{ + if ([key isEqualToString:@"toggleFilled"]) + { + for (id set in _chartView.data.dataSets) + { + set.drawFilledEnabled = !set.isDrawFilledEnabled; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleCircles"]) + { + for (id set in _chartView.data.dataSets) + { + set.drawCirclesEnabled = !set.isDrawCirclesEnabled; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleCubic"]) + { + for (id set in _chartView.data.dataSets) + { + set.mode = set.mode == LineChartModeCubicBezier ? LineChartModeLinear : LineChartModeCubicBezier; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleStepped"]) + { + for (id set in _chartView.data.dataSets) + { + switch (set.mode) { + case LineChartModeLinear: + case LineChartModeCubicBezier: + case LineChartModeHorizontalBezier: + set.mode = LineChartModeStepped; + break; + case LineChartModeStepped: set.mode = LineChartModeLinear; + } + } + + [_chartView setNeedsDisplay]; + } + + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/NegativeStackedBarChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/NegativeStackedBarChartViewController.h new file mode 100644 index 00000000000..610c3ecdad2 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/NegativeStackedBarChartViewController.h @@ -0,0 +1,18 @@ +// +// NegativeStackedBarChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface NegativeStackedBarChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/NegativeStackedBarChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/NegativeStackedBarChartViewController.m new file mode 100644 index 00000000000..b87ef62a132 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/NegativeStackedBarChartViewController.m @@ -0,0 +1,195 @@ +// +// NegativeStackedBarChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "NegativeStackedBarChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface NegativeStackedBarChartViewController () + +@property (nonatomic, strong) IBOutlet HorizontalBarChartView *chartView; + +@end + +@implementation NegativeStackedBarChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Stacked Bar Chart Negative"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleIcons", @"label": @"Toggle Icons"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + @{@"key": @"toggleBarBorders", @"label": @"Show Bar Borders"}, + ]; + + NSNumberFormatter *customFormatter = [[NSNumberFormatter alloc] init]; + customFormatter.negativePrefix = @""; + customFormatter.positiveSuffix = @"m"; + customFormatter.negativeSuffix = @"m"; + customFormatter.minimumSignificantDigits = 1; + customFormatter.minimumFractionDigits = 1; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.drawBarShadowEnabled = NO; + _chartView.drawValueAboveBarEnabled = YES; + _chartView.highlightFullBarEnabled = NO; + + // scaling can now only be done on x- and y-axis separately + _chartView.pinchZoomEnabled = NO; + + _chartView.drawBarShadowEnabled = NO; + + _chartView.leftAxis.enabled = NO; + _chartView.rightAxis.axisMaximum = 25.0; + _chartView.rightAxis.axisMinimum = -25.0; + _chartView.rightAxis.drawGridLinesEnabled = NO; + _chartView.rightAxis.drawZeroLineEnabled = YES; + _chartView.rightAxis.labelCount = 7; + _chartView.rightAxis.valueFormatter = [[ChartDefaultAxisValueFormatter alloc] initWithFormatter:customFormatter]; + _chartView.rightAxis.labelFont = [UIFont systemFontOfSize:9.f]; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelPosition = XAxisLabelPositionBothSided; + xAxis.drawGridLinesEnabled = NO; + xAxis.drawAxisLineEnabled = NO; + xAxis.axisMinimum = 0.0; + xAxis.axisMaximum = 110.0; + xAxis.centerAxisLabelsEnabled = YES; + xAxis.labelCount = 12; + xAxis.granularity = 10.0; + xAxis.valueFormatter = self; + + _chartView.rightAxis.labelFont = [UIFont systemFontOfSize:9.f]; + + ChartLegend *l = _chartView.legend; + l.horizontalAlignment = ChartLegendHorizontalAlignmentRight; + l.verticalAlignment = ChartLegendVerticalAlignmentBottom; + l.orientation = ChartLegendOrientationHorizontal; + l.drawInside = NO; + l.formSize = 8.f; + l.formToTextSpace = 4.f; + l.xEntrySpace = 6.f; + + [self updateChartData]; +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setChartData]; +} + +- (void)setChartData +{ + NSMutableArray *yValues = [NSMutableArray array]; + [yValues addObject:[[BarChartDataEntry alloc] initWithX:5 yValues:@[ @-10, @10 ]]]; + [yValues addObject:[[BarChartDataEntry alloc] initWithX:15 yValues:@[ @-12, @13 ]]]; + [yValues addObject:[[BarChartDataEntry alloc] initWithX:25 yValues:@[ @-15, @15 ]]]; + [yValues addObject:[[BarChartDataEntry alloc] initWithX:35 yValues:@[ @-17, @17 ]]]; + [yValues addObject:[[BarChartDataEntry alloc] initWithX:45 yValues:@[ @-19, @20 ] icon: [UIImage imageNamed:@"icon"]]]; + [yValues addObject:[[BarChartDataEntry alloc] initWithX:55 yValues:@[ @-19, @19 ]]]; + [yValues addObject:[[BarChartDataEntry alloc] initWithX:65 yValues:@[ @-16, @16 ]]]; + [yValues addObject:[[BarChartDataEntry alloc] initWithX:75 yValues:@[ @-13, @14 ]]]; + [yValues addObject:[[BarChartDataEntry alloc] initWithX:85 yValues:@[ @-10, @11 ]]]; + [yValues addObject:[[BarChartDataEntry alloc] initWithX:95 yValues:@[ @-5, @6 ]]]; + [yValues addObject:[[BarChartDataEntry alloc] initWithX:105 yValues:@[ @-1, @2 ]]]; + + BarChartDataSet *set = nil; + if (_chartView.data.dataSetCount > 0) + { + set = (BarChartDataSet *)_chartView.data.dataSets[0]; + [set replaceEntries: yValues]; + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + else + { + NSNumberFormatter *customFormatter = [[NSNumberFormatter alloc] init]; + customFormatter.negativePrefix = @""; + customFormatter.positiveSuffix = @"m"; + customFormatter.negativeSuffix = @"m"; + customFormatter.minimumSignificantDigits = 1; + customFormatter.minimumFractionDigits = 1; + + set = [[BarChartDataSet alloc] initWithEntries:yValues label:@"Age Distribution"]; + + set.drawIconsEnabled = NO; + + set.valueFormatter = [[ChartDefaultValueFormatter alloc] initWithFormatter:customFormatter]; + set.valueFont = [UIFont systemFontOfSize:7.f]; + set.axisDependency = AxisDependencyRight; + set.colors = @[ + [UIColor colorWithRed:67/255.f green:67/255.f blue:72/255.f alpha:1.f], + [UIColor colorWithRed:124/255.f green:181/255.f blue:236/255.f alpha:1.f] + ]; + set.stackLabels = @[ + @"Men", @"Women" + ]; + + BarChartData *data = [[BarChartData alloc] initWithDataSet:set]; + + data.barWidth = 8.5; + + _chartView.data = data; + [_chartView setNeedsDisplay]; + } +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)optionTapped:(NSString *)key +{ + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected, stack-index %ld", (long)highlight.stackIndex); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +#pragma mark - IAxisValueFormatter + +- (NSString *)stringForValue:(double)value + axis:(ChartAxisBase *)axis +{ + return [NSString stringWithFormat:@"%03.0f-%03.0f", value, value + 10.0]; +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PieChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PieChartViewController.h new file mode 100644 index 00000000000..098d12b7333 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PieChartViewController.h @@ -0,0 +1,18 @@ +// +// PieChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface PieChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PieChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PieChartViewController.m new file mode 100644 index 00000000000..5bc3a9d6651 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PieChartViewController.m @@ -0,0 +1,217 @@ +// +// PieChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "PieChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface PieChartViewController () + +@property (nonatomic, strong) IBOutlet PieChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation PieChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Pie Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Y-Values"}, + @{@"key": @"toggleXValues", @"label": @"Toggle X-Values"}, + @{@"key": @"togglePercent", @"label": @"Toggle Percent"}, + @{@"key": @"toggleHole", @"label": @"Toggle Hole"}, + @{@"key": @"toggleIcons", @"label": @"Toggle Icons"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"spin", @"label": @"Spin"}, + @{@"key": @"drawCenter", @"label": @"Draw CenterText"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + [self setupPieChartView:_chartView]; + + _chartView.delegate = self; + + ChartLegend *l = _chartView.legend; + l.horizontalAlignment = ChartLegendHorizontalAlignmentRight; + l.verticalAlignment = ChartLegendVerticalAlignmentTop; + l.orientation = ChartLegendOrientationVertical; + l.drawInside = NO; + l.xEntrySpace = 7.0; + l.yEntrySpace = 0.0; + l.yOffset = 0.0; + + // entry label styling + _chartView.entryLabelColor = UIColor.whiteColor; + _chartView.entryLabelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:12.f]; + + _sliderX.value = 4.0; + _sliderY.value = 100.0; + [self slidersValueChanged:nil]; + + [_chartView animateWithXAxisDuration:1.4 easingOption:ChartEasingOptionEaseOutBack]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + double mult = range; + + NSMutableArray *values = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + [values addObject:[[PieChartDataEntry alloc] initWithValue:(arc4random_uniform(mult) + mult / 5) label:parties[i % parties.count] icon: [UIImage imageNamed:@"icon"]]]; + } + + PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithEntries:values label:@"Election Results"]; + + dataSet.drawIconsEnabled = NO; + + dataSet.sliceSpace = 2.0; + dataSet.iconsOffset = CGPointMake(0, 40); + + // add a lot of colors + + NSMutableArray *colors = [[NSMutableArray alloc] init]; + [colors addObjectsFromArray:ChartColorTemplates.vordiplom]; + [colors addObjectsFromArray:ChartColorTemplates.joyful]; + [colors addObjectsFromArray:ChartColorTemplates.colorful]; + [colors addObjectsFromArray:ChartColorTemplates.liberty]; + [colors addObjectsFromArray:ChartColorTemplates.pastel]; + [colors addObject:[UIColor colorWithRed:51/255.f green:181/255.f blue:229/255.f alpha:1.f]]; + + dataSet.colors = colors; + + PieChartData *data = [[PieChartData alloc] initWithDataSet:dataSet]; + + NSNumberFormatter *pFormatter = [[NSNumberFormatter alloc] init]; + pFormatter.numberStyle = NSNumberFormatterPercentStyle; + pFormatter.maximumFractionDigits = 1; + pFormatter.multiplier = @1.f; + pFormatter.percentSymbol = @" %"; + [data setValueFormatter:[[ChartDefaultValueFormatter alloc] initWithFormatter:pFormatter]]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:11.f]]; + [data setValueTextColor:UIColor.whiteColor]; + + _chartView.data = data; + [_chartView highlightValues:nil]; +} + +- (void)optionTapped:(NSString *)key +{ + if ([key isEqualToString:@"toggleXValues"]) + { + _chartView.drawEntryLabelsEnabled = !_chartView.drawEntryLabelsEnabled; + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"togglePercent"]) + { + _chartView.usePercentValuesEnabled = !_chartView.isUsePercentValuesEnabled; + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleHole"]) + { + _chartView.drawHoleEnabled = !_chartView.isDrawHoleEnabled; + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"drawCenter"]) + { + _chartView.drawCenterTextEnabled = !_chartView.isDrawCenterTextEnabled; + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"animateX"]) + { + [_chartView animateWithXAxisDuration:1.4]; + return; + } + + if ([key isEqualToString:@"animateY"]) + { + [_chartView animateWithYAxisDuration:1.4]; + return; + } + + if ([key isEqualToString:@"animateXY"]) + { + [_chartView animateWithXAxisDuration:1.4 yAxisDuration:1.4]; + return; + } + + if ([key isEqualToString:@"spin"]) + { + [_chartView spinWithDuration:2.0 fromAngle:_chartView.rotationAngle toAngle:_chartView.rotationAngle + 360.f easingOption:ChartEasingOptionEaseInCubic]; + return; + } + + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PiePolylineChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PiePolylineChartViewController.h new file mode 100644 index 00000000000..1ee0f4d1b59 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PiePolylineChartViewController.h @@ -0,0 +1,13 @@ +// +// PiePolylineChartViewController.h +// ChartsDemo +// +// Created by Jack Wang on 3/21/16. +// Copyright © 2016 Jack Wang +// + +#import "PieChartViewController.h" + +@interface PiePolylineChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PiePolylineChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PiePolylineChartViewController.m new file mode 100644 index 00000000000..81f092e9be2 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PiePolylineChartViewController.m @@ -0,0 +1,205 @@ +// +// PiePolylineChartViewController.h +// ChartsDemo +// +// Created by Jack Wang on 3/21/16. +// Copyright © 2016 Jack Wang +// + +#import "PiePolylineChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface PiePolylineChartViewController () + +@property (nonatomic, strong) IBOutlet PieChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; +@end + +@implementation PiePolylineChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Pie Poly Line Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Y-Values"}, + @{@"key": @"toggleXValues", @"label": @"Toggle X-Values"}, + @{@"key": @"togglePercent", @"label": @"Toggle Percent"}, + @{@"key": @"toggleHole", @"label": @"Toggle Hole"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"spin", @"label": @"Spin"}, + @{@"key": @"drawCenter", @"label": @"Draw CenterText"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + [self setupPieChartView:_chartView]; + + _chartView.legend.enabled = NO; + _chartView.delegate = self; + + [_chartView setExtraOffsetsWithLeft:20.f top:0.f right:20.f bottom:0.f]; + + _sliderX.value = 4.0; + _sliderY.value = 100.0; + [self slidersValueChanged:nil]; + + [_chartView animateWithYAxisDuration:1.4 easingOption:ChartEasingOptionEaseOutBack]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + double mult = range; + + NSMutableArray *entries = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + [entries addObject:[[PieChartDataEntry alloc] initWithValue:(arc4random_uniform(mult) + mult / 5) label:parties[i % parties.count]]]; + } + + PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithEntries:entries label:@"Election Results"]; + dataSet.sliceSpace = 2.0; + + // add a lot of colors + + NSMutableArray *colors = [[NSMutableArray alloc] init]; + [colors addObjectsFromArray:ChartColorTemplates.vordiplom]; + [colors addObjectsFromArray:ChartColorTemplates.joyful]; + [colors addObjectsFromArray:ChartColorTemplates.colorful]; + [colors addObjectsFromArray:ChartColorTemplates.liberty]; + [colors addObjectsFromArray:ChartColorTemplates.pastel]; + [colors addObject:[UIColor colorWithRed:51/255.f green:181/255.f blue:229/255.f alpha:1.f]]; + + dataSet.colors = colors; + + dataSet.valueLinePart1OffsetPercentage = 0.8; + dataSet.valueLinePart1Length = 0.2; + dataSet.valueLinePart2Length = 0.4; + //dataSet.xValuePosition = PieChartValuePositionOutsideSlice; + dataSet.yValuePosition = PieChartValuePositionOutsideSlice; + + PieChartData *data = [[PieChartData alloc] initWithDataSet:dataSet]; + + NSNumberFormatter *pFormatter = [[NSNumberFormatter alloc] init]; + pFormatter.numberStyle = NSNumberFormatterPercentStyle; + pFormatter.maximumFractionDigits = 1; + pFormatter.multiplier = @1.f; + pFormatter.percentSymbol = @" %"; + [data setValueFormatter:[[ChartDefaultValueFormatter alloc] initWithFormatter:pFormatter]]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:11.f]]; + [data setValueTextColor:UIColor.blackColor]; + + _chartView.data = data; + [_chartView highlightValues:nil]; +} + +- (void)optionTapped:(NSString *)key +{ + if ([key isEqualToString:@"toggleXValues"]) + { + _chartView.drawEntryLabelsEnabled = !_chartView.isDrawEntryLabelsEnabled; + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"togglePercent"]) + { + _chartView.usePercentValuesEnabled = !_chartView.isUsePercentValuesEnabled; + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleHole"]) + { + _chartView.drawHoleEnabled = !_chartView.isDrawHoleEnabled; + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"drawCenter"]) + { + _chartView.drawCenterTextEnabled = !_chartView.isDrawCenterTextEnabled; + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"animateX"]) + { + [_chartView animateWithXAxisDuration:1.4]; + return; + } + + if ([key isEqualToString:@"animateY"]) + { + [_chartView animateWithYAxisDuration:1.4]; + return; + } + + if ([key isEqualToString:@"animateXY"]) + { + [_chartView animateWithXAxisDuration:1.4 yAxisDuration:1.4]; + return; + } + + if ([key isEqualToString:@"spin"]) + { + [_chartView spinWithDuration:2.0 fromAngle:_chartView.rotationAngle toAngle:_chartView.rotationAngle + 360.f]; + return; + } + + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PositiveNegativeBarChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PositiveNegativeBarChartViewController.h new file mode 100644 index 00000000000..a566badb86a --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PositiveNegativeBarChartViewController.h @@ -0,0 +1,18 @@ +// +// PositiveNegativeBarChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface PositiveNegativeBarChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PositiveNegativeBarChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PositiveNegativeBarChartViewController.m new file mode 100644 index 00000000000..2440fe9e1ab --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/PositiveNegativeBarChartViewController.m @@ -0,0 +1,194 @@ +// +// PositiveNegativeBarChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "PositiveNegativeBarChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface PositiveNegativeBarChartViewController () +{ + NSArray *dataList; +} + +@property (nonatomic, strong) IBOutlet BarChartView *chartView; + +@end + +@implementation PositiveNegativeBarChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Positive/Negative Bar Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + @{@"key": @"toggleBarBorders", @"label": @"Show Bar Borders"}, + ]; + + [self setupBarLineChartView:_chartView]; + + _chartView.delegate = self; + + _chartView.extraTopOffset = -30.f; + _chartView.extraBottomOffset = 10.f; + _chartView.extraLeftOffset = 70.f; + _chartView.extraRightOffset = 70.f; + + _chartView.drawBarShadowEnabled = NO; + _chartView.drawValueAboveBarEnabled = YES; + + _chartView.chartDescription.enabled = NO; + + // scaling can now only be done on x- and y-axis separately + _chartView.pinchZoomEnabled = NO; + + _chartView.drawGridBackgroundEnabled = NO; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelPosition = XAxisLabelPositionBottom; + xAxis.labelFont = [UIFont systemFontOfSize:13.f]; + xAxis.drawGridLinesEnabled = NO; + xAxis.drawAxisLineEnabled = NO; + xAxis.labelTextColor = [UIColor lightGrayColor]; + xAxis.labelCount = 5; + xAxis.centerAxisLabelsEnabled = YES; + xAxis.granularity = 1.0; + xAxis.valueFormatter = self; + + ChartYAxis *leftAxis = _chartView.leftAxis; + leftAxis.drawLabelsEnabled = NO; + leftAxis.spaceTop = 0.25; + leftAxis.spaceBottom = 0.25; + leftAxis.drawAxisLineEnabled = NO; + leftAxis.drawGridLinesEnabled = NO; + leftAxis.drawZeroLineEnabled = YES; + leftAxis.zeroLineColor = UIColor.grayColor; + leftAxis.zeroLineWidth = 0.7f; + + _chartView.rightAxis.enabled = NO; + _chartView.legend.enabled = NO; + + [self updateChartData]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setChartData]; +} + +- (void)setChartData +{ + // THIS IS THE ORIGINAL DATA YOU WANT TO PLOT + dataList = @[ + @{@"xValue": @(0), + @"yValue": @(-224.1f), + @"xLabel": @"12-19"}, + @{@"xValue": @(1), + @"yValue": @(238.5f), + @"xLabel": @"12-30"}, + @{@"xValue": @(2), + @"yValue": @(1280.1f), + @"xLabel": @"12-31"}, + @{@"xValue": @(3), + @"yValue": @(-442.3f), + @"xLabel": @"01-01"}, + @{@"xValue": @(4), + @"yValue": @(-2280.1f), + @"xLabel": @"01-02"}, + ]; + + NSMutableArray *values = [[NSMutableArray alloc] init]; + NSMutableArray *colors = [[NSMutableArray alloc] init]; + + UIColor *green = [UIColor colorWithRed:110/255.f green:190/255.f blue:102/255.f alpha:1.f]; + UIColor *red = [UIColor colorWithRed:211/255.f green:74/255.f blue:88/255.f alpha:1.f]; + + for (int i = 0; i < dataList.count; i++) + { + NSDictionary *d = dataList[i]; + BarChartDataEntry *entry = [[BarChartDataEntry alloc] initWithX:[d[@"xValue"] doubleValue] y:[d[@"yValue"] doubleValue]]; + [values addObject:entry]; + + // specific colors + if ([d[@"yValue"] doubleValue] >= 0.f) + { + [colors addObject:red]; + } + else + { + [colors addObject:green]; + } + } + + BarChartDataSet *set = set = [[BarChartDataSet alloc] initWithEntries:values label:@"Values"]; + set.colors = colors; + set.valueColors = colors; + + BarChartData *data = [[BarChartData alloc] initWithDataSet:set]; + [data setValueFont:[UIFont systemFontOfSize:13.f]]; + + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + formatter.maximumFractionDigits = 1; + [data setValueFormatter:[[ChartDefaultValueFormatter alloc] initWithFormatter:formatter]]; + + data.barWidth = 0.8; + + _chartView.data = data; +} + +- (void)optionTapped:(NSString *)key +{ + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +#pragma mark - IAxisValueFormatter + +- (NSString *)stringForValue:(double)value + axis:(ChartAxisBase *)axis +{ + return dataList[MIN(MAX((int) value, 0), dataList.count - 1)][@"xLabel"]; + +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/RadarChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/RadarChartViewController.h new file mode 100644 index 00000000000..b9e13507e29 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/RadarChartViewController.h @@ -0,0 +1,18 @@ +// +// RadarChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface RadarChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/RadarChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/RadarChartViewController.m new file mode 100644 index 00000000000..24cfea5b58e --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/RadarChartViewController.m @@ -0,0 +1,274 @@ +// +// RadarChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "RadarChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface RadarChartViewController () + +@property (nonatomic, strong) IBOutlet RadarChartView *chartView; +@property (nonatomic, strong) NSArray *activities; +@property (nonatomic, strong) UIColor *originalBarBgColor; +@property (nonatomic, strong) UIColor *originalBarTintColor; +@property (nonatomic) UIBarStyle originalBarStyle; + +@end + +@implementation RadarChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.activities = @[ @"Burger", @"Steak", @"Salad", @"Pasta", @"Pizza" ]; + + self.title = @"Radar Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"toggleHighlightCircle", @"label": @"Toggle highlight circle"}, + @{@"key": @"toggleXLabels", @"label": @"Toggle X-Values"}, + @{@"key": @"toggleYLabels", @"label": @"Toggle Y-Values"}, + @{@"key": @"toggleRotate", @"label": @"Toggle Rotate"}, + @{@"key": @"toggleFill", @"label": @"Toggle Fill"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"spin", @"label": @"Spin"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + _chartView.webLineWidth = 1.0; + _chartView.innerWebLineWidth = 1.0; + _chartView.webColor = UIColor.lightGrayColor; + _chartView.innerWebColor = UIColor.lightGrayColor; + _chartView.webAlpha = 1.0; + + RadarMarkerView *marker = (RadarMarkerView *)[RadarMarkerView viewFromXibIn:[NSBundle mainBundle]]; + marker.chartView = _chartView; + _chartView.marker = marker; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:9.f]; + xAxis.xOffset = 0.0; + xAxis.yOffset = 0.0; + xAxis.valueFormatter = self; + xAxis.labelTextColor = UIColor.whiteColor; + + ChartYAxis *yAxis = _chartView.yAxis; + yAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:9.f]; + yAxis.labelCount = 5; + yAxis.axisMinimum = 0.0; + yAxis.axisMaximum = 80.0; + yAxis.drawLabelsEnabled = NO; + + ChartLegend *l = _chartView.legend; + l.horizontalAlignment = ChartLegendHorizontalAlignmentCenter; + l.verticalAlignment = ChartLegendVerticalAlignmentTop; + l.orientation = ChartLegendOrientationHorizontal; + l.drawInside = NO; + l.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + l.xEntrySpace = 7.0; + l.yEntrySpace = 5.0; + l.textColor = UIColor.whiteColor; + + [self updateChartData]; + + [_chartView animateWithXAxisDuration:1.4 yAxisDuration:1.4 easingOption:ChartEasingOptionEaseOutBack]; +} + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + + [UIView animateWithDuration:0.15 animations:^{ + UINavigationBar *navigationBar = self.navigationController.navigationBar; + self.originalBarBgColor = navigationBar.barTintColor; + self.originalBarTintColor = navigationBar.tintColor; + self.originalBarStyle = navigationBar.barStyle; + + navigationBar.barTintColor = self.view.backgroundColor; + navigationBar.tintColor = UIColor.whiteColor; + navigationBar.barStyle = UIBarStyleBlack; + }]; +} + +- (void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; + + [UIView animateWithDuration:0.15 animations:^{ + UINavigationBar *navigationBar = self.navigationController.navigationBar; + navigationBar.barTintColor = self.originalBarBgColor; + navigationBar.tintColor = self.originalBarTintColor; + navigationBar.barStyle = self.originalBarStyle; + }]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setChartData]; +} + +- (void)setChartData +{ + double mult = 80; + double min = 20; + int cnt = 5; + + NSMutableArray *entries1 = [[NSMutableArray alloc] init]; + NSMutableArray *entries2 = [[NSMutableArray alloc] init]; + + // NOTE: The order of the entries when being added to the entries array determines their position around the center of the chart. + for (int i = 0; i < cnt; i++) + { + [entries1 addObject:[[RadarChartDataEntry alloc] initWithValue:(arc4random_uniform(mult) + min)]]; + [entries2 addObject:[[RadarChartDataEntry alloc] initWithValue:(arc4random_uniform(mult) + min)]]; + } + + RadarChartDataSet *set1 = [[RadarChartDataSet alloc] initWithEntries:entries1 label:@"Last Week"]; + [set1 setColor:[UIColor colorWithRed:103/255.0 green:110/255.0 blue:129/255.0 alpha:1.0]]; + set1.fillColor = [UIColor colorWithRed:103/255.0 green:110/255.0 blue:129/255.0 alpha:1.0]; + set1.drawFilledEnabled = YES; + set1.fillAlpha = 0.7; + set1.lineWidth = 2.0; + set1.drawHighlightCircleEnabled = YES; + [set1 setDrawHighlightIndicators:NO]; + + RadarChartDataSet *set2 = [[RadarChartDataSet alloc] initWithEntries:entries2 label:@"This Week"]; + [set2 setColor:[UIColor colorWithRed:121/255.0 green:162/255.0 blue:175/255.0 alpha:1.0]]; + set2.fillColor = [UIColor colorWithRed:121/255.0 green:162/255.0 blue:175/255.0 alpha:1.0]; + set2.drawFilledEnabled = YES; + set2.fillAlpha = 0.7; + set2.lineWidth = 2.0; + set2.drawHighlightCircleEnabled = YES; + [set2 setDrawHighlightIndicators:NO]; + + RadarChartData *data = [[RadarChartData alloc] initWithDataSets:@[set1, set2]]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:8.f]]; + [data setDrawValues:NO]; + data.valueTextColor = UIColor.whiteColor; + + _chartView.data = data; +} + +- (void)optionTapped:(NSString *)key +{ + if ([key isEqualToString:@"toggleXLabels"]) + { + _chartView.xAxis.drawLabelsEnabled = !_chartView.xAxis.isDrawLabelsEnabled; + + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleYLabels"]) + { + _chartView.yAxis.drawLabelsEnabled = !_chartView.yAxis.isDrawLabelsEnabled; + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleRotate"]) + { + _chartView.rotationEnabled = !_chartView.isRotationEnabled; + return; + } + + if ([key isEqualToString:@"toggleFill"]) + { + for (RadarChartDataSet *set in _chartView.data.dataSets) + { + set.drawFilledEnabled = !set.isDrawFilledEnabled; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"toggleHighlightCircle"]) + { + for (RadarChartDataSet *set in _chartView.data.dataSets) + { + set.drawHighlightCircleEnabled = !set.drawHighlightCircleEnabled; + } + + [_chartView setNeedsDisplay]; + return; + } + + if ([key isEqualToString:@"animateX"]) + { + [_chartView animateWithXAxisDuration:1.4]; + return; + } + + if ([key isEqualToString:@"animateY"]) + { + [_chartView animateWithYAxisDuration:1.4]; + return; + } + + if ([key isEqualToString:@"animateXY"]) + { + [_chartView animateWithXAxisDuration:1.4 yAxisDuration:1.4]; + return; + } + + if ([key isEqualToString:@"spin"]) + { + [_chartView spinWithDuration:2.0 fromAngle:_chartView.rotationAngle toAngle:_chartView.rotationAngle + 360.f easingOption:ChartEasingOptionEaseInCubic]; + return; + } + + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +#pragma mark - IAxisValueFormatter + +- (NSString *)stringForValue:(double)value + axis:(ChartAxisBase *)axis +{ + return self.activities[(int) value % self.activities.count]; +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/ScatterChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/ScatterChartViewController.h new file mode 100644 index 00000000000..2989d22d8ff --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/ScatterChartViewController.h @@ -0,0 +1,18 @@ +// +// ScatterChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface ScatterChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/ScatterChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/ScatterChartViewController.m new file mode 100644 index 00000000000..19a158f640f --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/ScatterChartViewController.m @@ -0,0 +1,167 @@ +// +// ScatterChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "ScatterChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface ScatterChartViewController () + +@property (nonatomic, strong) IBOutlet ScatterChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation ScatterChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Scatter Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.drawGridBackgroundEnabled = NO; + _chartView.dragEnabled = YES; + [_chartView setScaleEnabled:YES]; + _chartView.maxVisibleCount = 200; + _chartView.pinchZoomEnabled = YES; + + ChartLegend *l = _chartView.legend; + l.horizontalAlignment = ChartLegendHorizontalAlignmentRight; + l.verticalAlignment = ChartLegendVerticalAlignmentTop; + l.orientation = ChartLegendOrientationVertical; + l.drawInside = NO; + l.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + l.xOffset = 5.0; + + ChartYAxis *yl = _chartView.leftAxis; + yl.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + yl.axisMinimum = 0.0; // this replaces startAtZero = YES + + _chartView.rightAxis.enabled = NO; + + ChartXAxis *xl = _chartView.xAxis; + xl.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + xl.drawGridLinesEnabled = NO; + + _sliderX.value = 45.0; + _sliderY.value = 100.0; + [self slidersValueChanged:nil]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value + 1 range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + NSMutableArray *yVals1 = [[NSMutableArray alloc] init]; + NSMutableArray *yVals2 = [[NSMutableArray alloc] init]; + NSMutableArray *yVals3 = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + double val = (double) (arc4random_uniform(range)) + 3; + [yVals1 addObject:[[ChartDataEntry alloc] initWithX:(double)i y:val]]; + + val = (double) (arc4random_uniform(range)) + 3; + [yVals2 addObject:[[ChartDataEntry alloc] initWithX:(double)i + 0.33 y:val]]; + + val = (double) (arc4random_uniform(range)) + 3; + [yVals3 addObject:[[ChartDataEntry alloc] initWithX:(double)i + 0.66 y:val]]; + } + + ScatterChartDataSet *set1 = [[ScatterChartDataSet alloc] initWithEntries:yVals1 label:@"DS 1"]; + [set1 setScatterShape:ScatterShapeSquare]; + [set1 setColor:ChartColorTemplates.colorful[0]]; + ScatterChartDataSet *set2 = [[ScatterChartDataSet alloc] initWithEntries:yVals2 label:@"DS 2"]; + [set2 setScatterShape:ScatterShapeCircle]; + set2.scatterShapeHoleColor = ChartColorTemplates.colorful[3]; + set2.scatterShapeHoleRadius = 3.5f; + [set2 setColor:ChartColorTemplates.colorful[1]]; + ScatterChartDataSet *set3 = [[ScatterChartDataSet alloc] initWithEntries:yVals3 label:@"DS 3"]; + [set3 setScatterShape:ScatterShapeCross]; + [set3 setColor:ChartColorTemplates.colorful[2]]; + + set1.scatterShapeSize = 8.0; + set2.scatterShapeSize = 8.0; + set3.scatterShapeSize = 8.0; + + NSMutableArray *dataSets = [[NSMutableArray alloc] init]; + [dataSets addObject:set1]; + [dataSets addObject:set2]; + [dataSets addObject:set3]; + + ScatterChartData *data = [[ScatterChartData alloc] initWithDataSets:dataSets]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:7.f]]; + + _chartView.data = data; +} + +- (void)optionTapped:(NSString *)key +{ + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull )entry dataSetIndex:(NSInteger)dataSetIndex highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/SinusBarChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/SinusBarChartViewController.h new file mode 100644 index 00000000000..aa94a9fd646 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/SinusBarChartViewController.h @@ -0,0 +1,18 @@ +// +// SinusBarChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface SinusBarChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/SinusBarChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/SinusBarChartViewController.m new file mode 100644 index 00000000000..e64bf3388b5 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/SinusBarChartViewController.m @@ -0,0 +1,166 @@ +// +// SinusBarChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "SinusBarChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface SinusBarChartViewController () + +@property (nonatomic, strong) IBOutlet BarChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; + +@end + +@implementation SinusBarChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Sinus Bar Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.drawBarShadowEnabled = NO; + _chartView.drawValueAboveBarEnabled = YES; + _chartView.maxVisibleCount = 60; + _chartView.pinchZoomEnabled = NO; + _chartView.drawGridBackgroundEnabled = NO; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelPosition = XAxisLabelPositionBottom; + xAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + xAxis.drawGridLinesEnabled = NO; + xAxis.enabled = NO; + + ChartYAxis *leftAxis = _chartView.leftAxis; + leftAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + leftAxis.labelCount = 6; + leftAxis.axisMinimum = -2.5; + leftAxis.axisMaximum = 2.5; + leftAxis.granularityEnabled = true; + leftAxis.granularity = 0.1; + + ChartYAxis *rightAxis = _chartView.rightAxis; + rightAxis.drawGridLinesEnabled = NO; + rightAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; + rightAxis.labelCount = 6; + rightAxis.axisMinimum = -2.5; + rightAxis.axisMaximum = 2.5; + rightAxis.granularity = 0.1; + + ChartLegend *l = _chartView.legend; + l.horizontalAlignment = ChartLegendHorizontalAlignmentLeft; + l.verticalAlignment = ChartLegendVerticalAlignmentBottom; + l.orientation = ChartLegendOrientationHorizontal; + l.drawInside = NO; + l.form = ChartLegendFormSquare; + l.formSize = 9.0; + l.font = [UIFont systemFontOfSize:11.f]; + l.xEntrySpace = 4.0; + + _sliderX.value = 150.0; + [self slidersValueChanged:nil]; + + [_chartView animateWithXAxisDuration:2.0 yAxisDuration:2.0]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:(_sliderX.value)]; +} + +- (void)setDataCount:(int)count +{ + NSMutableArray *entries = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + [entries addObject:[[BarChartDataEntry alloc] initWithX:(double)i y:sinf(M_PI * (i % 128) / 64.0)]]; + } + + BarChartDataSet *set = nil; + if (_chartView.data.dataSetCount > 0) + { + set = (BarChartDataSet *)_chartView.data.dataSets[0]; + [set replaceEntries: entries]; + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + else + { + set = [[BarChartDataSet alloc] initWithEntries:entries label:@"Sinus Function"]; + [set setColor:[UIColor colorWithRed:240/255.f green:120/255.f blue:124/255.f alpha:1.f]]; + + BarChartData *data = [[BarChartData alloc] initWithDataSet:set]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]]; + [data setDrawValues:NO]; + + data.barWidth = 0.8; + + _chartView.data = data; + } +} + +- (void)optionTapped:(NSString *)key +{ + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected"); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/StackedBarChartViewController.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/StackedBarChartViewController.h new file mode 100644 index 00000000000..5ef6f2797b1 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/StackedBarChartViewController.h @@ -0,0 +1,18 @@ +// +// StackedBarChartViewController.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "DemoBaseViewController.h" +#import + +@interface StackedBarChartViewController : DemoBaseViewController + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/StackedBarChartViewController.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/StackedBarChartViewController.m new file mode 100644 index 00000000000..69fb1053bf7 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Demos/StackedBarChartViewController.m @@ -0,0 +1,180 @@ +// +// StackedBarChartViewController.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import "StackedBarChartViewController.h" +#import "ChartsDemo_iOS-Swift.h" + +@interface StackedBarChartViewController () + +@property (nonatomic, strong) IBOutlet BarChartView *chartView; +@property (nonatomic, strong) IBOutlet UISlider *sliderX; +@property (nonatomic, strong) IBOutlet UISlider *sliderY; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextX; +@property (nonatomic, strong) IBOutlet UITextField *sliderTextY; + +@end + +@implementation StackedBarChartViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = @"Stacked Bar Chart"; + + self.options = @[ + @{@"key": @"toggleValues", @"label": @"Toggle Values"}, + @{@"key": @"toggleIcons", @"label": @"Toggle Icons"}, + @{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"}, + @{@"key": @"animateX", @"label": @"Animate X"}, + @{@"key": @"animateY", @"label": @"Animate Y"}, + @{@"key": @"animateXY", @"label": @"Animate XY"}, + @{@"key": @"saveToGallery", @"label": @"Save to Camera Roll"}, + @{@"key": @"togglePinchZoom", @"label": @"Toggle PinchZoom"}, + @{@"key": @"toggleAutoScaleMinMax", @"label": @"Toggle auto scale min/max"}, + @{@"key": @"toggleData", @"label": @"Toggle Data"}, + @{@"key": @"toggleBarBorders", @"label": @"Show Bar Borders"}, + ]; + + _chartView.delegate = self; + + _chartView.chartDescription.enabled = NO; + + _chartView.maxVisibleCount = 40; + _chartView.pinchZoomEnabled = NO; + _chartView.drawGridBackgroundEnabled = NO; + _chartView.drawBarShadowEnabled = NO; + _chartView.drawValueAboveBarEnabled = NO; + _chartView.highlightFullBarEnabled = NO; + + NSNumberFormatter *leftAxisFormatter = [[NSNumberFormatter alloc] init]; + leftAxisFormatter.maximumFractionDigits = 1; + leftAxisFormatter.negativeSuffix = @" $"; + leftAxisFormatter.positiveSuffix = @" $"; + + ChartYAxis *leftAxis = _chartView.leftAxis; + leftAxis.valueFormatter = [[ChartDefaultAxisValueFormatter alloc] initWithFormatter:leftAxisFormatter]; + leftAxis.axisMinimum = 0.0; // this replaces startAtZero = YES + + _chartView.rightAxis.enabled = NO; + + ChartXAxis *xAxis = _chartView.xAxis; + xAxis.labelPosition = XAxisLabelPositionTop; + + ChartLegend *l = _chartView.legend; + l.horizontalAlignment = ChartLegendHorizontalAlignmentRight; + l.verticalAlignment = ChartLegendVerticalAlignmentBottom; + l.orientation = ChartLegendOrientationHorizontal; + l.drawInside = NO; + l.form = ChartLegendFormSquare; + l.formSize = 8.0; + l.formToTextSpace = 4.0; + l.xEntrySpace = 6.0; + + _sliderX.value = 12.0; + _sliderY.value = 100.0; + [self slidersValueChanged:nil]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)updateChartData +{ + if (self.shouldHideData) + { + _chartView.data = nil; + return; + } + + [self setDataCount:_sliderX.value + 1 range:_sliderY.value]; +} + +- (void)setDataCount:(int)count range:(double)range +{ + NSMutableArray *yVals = [[NSMutableArray alloc] init]; + + for (int i = 0; i < count; i++) + { + double mult = (range + 1); + double val1 = (double) (arc4random_uniform(mult) + mult / 3); + double val2 = (double) (arc4random_uniform(mult) + mult / 3); + double val3 = (double) (arc4random_uniform(mult) + mult / 3); + + [yVals addObject:[[BarChartDataEntry alloc] initWithX:i yValues:@[@(val1), @(val2), @(val3)] icon: [UIImage imageNamed:@"icon"]]]; + } + + BarChartDataSet *set1 = nil; + if (_chartView.data.dataSetCount > 0) + { + set1 = (BarChartDataSet *)_chartView.data.dataSets[0]; + [set1 replaceEntries: yVals]; + [_chartView.data notifyDataChanged]; + [_chartView notifyDataSetChanged]; + } + else + { + set1 = [[BarChartDataSet alloc] initWithEntries:yVals label:@"Statistics Vienna 2014"]; + + set1.drawIconsEnabled = NO; + + set1.colors = @[ChartColorTemplates.material[0], ChartColorTemplates.material[1], ChartColorTemplates.material[2]]; + set1.stackLabels = @[@"Births", @"Divorces", @"Marriages"]; + + NSMutableArray *dataSets = [[NSMutableArray alloc] init]; + [dataSets addObject:set1]; + + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + formatter.maximumFractionDigits = 1; + formatter.negativeSuffix = @" $"; + formatter.positiveSuffix = @" $"; + + BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets]; + [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:7.f]]; + [data setValueFormatter:[[ChartDefaultValueFormatter alloc] initWithFormatter:formatter]]; + [data setValueTextColor:UIColor.whiteColor]; + + _chartView.fitBars = YES; + _chartView.data = data; + } +} + +- (void)optionTapped:(NSString *)key +{ + [super handleOption:key forChartView:_chartView]; +} + +#pragma mark - Actions + +- (IBAction)slidersValueChanged:(id)sender +{ + _sliderTextX.text = [@((int)_sliderX.value) stringValue]; + _sliderTextY.text = [@((int)_sliderY.value) stringValue]; + + [self updateChartData]; +} + +#pragma mark - ChartViewDelegate + +- (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight +{ + NSLog(@"chartValueSelected, stack-index %ld", (long)highlight.stackIndex); +} + +- (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView +{ + NSLog(@"chartValueNothingSelected"); +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/DateValueFormatter.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/DateValueFormatter.h new file mode 100644 index 00000000000..2e94536aa75 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/DateValueFormatter.h @@ -0,0 +1,17 @@ +// +// DateValueFormatter.h +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "ChartsDemo_iOS-Swift.h" + +@interface DateValueFormatter : NSObject + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/DateValueFormatter.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/DateValueFormatter.m new file mode 100644 index 00000000000..27a8cfa8ffb --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/DateValueFormatter.m @@ -0,0 +1,39 @@ +// +// DateValueFormatter.m +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + + +#import "DateValueFormatter.h" + +@interface DateValueFormatter () +{ + NSDateFormatter *_dateFormatter; +} +@end + +@implementation DateValueFormatter + +- (id)init +{ + self = [super init]; + if (self) + { + _dateFormatter = [[NSDateFormatter alloc] init]; + _dateFormatter.dateFormat = @"dd MMM HH:mm"; + } + return self; +} + +- (NSString *)stringForValue:(double)value axis:(ChartAxisBase *)axis +{ + return [_dateFormatter stringFromDate:[NSDate dateWithTimeIntervalSince1970:value]]; +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/DayAxisValueFormatter.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/DayAxisValueFormatter.h new file mode 100644 index 00000000000..4de193d0c59 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/DayAxisValueFormatter.h @@ -0,0 +1,14 @@ +// +// DayAxisValueFormatter.h +// ChartsDemo +// Copyright © 2016 dcg. All rights reserved. +// + +#import +#import "ChartsDemo_iOS-Swift.h" + +@interface DayAxisValueFormatter : NSObject + +- (id)initForChart:(BarLineChartViewBase *)chart; + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/DayAxisValueFormatter.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/DayAxisValueFormatter.m new file mode 100644 index 00000000000..814456cc59d --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/DayAxisValueFormatter.m @@ -0,0 +1,166 @@ +// +// DayAxisValueFormatter.m +// ChartsDemo +// Copyright © 2016 dcg. All rights reserved. +// + +#import "DayAxisValueFormatter.h" + +@implementation DayAxisValueFormatter +{ + NSArray *months; + __weak BarLineChartViewBase *_chart; +} + +- (id)initForChart:(BarLineChartViewBase *)chart +{ + self = [super init]; + if (self) + { + self->_chart = chart; + + months = @[ + @"Jan", @"Feb", @"Mar", + @"Apr", @"May", @"Jun", + @"Jul", @"Aug", @"Sep", + @"Oct", @"Nov", @"Dec" + ]; + } + return self; +} + +- (NSString *)stringForValue:(double)value + axis:(ChartAxisBase *)axis +{ + int days = (int)value; + int year = [self determineYearForDays:days]; + int month = [self determineMonthForDayOfYear:days]; + + NSString *monthName = months[month % months.count]; + NSString *yearName = [@(year) stringValue]; + + if (_chart.visibleXRange > 30 * 6) + { + return [NSString stringWithFormat:@"%@ %@", monthName, yearName]; + } + else + { + int dayOfMonth = [self determineDayOfMonthForDays:days month:month + 12 * (year - 2016)]; + + NSString *appendix = @"th"; + + switch (dayOfMonth) + { + case 1: + appendix = @"st"; + break; + case 2: + appendix = @"nd"; + break; + case 3: + appendix = @"rd"; + break; + case 21: + appendix = @"st"; + break; + case 22: + appendix = @"nd"; + break; + case 23: + appendix = @"rd"; + break; + case 31: + appendix = @"st"; + break; + } + + return dayOfMonth == 0 ? @"" : [NSString stringWithFormat:@"%d%@ %@", dayOfMonth, appendix, monthName]; + } +} + +- (int)daysForMonth:(int)month year:(int)year +{ + // month is 0-based + + if (month == 1) + { + BOOL is29Feb = NO; + + if (year < 1582) + { + is29Feb = (year < 1 ? year + 1 : year) % 4 == 0; + } + else if (year > 1582) + { + is29Feb = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); + } + + return is29Feb ? 29 : 28; + } + + if (month == 3 || month == 5 || month == 8 || month == 10) + { + return 30; + } + + return 31; +} + +- (int)determineMonthForDayOfYear:(int)dayOfYear +{ + int month = -1; + int days = 0; + + while (days < dayOfYear) + { + month = month + 1; + + if (month >= 12) + month = 0; + + int year = [self determineYearForDays:days]; + days += [self daysForMonth:month year:year]; + } + + return MAX(month, 0); +} + + +- (int)determineDayOfMonthForDays:(int)days month:(int)month +{ + int count = 0; + int daysForMonths = 0; + + while (count < month) + { + int year = [self determineYearForDays:days]; + daysForMonths += [self daysForMonth:count % 12 year:year]; + count++; + } + + return days - daysForMonths; +} + +- (int)determineYearForDays:(int)days +{ + if (days <= 366) + { + return 2016; + } + else if (days <= 730) + { + return 2017; + } + else if (days <= 1094) + { + return 2018; + } + else if (days <= 1458) + { + return 2019; + } + + return 2020; +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/IntAxisValueFormatter.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/IntAxisValueFormatter.h new file mode 100644 index 00000000000..6401ed07d47 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/IntAxisValueFormatter.h @@ -0,0 +1,12 @@ +// +// IntAxisValueFormatter.h +// ChartsDemo +// Copyright © 2016 dcg. All rights reserved. +// + +#import +#import "ChartsDemo_iOS-Swift.h" + +@interface IntAxisValueFormatter : NSObject + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/IntAxisValueFormatter.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/IntAxisValueFormatter.m new file mode 100644 index 00000000000..227a5f2806c --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/IntAxisValueFormatter.m @@ -0,0 +1,19 @@ +// +// IntAxisValueFormatter.m +// ChartsDemo +// Copyright © 2016 dcg. All rights reserved. +// + +#import "IntAxisValueFormatter.h" + +@implementation IntAxisValueFormatter +{ +} + +- (NSString *)stringForValue:(double)value + axis:(ChartAxisBase *)axis +{ + return [@((NSInteger)value) stringValue]; +} + +@end diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/LargeValueFormatter.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/LargeValueFormatter.swift new file mode 100644 index 00000000000..47ca78fd5eb --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Objective-C/Formatters/LargeValueFormatter.swift @@ -0,0 +1,68 @@ +// +// LargeValueFormatter.swift +// ChartsDemo +// Copyright © 2016 dcg. All rights reserved. +// + +import Foundation +import Charts + +open class LargeValueFormatter: NSObject, IValueFormatter, IAxisValueFormatter +{ + fileprivate static let MAX_LENGTH = 5 + + /// Suffix to be appended after the values. + /// + /// **default**: suffix: ["", "k", "m", "b", "t"] + @objc open var suffix = ["", "k", "m", "b", "t"] + + /// An appendix text to be added at the end of the formatted value. + @objc open var appendix: String? + + public override init() + { + + } + + @objc public init(appendix: String?) + { + self.appendix = appendix + } + + fileprivate func format(value: Double) -> String + { + var sig = value + var length = 0 + let maxLength = suffix.count - 1 + + while sig >= 1000.0 && length < maxLength + { + sig /= 1000.0 + length += 1 + } + + var r = String(format: "%2.f", sig) + suffix[length] + + if appendix != nil + { + r += appendix! + } + + return r + } + + open func stringForValue( + _ value: Double, axis: AxisBase?) -> String + { + return format(value: value) + } + + open func stringForValue( + _ value: Double, + entry: ChartDataEntry, + dataSetIndex: Int, + viewPortHandler: ViewPortHandler?) -> String + { + return format(value: value) + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Contents.json b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000000..7c780dbcb5c --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,60 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-60@3x.png", + "scale" : "3x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "iTunesArtwork@2x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png new file mode 100644 index 00000000000..33b2e63ab49 Binary files /dev/null and b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png differ diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png new file mode 100644 index 00000000000..ef18aba8240 Binary files /dev/null and b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png differ diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png new file mode 100644 index 00000000000..775e7277c87 Binary files /dev/null and b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png differ diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png new file mode 100644 index 00000000000..df4daf6e9d2 Binary files /dev/null and b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png differ diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png new file mode 100644 index 00000000000..df4daf6e9d2 Binary files /dev/null and b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png differ diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png new file mode 100644 index 00000000000..14dd95b4a6b Binary files /dev/null and b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png differ diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/iTunesArtwork@2x.png b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/iTunesArtwork@2x.png new file mode 100644 index 00000000000..808316d6318 Binary files /dev/null and b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/AppIcon.appiconset/iTunesArtwork@2x.png differ diff --git a/StatsLauncher/Assets.xcassets/Contents.json b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/Contents.json similarity index 100% rename from StatsLauncher/Assets.xcassets/Contents.json rename to Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/Contents.json diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/icon.imageset/Contents.json b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/icon.imageset/Contents.json new file mode 100644 index 00000000000..8c89aaaae3c --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "star-2.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "star-1.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "star.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/icon.imageset/star-1.png b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/icon.imageset/star-1.png new file mode 100644 index 00000000000..c7811ef2b89 Binary files /dev/null and b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/icon.imageset/star-1.png differ diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/icon.imageset/star-2.png b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/icon.imageset/star-2.png new file mode 100644 index 00000000000..c7811ef2b89 Binary files /dev/null and b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/icon.imageset/star-2.png differ diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/icon.imageset/star.png b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/icon.imageset/star.png new file mode 100644 index 00000000000..c7811ef2b89 Binary files /dev/null and b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Images.xcassets/icon.imageset/star.png differ diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Launch Screen.storyboard b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Launch Screen.storyboard new file mode 100644 index 00000000000..c9e454f2e2f --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/Launch Screen.storyboard @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/markers/radar_marker@3x.png b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/markers/radar_marker@3x.png new file mode 100644 index 00000000000..a84b93b5391 Binary files /dev/null and b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Resources/markers/radar_marker@3x.png differ diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Supporting Files/ChartsDemo-Bridging-Header.h b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Supporting Files/ChartsDemo-Bridging-Header.h new file mode 100644 index 00000000000..1b2cb5d6d09 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Supporting Files/ChartsDemo-Bridging-Header.h @@ -0,0 +1,4 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Supporting Files/Info.plist b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Supporting Files/Info.plist new file mode 100644 index 00000000000..6e4887eb4c2 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Supporting Files/Info.plist @@ -0,0 +1,42 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + NSPhotoLibraryAddUsageDescription + This app requires access to the photo library to store shots of charts there. + NSPhotoLibraryUsageDescription + This app requires access to the photo library to store shots of charts there. + UILaunchStoryboardName + Launch Screen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Supporting Files/main.m b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Supporting Files/main.m new file mode 100644 index 00000000000..1d64bc0e891 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Supporting Files/main.m @@ -0,0 +1,19 @@ +// +// main.m +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/AppDelegate.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/AppDelegate.swift new file mode 100644 index 00000000000..b7752a9bea8 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/AppDelegate.swift @@ -0,0 +1,54 @@ +// +// AppDelegate.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-03. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + self.window = UIWindow(frame: UIScreen.main.bounds) + + + let vc = DemoListViewController() + let nav = UINavigationController(rootViewController: vc) + + window?.rootViewController = nav + window?.makeKeyAndVisible() + + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Components/BalloonMarker.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Components/BalloonMarker.swift new file mode 100644 index 00000000000..3a66e1cb6a0 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Components/BalloonMarker.swift @@ -0,0 +1,206 @@ +// +// BalloonMarker.swift +// ChartsDemo-Swift +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import Charts + +open class BalloonMarker: MarkerImage +{ + open var color: UIColor + open var arrowSize = CGSize(width: 15, height: 11) + open var font: UIFont + open var textColor: UIColor + open var insets: UIEdgeInsets + open var minimumSize = CGSize() + + fileprivate var label: String? + fileprivate var _labelSize: CGSize = CGSize() + fileprivate var _paragraphStyle: NSMutableParagraphStyle? + fileprivate var _drawAttributes = [NSAttributedString.Key : Any]() + + public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets) + { + self.color = color + self.font = font + self.textColor = textColor + self.insets = insets + + _paragraphStyle = NSParagraphStyle.default.mutableCopy() as? NSMutableParagraphStyle + _paragraphStyle?.alignment = .center + super.init() + } + + open override func offsetForDrawing(atPoint point: CGPoint) -> CGPoint + { + var offset = self.offset + var size = self.size + + if size.width == 0.0 && image != nil + { + size.width = image!.size.width + } + if size.height == 0.0 && image != nil + { + size.height = image!.size.height + } + + let width = size.width + let height = size.height + let padding: CGFloat = 8.0 + + var origin = point + origin.x -= width / 2 + origin.y -= height + + if origin.x + offset.x < 0.0 + { + offset.x = -origin.x + padding + } + else if let chart = chartView, + origin.x + width + offset.x > chart.bounds.size.width + { + offset.x = chart.bounds.size.width - origin.x - width - padding + } + + if origin.y + offset.y < 0 + { + offset.y = height + padding; + } + else if let chart = chartView, + origin.y + height + offset.y > chart.bounds.size.height + { + offset.y = chart.bounds.size.height - origin.y - height - padding + } + + return offset + } + + open override func draw(context: CGContext, point: CGPoint) + { + guard let label = label else { return } + + let offset = self.offsetForDrawing(atPoint: point) + let size = self.size + + var rect = CGRect( + origin: CGPoint( + x: point.x + offset.x, + y: point.y + offset.y), + size: size) + rect.origin.x -= size.width / 2.0 + rect.origin.y -= size.height + + context.saveGState() + + context.setFillColor(color.cgColor) + + if offset.y > 0 + { + context.beginPath() + context.move(to: CGPoint( + x: rect.origin.x, + y: rect.origin.y + arrowSize.height)) + context.addLine(to: CGPoint( + x: rect.origin.x + (rect.size.width - arrowSize.width) / 2.0, + y: rect.origin.y + arrowSize.height)) + //arrow vertex + context.addLine(to: CGPoint( + x: point.x, + y: point.y)) + context.addLine(to: CGPoint( + x: rect.origin.x + (rect.size.width + arrowSize.width) / 2.0, + y: rect.origin.y + arrowSize.height)) + context.addLine(to: CGPoint( + x: rect.origin.x + rect.size.width, + y: rect.origin.y + arrowSize.height)) + context.addLine(to: CGPoint( + x: rect.origin.x + rect.size.width, + y: rect.origin.y + rect.size.height)) + context.addLine(to: CGPoint( + x: rect.origin.x, + y: rect.origin.y + rect.size.height)) + context.addLine(to: CGPoint( + x: rect.origin.x, + y: rect.origin.y + arrowSize.height)) + context.fillPath() + } + else + { + context.beginPath() + context.move(to: CGPoint( + x: rect.origin.x, + y: rect.origin.y)) + context.addLine(to: CGPoint( + x: rect.origin.x + rect.size.width, + y: rect.origin.y)) + context.addLine(to: CGPoint( + x: rect.origin.x + rect.size.width, + y: rect.origin.y + rect.size.height - arrowSize.height)) + context.addLine(to: CGPoint( + x: rect.origin.x + (rect.size.width + arrowSize.width) / 2.0, + y: rect.origin.y + rect.size.height - arrowSize.height)) + //arrow vertex + context.addLine(to: CGPoint( + x: point.x, + y: point.y)) + context.addLine(to: CGPoint( + x: rect.origin.x + (rect.size.width - arrowSize.width) / 2.0, + y: rect.origin.y + rect.size.height - arrowSize.height)) + context.addLine(to: CGPoint( + x: rect.origin.x, + y: rect.origin.y + rect.size.height - arrowSize.height)) + context.addLine(to: CGPoint( + x: rect.origin.x, + y: rect.origin.y)) + context.fillPath() + } + + if offset.y > 0 { + rect.origin.y += self.insets.top + arrowSize.height + } else { + rect.origin.y += self.insets.top + } + + rect.size.height -= self.insets.top + self.insets.bottom + + UIGraphicsPushContext(context) + + label.draw(in: rect, withAttributes: _drawAttributes) + + UIGraphicsPopContext() + + context.restoreGState() + } + + open override func refreshContent(entry: ChartDataEntry, highlight: Highlight) + { + setLabel(String(entry.y)) + } + + open func setLabel(_ newLabel: String) + { + label = newLabel + + _drawAttributes.removeAll() + _drawAttributes[.font] = self.font + _drawAttributes[.paragraphStyle] = _paragraphStyle + _drawAttributes[.foregroundColor] = self.textColor + + _labelSize = label?.size(withAttributes: _drawAttributes) ?? CGSize.zero + + var size = CGSize() + size.width = _labelSize.width + self.insets.left + self.insets.right + size.height = _labelSize.height + self.insets.top + self.insets.bottom + size.width = max(minimumSize.width, size.width) + size.height = max(minimumSize.height, size.height) + self.size = size + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Components/RadarMarkerView.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Components/RadarMarkerView.swift new file mode 100644 index 00000000000..019196d5e8e --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Components/RadarMarkerView.swift @@ -0,0 +1,27 @@ +// +// RadarMarkerView.swift +// ChartsDemo +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import Charts + +public class RadarMarkerView: MarkerView { + @IBOutlet var label: UILabel! + + public override func awakeFromNib() { + self.offset.x = -self.frame.size.width / 2.0 + self.offset.y = -self.frame.size.height - 7.0 + } + + public override func refreshContent(entry: ChartDataEntry, highlight: Highlight) { + label.text = String.init(format: "%d %%", Int(round(entry.y))) + layoutIfNeeded() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Components/XYMarkerView.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Components/XYMarkerView.swift new file mode 100644 index 00000000000..23bb965487b --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Components/XYMarkerView.swift @@ -0,0 +1,32 @@ +// +// XYMarkerView.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import Foundation +import Charts + +public class XYMarkerView: BalloonMarker { + public var xAxisValueFormatter: IAxisValueFormatter + fileprivate var yFormatter = NumberFormatter() + + public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets, + xAxisValueFormatter: IAxisValueFormatter) { + self.xAxisValueFormatter = xAxisValueFormatter + yFormatter.minimumFractionDigits = 1 + yFormatter.maximumFractionDigits = 1 + super.init(color: color, font: font, textColor: textColor, insets: insets) + } + + public override func refreshContent(entry: ChartDataEntry, highlight: Highlight) { + let string = "x: " + + xAxisValueFormatter.stringForValue(entry.x, axis: XAxis()) + + ", y: " + + yFormatter.string(from: NSNumber(floatLiteral: entry.y))! + setLabel(string) + } + +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/DemoBaseViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/DemoBaseViewController.swift new file mode 100644 index 00000000000..d96b07ef7ff --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/DemoBaseViewController.swift @@ -0,0 +1,364 @@ +// +// DemoBaseViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-03. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +enum Option { + case toggleValues + case toggleIcons + case toggleHighlight + case animateX + case animateY + case animateXY + case saveToGallery + case togglePinchZoom + case toggleAutoScaleMinMax + case toggleData + case toggleBarBorders + // CandleChart + case toggleShadowColorSameAsCandle + case toggleShowCandleBar + // CombinedChart + case toggleLineValues + case toggleBarValues + case removeDataSet + // CubicLineSampleFillFormatter + case toggleFilled + case toggleCircles + case toggleCubic + case toggleHorizontalCubic + case toggleStepped + // HalfPieChartController + case toggleXValues + case togglePercent + case toggleHole + case spin + case drawCenter + // RadarChart + case toggleXLabels + case toggleYLabels + case toggleRotate + case toggleHighlightCircle + + var label: String { + switch self { + case .toggleValues: return "Toggle Y-Values" + case .toggleIcons: return "Toggle Icons" + case .toggleHighlight: return "Toggle Highlight" + case .animateX: return "Animate X" + case .animateY: return "Animate Y" + case .animateXY: return "Animate XY" + case .saveToGallery: return "Save to Camera Roll" + case .togglePinchZoom: return "Toggle PinchZoom" + case .toggleAutoScaleMinMax: return "Toggle auto scale min/max" + case .toggleData: return "Toggle Data" + case .toggleBarBorders: return "Toggle Bar Borders" + // CandleChart + case .toggleShadowColorSameAsCandle: return "Toggle shadow same color" + case .toggleShowCandleBar: return "Toggle show candle bar" + // CombinedChart + case .toggleLineValues: return "Toggle Line Values" + case .toggleBarValues: return "Toggle Bar Values" + case .removeDataSet: return "Remove Random Set" + // CubicLineSampleFillFormatter + case .toggleFilled: return "Toggle Filled" + case .toggleCircles: return "Toggle Circles" + case .toggleCubic: return "Toggle Cubic" + case .toggleHorizontalCubic: return "Toggle Horizontal Cubic" + case .toggleStepped: return "Toggle Stepped" + // HalfPieChartController + case .toggleXValues: return "Toggle X-Values" + case .togglePercent: return "Toggle Percent" + case .toggleHole: return "Toggle Hole" + case .spin: return "Spin" + case .drawCenter: return "Draw CenterText" + // RadarChart + case .toggleXLabels: return "Toggle X-Labels" + case .toggleYLabels: return "Toggle Y-Labels" + case .toggleRotate: return "Toggle Rotate" + case .toggleHighlightCircle: return "Toggle highlight circle" + } + } +} + +class DemoBaseViewController: UIViewController, ChartViewDelegate { + private var optionsTableView: UITableView? = nil + let parties = ["Party A", "Party B", "Party C", "Party D", "Party E", "Party F", + "Party G", "Party H", "Party I", "Party J", "Party K", "Party L", + "Party M", "Party N", "Party O", "Party P", "Party Q", "Party R", + "Party S", "Party T", "Party U", "Party V", "Party W", "Party X", + "Party Y", "Party Z"] + + @IBOutlet weak var optionsButton: UIButton! + var options: [Option]! + + var shouldHideData: Bool = false + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + self.initialize() + } + + override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { + super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) + self.initialize() + } + + private func initialize() { + self.edgesForExtendedLayout = [] + } + + func optionTapped(_ option: Option) {} + + func handleOption(_ option: Option, forChartView chartView: ChartViewBase) { + switch option { + case .toggleValues: + for set in chartView.data!.dataSets { + set.drawValuesEnabled = !set.drawValuesEnabled + } + chartView.setNeedsDisplay() + + case .toggleIcons: + for set in chartView.data!.dataSets { + set.drawIconsEnabled = !set.drawIconsEnabled + } + chartView.setNeedsDisplay() + + case .toggleHighlight: + chartView.data!.highlightEnabled = !chartView.data!.isHighlightEnabled + chartView.setNeedsDisplay() + + case .animateX: + chartView.animate(xAxisDuration: 3) + + case .animateY: + chartView.animate(yAxisDuration: 3) + + case .animateXY: + chartView.animate(xAxisDuration: 3, yAxisDuration: 3) + + case .saveToGallery: + UIImageWriteToSavedPhotosAlbum(chartView.getChartImage(transparent: false)!, nil, nil, nil) + + case .togglePinchZoom: + let barLineChart = chartView as! BarLineChartViewBase + barLineChart.pinchZoomEnabled = !barLineChart.pinchZoomEnabled + chartView.setNeedsDisplay() + + case .toggleAutoScaleMinMax: + let barLineChart = chartView as! BarLineChartViewBase + barLineChart.autoScaleMinMaxEnabled = !barLineChart.isAutoScaleMinMaxEnabled + chartView.notifyDataSetChanged() + + case .toggleData: + shouldHideData = !shouldHideData + updateChartData() + + case .toggleBarBorders: + for set in chartView.data!.dataSets { + if let set = set as? BarChartDataSet { + set.barBorderWidth = set.barBorderWidth == 1.0 ? 0.0 : 1.0 + } + } + chartView.setNeedsDisplay() + default: + break + } + } + + @IBAction func optionsButtonTapped(_ sender: Any) { + if let optionsTableView = self.optionsTableView { + optionsTableView.removeFromSuperview() + self.optionsTableView = nil + return + } + + let optionsTableView = UITableView() + optionsTableView.backgroundColor = UIColor(white: 0, alpha: 0.9) + optionsTableView.delegate = self + optionsTableView.dataSource = self + + optionsTableView.translatesAutoresizingMaskIntoConstraints = false + + self.optionsTableView = optionsTableView + + var constraints = [NSLayoutConstraint]() + + constraints.append(NSLayoutConstraint(item: optionsTableView, + attribute: .leading, + relatedBy: .equal, + toItem: self.view, + attribute: .leading, + multiplier: 1, + constant: 40)) + + constraints.append(NSLayoutConstraint(item: optionsTableView, + attribute: .trailing, + relatedBy: .equal, + toItem: sender as! UIView, + attribute: .trailing, + multiplier: 1, + constant: 0)) + + constraints.append(NSLayoutConstraint(item: optionsTableView, + attribute: .top, + relatedBy: .equal, + toItem: sender, + attribute: .bottom, + multiplier: 1, + constant: 5)) + + self.view.addSubview(optionsTableView) + constraints.forEach { $0.isActive = true } + + let constraint = NSLayoutConstraint(item: optionsTableView, + attribute: .height, + relatedBy: .equal, + toItem: nil, + attribute: .height, + multiplier: 1, + constant: 220) + constraint.isActive = true + } + + func updateChartData() { + fatalError("updateChartData not overridden") + } + + func setup(pieChartView chartView: PieChartView) { + chartView.usePercentValuesEnabled = true + chartView.drawSlicesUnderHoleEnabled = false + chartView.holeRadiusPercent = 0.58 + chartView.transparentCircleRadiusPercent = 0.61 + chartView.chartDescription?.enabled = false + chartView.setExtraOffsets(left: 5, top: 10, right: 5, bottom: 5) + + chartView.drawCenterTextEnabled = true + + let paragraphStyle = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle + paragraphStyle.lineBreakMode = .byTruncatingTail + paragraphStyle.alignment = .center + + let centerText = NSMutableAttributedString(string: "Charts\nby Daniel Cohen Gindi") + centerText.setAttributes([.font : UIFont(name: "HelveticaNeue-Light", size: 13)!, + .paragraphStyle : paragraphStyle], range: NSRange(location: 0, length: centerText.length)) + centerText.addAttributes([.font : UIFont(name: "HelveticaNeue-Light", size: 11)!, + .foregroundColor : UIColor.gray], range: NSRange(location: 10, length: centerText.length - 10)) + centerText.addAttributes([.font : UIFont(name: "HelveticaNeue-Light", size: 11)!, + .foregroundColor : UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)], range: NSRange(location: centerText.length - 19, length: 19)) + chartView.centerAttributedText = centerText; + + chartView.drawHoleEnabled = true + chartView.rotationAngle = 0 + chartView.rotationEnabled = true + chartView.highlightPerTapEnabled = true + + let l = chartView.legend + l.horizontalAlignment = .right + l.verticalAlignment = .top + l.orientation = .vertical + l.drawInside = false + l.xEntrySpace = 7 + l.yEntrySpace = 0 + l.yOffset = 0 +// chartView.legend = l + } + + func setup(radarChartView chartView: RadarChartView) { + chartView.chartDescription?.enabled = false + } + + func setup(barLineChartView chartView: BarLineChartViewBase) { + chartView.chartDescription?.enabled = false + + chartView.dragEnabled = true + chartView.setScaleEnabled(true) + chartView.pinchZoomEnabled = false + + // ChartYAxis *leftAxis = chartView.leftAxis; + + let xAxis = chartView.xAxis + xAxis.labelPosition = .bottom + + chartView.rightAxis.enabled = false + } + // TODO: Cannot override from extensions + //extension DemoBaseViewController: ChartViewDelegate { + func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) { + NSLog("chartValueSelected"); + } + + func chartValueNothingSelected(_ chartView: ChartViewBase) { + NSLog("chartValueNothingSelected"); + } + + func chartScaled(_ chartView: ChartViewBase, scaleX: CGFloat, scaleY: CGFloat) { + + } + + func chartTranslated(_ chartView: ChartViewBase, dX: CGFloat, dY: CGFloat) { + + } +} + +extension DemoBaseViewController: UITableViewDelegate, UITableViewDataSource { + func numberOfSections(in tableView: UITableView) -> Int { + if optionsTableView != nil { + return 1 + } + + return 0 + } + + @available(iOS 2.0, *) + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + if optionsTableView != nil { + return options.count + } + + return 0 + + } + + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + if optionsTableView != nil { + return 40.0; + } + + return 44.0; + } + + @available(iOS 2.0, *) + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + var cell = tableView.dequeueReusableCell(withIdentifier: "Cell") + + if cell == nil { + cell = UITableViewCell(style: .default, reuseIdentifier: "Cell") + cell?.backgroundView = nil + cell?.backgroundColor = .clear + cell?.textLabel?.textColor = .white + } + cell?.textLabel?.text = self.options[indexPath.row].label + + return cell! + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + if optionsTableView != nil { + tableView.deselectRow(at: indexPath, animated: true) + + optionsTableView?.removeFromSuperview() + self.optionsTableView = nil + + self.optionTapped(self.options[indexPath.row]) + } + + } +} + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/DemoListViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/DemoListViewController.swift new file mode 100644 index 00000000000..1322e488cb5 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/DemoListViewController.swift @@ -0,0 +1,129 @@ +// +// DemoListViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit + +private struct ItemDef { + let title: String + let subtitle: String + let `class`: AnyClass +} + +class DemoListViewController: UIViewController { + + @IBOutlet var tableView: UITableView! + private var itemDefs = [ItemDef(title: "Line Chart", + subtitle: "A simple demonstration of the linechart.", + class: LineChart1ViewController.self), + ItemDef(title: "Line Chart (Dual YAxis)", + subtitle: "Demonstration of the linechart with dual y-axis.", + class: LineChart2ViewController.self), + ItemDef(title: "Bar Chart", + subtitle: "A simple demonstration of the bar chart.", + class: BarChartViewController.self), + ItemDef(title: "Horizontal Bar Chart", + subtitle: "A simple demonstration of the horizontal bar chart.", + class: HorizontalBarChartViewController.self), + ItemDef(title: "Combined Chart", + subtitle: "Demonstrates how to create a combined chart (bar and line in this case).", + class: CombinedChartViewController.self), + ItemDef(title: "Pie Chart", + subtitle: "A simple demonstration of the pie chart.", + class: PieChartViewController.self), + ItemDef(title: "Pie Chart with value lines", + subtitle: "A simple demonstration of the pie chart with polyline notes.", + class: PiePolylineChartViewController.self), + ItemDef(title: "Scatter Chart", + subtitle: "A simple demonstration of the scatter chart.", + class: ScatterChartViewController.self), + ItemDef(title: "Bubble Chart", + subtitle: "A simple demonstration of the bubble chart.", + class: BubbleChartViewController.self), + ItemDef(title: "Stacked Bar Chart", + subtitle: "A simple demonstration of a bar chart with stacked bars.", + class: StackedBarChartViewController.self), + ItemDef(title: "Stacked Bar Chart Negative", + subtitle: "A simple demonstration of stacked bars with negative and positive values.", + class: NegativeStackedBarChartViewController.self), + ItemDef(title: "Another Bar Chart", + subtitle: "Implementation of a BarChart that only shows values at the bottom.", + class: AnotherBarChartViewController.self), + ItemDef(title: "Multiple Lines Chart", + subtitle: "A line chart with multiple DataSet objects. One color per DataSet.", + class: MultipleLinesChartViewController.self), + ItemDef(title: "Multiple Bars Chart", + subtitle: "A bar chart with multiple DataSet objects. One multiple colors per DataSet.", + class: MultipleBarChartViewController.self), + ItemDef(title: "Candle Stick Chart", + subtitle: "Demonstrates usage of the CandleStickChart.", + class: CandleStickChartViewController.self), + ItemDef(title: "Cubic Line Chart", + subtitle: "Demonstrates cubic lines in a LineChart.", + class: CubicLineChartViewController.self), + ItemDef(title: "Radar Chart", + subtitle: "Demonstrates the use of a spider-web like (net) chart.", + class: RadarChartViewController.self), + ItemDef(title: "Colored Line Chart", + subtitle: "Shows a LineChart with different background and line color.", + class: ColoredLineChartViewController.self), + ItemDef(title: "Sinus Bar Chart", + subtitle: "A Bar Chart plotting the sinus function with 8.000 values.", + class: SinusBarChartViewController.self), + ItemDef(title: "BarChart positive / negative", + subtitle: "This demonstrates how to create a BarChart with positive and negative values in different colors.", + class: PositiveNegativeBarChartViewController.self), + ItemDef(title: "Time Line Chart", + subtitle: "Simple demonstration of a time-chart. This chart draws one line entry per hour originating from the current time in milliseconds.", + class: LineChartTimeViewController.self), + ItemDef(title: "Filled Line Chart", + subtitle: "This demonstrates how to fill an area between two LineDataSets.", + class: LineChartFilledViewController.self), + ItemDef(title: "Half Pie Chart", + subtitle: "This demonstrates how to create a 180 degree PieChart.", + class: HalfPieChartViewController.self) + ] + + override func viewDidLoad() { + super.viewDidLoad() + + self.title = "Charts Demonstration" + self.tableView.rowHeight = 70 + //FIXME: Add TimeLineChart + + } +} + +extension DemoListViewController: UITableViewDelegate, UITableViewDataSource { + func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return self.itemDefs.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let def = self.itemDefs[indexPath.row] + let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") ?? UITableViewCell(style: .subtitle, reuseIdentifier: "Cell") + cell.textLabel?.text = def.title + cell.detailTextLabel?.text = def.subtitle + cell.detailTextLabel?.numberOfLines = 0 + + return cell + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let def = self.itemDefs[indexPath.row] + + let vcClass = def.class as! UIViewController.Type + let vc = vcClass.init() + + self.navigationController?.pushViewController(vc, animated: true) + tableView.deselectRow(at: indexPath, animated: true) + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/AnotherBarChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/AnotherBarChartViewController.swift new file mode 100644 index 00000000000..abfe17ef3c1 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/AnotherBarChartViewController.swift @@ -0,0 +1,100 @@ +// +// AnotherBarChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class AnotherBarChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: BarChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Another Bar Chart" + + self.options = [.toggleValues, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleData, + .toggleBarBorders] + + chartView.delegate = self + + chartView.chartDescription?.enabled = false + chartView.maxVisibleCount = 60 + chartView.pinchZoomEnabled = false + chartView.drawBarShadowEnabled = false + + let xAxis = chartView.xAxis + xAxis.labelPosition = .bottom + + chartView.legend.enabled = false + + sliderX.value = 10 + sliderY.value = 100 + self.slidersValueChanged(nil) + } + + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value) + 1, range: Double(sliderY.value)) + } + + func setDataCount(_ count: Int, range: Double) { + let yVals = (0.. BarChartDataEntry in + let mult = range + 1 + let val = Double(arc4random_uniform(UInt32(mult))) + mult/3 + return BarChartDataEntry(x: Double(i), y: val) + } + + var set1: BarChartDataSet! = nil + if let set = chartView.data?.dataSets.first as? BarChartDataSet { + set1 = set + set1?.replaceEntries(yVals) + chartView.data?.notifyDataChanged() + chartView.notifyDataSetChanged() + } else { + set1 = BarChartDataSet(entries: yVals, label: "Data Set") + set1.colors = ChartColorTemplates.vordiplom() + set1.drawValuesEnabled = false + + let data = BarChartData(dataSet: set1) + chartView.data = data + chartView.fitBars = true + } + + chartView.setNeedsDisplay() + } + + override func optionTapped(_ option: Option) { + super.handleOption(option, forChartView: chartView) + } + + // MARK: - Actions + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/BarChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/BarChartViewController.swift new file mode 100644 index 00000000000..02fc03034a4 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/BarChartViewController.swift @@ -0,0 +1,152 @@ +// +// BarChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class BarChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: BarChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Bar Chart" + + self.options = [.toggleValues, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleData, + .toggleBarBorders] + + self.setup(barLineChartView: chartView) + + chartView.delegate = self + + chartView.drawBarShadowEnabled = false + chartView.drawValueAboveBarEnabled = false + + chartView.maxVisibleCount = 60 + + let xAxis = chartView.xAxis + xAxis.labelPosition = .bottom + xAxis.labelFont = .systemFont(ofSize: 10) + xAxis.granularity = 1 + xAxis.labelCount = 7 + xAxis.valueFormatter = DayAxisValueFormatter(chart: chartView) + + let leftAxisFormatter = NumberFormatter() + leftAxisFormatter.minimumFractionDigits = 0 + leftAxisFormatter.maximumFractionDigits = 1 + leftAxisFormatter.negativeSuffix = " $" + leftAxisFormatter.positiveSuffix = " $" + + let leftAxis = chartView.leftAxis + leftAxis.labelFont = .systemFont(ofSize: 10) + leftAxis.labelCount = 8 + leftAxis.valueFormatter = DefaultAxisValueFormatter(formatter: leftAxisFormatter) + leftAxis.labelPosition = .outsideChart + leftAxis.spaceTop = 0.15 + leftAxis.axisMinimum = 0 // FIXME: HUH?? this replaces startAtZero = YES + + let rightAxis = chartView.rightAxis + rightAxis.enabled = true + rightAxis.labelFont = .systemFont(ofSize: 10) + rightAxis.labelCount = 8 + rightAxis.valueFormatter = leftAxis.valueFormatter + rightAxis.spaceTop = 0.15 + rightAxis.axisMinimum = 0 + + let l = chartView.legend + l.horizontalAlignment = .left + l.verticalAlignment = .bottom + l.orientation = .horizontal + l.drawInside = false + l.form = .circle + l.formSize = 9 + l.font = UIFont(name: "HelveticaNeue-Light", size: 11)! + l.xEntrySpace = 4 +// chartView.legend = l + + let marker = XYMarkerView(color: UIColor(white: 180/250, alpha: 1), + font: .systemFont(ofSize: 12), + textColor: .white, + insets: UIEdgeInsets(top: 8, left: 8, bottom: 20, right: 8), + xAxisValueFormatter: chartView.xAxis.valueFormatter!) + marker.chartView = chartView + marker.minimumSize = CGSize(width: 80, height: 40) + chartView.marker = marker + + sliderX.value = 12 + sliderY.value = 50 + slidersValueChanged(nil) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value) + 1, range: UInt32(sliderY.value)) + } + + func setDataCount(_ count: Int, range: UInt32) { + let start = 1 + + let yVals = (start.. BarChartDataEntry in + let mult = range + 1 + let val = Double(arc4random_uniform(mult)) + if arc4random_uniform(100) < 25 { + return BarChartDataEntry(x: Double(i), y: val, icon: UIImage(named: "icon")) + } else { + return BarChartDataEntry(x: Double(i), y: val) + } + } + + var set1: BarChartDataSet! = nil + if let set = chartView.data?.dataSets.first as? BarChartDataSet { + set1 = set + set1.replaceEntries(yVals) + chartView.data?.notifyDataChanged() + chartView.notifyDataSetChanged() + } else { + set1 = BarChartDataSet(entries: yVals, label: "The year 2017") + set1.colors = ChartColorTemplates.material() + set1.drawValuesEnabled = false + + let data = BarChartData(dataSet: set1) + data.setValueFont(UIFont(name: "HelveticaNeue-Light", size: 10)!) + data.barWidth = 0.9 + chartView.data = data + } + +// chartView.setNeedsDisplay() + } + + override func optionTapped(_ option: Option) { + super.handleOption(option, forChartView: chartView) + } + + // MARK: - Actions + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value + 2))" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/BubbleChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/BubbleChartViewController.swift new file mode 100644 index 00000000000..b53576fc79a --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/BubbleChartViewController.swift @@ -0,0 +1,127 @@ +// +// BubbleChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class BubbleChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: BubbleChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Bubble Chart" + self.options = [.toggleValues, + .toggleIcons, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleAutoScaleMinMax, + .toggleData] + + chartView.delegate = self + + chartView.chartDescription?.enabled = false + + chartView.dragEnabled = false + chartView.setScaleEnabled(true) + chartView.maxVisibleCount = 200 + chartView.pinchZoomEnabled = true + + chartView.legend.horizontalAlignment = .right + chartView.legend.verticalAlignment = .top + chartView.legend.orientation = .vertical + chartView.legend.drawInside = false + chartView.legend.font = UIFont(name: "HelveticaNeue-Light", size: 10)! + + chartView.leftAxis.labelFont = UIFont(name: "HelveticaNeue-Light", size: 10)! + chartView.leftAxis.spaceTop = 0.3 + chartView.leftAxis.spaceBottom = 0.3 + chartView.leftAxis.axisMinimum = 0 + + chartView.rightAxis.enabled = false + + chartView.xAxis.labelPosition = .bottom + chartView.xAxis.labelFont = UIFont(name: "HelveticaNeue-Light", size: 10)! + + sliderX.value = 10 + sliderY.value = 50 + slidersValueChanged(nil) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value), range: UInt32(sliderY.value)) + } + + func setDataCount(_ count: Int, range: UInt32) { + let yVals1 = (0.. BubbleChartDataEntry in + let val = Double(arc4random_uniform(range)) + let size = CGFloat(arc4random_uniform(range)) + return BubbleChartDataEntry(x: Double(i), y: val, size: size, icon: UIImage(named: "icon")) + } + let yVals2 = (0.. BubbleChartDataEntry in + let val = Double(arc4random_uniform(range)) + let size = CGFloat(arc4random_uniform(range)) + return BubbleChartDataEntry(x: Double(i), y: val, size: size, icon: UIImage(named: "icon")) + } + let yVals3 = (0.. BubbleChartDataEntry in + let val = Double(arc4random_uniform(range)) + let size = CGFloat(arc4random_uniform(range)) + return BubbleChartDataEntry(x: Double(i), y: val, size: size) + } + + let set1 = BubbleChartDataSet(entries: yVals1, label: "DS 1") + set1.drawIconsEnabled = false + set1.setColor(ChartColorTemplates.colorful()[0], alpha: 0.5) + set1.drawValuesEnabled = true + + let set2 = BubbleChartDataSet(entries: yVals2, label: "DS 2") + set2.drawIconsEnabled = false + set2.iconsOffset = CGPoint(x: 0, y: 15) + set2.setColor(ChartColorTemplates.colorful()[1], alpha: 0.5) + set2.drawValuesEnabled = true + + let set3 = BubbleChartDataSet(entries: yVals3, label: "DS 3") + set3.setColor(ChartColorTemplates.colorful()[2], alpha: 0.5) + set3.drawValuesEnabled = true + + let data = BubbleChartData(dataSets: [set1, set2, set3]) + data.setDrawValues(false) + data.setValueFont(UIFont(name: "HelveticaNeue-Light", size: 7)!) + data.setHighlightCircleWidth(1.5) + data.setValueTextColor(.white) + + chartView.data = data + } + + override func optionTapped(_ option: Option) { + super.handleOption(option, forChartView: chartView) + } + + // MARK: - Actions + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/CandleStickChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/CandleStickChartViewController.swift new file mode 100644 index 00000000000..d8fd334ca05 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/CandleStickChartViewController.swift @@ -0,0 +1,129 @@ +// +// CandleStickChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class CandleStickChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: CandleStickChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Candle Stick Chart" + self.options = [.toggleValues, + .toggleIcons, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleAutoScaleMinMax, + .toggleShadowColorSameAsCandle, + .toggleShowCandleBar, + .toggleData] + + chartView.delegate = self + + chartView.chartDescription?.enabled = false + + chartView.dragEnabled = false + chartView.setScaleEnabled(true) + chartView.maxVisibleCount = 200 + chartView.pinchZoomEnabled = true + + chartView.legend.horizontalAlignment = .right + chartView.legend.verticalAlignment = .top + chartView.legend.orientation = .vertical + chartView.legend.drawInside = false + chartView.legend.font = UIFont(name: "HelveticaNeue-Light", size: 10)! + + chartView.leftAxis.labelFont = UIFont(name: "HelveticaNeue-Light", size: 10)! + chartView.leftAxis.spaceTop = 0.3 + chartView.leftAxis.spaceBottom = 0.3 + chartView.leftAxis.axisMinimum = 0 + + chartView.rightAxis.enabled = false + + chartView.xAxis.labelPosition = .bottom + chartView.xAxis.labelFont = UIFont(name: "HelveticaNeue-Light", size: 10)! + + sliderX.value = 10 + sliderY.value = 50 + slidersValueChanged(nil) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value), range: UInt32(sliderY.value)) + } + + func setDataCount(_ count: Int, range: UInt32) { + let yVals1 = (0.. CandleChartDataEntry in + let mult = range + 1 + let val = Double(arc4random_uniform(40) + mult) + let high = Double(arc4random_uniform(9) + 8) + let low = Double(arc4random_uniform(9) + 8) + let open = Double(arc4random_uniform(6) + 1) + let close = Double(arc4random_uniform(6) + 1) + let even = i % 2 == 0 + + return CandleChartDataEntry(x: Double(i), shadowH: val + high, shadowL: val - low, open: even ? val + open : val - open, close: even ? val - close : val + close, icon: UIImage(named: "icon")!) + } + + let set1 = CandleChartDataSet(entries: yVals1, label: "Data Set") + set1.axisDependency = .left + set1.setColor(UIColor(white: 80/255, alpha: 1)) + set1.drawIconsEnabled = false + set1.shadowColor = .darkGray + set1.shadowWidth = 0.7 + set1.decreasingColor = .red + set1.decreasingFilled = true + set1.increasingColor = UIColor(red: 122/255, green: 242/255, blue: 84/255, alpha: 1) + set1.increasingFilled = false + set1.neutralColor = .blue + + let data = CandleChartData(dataSet: set1) + chartView.data = data + } + + override func optionTapped(_ option: Option) { + switch option { + case .toggleShadowColorSameAsCandle: + for set in chartView.data!.dataSets as! [CandleChartDataSet] { + set.shadowColorSameAsCandle = !set.shadowColorSameAsCandle + } + chartView.notifyDataSetChanged() + case .toggleShowCandleBar: + for set in chartView.data!.dataSets as! [CandleChartDataSet] { + set.showCandleBar = !set.showCandleBar + } + chartView.notifyDataSetChanged() + default: + super.handleOption(option, forChartView: chartView) + } + } + + // MARK: - Actions + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + }} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/ColoredLineChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/ColoredLineChartViewController.swift new file mode 100644 index 00000000000..a2e105995e3 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/ColoredLineChartViewController.swift @@ -0,0 +1,77 @@ +// +// ColoredLineChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-04. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class ColoredLineChartViewController: DemoBaseViewController { + @IBOutlet var chartViews: [LineChartView]! + + override func viewDidLoad() { + super.viewDidLoad() + + self.title = "Colored Line Chart" + + let colors = [UIColor(red: 137/255, green: 230/255, blue: 81/255, alpha: 1), + UIColor(red: 240/255, green: 240/255, blue: 30/255, alpha: 1), + UIColor(red: 89/255, green: 199/255, blue: 250/255, alpha: 1), + UIColor(red: 250/255, green: 104/255, blue: 104/255, alpha: 1)] + + for (i, chartView) in chartViews.enumerated() { + let data = dataWithCount(36, range: 100) + data.setValueFont(UIFont(name: "HelveticaNeue", size: 7)!) + + setupChart(chartView, data: data, color: colors[i % colors.count]) + } + } + + func setupChart(_ chart: LineChartView, data: LineChartData, color: UIColor) { + (data.getDataSetByIndex(0) as! LineChartDataSet).circleHoleColor = color + + chart.delegate = self + chart.backgroundColor = color + + chart.chartDescription?.enabled = false + + chart.dragEnabled = true + chart.setScaleEnabled(true) + chart.pinchZoomEnabled = false + chart.setViewPortOffsets(left: 10, top: 0, right: 10, bottom: 0) + + chart.legend.enabled = false + + chart.leftAxis.enabled = false + chart.leftAxis.spaceTop = 0.4 + chart.leftAxis.spaceBottom = 0.4 + chart.rightAxis.enabled = false + chart.xAxis.enabled = false + + chart.data = data + + chart.animate(xAxisDuration: 2.5) + } + + func dataWithCount(_ count: Int, range: UInt32) -> LineChartData { + let yVals = (0.. ChartDataEntry in + let val = Double(arc4random_uniform(range)) + 3 + return ChartDataEntry(x: Double(i), y: val) + } + + let set1 = LineChartDataSet(entries: yVals, label: "DataSet 1") + + set1.lineWidth = 1.75 + set1.circleRadius = 5.0 + set1.circleHoleRadius = 2.5 + set1.setColor(.white) + set1.setCircleColor(.white) + set1.highlightColor = .white + set1.drawValuesEnabled = false + + return LineChartData(dataSet: set1) + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/CombinedChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/CombinedChartViewController.swift new file mode 100644 index 00000000000..e78aadaa960 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/CombinedChartViewController.swift @@ -0,0 +1,233 @@ +// +// CombinedChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +private let ITEM_COUNT = 12 + +class CombinedChartViewController: DemoBaseViewController { + @IBOutlet var chartView: CombinedChartView! + + let months = ["Jan", "Feb", "Mar", + "Apr", "May", "Jun", + "Jul", "Aug", "Sep", + "Oct", "Nov", "Dec"] + + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Combined Chart" + self.options = [.toggleLineValues, + .toggleBarValues, + .saveToGallery, + .toggleData, + .toggleBarBorders, + .removeDataSet] + + chartView.delegate = self + + chartView.chartDescription?.enabled = false + + chartView.drawBarShadowEnabled = false + chartView.highlightFullBarEnabled = false + + + chartView.drawOrder = [DrawOrder.bar.rawValue, + DrawOrder.bubble.rawValue, + DrawOrder.candle.rawValue, + DrawOrder.line.rawValue, + DrawOrder.scatter.rawValue] + + let l = chartView.legend + l.wordWrapEnabled = true + l.horizontalAlignment = .center + l.verticalAlignment = .bottom + l.orientation = .horizontal + l.drawInside = false +// chartView.legend = l + + let rightAxis = chartView.rightAxis + rightAxis.axisMinimum = 0 + + let leftAxis = chartView.leftAxis + leftAxis.axisMinimum = 0 + + let xAxis = chartView.xAxis + xAxis.labelPosition = .bothSided + xAxis.axisMinimum = 0 + xAxis.granularity = 1 + xAxis.valueFormatter = self + + self.updateChartData() + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setChartData() + } + + func setChartData() { + let data = CombinedChartData() + data.lineData = generateLineData() + data.barData = generateBarData() + data.bubbleData = generateBubbleData() + data.scatterData = generateScatterData() + data.candleData = generateCandleData() + + chartView.xAxis.axisMaximum = data.xMax + 0.25 + + chartView.data = data + } + + override func optionTapped(_ option: Option) { + switch option { + case .toggleLineValues: + for set in chartView.data!.dataSets { + if let set = set as? LineChartDataSet { + set.drawValuesEnabled = !set .drawValuesEnabled + + } + } + chartView.setNeedsDisplay() + + case .toggleBarValues: + for set in chartView.data!.dataSets { + if let set = set as? BarChartDataSet { + set.drawValuesEnabled = !set .drawValuesEnabled + } + } + chartView.setNeedsDisplay() + + case .removeDataSet: + let rnd = Int(arc4random_uniform(UInt32(chartView.data!.dataSetCount))) + chartView.data?.removeDataSet(chartView.data!.getDataSetByIndex(rnd)) + chartView.data?.notifyDataChanged() + chartView.notifyDataSetChanged() + + default: + super.handleOption(option, forChartView: chartView) + } + } + + func generateLineData() -> LineChartData { + let entries = (0.. ChartDataEntry in + return ChartDataEntry(x: Double(i) + 0.5, y: Double(arc4random_uniform(15) + 5)) + } + + let set = LineChartDataSet(entries: entries, label: "Line DataSet") + set.setColor(UIColor(red: 240/255, green: 238/255, blue: 70/255, alpha: 1)) + set.lineWidth = 2.5 + set.setCircleColor(UIColor(red: 240/255, green: 238/255, blue: 70/255, alpha: 1)) + set.circleRadius = 5 + set.circleHoleRadius = 2.5 + set.fillColor = UIColor(red: 240/255, green: 238/255, blue: 70/255, alpha: 1) + set.mode = .cubicBezier + set.drawValuesEnabled = true + set.valueFont = .systemFont(ofSize: 10) + set.valueTextColor = UIColor(red: 240/255, green: 238/255, blue: 70/255, alpha: 1) + + set.axisDependency = .left + + return LineChartData(dataSet: set) + } + + func generateBarData() -> BarChartData { + let entries1 = (0.. BarChartDataEntry in + return BarChartDataEntry(x: 0, y: Double(arc4random_uniform(25) + 25)) + } + let entries2 = (0.. BarChartDataEntry in + return BarChartDataEntry(x: 0, yValues: [Double(arc4random_uniform(13) + 12), Double(arc4random_uniform(13) + 12)]) + } + + let set1 = BarChartDataSet(entries: entries1, label: "Bar 1") + set1.setColor(UIColor(red: 60/255, green: 220/255, blue: 78/255, alpha: 1)) + set1.valueTextColor = UIColor(red: 60/255, green: 220/255, blue: 78/255, alpha: 1) + set1.valueFont = .systemFont(ofSize: 10) + set1.axisDependency = .left + + let set2 = BarChartDataSet(entries: entries2, label: "") + set2.stackLabels = ["Stack 1", "Stack 2"] + set2.colors = [UIColor(red: 61/255, green: 165/255, blue: 255/255, alpha: 1), + UIColor(red: 23/255, green: 197/255, blue: 255/255, alpha: 1) + ] + set2.valueTextColor = UIColor(red: 61/255, green: 165/255, blue: 255/255, alpha: 1) + set2.valueFont = .systemFont(ofSize: 10) + set2.axisDependency = .left + + let groupSpace = 0.06 + let barSpace = 0.02 // x2 dataset + let barWidth = 0.45 // x2 dataset + // (0.45 + 0.02) * 2 + 0.06 = 1.00 -> interval per "group" + + let data = BarChartData(dataSets: [set1, set2]) + data.barWidth = barWidth + + // make this BarData object grouped + data.groupBars(fromX: 0, groupSpace: groupSpace, barSpace: barSpace) + + return data + } + + func generateScatterData() -> ScatterChartData { + let entries = stride(from: 0.0, to: Double(ITEM_COUNT), by: 0.5).map { (i) -> ChartDataEntry in + return ChartDataEntry(x: i+0.25, y: Double(arc4random_uniform(10) + 55)) + } + + let set = ScatterChartDataSet(entries: entries, label: "Scatter DataSet") + set.colors = ChartColorTemplates.material() + set.scatterShapeSize = 4.5 + set.drawValuesEnabled = false + set.valueFont = .systemFont(ofSize: 10) + + return ScatterChartData(dataSet: set) + } + + func generateCandleData() -> CandleChartData { + let entries = stride(from: 0, to: ITEM_COUNT, by: 2).map { (i) -> CandleChartDataEntry in + return CandleChartDataEntry(x: Double(i+1), shadowH: 90, shadowL: 70, open: 85, close: 75) + } + + let set = CandleChartDataSet(entries: entries, label: "Candle DataSet") + set.setColor(UIColor(red: 80/255, green: 80/255, blue: 80/255, alpha: 1)) + set.decreasingColor = UIColor(red: 142/255, green: 150/255, blue: 175/255, alpha: 1) + set.shadowColor = .darkGray + set.valueFont = .systemFont(ofSize: 10) + set.drawValuesEnabled = false + + return CandleChartData(dataSet: set) + } + + func generateBubbleData() -> BubbleChartData { + let entries = (0.. BubbleChartDataEntry in + return BubbleChartDataEntry(x: Double(i) + 0.5, + y: Double(arc4random_uniform(10) + 105), + size: CGFloat(arc4random_uniform(50) + 105)) + } + + let set = BubbleChartDataSet(entries: entries, label: "Bubble DataSet") + set.setColors(ChartColorTemplates.vordiplom(), alpha: 1) + set.valueTextColor = .white + set.valueFont = .systemFont(ofSize: 10) + set.drawValuesEnabled = true + + return BubbleChartData(dataSet: set) + } +} + +extension CombinedChartViewController: IAxisValueFormatter { + func stringForValue(_ value: Double, axis: AxisBase?) -> String { + return months[Int(value) % months.count] + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/CubicLineChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/CubicLineChartViewController.swift new file mode 100644 index 00000000000..257be284f1f --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/CubicLineChartViewController.swift @@ -0,0 +1,155 @@ +// +// CubicLineChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +private class CubicLineSampleFillFormatter: IFillFormatter { + func getFillLinePosition(dataSet: ILineChartDataSet, dataProvider: LineChartDataProvider) -> CGFloat { + return -10 + } +} + +class CubicLineChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: LineChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Cubic Line Chart" + + self.options = [.toggleValues, + .toggleFilled, + .toggleCircles, + .toggleCubic, + .toggleHorizontalCubic, + .toggleStepped, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleAutoScaleMinMax, + .toggleData] + + chartView.delegate = self + + chartView.setViewPortOffsets(left: 0, top: 20, right: 0, bottom: 0) + chartView.backgroundColor = UIColor(red: 104/255, green: 241/255, blue: 175/255, alpha: 1) + + chartView.dragEnabled = true + chartView.setScaleEnabled(true) + chartView.pinchZoomEnabled = false + chartView.maxHighlightDistance = 300 + + chartView.xAxis.enabled = false + + let yAxis = chartView.leftAxis + yAxis.labelFont = UIFont(name: "HelveticaNeue-Light", size:12)! + yAxis.setLabelCount(6, force: false) + yAxis.labelTextColor = .white + yAxis.labelPosition = .insideChart + yAxis.axisLineColor = .white + + chartView.rightAxis.enabled = false + chartView.legend.enabled = false + + sliderX.value = 45 + sliderY.value = 100 + self.slidersValueChanged(nil) + + chartView.animate(xAxisDuration: 2, yAxisDuration: 2) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value + 1), range: UInt32(sliderY.value)) + } + + func setDataCount(_ count: Int, range: UInt32) { + let yVals1 = (0.. ChartDataEntry in + let mult = range + 1 + let val = Double(arc4random_uniform(mult) + 20) + return ChartDataEntry(x: Double(i), y: val) + } + + let set1 = LineChartDataSet(entries: yVals1, label: "DataSet 1") + set1.mode = .cubicBezier + set1.drawCirclesEnabled = false + set1.lineWidth = 1.8 + set1.circleRadius = 4 + set1.setCircleColor(.white) + set1.highlightColor = UIColor(red: 244/255, green: 117/255, blue: 117/255, alpha: 1) + set1.fillColor = .white + set1.fillAlpha = 1 + set1.drawHorizontalHighlightIndicatorEnabled = false + set1.fillFormatter = CubicLineSampleFillFormatter() + + let data = LineChartData(dataSet: set1) + data.setValueFont(UIFont(name: "HelveticaNeue-Light", size: 9)!) + data.setDrawValues(false) + + chartView.data = data + } + + override func optionTapped(_ option: Option) { + switch option { + case .toggleFilled: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.drawFilledEnabled = !set.drawFilledEnabled + } + chartView.setNeedsDisplay() + + case .toggleCircles: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.drawCirclesEnabled = !set.drawCirclesEnabled + } + chartView.setNeedsDisplay() + + case .toggleCubic: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.mode = (set.mode == .cubicBezier) ? .linear : .cubicBezier + } + chartView.setNeedsDisplay() + + case .toggleStepped: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.mode = (set.mode == .stepped) ? .linear : .stepped + } + chartView.setNeedsDisplay() + + case .toggleHorizontalCubic: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.mode = (set.mode == .cubicBezier) ? .horizontalBezier : .cubicBezier + } + chartView.setNeedsDisplay() + + default: + super.handleOption(option, forChartView: chartView) + } + } + + // MARK: - Actions + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/HalfPieChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/HalfPieChartViewController.swift new file mode 100644 index 00000000000..541aa6080c8 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/HalfPieChartViewController.swift @@ -0,0 +1,142 @@ +// +// HalfPieChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class HalfPieChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: PieChartView! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Half Pie Chart" + + self.options = [.toggleValues, + .toggleXValues, + .togglePercent, + .toggleHole, + .animateX, + .animateY, + .animateXY, + .spin, + .drawCenter, + .saveToGallery, + .toggleData] + + self.setup(pieChartView: chartView) + + chartView.delegate = self + + chartView.holeColor = .white + chartView.transparentCircleColor = NSUIColor.white.withAlphaComponent(0.43) + chartView.holeRadiusPercent = 0.58 + chartView.rotationEnabled = false + chartView.highlightPerTapEnabled = true + + chartView.maxAngle = 180 // Half chart + chartView.rotationAngle = 180 // Rotate to make the half on the upper side + chartView.centerTextOffset = CGPoint(x: 0, y: -20) + + let l = chartView.legend + l.horizontalAlignment = .center + l.verticalAlignment = .top + l.orientation = .horizontal + l.drawInside = false + l.xEntrySpace = 7 + l.yEntrySpace = 0 + l.yOffset = 0 +// chartView.legend = l + + // entry label styling + chartView.entryLabelColor = .white + chartView.entryLabelFont = UIFont(name:"HelveticaNeue-Light", size:12)! + + self.updateChartData() + + chartView.animate(xAxisDuration: 1.4, easingOption: .easeOutBack) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(4, range: 100) + } + + func setDataCount(_ count: Int, range: UInt32) { + let entries = (0.. PieChartDataEntry in + // IMPORTANT: In a PieChart, no values (Entry) should have the same xIndex (even if from different DataSets), since no values can be drawn above each other. + return PieChartDataEntry(value: Double(arc4random_uniform(range) + range / 5), + label: parties[i % parties.count]) + } + + let set = PieChartDataSet(entries: entries, label: "Election Results") + set.sliceSpace = 3 + set.selectionShift = 5 + set.colors = ChartColorTemplates.material() + + let data = PieChartData(dataSet: set) + + let pFormatter = NumberFormatter() + pFormatter.numberStyle = .percent + pFormatter.maximumFractionDigits = 1 + pFormatter.multiplier = 1 + pFormatter.percentSymbol = " %" + data.setValueFormatter(DefaultValueFormatter(formatter: pFormatter)) + + data.setValueFont(UIFont(name: "HelveticaNeue-Light", size: 11)!) + data.setValueTextColor(.white) + + chartView.data = data + + chartView.setNeedsDisplay() + } + + override func optionTapped(_ option: Option) { + switch option { + case .toggleXValues: + chartView.drawEntryLabelsEnabled = !chartView.drawEntryLabelsEnabled + chartView.setNeedsDisplay() + + case .togglePercent: + chartView.usePercentValuesEnabled = !chartView.usePercentValuesEnabled + chartView.setNeedsDisplay() + + case .toggleHole: + chartView.drawHoleEnabled = !chartView.drawHoleEnabled + chartView.setNeedsDisplay() + + case .drawCenter: + chartView.drawCenterTextEnabled = !chartView.drawCenterTextEnabled + chartView.setNeedsDisplay() + + case .animateX: + chartView.animate(xAxisDuration: 1.4) + + case .animateY: + chartView.animate(yAxisDuration: 1.4) + + case .animateXY: + chartView.animate(xAxisDuration: 1.4, yAxisDuration: 1.4) + + case .spin: + chartView.spin(duration: 2, + fromAngle: chartView.rotationAngle, + toAngle: chartView.rotationAngle + 360, + easingOption: .easeInCubic) + + default: + handleOption(option, forChartView: chartView) + } + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/HorizontalBarChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/HorizontalBarChartViewController.swift new file mode 100644 index 00000000000..850a6b6eaba --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/HorizontalBarChartViewController.swift @@ -0,0 +1,124 @@ +// +// HorizontalBarChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class HorizontalBarChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: HorizontalBarChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Horizontal Bar Char" + self.options = [.toggleValues, + .toggleIcons, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleAutoScaleMinMax, + .toggleData, + .toggleBarBorders] + + self.setup(barLineChartView: chartView) + + chartView.delegate = self + + chartView.drawBarShadowEnabled = false + chartView.drawValueAboveBarEnabled = true + + chartView.maxVisibleCount = 60 + + let xAxis = chartView.xAxis + xAxis.labelPosition = .bottom + xAxis.labelFont = .systemFont(ofSize: 10) + xAxis.drawAxisLineEnabled = true + xAxis.granularity = 10 + + let leftAxis = chartView.leftAxis + leftAxis.labelFont = .systemFont(ofSize: 10) + leftAxis.drawAxisLineEnabled = true + leftAxis.drawGridLinesEnabled = true + leftAxis.axisMinimum = 0 + + let rightAxis = chartView.rightAxis + rightAxis.enabled = true + rightAxis.labelFont = .systemFont(ofSize: 10) + rightAxis.drawAxisLineEnabled = true + rightAxis.axisMinimum = 0 + + let l = chartView.legend + l.horizontalAlignment = .left + l.verticalAlignment = .bottom + l.orientation = .horizontal + l.drawInside = false + l.form = .square + l.formSize = 8 + l.font = UIFont(name: "HelveticaNeue-Light", size: 11)! + l.xEntrySpace = 4 +// chartView.legend = l + + chartView.fitBars = true + + sliderX.value = 12 + sliderY.value = 50 + slidersValueChanged(nil) + + chartView.animate(yAxisDuration: 2.5) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value) + 1, range: UInt32(sliderY.value)) + } + + func setDataCount(_ count: Int, range: UInt32) { + let barWidth = 9.0 + let spaceForBar = 10.0 + + let yVals = (0.. BarChartDataEntry in + let mult = range + 1 + let val = Double(arc4random_uniform(mult)) + return BarChartDataEntry(x: Double(i)*spaceForBar, y: val, icon: #imageLiteral(resourceName: "icon")) + } + + let set1 = BarChartDataSet(entries: yVals, label: "DataSet") + set1.drawIconsEnabled = false + + let data = BarChartData(dataSet: set1) + data.setValueFont(UIFont(name:"HelveticaNeue-Light", size:10)!) + data.barWidth = barWidth + + chartView.data = data + } + + override func optionTapped(_ option: Option) { + super.handleOption(option, forChartView: chartView) + } + + // MARK: - Actions + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/LineChart1ViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/LineChart1ViewController.swift new file mode 100644 index 00000000000..38e51f79d9f --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/LineChart1ViewController.swift @@ -0,0 +1,187 @@ +// +// LineChart1ViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class LineChart1ViewController: DemoBaseViewController { + + @IBOutlet var chartView: LineChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Line Chart 1" + self.options = [.toggleValues, + .toggleFilled, + .toggleCircles, + .toggleCubic, + .toggleHorizontalCubic, + .toggleIcons, + .toggleStepped, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleAutoScaleMinMax, + .toggleData] + + chartView.delegate = self + + chartView.chartDescription?.enabled = false + chartView.dragEnabled = true + chartView.setScaleEnabled(true) + chartView.pinchZoomEnabled = true + + // x-axis limit line + let llXAxis = ChartLimitLine(limit: 10, label: "Index 10") + llXAxis.lineWidth = 4 + llXAxis.lineDashLengths = [10, 10, 0] + llXAxis.labelPosition = .bottomRight + llXAxis.valueFont = .systemFont(ofSize: 10) + + chartView.xAxis.gridLineDashLengths = [10, 10] + chartView.xAxis.gridLineDashPhase = 0 + + let ll1 = ChartLimitLine(limit: 150, label: "Upper Limit") + ll1.lineWidth = 4 + ll1.lineDashLengths = [5, 5] + ll1.labelPosition = .topRight + ll1.valueFont = .systemFont(ofSize: 10) + + let ll2 = ChartLimitLine(limit: -30, label: "Lower Limit") + ll2.lineWidth = 4 + ll2.lineDashLengths = [5,5] + ll2.labelPosition = .bottomRight + ll2.valueFont = .systemFont(ofSize: 10) + + let leftAxis = chartView.leftAxis + leftAxis.removeAllLimitLines() + leftAxis.addLimitLine(ll1) + leftAxis.addLimitLine(ll2) + leftAxis.axisMaximum = 200 + leftAxis.axisMinimum = -50 + leftAxis.gridLineDashLengths = [5, 5] + leftAxis.drawLimitLinesBehindDataEnabled = true + + chartView.rightAxis.enabled = false + + //[_chartView.viewPortHandler setMaximumScaleY: 2.f]; + //[_chartView.viewPortHandler setMaximumScaleX: 2.f]; + + let marker = BalloonMarker(color: UIColor(white: 180/255, alpha: 1), + font: .systemFont(ofSize: 12), + textColor: .white, + insets: UIEdgeInsets(top: 8, left: 8, bottom: 20, right: 8)) + marker.chartView = chartView + marker.minimumSize = CGSize(width: 80, height: 40) + chartView.marker = marker + + chartView.legend.form = .line + + sliderX.value = 45 + sliderY.value = 100 + slidersValueChanged(nil) + + chartView.animate(xAxisDuration: 2.5) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value), range: UInt32(sliderY.value)) + } + + func setDataCount(_ count: Int, range: UInt32) { + let values = (0.. ChartDataEntry in + let val = Double(arc4random_uniform(range) + 3) + return ChartDataEntry(x: Double(i), y: val, icon: #imageLiteral(resourceName: "icon")) + } + + let set1 = LineChartDataSet(entries: values, label: "DataSet 1") + set1.drawIconsEnabled = false + + set1.lineDashLengths = [5, 2.5] + set1.highlightLineDashLengths = [5, 2.5] + set1.setColor(.black) + set1.setCircleColor(.black) + set1.lineWidth = 1 + set1.circleRadius = 3 + set1.drawCircleHoleEnabled = false + set1.valueFont = .systemFont(ofSize: 9) + set1.formLineDashLengths = [5, 2.5] + set1.formLineWidth = 1 + set1.formSize = 15 + + let gradientColors = [ChartColorTemplates.colorFromString("#00ff0000").cgColor, + ChartColorTemplates.colorFromString("#ffff0000").cgColor] + let gradient = CGGradient(colorsSpace: nil, colors: gradientColors as CFArray, locations: nil)! + + set1.fillAlpha = 1 + set1.fill = Fill(linearGradient: gradient, angle: 90) //.linearGradient(gradient, angle: 90) + set1.drawFilledEnabled = true + + let data = LineChartData(dataSet: set1) + + chartView.data = data + } + + override func optionTapped(_ option: Option) { + switch option { + case .toggleFilled: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.drawFilledEnabled = !set.drawFilledEnabled + } + chartView.setNeedsDisplay() + + case .toggleCircles: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.drawCirclesEnabled = !set.drawCirclesEnabled + } + chartView.setNeedsDisplay() + + case .toggleCubic: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.mode = (set.mode == .cubicBezier) ? .linear : .cubicBezier + } + chartView.setNeedsDisplay() + + case .toggleStepped: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.mode = (set.mode == .stepped) ? .linear : .stepped + } + chartView.setNeedsDisplay() + + case .toggleHorizontalCubic: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.mode = (set.mode == .cubicBezier) ? .horizontalBezier : .cubicBezier + } + chartView.setNeedsDisplay() + + default: + super.handleOption(option, forChartView: chartView) + } + } + + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/LineChart2ViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/LineChart2ViewController.swift new file mode 100644 index 00000000000..dc94f6c65ba --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/LineChart2ViewController.swift @@ -0,0 +1,200 @@ +// +// LineChart2ViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class LineChart2ViewController: DemoBaseViewController { + + @IBOutlet var chartView: LineChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Line Chart 2" + self.options = [.toggleValues, + .toggleFilled, + .toggleCircles, + .toggleCubic, + .toggleHorizontalCubic, + .toggleStepped, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleAutoScaleMinMax, + .toggleData] + + chartView.delegate = self + + chartView.chartDescription?.enabled = false + chartView.dragEnabled = true + chartView.setScaleEnabled(true) + chartView.pinchZoomEnabled = true + + let l = chartView.legend + l.form = .line + l.font = UIFont(name: "HelveticaNeue-Light", size: 11)! + l.textColor = .white + l.horizontalAlignment = .left + l.verticalAlignment = .bottom + l.orientation = .horizontal + l.drawInside = false + + let xAxis = chartView.xAxis + xAxis.labelFont = .systemFont(ofSize: 11) + xAxis.labelTextColor = .white + xAxis.drawAxisLineEnabled = false + + let leftAxis = chartView.leftAxis + leftAxis.labelTextColor = UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1) + leftAxis.axisMaximum = 200 + leftAxis.axisMinimum = 0 + leftAxis.drawGridLinesEnabled = true + leftAxis.granularityEnabled = true + + let rightAxis = chartView.rightAxis + rightAxis.labelTextColor = .red + rightAxis.axisMaximum = 900 + rightAxis.axisMinimum = -200 + rightAxis.granularityEnabled = false + + sliderX.value = 20 + sliderY.value = 30 + slidersValueChanged(nil) + + chartView.animate(xAxisDuration: 2.5) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value + 1), range: UInt32(sliderY.value)) + } + + func setDataCount(_ count: Int, range: UInt32) { + let yVals1 = (0.. ChartDataEntry in + let mult = range / 2 + let val = Double(arc4random_uniform(mult) + 50) + return ChartDataEntry(x: Double(i), y: val) + } + let yVals2 = (0.. ChartDataEntry in + let val = Double(arc4random_uniform(range) + 450) + return ChartDataEntry(x: Double(i), y: val) + } + let yVals3 = (0.. ChartDataEntry in + let val = Double(arc4random_uniform(range) + 500) + return ChartDataEntry(x: Double(i), y: val) + } + + let set1 = LineChartDataSet(entries: yVals1, label: "DataSet 1") + set1.axisDependency = .left + set1.setColor(UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)) + set1.setCircleColor(.white) + set1.lineWidth = 2 + set1.circleRadius = 3 + set1.fillAlpha = 65/255 + set1.fillColor = UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1) + set1.highlightColor = UIColor(red: 244/255, green: 117/255, blue: 117/255, alpha: 1) + set1.drawCircleHoleEnabled = false + + let set2 = LineChartDataSet(entries: yVals2, label: "DataSet 2") + set2.axisDependency = .right + set2.setColor(.red) + set2.setCircleColor(.white) + set2.lineWidth = 2 + set2.circleRadius = 3 + set2.fillAlpha = 65/255 + set2.fillColor = .red + set2.highlightColor = UIColor(red: 244/255, green: 117/255, blue: 117/255, alpha: 1) + set2.drawCircleHoleEnabled = false + + let set3 = LineChartDataSet(entries: yVals3, label: "DataSet 3") + set3.axisDependency = .right + set3.setColor(.yellow) + set3.setCircleColor(.white) + set3.lineWidth = 2 + set3.circleRadius = 3 + set3.fillAlpha = 65/255 + set3.fillColor = UIColor.yellow.withAlphaComponent(200/255) + set3.highlightColor = UIColor(red: 244/255, green: 117/255, blue: 117/255, alpha: 1) + set3.drawCircleHoleEnabled = false + + let data = LineChartData(dataSets: [set1, set2, set3]) + data.setValueTextColor(.white) + data.setValueFont(.systemFont(ofSize: 9)) + + chartView.data = data + } + + override func optionTapped(_ option: Option) { + switch option { + case .toggleFilled: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.drawFilledEnabled = !set.drawFilledEnabled + } + chartView.setNeedsDisplay() + + case .toggleCircles: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.drawCirclesEnabled = !set.drawCirclesEnabled + } + chartView.setNeedsDisplay() + + case .toggleCubic: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.mode = (set.mode == .cubicBezier) ? .linear : .cubicBezier + } + chartView.setNeedsDisplay() + + case .toggleStepped: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.mode = (set.mode == .stepped) ? .linear : .stepped + } + chartView.setNeedsDisplay() + + case .toggleHorizontalCubic: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.mode = (set.mode == .cubicBezier) ? .horizontalBezier : .cubicBezier + } + chartView.setNeedsDisplay() + + default: + super.handleOption(option, forChartView: chartView) + } + } + + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + } +//} + // TODO: Declarations in extensions cannot override yet. +//extension LineChart2ViewController { + override func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) { + super.chartValueSelected(chartView, entry: entry, highlight: highlight) + + self.chartView.centerViewToAnimated(xValue: entry.x, yValue: entry.y, + axis: self.chartView.data!.getDataSetByIndex(highlight.dataSetIndex).axisDependency, + duration: 1) + //[_chartView moveViewToAnimatedWithXValue:entry.x yValue:entry.y axis:[_chartView.data getDataSetByIndex:dataSetIndex].axisDependency duration:1.0]; + //[_chartView zoomAndCenterViewAnimatedWithScaleX:1.8 scaleY:1.8 xValue:entry.x yValue:entry.y axis:[_chartView.data getDataSetByIndex:dataSetIndex].axisDependency duration:1.0]; + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/LineChartFilledViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/LineChartFilledViewController.swift new file mode 100644 index 00000000000..7c515c352b3 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/LineChartFilledViewController.swift @@ -0,0 +1,117 @@ +// +// LineChartFilledViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class LineChartFilledViewController: DemoBaseViewController { + + @IBOutlet var chartView: LineChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Filled Line Chart" + + chartView.delegate = self + + chartView.backgroundColor = .white + chartView.gridBackgroundColor = UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 150/255) + chartView.drawGridBackgroundEnabled = true + + chartView.drawBordersEnabled = true + + chartView.chartDescription?.enabled = false + + chartView.pinchZoomEnabled = false + chartView.dragEnabled = true + chartView.setScaleEnabled(true) + + chartView.legend.enabled = false + + chartView.xAxis.enabled = false + + let leftAxis = chartView.leftAxis + leftAxis.axisMaximum = 900 + leftAxis.axisMinimum = -250 + leftAxis.drawAxisLineEnabled = false + + chartView.rightAxis.enabled = false + + sliderX.value = 100 + sliderY.value = 60 + slidersValueChanged(nil) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value), range: UInt32(sliderY.value)) + } + + func setDataCount(_ count: Int, range: UInt32) { + let yVals1 = (0.. ChartDataEntry in + let val = Double(arc4random_uniform(range) + 50) + return ChartDataEntry(x: Double(i), y: val) + } + let yVals2 = (0.. ChartDataEntry in + let val = Double(arc4random_uniform(range) + 450) + return ChartDataEntry(x: Double(i), y: val) + } + + let set1 = LineChartDataSet(entries: yVals1, label: "DataSet 1") + set1.axisDependency = .left + set1.setColor(UIColor(red: 255/255, green: 241/255, blue: 46/255, alpha: 1)) + set1.drawCirclesEnabled = false + set1.lineWidth = 2 + set1.circleRadius = 3 + set1.fillAlpha = 1 + set1.drawFilledEnabled = true + set1.fillColor = .white + set1.highlightColor = UIColor(red: 244/255, green: 117/255, blue: 117/255, alpha: 1) + set1.drawCircleHoleEnabled = false + set1.fillFormatter = DefaultFillFormatter { _,_ -> CGFloat in + return CGFloat(self.chartView.leftAxis.axisMinimum) + } + + let set2 = LineChartDataSet(entries: yVals2, label: "DataSet 2") + set2.axisDependency = .left + set2.setColor(UIColor(red: 255/255, green: 241/255, blue: 46/255, alpha: 1)) + set2.drawCirclesEnabled = false + set2.lineWidth = 2 + set2.circleRadius = 3 + set2.fillAlpha = 1 + set2.drawFilledEnabled = true + set2.fillColor = .white + set2.highlightColor = UIColor(red: 244/255, green: 117/255, blue: 117/255, alpha: 1) + set2.drawCircleHoleEnabled = false + set2.fillFormatter = DefaultFillFormatter { _,_ -> CGFloat in + return CGFloat(self.chartView.leftAxis.axisMaximum) + } + + let data = LineChartData(dataSets: [set1, set2]) + data.setDrawValues(false) + + chartView.data = data + } + + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/LineChartTimeViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/LineChartTimeViewController.swift new file mode 100644 index 00000000000..92258e15db3 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/LineChartTimeViewController.swift @@ -0,0 +1,161 @@ +// +// LineChartTimeViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class LineChartTimeViewController: DemoBaseViewController { + @IBOutlet var chartView: LineChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderTextX: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Time Line Chart" + self.options = [.toggleValues, + .toggleFilled, + .toggleCircles, + .toggleCubic, + .toggleHorizontalCubic, + .toggleStepped, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleAutoScaleMinMax, + .toggleData] + + chartView.delegate = self + + chartView.chartDescription?.enabled = false + + chartView.dragEnabled = true + chartView.setScaleEnabled(true) + chartView.pinchZoomEnabled = false + chartView.highlightPerDragEnabled = true + + chartView.backgroundColor = .white + + chartView.legend.enabled = false + + let xAxis = chartView.xAxis + xAxis.labelPosition = .topInside + xAxis.labelFont = .systemFont(ofSize: 10, weight: .light) + xAxis.labelTextColor = UIColor(red: 255/255, green: 192/255, blue: 56/255, alpha: 1) + xAxis.drawAxisLineEnabled = false + xAxis.drawGridLinesEnabled = true + xAxis.centerAxisLabelsEnabled = true + xAxis.granularity = 3600 + xAxis.valueFormatter = DateValueFormatter() + + let leftAxis = chartView.leftAxis + leftAxis.labelPosition = .insideChart + leftAxis.labelFont = .systemFont(ofSize: 12, weight: .light) + leftAxis.drawGridLinesEnabled = true + leftAxis.granularityEnabled = true + leftAxis.axisMinimum = 0 + leftAxis.axisMaximum = 170 + leftAxis.yOffset = -9 + leftAxis.labelTextColor = UIColor(red: 255/255, green: 192/255, blue: 56/255, alpha: 1) + + + chartView.rightAxis.enabled = false + + chartView.legend.form = .line + + sliderX.value = 100 + slidersValueChanged(nil) + + chartView.animate(xAxisDuration: 2.5) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value), range: 30) + } + + func setDataCount(_ count: Int, range: UInt32) { + let now = Date().timeIntervalSince1970 + let hourSeconds: TimeInterval = 3600 + + let from = now - (Double(count) / 2) * hourSeconds + let to = now + (Double(count) / 2) * hourSeconds + + let values = stride(from: from, to: to, by: hourSeconds).map { (x) -> ChartDataEntry in + let y = arc4random_uniform(range) + 50 + return ChartDataEntry(x: x, y: Double(y)) + } + + let set1 = LineChartDataSet(entries: values, label: "DataSet 1") + set1.axisDependency = .left + set1.setColor(UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)) + set1.lineWidth = 1.5 + set1.drawCirclesEnabled = false + set1.drawValuesEnabled = false + set1.fillAlpha = 0.26 + set1.fillColor = UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1) + set1.highlightColor = UIColor(red: 244/255, green: 117/255, blue: 117/255, alpha: 1) + set1.drawCircleHoleEnabled = false + + let data = LineChartData(dataSet: set1) + data.setValueTextColor(.white) + data.setValueFont(.systemFont(ofSize: 9, weight: .light)) + + chartView.data = data + } + + override func optionTapped(_ option: Option) { + switch option { + case .toggleFilled: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.drawFilledEnabled = !set.drawFilledEnabled + } + chartView.setNeedsDisplay() + + case .toggleCircles: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.drawCirclesEnabled = !set.drawCirclesEnabled + } + chartView.setNeedsDisplay() + + case .toggleCubic: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.mode = (set.mode == .cubicBezier) ? .linear : .cubicBezier + } + chartView.setNeedsDisplay() + + case .toggleStepped: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.mode = (set.mode == .stepped) ? .linear : .stepped + } + chartView.setNeedsDisplay() + + case .toggleHorizontalCubic: + for set in chartView.data!.dataSets as! [LineChartDataSet] { + set.mode = (set.mode == .cubicBezier) ? .horizontalBezier : .cubicBezier + } + chartView.setNeedsDisplay() + + default: + super.handleOption(option, forChartView: chartView) + } + } + + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + self.updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/MultipleBarChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/MultipleBarChartViewController.swift new file mode 100644 index 00000000000..26d806d5e2c --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/MultipleBarChartViewController.swift @@ -0,0 +1,154 @@ +// +// MultipleBarChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class MultipleBarChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: BarChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Multiple Bar Chart" + + self.options = [.toggleValues, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleAutoScaleMinMax, + .toggleData, + .toggleBarBorders] + + chartView.delegate = self + + chartView.chartDescription?.enabled = false + + chartView.pinchZoomEnabled = false + chartView.drawBarShadowEnabled = false + + let marker = BalloonMarker(color: UIColor(white: 180/255, alpha: 1), font: .systemFont(ofSize: 12), textColor: .white, insets: UIEdgeInsets(top: 8, left: 8, bottom: 20, right: 8)) + marker.chartView = chartView + marker.minimumSize = CGSize(width: 80, height: 40) + chartView.marker = marker + + let l = chartView.legend + l.horizontalAlignment = .right + l.verticalAlignment = .top + l.orientation = .vertical + l.drawInside = true + l.font = .systemFont(ofSize: 8, weight: .light) + l.yOffset = 10 + l.xOffset = 10 + l.yEntrySpace = 0 +// chartView.legend = l + + let xAxis = chartView.xAxis + xAxis.labelFont = .systemFont(ofSize: 10, weight: .light) + xAxis.granularity = 1 + xAxis.centerAxisLabelsEnabled = true + xAxis.valueFormatter = IntAxisValueFormatter() + + let leftAxisFormatter = NumberFormatter() + leftAxisFormatter.maximumFractionDigits = 1 + + let leftAxis = chartView.leftAxis + leftAxis.labelFont = .systemFont(ofSize: 10, weight: .light) + leftAxis.valueFormatter = LargeValueFormatter() + leftAxis.spaceTop = 0.35 + leftAxis.axisMinimum = 0 + + chartView.rightAxis.enabled = false + + sliderX.value = 10 + sliderY.value = 100 + slidersValueChanged(nil) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value), range: UInt32(sliderY.value)) + } + + func setDataCount(_ count: Int, range: UInt32) { + let groupSpace = 0.08 + let barSpace = 0.03 + let barWidth = 0.2 + // (0.2 + 0.03) * 4 + 0.08 = 1.00 -> interval per "group" + + let randomMultiplier = range * 100000 + let groupCount = count + 1 + let startYear = 1980 + let endYear = startYear + groupCount + + let block: (Int) -> BarChartDataEntry = { (i) -> BarChartDataEntry in + return BarChartDataEntry(x: Double(i), y: Double(arc4random_uniform(randomMultiplier))) + } + let yVals1 = (startYear ..< endYear).map(block) + let yVals2 = (startYear ..< endYear).map(block) + let yVals3 = (startYear ..< endYear).map(block) + let yVals4 = (startYear ..< endYear).map(block) + + let set1 = BarChartDataSet(entries: yVals1, label: "Company A") + set1.setColor(UIColor(red: 104/255, green: 241/255, blue: 175/255, alpha: 1)) + + let set2 = BarChartDataSet(entries: yVals2, label: "Company B") + set2.setColor(UIColor(red: 164/255, green: 228/255, blue: 251/255, alpha: 1)) + + let set3 = BarChartDataSet(entries: yVals3, label: "Company C") + set3.setColor(UIColor(red: 242/255, green: 247/255, blue: 158/255, alpha: 1)) + + let set4 = BarChartDataSet(entries: yVals4, label: "Company D") + set4.setColor(UIColor(red: 255/255, green: 102/255, blue: 0/255, alpha: 1)) + + let data = BarChartData(dataSets: [set1, set2, set3, set4]) + data.setValueFont(.systemFont(ofSize: 10, weight: .light)) + data.setValueFormatter(LargeValueFormatter()) + + // specify the width each bar should have + data.barWidth = barWidth + + // restrict the x-axis range + chartView.xAxis.axisMinimum = Double(startYear) + + // groupWidthWithGroupSpace(...) is a helper that calculates the width each group needs based on the provided parameters + chartView.xAxis.axisMaximum = Double(startYear) + data.groupWidth(groupSpace: groupSpace, barSpace: barSpace) * Double(groupCount) + + data.groupBars(fromX: Double(startYear), groupSpace: groupSpace, barSpace: barSpace) + + chartView.data = data + } + + override func optionTapped(_ option: Option) { + super.handleOption(option, forChartView: chartView) + } + + // MARK: - Actions + @IBAction func slidersValueChanged(_ sender: Any?) { + let startYear = 1980 + let endYear = startYear + Int(sliderX.value) + + sliderTextX.text = "\(startYear)-\(endYear)" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/MultipleLinesChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/MultipleLinesChartViewController.swift new file mode 100644 index 00000000000..78a969c698e --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/MultipleLinesChartViewController.swift @@ -0,0 +1,138 @@ +// +// MultipleLinesChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class MultipleLinesChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: LineChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Multiple Lines Chart" + self.options = [.toggleValues, + .toggleFilled, + .toggleCircles, + .toggleCubic, + .toggleStepped, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleAutoScaleMinMax, + .toggleData] + + chartView.delegate = self + + chartView.chartDescription?.enabled = false + + chartView.leftAxis.enabled = false + chartView.rightAxis.drawAxisLineEnabled = false + chartView.xAxis.drawAxisLineEnabled = false + + chartView.drawBordersEnabled = false + chartView.setScaleEnabled(true) + + let l = chartView.legend + l.horizontalAlignment = .right + l.verticalAlignment = .top + l.orientation = .vertical + l.drawInside = false +// chartView.legend = l + + sliderX.value = 20 + sliderY.value = 100 + slidersValueChanged(nil) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value), range: UInt32(sliderY.value)) + } + + // TODO: Refine data creation + func setDataCount(_ count: Int, range: UInt32) { + let colors = ChartColorTemplates.vordiplom()[0...2] + + let block: (Int) -> ChartDataEntry = { (i) -> ChartDataEntry in + let val = Double(arc4random_uniform(range) + 3) + return ChartDataEntry(x: Double(i), y: val) + } + let dataSets = (0..<3).map { i -> LineChartDataSet in + let yVals = (0.. String { + return String(format: "%03.0f-%03.0f", value, value + 10) + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/PieChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/PieChartViewController.swift new file mode 100644 index 00000000000..e42982bc76d --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/PieChartViewController.swift @@ -0,0 +1,153 @@ +// +// PieChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class PieChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: PieChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Pie Chart" + + self.options = [.toggleValues, + .toggleXValues, + .togglePercent, + .toggleHole, + .toggleIcons, + .animateX, + .animateY, + .animateXY, + .spin, + .drawCenter, + .saveToGallery, + .toggleData] + + self.setup(pieChartView: chartView) + + chartView.delegate = self + + let l = chartView.legend + l.horizontalAlignment = .right + l.verticalAlignment = .top + l.orientation = .vertical + l.xEntrySpace = 7 + l.yEntrySpace = 0 + l.yOffset = 0 +// chartView.legend = l + + // entry label styling + chartView.entryLabelColor = .white + chartView.entryLabelFont = .systemFont(ofSize: 12, weight: .light) + + sliderX.value = 4 + sliderY.value = 100 + self.slidersValueChanged(nil) + + chartView.animate(xAxisDuration: 1.4, easingOption: .easeOutBack) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value), range: UInt32(sliderY.value)) + } + + func setDataCount(_ count: Int, range: UInt32) { + let entries = (0.. PieChartDataEntry in + // IMPORTANT: In a PieChart, no values (Entry) should have the same xIndex (even if from different DataSets), since no values can be drawn above each other. + return PieChartDataEntry(value: Double(arc4random_uniform(range) + range / 5), + label: parties[i % parties.count], + icon: #imageLiteral(resourceName: "icon")) + } + + let set = PieChartDataSet(entries: entries, label: "Election Results") + set.drawIconsEnabled = false + set.sliceSpace = 2 + + + set.colors = ChartColorTemplates.vordiplom() + + ChartColorTemplates.joyful() + + ChartColorTemplates.colorful() + + ChartColorTemplates.liberty() + + ChartColorTemplates.pastel() + + [UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)] + + let data = PieChartData(dataSet: set) + + let pFormatter = NumberFormatter() + pFormatter.numberStyle = .percent + pFormatter.maximumFractionDigits = 1 + pFormatter.multiplier = 1 + pFormatter.percentSymbol = " %" + data.setValueFormatter(DefaultValueFormatter(formatter: pFormatter)) + + data.setValueFont(.systemFont(ofSize: 11, weight: .light)) + data.setValueTextColor(.white) + + chartView.data = data + chartView.highlightValues(nil) + } + + override func optionTapped(_ option: Option) { + switch option { + case .toggleXValues: + chartView.drawEntryLabelsEnabled = !chartView.drawEntryLabelsEnabled + chartView.setNeedsDisplay() + + case .togglePercent: + chartView.usePercentValuesEnabled = !chartView.usePercentValuesEnabled + chartView.setNeedsDisplay() + + case .toggleHole: + chartView.drawHoleEnabled = !chartView.drawHoleEnabled + chartView.setNeedsDisplay() + + case .drawCenter: + chartView.drawCenterTextEnabled = !chartView.drawCenterTextEnabled + chartView.setNeedsDisplay() + + case .animateX: + chartView.animate(xAxisDuration: 1.4) + + case .animateY: + chartView.animate(yAxisDuration: 1.4) + + case .animateXY: + chartView.animate(xAxisDuration: 1.4, yAxisDuration: 1.4) + + case .spin: + chartView.spin(duration: 2, + fromAngle: chartView.rotationAngle, + toAngle: chartView.rotationAngle + 360, + easingOption: .easeInCubic) + + default: + handleOption(option, forChartView: chartView) + } + } + + // MARK: - Actions + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/PiePolylineChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/PiePolylineChartViewController.swift new file mode 100644 index 00000000000..a25000739b6 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/PiePolylineChartViewController.swift @@ -0,0 +1,145 @@ +// +// PiePolylineChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class PiePolylineChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: PieChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Pie Poly Line Chart" + + self.options = [.toggleValues, + .toggleXValues, + .togglePercent, + .toggleHole, + .animateX, + .animateY, + .animateXY, + .spin, + .drawCenter, + .saveToGallery, + .toggleData] + + self.setup(pieChartView: chartView) + + chartView.delegate = self + + chartView.legend.enabled = false + chartView.setExtraOffsets(left: 20, top: 0, right: 20, bottom: 0) + + sliderX.value = 40 + sliderY.value = 100 + self.slidersValueChanged(nil) + + chartView.animate(xAxisDuration: 1.4, easingOption: .easeOutBack) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value), range: UInt32(sliderY.value)) + } + + func setDataCount(_ count: Int, range: UInt32) { + let entries = (0.. PieChartDataEntry in + // IMPORTANT: In a PieChart, no values (Entry) should have the same xIndex (even if from different DataSets), since no values can be drawn above each other. + return PieChartDataEntry(value: Double(arc4random_uniform(range) + range / 5), + label: parties[i % parties.count]) + } + + let set = PieChartDataSet(entries: entries, label: "Election Results") + set.sliceSpace = 2 + + + set.colors = ChartColorTemplates.vordiplom() + + ChartColorTemplates.joyful() + + ChartColorTemplates.colorful() + + ChartColorTemplates.liberty() + + ChartColorTemplates.pastel() + + [UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)] + + set.valueLinePart1OffsetPercentage = 0.8 + set.valueLinePart1Length = 0.2 + set.valueLinePart2Length = 0.4 + //set.xValuePosition = .outsideSlice + set.yValuePosition = .outsideSlice + + let data = PieChartData(dataSet: set) + + let pFormatter = NumberFormatter() + pFormatter.numberStyle = .percent + pFormatter.maximumFractionDigits = 1 + pFormatter.multiplier = 1 + pFormatter.percentSymbol = " %" + data.setValueFormatter(DefaultValueFormatter(formatter: pFormatter)) + data.setValueFont(.systemFont(ofSize: 11, weight: .light)) + data.setValueTextColor(.black) + + chartView.data = data + chartView.highlightValues(nil) + } + + override func optionTapped(_ option: Option) { + switch option { + case .toggleXValues: + chartView.drawEntryLabelsEnabled = !chartView.drawEntryLabelsEnabled + chartView.setNeedsDisplay() + + case .togglePercent: + chartView.usePercentValuesEnabled = !chartView.usePercentValuesEnabled + chartView.setNeedsDisplay() + + case .toggleHole: + chartView.drawHoleEnabled = !chartView.drawHoleEnabled + chartView.setNeedsDisplay() + + case .drawCenter: + chartView.drawCenterTextEnabled = !chartView.drawCenterTextEnabled + chartView.setNeedsDisplay() + + case .animateX: + chartView.animate(xAxisDuration: 1.4) + + case .animateY: + chartView.animate(yAxisDuration: 1.4) + + case .animateXY: + chartView.animate(xAxisDuration: 1.4, yAxisDuration: 1.4) + + case .spin: + chartView.spin(duration: 2, + fromAngle: chartView.rotationAngle, + toAngle: chartView.rotationAngle + 360, + easingOption: .easeInCubic) + + default: + handleOption(option, forChartView: chartView) + } + } + + // MARK: - Actions + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/PositiveNegativeBarChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/PositiveNegativeBarChartViewController.swift new file mode 100644 index 00000000000..ded4a0a31e1 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/PositiveNegativeBarChartViewController.swift @@ -0,0 +1,120 @@ +// +// PositiveNegativeBarChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class PositiveNegativeBarChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: BarChartView! + + let dataLabels = ["12-19", + "12-30", + "12-31", + "01-01", + "01-02"] + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Positive/Negative Bar Chart" + self.options = [.toggleValues, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleAutoScaleMinMax, + .toggleData, + .toggleBarBorders] + + self.setup(barLineChartView: chartView) + + chartView.delegate = self + + chartView.setExtraOffsets(left: 70, top: -30, right: 70, bottom: 10) + + chartView.drawBarShadowEnabled = false + chartView.drawValueAboveBarEnabled = true + + chartView.chartDescription?.enabled = false + + chartView.rightAxis.enabled = false + + let xAxis = chartView.xAxis + xAxis.labelPosition = .bottom + xAxis.labelFont = .systemFont(ofSize: 13) + xAxis.drawAxisLineEnabled = false + xAxis.labelTextColor = .lightGray + xAxis.labelCount = 5 + xAxis.centerAxisLabelsEnabled = true + xAxis.granularity = 1 + xAxis.valueFormatter = self + + let leftAxis = chartView.leftAxis + leftAxis.drawLabelsEnabled = false + leftAxis.spaceTop = 0.25 + leftAxis.spaceBottom = 0.25 + leftAxis.drawAxisLineEnabled = false + leftAxis.drawZeroLineEnabled = true + leftAxis.zeroLineColor = .gray + leftAxis.zeroLineWidth = 0.7 + + self.updateChartData() + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setChartData() + } + + func setChartData() { + let yVals = [BarChartDataEntry(x: 0, y: -224.1), + BarChartDataEntry(x: 1, y: 238.5), + BarChartDataEntry(x: 2, y: 1280.1), + BarChartDataEntry(x: 3, y: -442.3), + BarChartDataEntry(x: 4, y: -2280.1) + ] + + let red = UIColor(red: 211/255, green: 74/255, blue: 88/255, alpha: 1) + let green = UIColor(red: 110/255, green: 190/255, blue: 102/255, alpha: 1) + let colors = yVals.map { (entry) -> NSUIColor in + return entry.y > 0 ? red : green + } + + let set = BarChartDataSet(entries: yVals, label: "Values") + set.colors = colors + set.valueColors = colors + + let data = BarChartData(dataSet: set) + data.setValueFont(.systemFont(ofSize: 13)) + + let formatter = NumberFormatter() + formatter.maximumFractionDigits = 1 + data.setValueFormatter(DefaultValueFormatter(formatter: formatter)) + data.barWidth = 0.8 + + chartView.data = data + } + + override func optionTapped(_ option: Option) { + super.handleOption(option, forChartView: chartView) + } +} + +extension PositiveNegativeBarChartViewController: IAxisValueFormatter { + func stringForValue(_ value: Double, axis: AxisBase?) -> String { + return dataLabels[min(max(Int(value), 0), dataLabels.count - 1)] + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/RadarChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/RadarChartViewController.swift new file mode 100644 index 00000000000..c46736f98d3 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/RadarChartViewController.swift @@ -0,0 +1,203 @@ +// +// RadarChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class RadarChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: RadarChartView! + + let activities = ["Burger", "Steak", "Salad", "Pasta", "Pizza"] + var originalBarBgColor: UIColor! + var originalBarTintColor: UIColor! + var originalBarStyle: UIBarStyle! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Radar Chart" + self.options = [.toggleValues, + .toggleHighlight, + .toggleHighlightCircle, + .toggleXLabels, + .toggleYLabels, + .toggleRotate, + .toggleFilled, + .animateX, + .animateY, + .animateXY, + .spin, + .saveToGallery, + .toggleData] + + chartView.delegate = self + + chartView.chartDescription?.enabled = false + chartView.webLineWidth = 1 + chartView.innerWebLineWidth = 1 + chartView.webColor = .lightGray + chartView.innerWebColor = .lightGray + chartView.webAlpha = 1 + + let marker = RadarMarkerView.viewFromXib()! + marker.chartView = chartView + chartView.marker = marker + + let xAxis = chartView.xAxis + xAxis.labelFont = .systemFont(ofSize: 9, weight: .light) + xAxis.xOffset = 0 + xAxis.yOffset = 0 + xAxis.valueFormatter = self + xAxis.labelTextColor = .white + + let yAxis = chartView.yAxis + yAxis.labelFont = .systemFont(ofSize: 9, weight: .light) + yAxis.labelCount = 5 + yAxis.axisMinimum = 0 + yAxis.axisMaximum = 80 + yAxis.drawLabelsEnabled = false + + let l = chartView.legend + l.horizontalAlignment = .center + l.verticalAlignment = .top + l.orientation = .horizontal + l.drawInside = false + l.font = .systemFont(ofSize: 10, weight: .light) + l.xEntrySpace = 7 + l.yEntrySpace = 5 + l.textColor = .white +// chartView.legend = l + + self.updateChartData() + + chartView.animate(xAxisDuration: 1.4, yAxisDuration: 1.4, easingOption: .easeOutBack) + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + UIView.animate(withDuration: 0.15) { + let navBar = self.navigationController!.navigationBar + self.originalBarBgColor = navBar.barTintColor + self.originalBarTintColor = navBar.tintColor + self.originalBarStyle = navBar.barStyle + + navBar.barTintColor = self.view.backgroundColor + navBar.tintColor = .white + navBar.barStyle = .black + } + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + + UIView.animate(withDuration: 0.15) { + let navBar = self.navigationController!.navigationBar + navBar.barTintColor = self.originalBarBgColor + navBar.tintColor = self.originalBarTintColor + navBar.barStyle = self.originalBarStyle + } + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setChartData() + } + + func setChartData() { + let mult: UInt32 = 80 + let min: UInt32 = 20 + let cnt = 5 + + let block: (Int) -> RadarChartDataEntry = { _ in return RadarChartDataEntry(value: Double(arc4random_uniform(mult) + min))} + let entries1 = (0.. String { + return activities[Int(value) % activities.count] + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/ScatterChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/ScatterChartViewController.swift new file mode 100644 index 00000000000..1e4a6fb741f --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/ScatterChartViewController.swift @@ -0,0 +1,124 @@ +// +// ScatterChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class ScatterChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: ScatterChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderY: UISlider! + @IBOutlet var sliderTextX: UITextField! + @IBOutlet var sliderTextY: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Scatter Chart" + self.options = [.toggleValues, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleAutoScaleMinMax, + .toggleData] + + chartView.delegate = self + + chartView.chartDescription?.enabled = false + + chartView.dragEnabled = true + chartView.setScaleEnabled(true) + chartView.maxVisibleCount = 200 + chartView.pinchZoomEnabled = true + + let l = chartView.legend + l.horizontalAlignment = .right + l.verticalAlignment = .top + l.orientation = .vertical + l.drawInside = false + l.font = .systemFont(ofSize: 10, weight: .light) + l.xOffset = 5 + + let leftAxis = chartView.leftAxis + leftAxis.labelFont = .systemFont(ofSize: 10, weight: .light) + leftAxis.axisMinimum = 0 + + chartView.rightAxis.enabled = false + + + let xAxis = chartView.xAxis + xAxis.labelFont = .systemFont(ofSize: 10, weight: .light) + + sliderX.value = 45 + sliderY.value = 100 + slidersValueChanged(nil) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value + 1), range: UInt32(sliderY.value)) + } + + func setDataCount(_ count: Int, range: UInt32) { + let values1 = (0.. ChartDataEntry in + let val = Double(arc4random_uniform(range) + 3) + return ChartDataEntry(x: Double(i), y: val) + } + let values2 = (0.. ChartDataEntry in + let val = Double(arc4random_uniform(range) + 3) + return ChartDataEntry(x: Double(i) + 0.33, y: val) + } + let values3 = (0.. ChartDataEntry in + let val = Double(arc4random_uniform(range) + 3) + return ChartDataEntry(x: Double(i) + 0.66, y: val) + } + + + let set1 = ScatterChartDataSet(entries: values1, label: "DS 1") + set1.setScatterShape(.square) + set1.setColor(ChartColorTemplates.colorful()[0]) + set1.scatterShapeSize = 8 + + let set2 = ScatterChartDataSet(entries: values2, label: "DS 2") + set2.setScatterShape(.circle) + set2.scatterShapeHoleColor = ChartColorTemplates.colorful()[3] + set2.scatterShapeHoleRadius = 3.5 + set2.setColor(ChartColorTemplates.colorful()[1]) + set2.scatterShapeSize = 8 + + let set3 = ScatterChartDataSet(entries: values3, label: "DS 3") + set3.setScatterShape(.cross) + set3.setColor(ChartColorTemplates.colorful()[2]) + set3.scatterShapeSize = 8 + + let data = ScatterChartData(dataSets: [set1, set2, set3]) + data.setValueFont(.systemFont(ofSize: 7, weight: .light)) + + chartView.data = data + } + + override func optionTapped(_ option: Option) { + super.handleOption(option, forChartView: chartView) + } + + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + sliderTextY.text = "\(Int(sliderY.value))" + + self.updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/SinusBarChartViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/SinusBarChartViewController.swift new file mode 100644 index 00000000000..28359e03017 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Demos/SinusBarChartViewController.swift @@ -0,0 +1,108 @@ +// +// SinusBarChartViewController.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import UIKit +import Charts + +class SinusBarChartViewController: DemoBaseViewController { + + @IBOutlet var chartView: BarChartView! + @IBOutlet var sliderX: UISlider! + @IBOutlet var sliderTextX: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + self.title = "Sinus Bar Chart" + self.options = [.toggleValues, + .toggleHighlight, + .animateX, + .animateY, + .animateXY, + .saveToGallery, + .togglePinchZoom, + .toggleAutoScaleMinMax, + .toggleData] + + chartView.delegate = self + + chartView.chartDescription?.enabled = false + + chartView.drawBarShadowEnabled = false + chartView.drawValueAboveBarEnabled = false + chartView.maxVisibleCount = 60 + + let xAxis = chartView.xAxis + xAxis.labelPosition = .bottom + xAxis.enabled = false + + let leftAxis = chartView.leftAxis + leftAxis.labelCount = 6 + leftAxis.axisMinimum = -2.5 + leftAxis.axisMaximum = 2.5 + leftAxis.granularityEnabled = true + leftAxis.granularity = 0.1 + + let rightAxis = chartView.rightAxis + rightAxis.labelCount = 6 + rightAxis.axisMinimum = -2.5 + rightAxis.axisMaximum = 2.5 + rightAxis.granularity = 0.1 + + let l = chartView.legend + l.horizontalAlignment = .left + l.verticalAlignment = .bottom + l.orientation = .horizontal + l.drawInside = false + l.form = .square + l.formSize = 9 + l.font = .systemFont(ofSize: 11) + l.xEntrySpace = 4 +// chartView.legend = l + + sliderX.value = 150 + slidersValueChanged(nil) + + chartView.animate(xAxisDuration: 2, yAxisDuration: 2) + } + + override func updateChartData() { + if self.shouldHideData { + chartView.data = nil + return + } + + self.setDataCount(Int(sliderX.value)) + } + + func setDataCount(_ count: Int) { + let entries = (0.. BarChartDataEntry in + let mult = range + 1 + let val1 = Double(arc4random_uniform(mult) + mult / 3) + let val2 = Double(arc4random_uniform(mult) + mult / 3) + let val3 = Double(arc4random_uniform(mult) + mult / 3) + + return BarChartDataEntry(x: Double(i), yValues: [val1, val2, val3], icon: #imageLiteral(resourceName: "icon")) + } + + let set = BarChartDataSet(entries: yVals, label: "Statistics Vienna 2014") + set.drawIconsEnabled = false + set.colors = [ChartColorTemplates.material()[0], ChartColorTemplates.material()[1], ChartColorTemplates.material()[2]] + set.stackLabels = ["Births", "Divorces", "Marriages"] + + let data = BarChartData(dataSet: set) + data.setValueFont(.systemFont(ofSize: 7, weight: .light)) + data.setValueFormatter(DefaultValueFormatter(formatter: formatter)) + data.setValueTextColor(.white) + + chartView.fitBars = true + chartView.data = data + } + + override func optionTapped(_ option: Option) { + super.handleOption(option, forChartView: chartView) + } + + @IBAction func slidersValueChanged(_ sender: Any?) { + sliderTextX.text = "\(Int(sliderX.value))" + sliderTextY.text = "\(Int(sliderY.value))" + + updateChartData() + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Formatters/DateValueFormatter.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Formatters/DateValueFormatter.swift new file mode 100644 index 00000000000..2962a6852aa --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Formatters/DateValueFormatter.swift @@ -0,0 +1,23 @@ +// +// DateValueFormatter.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import Foundation +import Charts + +public class DateValueFormatter: NSObject, IAxisValueFormatter { + private let dateFormatter = DateFormatter() + + override init() { + super.init() + dateFormatter.dateFormat = "dd MMM HH:mm" + } + + public func stringForValue(_ value: Double, axis: AxisBase?) -> String { + return dateFormatter.string(from: Date(timeIntervalSince1970: value)) + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Formatters/DayAxisValueFormatter.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Formatters/DayAxisValueFormatter.swift new file mode 100644 index 00000000000..245a25c83e5 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Formatters/DayAxisValueFormatter.swift @@ -0,0 +1,109 @@ +// +// DayAxisValueFormatter.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import Foundation +import Charts + +public class DayAxisValueFormatter: NSObject, IAxisValueFormatter { + weak var chart: BarLineChartViewBase? + let months = ["Jan", "Feb", "Mar", + "Apr", "May", "Jun", + "Jul", "Aug", "Sep", + "Oct", "Nov", "Dec"] + + init(chart: BarLineChartViewBase) { + self.chart = chart + } + + public func stringForValue(_ value: Double, axis: AxisBase?) -> String { + let days = Int(value) + let year = determineYear(forDays: days) + let month = determineMonth(forDayOfYear: days) + + let monthName = months[month % months.count] + let yearName = "\(year)" + + if let chart = chart, + chart.visibleXRange > 30 * 6 { + return monthName + yearName + } else { + let dayOfMonth = determineDayOfMonth(forDays: days, month: month + 12 * (year - 2016)) + var appendix: String + + switch dayOfMonth { + case 1, 21, 31: appendix = "st" + case 2, 22: appendix = "nd" + case 3, 23: appendix = "rd" + default: appendix = "th" + } + + return dayOfMonth == 0 ? "" : String(format: "%d\(appendix) \(monthName)", dayOfMonth) + } + } + + private func days(forMonth month: Int, year: Int) -> Int { + // month is 0-based + switch month { + case 1: + var is29Feb = false + if year < 1582 { + is29Feb = (year < 1 ? year + 1 : year) % 4 == 0 + } else if year > 1582 { + is29Feb = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0) + } + + return is29Feb ? 29 : 28 + + case 3, 5, 8, 10: + return 30 + + default: + return 31 + } + } + + private func determineMonth(forDayOfYear dayOfYear: Int) -> Int { + var month = -1 + var days = 0 + + while days < dayOfYear { + month += 1 + if month >= 12 { + month = 0 + } + + let year = determineYear(forDays: days) + days += self.days(forMonth: month, year: year) + } + + return max(month, 0) + } + + private func determineDayOfMonth(forDays days: Int, month: Int) -> Int { + var count = 0 + var daysForMonth = 0 + + while count < month { + let year = determineYear(forDays: days) + daysForMonth += self.days(forMonth: count % 12, year: year) + count += 1 + } + + return days - daysForMonth + } + + private func determineYear(forDays days: Int) -> Int { + switch days { + case ...366: return 2016 + case 367...730: return 2017 + case 731...1094: return 2018 + case 1095...1458: return 2019 + default: return 2020 + } + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Formatters/IntAxisValueFormatter.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Formatters/IntAxisValueFormatter.swift new file mode 100644 index 00000000000..bd3062a1904 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Formatters/IntAxisValueFormatter.swift @@ -0,0 +1,16 @@ +// +// IntAxisValueFormatter.swift +// ChartsDemo-iOS +// +// Created by Jacob Christie on 2017-07-09. +// Copyright © 2017 jc. All rights reserved. +// + +import Foundation +import Charts + +public class IntAxisValueFormatter: NSObject, IAxisValueFormatter { + public func stringForValue(_ value: Double, axis: AxisBase?) -> String { + return "\(Int(value))" + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Formatters/LargeValueFormatter.swift b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Formatters/LargeValueFormatter.swift new file mode 100644 index 00000000000..c95ca034a6d --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/Swift/Formatters/LargeValueFormatter.swift @@ -0,0 +1,58 @@ +// +// LargeValueFormatter.swift +// ChartsDemo +// Copyright © 2016 dcg. All rights reserved. +// + +import Foundation +import Charts + +private let MAX_LENGTH = 5 + +@objc protocol Testing123 { } + +public class LargeValueFormatter: NSObject, IValueFormatter, IAxisValueFormatter { + + /// Suffix to be appended after the values. + /// + /// **default**: suffix: ["", "k", "m", "b", "t"] + public var suffix = ["", "k", "m", "b", "t"] + + /// An appendix text to be added at the end of the formatted value. + public var appendix: String? + + public init(appendix: String? = nil) { + self.appendix = appendix + } + + fileprivate func format(value: Double) -> String { + var sig = value + var length = 0 + let maxLength = suffix.count - 1 + + while sig >= 1000.0 && length < maxLength { + sig /= 1000.0 + length += 1 + } + + var r = String(format: "%2.f", sig) + suffix[length] + + if let appendix = appendix { + r += appendix + } + + return r + } + + public func stringForValue(_ value: Double, axis: AxisBase?) -> String { + return format(value: value) + } + + public func stringForValue( + _ value: Double, + entry: ChartDataEntry, + dataSetIndex: Int, + viewPortHandler: ViewPortHandler?) -> String { + return format(value: value) + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/DemoListViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/DemoListViewController.xib new file mode 100644 index 00000000000..651bae9f4c1 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/DemoListViewController.xib @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/AnotherBarChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/AnotherBarChartViewController.xib new file mode 100644 index 00000000000..571312c92c2 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/AnotherBarChartViewController.xib @@ -0,0 +1,101 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/BarChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/BarChartViewController.xib new file mode 100644 index 00000000000..85dbdc83711 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/BarChartViewController.xib @@ -0,0 +1,101 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/BubbleChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/BubbleChartViewController.xib new file mode 100644 index 00000000000..03af8863396 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/BubbleChartViewController.xib @@ -0,0 +1,101 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/CandleStickChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/CandleStickChartViewController.xib new file mode 100644 index 00000000000..460c052371b --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/CandleStickChartViewController.xib @@ -0,0 +1,101 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/ColoredLineChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/ColoredLineChartViewController.xib new file mode 100644 index 00000000000..ef099b9fd93 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/ColoredLineChartViewController.xib @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/CombinedChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/CombinedChartViewController.xib new file mode 100644 index 00000000000..82fe07e540b --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/CombinedChartViewController.xib @@ -0,0 +1,57 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/CubicLineChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/CubicLineChartViewController.xib new file mode 100644 index 00000000000..007e470e21d --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/CubicLineChartViewController.xib @@ -0,0 +1,101 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/HalfPieChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/HalfPieChartViewController.xib new file mode 100644 index 00000000000..cdcf1ffe657 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/HalfPieChartViewController.xib @@ -0,0 +1,57 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/HorizontalBarChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/HorizontalBarChartViewController.xib new file mode 100644 index 00000000000..7ea8e71202d --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/HorizontalBarChartViewController.xib @@ -0,0 +1,101 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/LineChart1ViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/LineChart1ViewController.xib new file mode 100644 index 00000000000..9902b5b27dd --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/LineChart1ViewController.xib @@ -0,0 +1,101 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/LineChart2ViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/LineChart2ViewController.xib new file mode 100644 index 00000000000..c1c730e97b6 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/LineChart2ViewController.xib @@ -0,0 +1,101 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/LineChartFilledViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/LineChartFilledViewController.xib new file mode 100644 index 00000000000..62bf7015e64 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/LineChartFilledViewController.xib @@ -0,0 +1,88 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/LineChartTimeViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/LineChartTimeViewController.xib new file mode 100644 index 00000000000..d13233af3f3 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/LineChartTimeViewController.xib @@ -0,0 +1,79 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/MultipleBarChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/MultipleBarChartViewController.xib new file mode 100644 index 00000000000..9ee6745abce --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/MultipleBarChartViewController.xib @@ -0,0 +1,100 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/MultipleLinesChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/MultipleLinesChartViewController.xib new file mode 100644 index 00000000000..c9595f1dc4c --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/MultipleLinesChartViewController.xib @@ -0,0 +1,101 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/NegativeStackedBarChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/NegativeStackedBarChartViewController.xib new file mode 100644 index 00000000000..ac24e0d3c96 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/NegativeStackedBarChartViewController.xib @@ -0,0 +1,57 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/PieChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/PieChartViewController.xib new file mode 100644 index 00000000000..39cce57ef35 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/PieChartViewController.xib @@ -0,0 +1,101 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/PiePolylineChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/PiePolylineChartViewController.xib new file mode 100644 index 00000000000..c0bc4dbb86e --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/PiePolylineChartViewController.xib @@ -0,0 +1,115 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/PositiveNegativeBarChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/PositiveNegativeBarChartViewController.xib new file mode 100644 index 00000000000..365f7f63375 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/PositiveNegativeBarChartViewController.xib @@ -0,0 +1,57 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/RadarChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/RadarChartViewController.xib new file mode 100644 index 00000000000..3e45cbe67dd --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/RadarChartViewController.xib @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/RealmDemosViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/RealmDemosViewController.xib new file mode 100644 index 00000000000..9e6861347a4 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/RealmDemosViewController.xib @@ -0,0 +1,49 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + Realm demos are now part of the separate ChartsRealm repo. + +Please go to https://github.com/danielgindi/ChartsRealm and follow the instructions there. + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/ScatterChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/ScatterChartViewController.xib new file mode 100644 index 00000000000..926e15c0df2 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/ScatterChartViewController.xib @@ -0,0 +1,101 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/SinusBarChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/SinusBarChartViewController.xib new file mode 100644 index 00000000000..e2c84ecf6f5 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/SinusBarChartViewController.xib @@ -0,0 +1,79 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/StackedBarChartViewController.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/StackedBarChartViewController.xib new file mode 100644 index 00000000000..cb9e5c20e2c --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/Demos/StackedBarChartViewController.xib @@ -0,0 +1,101 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/RadarMarkerView.xib b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/RadarMarkerView.xib new file mode 100644 index 00000000000..8ffdb62c0d1 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-iOS/XIBs/RadarMarkerView.xib @@ -0,0 +1,53 @@ + + + + + + + + + + + + + HelveticaNeue-Light + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS.xcodeproj/project.pbxproj b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..f89adb89993 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS.xcodeproj/project.pbxproj @@ -0,0 +1,428 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 0630AE8C1D8128A5008859B0 /* Charts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0630AE711D812840008859B0 /* Charts.framework */; }; + 0630AE8D1D8128A5008859B0 /* Charts.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0630AE711D812840008859B0 /* Charts.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 5B9A0C3A1C83AB1800ED8ED8 /* BarDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B9A0C391C83AB1800ED8ED8 /* BarDemoViewController.swift */; }; + 5B9A0C3C1C83AB2100ED8ED8 /* LineDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B9A0C3B1C83AB2100ED8ED8 /* LineDemoViewController.swift */; }; + 5B9A0C3E1C83AB2B00ED8ED8 /* RadarDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B9A0C3D1C83AB2B00ED8ED8 /* RadarDemoViewController.swift */; }; + 5B9A0C401C83AB3400ED8ED8 /* PieDemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B9A0C3F1C83AB3400ED8ED8 /* PieDemoViewController.swift */; }; + 65B3F6421C73B4F5000983D0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B3F6411C73B4F5000983D0 /* AppDelegate.swift */; }; + 65B3F6461C73B4F5000983D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 65B3F6451C73B4F5000983D0 /* Assets.xcassets */; }; + 65B3F6491C73B4F5000983D0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 65B3F6471C73B4F5000983D0 /* Main.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 0630AE701D812840008859B0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0630AE691D812840008859B0 /* Charts.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 06165F241D8110E600722320; + remoteInfo = Charts; + }; + 0630AE721D812840008859B0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0630AE691D812840008859B0 /* Charts.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 06165F2E1D8110E600722320; + remoteInfo = ChartsTests; + }; + 0630AE8E1D8128A5008859B0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0630AE691D812840008859B0 /* Charts.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = A58A4ED274A941CA248EA921; + remoteInfo = Charts; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 65B3F65F1C73B507000983D0 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 0630AE8D1D8128A5008859B0 /* Charts.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 03780C7E1EA29C87005C11C8 /* PlaygroundChart.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = PlaygroundChart.playground; sourceTree = ""; }; + 0630AE691D812840008859B0 /* Charts.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Charts.xcodeproj; path = ../Charts.xcodeproj; sourceTree = ""; }; + 5B9A0C391C83AB1800ED8ED8 /* BarDemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarDemoViewController.swift; sourceTree = ""; }; + 5B9A0C3B1C83AB2100ED8ED8 /* LineDemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LineDemoViewController.swift; sourceTree = ""; }; + 5B9A0C3D1C83AB2B00ED8ED8 /* RadarDemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadarDemoViewController.swift; sourceTree = ""; }; + 5B9A0C3F1C83AB3400ED8ED8 /* PieDemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PieDemoViewController.swift; sourceTree = ""; }; + 65B3F63E1C73B4F5000983D0 /* ChartsDemo-macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ChartsDemo-macOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 65B3F6411C73B4F5000983D0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 65B3F6451C73B4F5000983D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 65B3F6481C73B4F5000983D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 65B3F64A1C73B4F5000983D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 65B3F63B1C73B4F5000983D0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0630AE8C1D8128A5008859B0 /* Charts.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0630AE6A1D812840008859B0 /* Products */ = { + isa = PBXGroup; + children = ( + 0630AE711D812840008859B0 /* Charts.framework */, + 0630AE731D812840008859B0 /* ChartsTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 5B9A0C381C83AB0600ED8ED8 /* Demos */ = { + isa = PBXGroup; + children = ( + 5B9A0C391C83AB1800ED8ED8 /* BarDemoViewController.swift */, + 5B9A0C3B1C83AB2100ED8ED8 /* LineDemoViewController.swift */, + 5B9A0C3D1C83AB2B00ED8ED8 /* RadarDemoViewController.swift */, + 5B9A0C3F1C83AB3400ED8ED8 /* PieDemoViewController.swift */, + ); + path = Demos; + sourceTree = ""; + }; + 65B3F6351C73B4F5000983D0 = { + isa = PBXGroup; + children = ( + 65B3F6401C73B4F5000983D0 /* ChartsDemo-macOS */, + 65B3F63F1C73B4F5000983D0 /* Products */, + 03780C7E1EA29C87005C11C8 /* PlaygroundChart.playground */, + 0630AE691D812840008859B0 /* Charts.xcodeproj */, + ); + sourceTree = ""; + }; + 65B3F63F1C73B4F5000983D0 /* Products */ = { + isa = PBXGroup; + children = ( + 65B3F63E1C73B4F5000983D0 /* ChartsDemo-macOS.app */, + ); + name = Products; + sourceTree = ""; + }; + 65B3F6401C73B4F5000983D0 /* ChartsDemo-macOS */ = { + isa = PBXGroup; + children = ( + 5B9A0C381C83AB0600ED8ED8 /* Demos */, + 65B3F6411C73B4F5000983D0 /* AppDelegate.swift */, + 65B3F6451C73B4F5000983D0 /* Assets.xcassets */, + 65B3F6471C73B4F5000983D0 /* Main.storyboard */, + 65B3F64A1C73B4F5000983D0 /* Info.plist */, + ); + path = "ChartsDemo-macOS"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 65B3F63D1C73B4F5000983D0 /* ChartsDemo-macOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 65B3F64D1C73B4F5000983D0 /* Build configuration list for PBXNativeTarget "ChartsDemo-macOS" */; + buildPhases = ( + 65B3F63A1C73B4F5000983D0 /* Sources */, + 65B3F63B1C73B4F5000983D0 /* Frameworks */, + 65B3F63C1C73B4F5000983D0 /* Resources */, + 65B3F65F1C73B507000983D0 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 0630AE8F1D8128A5008859B0 /* PBXTargetDependency */, + ); + name = "ChartsDemo-macOS"; + productName = "ChartsDemo-OSX"; + productReference = 65B3F63E1C73B4F5000983D0 /* ChartsDemo-macOS.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 65B3F6361C73B4F5000983D0 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0720; + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = dcg; + TargetAttributes = { + 65B3F63D1C73B4F5000983D0 = { + CreatedOnToolsVersion = 7.2.1; + LastSwiftMigration = 0800; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 65B3F6391C73B4F5000983D0 /* Build configuration list for PBXProject "ChartsDemo-macOS" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + English, + en, + Base, + ); + mainGroup = 65B3F6351C73B4F5000983D0; + productRefGroup = 65B3F63F1C73B4F5000983D0 /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 0630AE6A1D812840008859B0 /* Products */; + ProjectRef = 0630AE691D812840008859B0 /* Charts.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 65B3F63D1C73B4F5000983D0 /* ChartsDemo-macOS */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 0630AE711D812840008859B0 /* Charts.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Charts.framework; + remoteRef = 0630AE701D812840008859B0 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 0630AE731D812840008859B0 /* ChartsTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ChartsTests.xctest; + remoteRef = 0630AE721D812840008859B0 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 65B3F63C1C73B4F5000983D0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 65B3F6461C73B4F5000983D0 /* Assets.xcassets in Resources */, + 65B3F6491C73B4F5000983D0 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 65B3F63A1C73B4F5000983D0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 65B3F6421C73B4F5000983D0 /* AppDelegate.swift in Sources */, + 5B9A0C3E1C83AB2B00ED8ED8 /* RadarDemoViewController.swift in Sources */, + 5B9A0C3A1C83AB1800ED8ED8 /* BarDemoViewController.swift in Sources */, + 5B9A0C401C83AB3400ED8ED8 /* PieDemoViewController.swift in Sources */, + 5B9A0C3C1C83AB2100ED8ED8 /* LineDemoViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 0630AE8F1D8128A5008859B0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Charts; + targetProxy = 0630AE8E1D8128A5008859B0 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 65B3F6471C73B4F5000983D0 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 65B3F6481C73B4F5000983D0 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 65B3F64B1C73B4F5000983D0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 65B3F64C1C73B4F5000983D0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 65B3F64E1C73B4F5000983D0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = "$(SRCROOT)/ChartsDemo-macOS/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.ChartsDemo-OSX"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 65B3F64F1C73B4F5000983D0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Manual; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = "$(SRCROOT)/ChartsDemo-macOS/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.dcg.ChartsDemo-OSX"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 65B3F6391C73B4F5000983D0 /* Build configuration list for PBXProject "ChartsDemo-macOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 65B3F64B1C73B4F5000983D0 /* Debug */, + 65B3F64C1C73B4F5000983D0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 65B3F64D1C73B4F5000983D0 /* Build configuration list for PBXNativeTarget "ChartsDemo-macOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 65B3F64E1C73B4F5000983D0 /* Debug */, + 65B3F64F1C73B4F5000983D0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 65B3F6361C73B4F5000983D0 /* Project object */; +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/AppDelegate.swift b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/AppDelegate.swift new file mode 100644 index 00000000000..2826de9edb1 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/AppDelegate.swift @@ -0,0 +1,7 @@ +import Cocoa + +@NSApplicationMain +class AppDelegate: NSObject, NSApplicationDelegate +{ +} + diff --git a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/Contents.json b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json old mode 100755 new mode 100644 similarity index 74% rename from StatsLauncher/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json index 501f63e3172..2db2b1c7c6c --- a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,63 +1,53 @@ { "images" : [ { - "size" : "16x16", "idiom" : "mac", - "filename" : "16.png", + "size" : "16x16", "scale" : "1x" }, { - "size" : "16x16", "idiom" : "mac", - "filename" : "32.png", + "size" : "16x16", "scale" : "2x" }, { - "size" : "32x32", "idiom" : "mac", - "filename" : "32-1.png", + "size" : "32x32", "scale" : "1x" }, { - "size" : "32x32", "idiom" : "mac", - "filename" : "64.png", + "size" : "32x32", "scale" : "2x" }, { - "size" : "128x128", "idiom" : "mac", - "filename" : "128.png", + "size" : "128x128", "scale" : "1x" }, { - "size" : "128x128", "idiom" : "mac", - "filename" : "256.png", + "size" : "128x128", "scale" : "2x" }, { - "size" : "256x256", "idiom" : "mac", - "filename" : "256-1.png", + "size" : "256x256", "scale" : "1x" }, { - "size" : "256x256", "idiom" : "mac", - "filename" : "512-1.png", + "size" : "256x256", "scale" : "2x" }, { - "size" : "512x512", "idiom" : "mac", - "filename" : "512.png", + "size" : "512x512", "scale" : "1x" }, { - "size" : "512x512", "idiom" : "mac", - "filename" : "1024.png", + "size" : "512x512", "scale" : "2x" } ], diff --git a/StatsLauncher/Base.lproj/Main.storyboard b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Base.lproj/Main.storyboard similarity index 79% rename from StatsLauncher/Base.lproj/Main.storyboard rename to Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Base.lproj/Main.storyboard index f26e28151d3..e1bbcb34b18 100644 --- a/StatsLauncher/Base.lproj/Main.storyboard +++ b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Base.lproj/Main.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -10,11 +11,11 @@ - + - + - + @@ -28,7 +29,7 @@ - + @@ -46,7 +47,7 @@ - + @@ -97,7 +98,8 @@ - + + @@ -344,37 +346,17 @@ - - - - - - - - - - - - - - - + + + - - - - - - - - - - + + @@ -614,19 +596,6 @@ - - - - - - - - - - - - - @@ -659,7 +628,7 @@ - + @@ -673,11 +642,181 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Demos/BarDemoViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Demos/BarDemoViewController.swift new file mode 100644 index 00000000000..bf0d91c76ce --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Demos/BarDemoViewController.swift @@ -0,0 +1,76 @@ +// +// BarDemoViewController.swift +// ChartsDemo-OSX +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/ios-charts + +import Foundation +import Cocoa +import Charts + +open class BarDemoViewController: NSViewController +{ + @IBOutlet var barChartView: BarChartView! + + override open func viewDidLoad() + { + super.viewDidLoad() + + // Do any additional setup after loading the view. + let xArray = Array(1..<10) + let ys1 = xArray.map { x in return sin(Double(x) / 2.0 / 3.141 * 1.5) } + let ys2 = xArray.map { x in return cos(Double(x) / 2.0 / 3.141) } + + let yse1 = ys1.enumerated().map { x, y in return BarChartDataEntry(x: Double(x), y: y) } + let yse2 = ys2.enumerated().map { x, y in return BarChartDataEntry(x: Double(x), y: y) } + + let data = BarChartData() + let ds1 = BarChartDataSet(entries: yse1, label: "Hello") + ds1.colors = [NSUIColor.red] + data.addDataSet(ds1) + + let ds2 = BarChartDataSet(entries: yse2, label: "World") + ds2.colors = [NSUIColor.blue] + data.addDataSet(ds2) + + let barWidth = 0.4 + let barSpace = 0.05 + let groupSpace = 0.1 + + data.barWidth = barWidth + self.barChartView.xAxis.axisMinimum = Double(xArray[0]) + self.barChartView.xAxis.axisMaximum = Double(xArray[0]) + data.groupWidth(groupSpace: groupSpace, barSpace: barSpace) * Double(xArray.count) + // (0.4 + 0.05) * 2 (data set count) + 0.1 = 1 + data.groupBars(fromX: Double(xArray[0]), groupSpace: groupSpace, barSpace: barSpace) + + self.barChartView.data = data + + self.barChartView.gridBackgroundColor = NSUIColor.white + + self.barChartView.chartDescription?.text = "Barchart Demo" + } + + @IBAction func save(_ sender: Any) + { + let panel = NSSavePanel() + panel.allowedFileTypes = ["png"] + panel.beginSheetModal(for: self.view.window!) { (result) -> Void in + if result.rawValue == NSFileHandlingPanelOKButton + { + if let path = panel.url?.path + { + let _ = self.barChartView.save(to: path, format: .png, compressionQuality: 1.0) + } + } + } + } + + override open func viewWillAppear() + { + self.barChartView.animate(xAxisDuration: 1.0, yAxisDuration: 1.0) + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Demos/LineDemoViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Demos/LineDemoViewController.swift new file mode 100644 index 00000000000..5f555649d3f --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Demos/LineDemoViewController.swift @@ -0,0 +1,49 @@ +// +// LineDemoViewController.swift +// ChartsDemo-OSX +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/ios-charts + +import Foundation +import Cocoa +import Charts + +open class LineDemoViewController: NSViewController +{ + @IBOutlet var lineChartView: LineChartView! + + override open func viewDidLoad() + { + super.viewDidLoad() + + // Do any additional setup after loading the view. + let ys1 = Array(1..<10).map { x in return sin(Double(x) / 2.0 / 3.141 * 1.5) } + let ys2 = Array(1..<10).map { x in return cos(Double(x) / 2.0 / 3.141) } + + let yse1 = ys1.enumerated().map { x, y in return ChartDataEntry(x: Double(x), y: y) } + let yse2 = ys2.enumerated().map { x, y in return ChartDataEntry(x: Double(x), y: y) } + + let data = LineChartData() + let ds1 = LineChartDataSet(entries: yse1, label: "Hello") + ds1.colors = [NSUIColor.red] + data.addDataSet(ds1) + + let ds2 = LineChartDataSet(entries: yse2, label: "World") + ds2.colors = [NSUIColor.blue] + data.addDataSet(ds2) + self.lineChartView.data = data + + self.lineChartView.gridBackgroundColor = NSUIColor.white + + self.lineChartView.chartDescription?.text = "Linechart Demo" + } + + override open func viewWillAppear() + { + self.lineChartView.animate(xAxisDuration: 0.0, yAxisDuration: 1.0) + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Demos/PieDemoViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Demos/PieDemoViewController.swift new file mode 100644 index 00000000000..5a566f58a87 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Demos/PieDemoViewController.swift @@ -0,0 +1,54 @@ +// +// PieDemoViewController.swift +// ChartsDemo-OSX +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/ios-charts + +import Foundation +import Cocoa +import Charts + +open class PieDemoViewController: NSViewController +{ + @IBOutlet var pieChartView: PieChartView! + + override open func viewDidLoad() + { + super.viewDidLoad() + + // Do any additional setup after loading the view. + let ys1 = Array(1..<10).map { x in return sin(Double(x) / 2.0 / 3.141 * 1.5) * 100.0 } + + let yse1 = ys1.enumerated().map { x, y in return PieChartDataEntry(value: y, label: String(x)) } + + let data = PieChartData() + let ds1 = PieChartDataSet(entries: yse1, label: "Hello") + + ds1.colors = ChartColorTemplates.vordiplom() + + data.addDataSet(ds1) + + let paragraphStyle: NSMutableParagraphStyle = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle + paragraphStyle.lineBreakMode = .byTruncatingTail + paragraphStyle.alignment = .center + let centerText: NSMutableAttributedString = NSMutableAttributedString(string: "Charts\nby Daniel Cohen Gindi") + centerText.setAttributes([NSAttributedString.Key.font: NSFont(name: "HelveticaNeue-Light", size: 15.0)!, NSAttributedString.Key.paragraphStyle: paragraphStyle], range: NSMakeRange(0, centerText.length)) + centerText.addAttributes([NSAttributedString.Key.font: NSFont(name: "HelveticaNeue-Light", size: 13.0)!, NSAttributedString.Key.foregroundColor: NSColor.gray], range: NSMakeRange(10, centerText.length - 10)) + centerText.addAttributes([NSAttributedString.Key.font: NSFont(name: "HelveticaNeue-LightItalic", size: 13.0)!, NSAttributedString.Key.foregroundColor: NSColor(red: 51 / 255.0, green: 181 / 255.0, blue: 229 / 255.0, alpha: 1.0)], range: NSMakeRange(centerText.length - 19, 19)) + + self.pieChartView.centerAttributedText = centerText + + self.pieChartView.data = data + + self.pieChartView.chartDescription?.text = "Piechart Demo" + } + + override open func viewWillAppear() + { + self.pieChartView.animate(xAxisDuration: 0.0, yAxisDuration: 1.0) + } +} diff --git a/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Demos/RadarDemoViewController.swift b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Demos/RadarDemoViewController.swift new file mode 100644 index 00000000000..e147a2688ce --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Demos/RadarDemoViewController.swift @@ -0,0 +1,47 @@ +// +// RadarDemoViewController.swift +// ChartsDemo-OSX +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/ios-charts + +import Foundation +import Cocoa +import Charts + +open class RadarDemoViewController: NSViewController +{ + @IBOutlet var radarChartView: RadarChartView! + + override open func viewDidLoad() + { + super.viewDidLoad() + + // Do any additional setup after loading the view. + let ys1 = Array(1..<10).map { x in return sin(Double(x) / 2.0 / 3.141 * 1.5) } + let ys2 = Array(1..<10).map { x in return cos(Double(x) / 2.0 / 3.141) } + + let yse1 = ys1.enumerated().map { x, y in return RadarChartDataEntry(value: y) } + let yse2 = ys2.enumerated().map { x, y in return RadarChartDataEntry(value: y) } + + let data = RadarChartData() + let ds1 = RadarChartDataSet(entries: yse1, label: "Hello") + ds1.colors = [NSUIColor.red] + data.addDataSet(ds1) + + let ds2 = RadarChartDataSet(entries: yse2, label: "World") + ds2.colors = [NSUIColor.blue] + data.addDataSet(ds2) + self.radarChartView.data = data + self.radarChartView.chartDescription?.text = "Radarchart Demo" + + } + + override open func viewWillAppear() + { + self.radarChartView.animate(xAxisDuration: 0.0, yAxisDuration: 1.0) + } +} diff --git a/StatsLauncher/Info.plist b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Info.plist similarity index 80% rename from StatsLauncher/Info.plist rename to Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Info.plist index 4fe434c6a68..cb0cc0d1bc1 100644 --- a/StatsLauncher/Info.plist +++ b/Carthage/Checkouts/Charts/ChartsDemo-macOS/ChartsDemo-macOS/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIconFile @@ -17,15 +17,13 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.0 + 1.0 + CFBundleSignature + ???? CFBundleVersion 1 - LSBackgroundOnly - LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) - NSHumanReadableCopyright - Copyright © 2019 Serhiy Mytrovtsiy. All rights reserved. NSMainStoryboardFile Main NSPrincipalClass diff --git a/Carthage/Checkouts/Charts/ChartsDemo-macOS/PlaygroundChart.playground/Contents.o b/Carthage/Checkouts/Charts/ChartsDemo-macOS/PlaygroundChart.playground/Contents.o new file mode 100644 index 00000000000..e7a031a9a8f Binary files /dev/null and b/Carthage/Checkouts/Charts/ChartsDemo-macOS/PlaygroundChart.playground/Contents.o differ diff --git a/Carthage/Checkouts/Charts/ChartsDemo-macOS/PlaygroundChart.playground/Pages/BarChart.xcplaygroundpage/Contents.swift b/Carthage/Checkouts/Charts/ChartsDemo-macOS/PlaygroundChart.playground/Pages/BarChart.xcplaygroundpage/Contents.swift new file mode 100644 index 00000000000..5845162bca1 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-macOS/PlaygroundChart.playground/Pages/BarChart.xcplaygroundpage/Contents.swift @@ -0,0 +1,63 @@ +// +// PlayGround +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// Copyright © 2017 thierry Hentic. +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/ios-charts + +/*: + **** + [Menu](Menu) + + [Previous](@previous) | [Next](@next) + **** + */ + +//: # Bar Chart +//#-hidden-code +import Cocoa +import Charts +import PlaygroundSupport +//#-end-hidden-code + + +let months = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] +let values : [Double] = [28800, 32400, 36000, 34000, 30000, 42000, 45000] + +let r = CGRect(x: 0, y: 0, width: 600, height: 600) +var chartView = BarChartView(frame: r) +//: ### General +chartView.pinchZoomEnabled = false +chartView.drawBarShadowEnabled = false +chartView.doubleTapToZoomEnabled = false +chartView.drawGridBackgroundEnabled = true +chartView.fitBars = true +//: ### BarChartDataEntry +var yVals = [BarChartDataEntry]() +for i in 0..<7 +{ + yVals.append(BarChartDataEntry(x: Double(i), y: values[i])) +} +//: ### BarChartDataSet +var set1 = BarChartDataSet() +set1 = BarChartDataSet(values: yVals, label: "DataSet") +set1.colors = ChartColorTemplates.vordiplom() +set1.drawValuesEnabled = true + +var dataSets = [ChartDataSet]() +dataSets.append(set1) +//: ### BarChartData +let data = BarChartData(dataSets: dataSets) +chartView.data = data + +chartView.animate(xAxisDuration: 2.0, yAxisDuration: 2.0, easingOption: .easeInBounce) +/*:---*/ +//: ### Setup for the live view +PlaygroundPage.current.liveView = chartView +/*: + **** + [Previous](@previous) | [Next](@next) + */ diff --git a/Carthage/Checkouts/Charts/ChartsDemo-macOS/PlaygroundChart.playground/Pages/BubbleChart.xcplaygroundpage/Contents.swift b/Carthage/Checkouts/Charts/ChartsDemo-macOS/PlaygroundChart.playground/Pages/BubbleChart.xcplaygroundpage/Contents.swift new file mode 100644 index 00000000000..1e574aa7d46 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-macOS/PlaygroundChart.playground/Pages/BubbleChart.xcplaygroundpage/Contents.swift @@ -0,0 +1,82 @@ +// +// PlayGround +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// Copyright © 2017 thierry Hentic. +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/ios-charts +/*: + **** + [Menu](Menu) + + [Previous](@previous) + **** + */ + +//: # Bubble Chart +import Cocoa +import Charts +import PlaygroundSupport + +let ITEM_COUNT = 20 + +let r = CGRect(x: 0, y: 0, width: 600, height: 600) +var chartView = BubbleChartView(frame: r) +//: ### General +chartView.drawGridBackgroundEnabled = true +//: ### xAxis +let xAxis = chartView.xAxis +xAxis.labelPosition = .bothSided +xAxis.axisMinimum = 0.0 +xAxis.granularity = 1.0 +//: ### LeftAxis +let leftAxis = chartView.leftAxis +leftAxis.drawGridLinesEnabled = true +leftAxis.axisMinimum = 40.0 +//: ### RightAxis +let rightAxis = chartView.rightAxis +rightAxis.drawGridLinesEnabled = true +rightAxis.axisMinimum = 40.0 +//: ### Legend +let legend = chartView.legend +legend.wordWrapEnabled = true +legend.horizontalAlignment = .center +legend.verticalAlignment = .bottom +legend.orientation = .horizontal +legend.drawInside = false +//: ### Description +chartView.chartDescription?.enabled = false +//: ### BubbleChartDataEntry +var entries = [BubbleChartDataEntry]() +for index in 0..Float +{ + return Float(arc4random_uniform( UInt32(to - from ))) + Float(from) +} + + +let ITEM_COUNT = 20 + + +let r = CGRect(x: 0, y: 0, width: 600, height: 600) +var chartView = CandleStickChartView(frame: r) +//: ### General +chartView.drawGridBackgroundEnabled = true +//: ### xAxis +let xAxis = chartView.xAxis +xAxis.labelPosition = .bothSided +xAxis.axisMinimum = 0.0 +xAxis.granularity = 1.0 +//: ### LeftAxis +let leftAxis = chartView.leftAxis +leftAxis.drawGridLinesEnabled = true +leftAxis.axisMinimum = 0.0 +//: ### RightAxis +let rightAxis = chartView.rightAxis +rightAxis.drawGridLinesEnabled = true +rightAxis.axisMinimum = 0.0 +//: ### Legend +let legend = chartView.legend +legend.wordWrapEnabled = true +legend.horizontalAlignment = .center +legend.verticalAlignment = .bottom +legend.orientation = .horizontal +legend.drawInside = false +//: ### Description +chartView.chartDescription?.enabled = false +//: ### CandleChartDataEntry +var entries = [CandleChartDataEntry]() + +for i in 0.. LineChartData +{ +//: ### ChartDataEntry + var entries = [ChartDataEntry]() + for index in 0.. BarChartData +{ +//: ### BarChartDataEntry + var entries1 = [BarChartDataEntry]() + var entries2 = [BarChartDataEntry]() + + for _ in 0.. interval per "group" + */ + let data = BarChartData(dataSets: [set1, set2]) + data.barWidth = barWidth +/*: +- Note: make this BarData object grouped +*/ + data.groupBars(fromX: 0.0, groupSpace: groupSpace, barSpace: barSpace) // start at x = 0 + return data +} +//: ## Principal +let ITEM_COUNT = 12 + + +let r = CGRect(x: 0, y: 0, width: 600, height: 600) +var chartView = CombinedChartView(frame: r) +//: ### General +chartView.drawGridBackgroundEnabled = false +chartView.drawBarShadowEnabled = false +chartView.highlightFullBarEnabled = false +chartView.drawOrder = [DrawOrder.bar.rawValue, DrawOrder.bubble.rawValue, DrawOrder.candle.rawValue, DrawOrder.line.rawValue, DrawOrder.scatter.rawValue] +//: ### xAxis +let xAxis = chartView.xAxis +xAxis.labelPosition = .bothSided +xAxis.axisMinimum = 0.0 +xAxis.granularity = 1.0 +//xAxis.valueFormatter = BarChartFormatter() +//: ### LeftAxis +let leftAxis = chartView.leftAxis +leftAxis.drawGridLinesEnabled = false +leftAxis.axisMinimum = 0.0 +//: ### RightAxis +let rightAxis = chartView.rightAxis +rightAxis.drawGridLinesEnabled = false +rightAxis.axisMinimum = 0.0 +//: ### Legend +let legend = chartView.legend +legend.wordWrapEnabled = true +legend.horizontalAlignment = .center +legend.verticalAlignment = .bottom +legend.orientation = .horizontal +legend.drawInside = false +//: ### Description +chartView.chartDescription?.enabled = false + +setChartData() +chartView.animate(xAxisDuration: 2.0, yAxisDuration: 2.0, easingOption: .easeInBounce) + +/*:---*/ +//: ### Setup for the live view +PlaygroundPage.current.liveView = chartView + +/*: + **** + [Previous](@previous) | [Next](@next) + */ + + diff --git a/Carthage/Checkouts/Charts/ChartsDemo-macOS/PlaygroundChart.playground/Pages/HorizontalBarChart.xcplaygroundpage/Contents.swift b/Carthage/Checkouts/Charts/ChartsDemo-macOS/PlaygroundChart.playground/Pages/HorizontalBarChart.xcplaygroundpage/Contents.swift new file mode 100644 index 00000000000..30db0670f47 --- /dev/null +++ b/Carthage/Checkouts/Charts/ChartsDemo-macOS/PlaygroundChart.playground/Pages/HorizontalBarChart.xcplaygroundpage/Contents.swift @@ -0,0 +1,102 @@ +// +// PlayGround +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// Copyright © 2017 thierry Hentic. +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/ios-charts +/*: + **** + [Menu](Menu) + + [Previous](@previous) | [Next](@next) + **** + */ + +//: # Horizontal Bar Chart +import Cocoa +import Charts +import PlaygroundSupport + + +let r = CGRect(x: 0, y: 0, width: 600, height: 600) +var chartView = HorizontalBarChartView(frame: r) +//: ### General +chartView.drawBarShadowEnabled = false +chartView.drawValueAboveBarEnabled = true +chartView.maxVisibleCount = 60 +chartView.fitBars = true +chartView.gridBackgroundColor = NSUIColor.white +chartView.drawGridBackgroundEnabled = true +//: ### xAxis +let xAxis = chartView.xAxis +xAxis.labelPosition = .bothSided +xAxis.labelTextColor = #colorLiteral(red: 0, green: 0.9768045545, blue: 0, alpha: 1) +xAxis.labelFont = NSUIFont.systemFont(ofSize: CGFloat(12.0)) +xAxis.drawAxisLineEnabled = true +xAxis.drawGridLinesEnabled = true +xAxis.granularity = 10.0 +//: ### LeftAxis +let leftAxis = chartView.leftAxis +leftAxis.labelFont = NSUIFont.systemFont(ofSize: CGFloat(12.0)) +leftAxis.labelTextColor = #colorLiteral(red: 0.01680417731, green: 0.1983509958, blue: 1, alpha: 1) +leftAxis.drawAxisLineEnabled = true +leftAxis.drawGridLinesEnabled = true +leftAxis.axisMinimum = 0.0 +leftAxis.enabled = true +//: ### RightAxis +let rightAxis = chartView.rightAxis +rightAxis.labelFont = NSUIFont.systemFont(ofSize: CGFloat(12.0)) +rightAxis.labelTextColor = #colorLiteral(red: 0.7450980544, green: 0.1568627506, blue: 0.07450980693, alpha: 1) +rightAxis.drawAxisLineEnabled = true +rightAxis.drawGridLinesEnabled = false +rightAxis.axisMinimum = 0.0 +rightAxis.enabled = true +//: ### Legend +let legend = chartView.legend +legend.horizontalAlignment = .left +legend.verticalAlignment = .bottom +legend.orientation = .horizontal +legend.drawInside = false +legend.form = .square +legend.formSize = 8.0 +legend.font = NSUIFont(name: "HelveticaNeue-Light", size: CGFloat(11.0))! +legend.xEntrySpace = 4.0 + +//: ### Description +chartView.chartDescription?.text = "Horizontal Bar Chart" +//: ### BarChartDataEntry +let count = 12 +let range = 50.0 +let barWidth = 9.0 +let spaceForBar = 10.0 + +var yVals = [BarChartDataEntry]() +for i in 0.. + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Carthage/Checkouts/Charts/Gemfile b/Carthage/Checkouts/Charts/Gemfile new file mode 100644 index 00000000000..9867a39f044 --- /dev/null +++ b/Carthage/Checkouts/Charts/Gemfile @@ -0,0 +1,6 @@ +source 'https://rubygems.org' + +gem 'cocoapods', '>= 1.6.0.beta.1' +gem 'github_changelog_generator' +gem 'rake' +gem 'xcpretty' diff --git a/Carthage/Checkouts/Charts/Gemfile.lock b/Carthage/Checkouts/Charts/Gemfile.lock new file mode 100644 index 00000000000..5b158b5f0ce --- /dev/null +++ b/Carthage/Checkouts/Charts/Gemfile.lock @@ -0,0 +1,107 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.0) + activesupport (4.2.11.1) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + atomos (0.1.3) + claide (1.0.2) + cocoapods (1.7.0.beta.3) + activesupport (>= 4.0.2, < 5) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.7.0.beta.3) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.2.2, < 2.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-stats (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.3.1, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.2.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.6.6) + nap (~> 1.0) + ruby-macho (~> 1.4) + xcodeproj (>= 1.8.2, < 2.0) + cocoapods-core (1.7.0.beta.3) + activesupport (>= 4.0.2, < 6) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + cocoapods-deintegrate (1.0.4) + cocoapods-downloader (1.2.2) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.0) + cocoapods-stats (1.1.0) + cocoapods-trunk (1.3.1) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.1.0) + colored2 (3.1.2) + concurrent-ruby (1.1.5) + escape (0.0.4) + faraday (0.15.4) + multipart-post (>= 1.2, < 3) + faraday-http-cache (2.0.0) + faraday (~> 0.8) + fourflusher (2.2.0) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + github_changelog_generator (1.14.3) + activesupport + faraday-http-cache + multi_json + octokit (~> 4.6) + rainbow (>= 2.1) + rake (>= 10.0) + retriable (~> 2.1) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + minitest (5.11.3) + molinillo (0.6.6) + multi_json (1.13.1) + multipart-post (2.0.0) + nanaimo (0.2.6) + nap (1.1.0) + netrc (0.11.0) + octokit (4.14.0) + sawyer (~> 0.8.0, >= 0.5.3) + public_suffix (3.0.3) + rainbow (3.0.0) + rake (12.3.2) + retriable (2.1.0) + rouge (2.0.7) + ruby-macho (1.4.0) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + xcodeproj (1.8.2) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.2.6) + xcpretty (0.3.0) + rouge (~> 2.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + cocoapods (>= 1.6.0.beta.1) + github_changelog_generator + rake + xcpretty + +BUNDLED WITH + 1.16.6 diff --git a/Carthage/Checkouts/Charts/LICENSE b/Carthage/Checkouts/Charts/LICENSE new file mode 100644 index 00000000000..17c2ed446b8 --- /dev/null +++ b/Carthage/Checkouts/Charts/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2016 Daniel Cohen Gindi & Philipp Jahoda + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/Carthage/Checkouts/Charts/Package.swift b/Carthage/Checkouts/Charts/Package.swift new file mode 100644 index 00000000000..6796c8899b1 --- /dev/null +++ b/Carthage/Checkouts/Charts/Package.swift @@ -0,0 +1,15 @@ +// swift-tools-version:4.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. +import PackageDescription + +let package = Package( + name: "Charts", + products: [ + .library(name: "Charts", type: .dynamic, targets: ["Charts"]) + ], + dependencies: [], + targets: [ + .target(name: "Charts", dependencies: []) + ], + swiftLanguageVersions: [5] +) diff --git a/Carthage/Checkouts/Charts/README.md b/Carthage/Checkouts/Charts/README.md new file mode 100644 index 00000000000..89d92c813f5 --- /dev/null +++ b/Carthage/Checkouts/Charts/README.md @@ -0,0 +1,213 @@ +**Version 3.3.0**, synced to [MPAndroidChart #f6a398b](https://github.com/PhilJay/MPAndroidChart/commit/f6a398b) + +![alt tag](https://raw.github.com/danielgindi/Charts/master/Assets/feature_graphic.png) + ![Supported Platforms](https://img.shields.io/cocoapods/p/Charts.svg) [![Releases](https://img.shields.io/github/release/danielgindi/Charts.svg)](https://github.com/danielgindi/Charts/releases) [![Latest pod release](https://img.shields.io/cocoapods/v/Charts.svg)](http://cocoapods.org/pods/charts) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Build Status](https://travis-ci.org/danielgindi/Charts.svg?branch=master)](https://travis-ci.org/danielgindi/Charts) [![codecov](https://codecov.io/gh/danielgindi/Charts/branch/master/graph/badge.svg)](https://codecov.io/gh/danielgindi/Charts) +[![Join the chat at https://gitter.im/danielgindi/Charts](https://badges.gitter.im/danielgindi/Charts.svg)](https://gitter.im/danielgindi/Charts?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +### Just a heads up: Charts 3.0 has some breaking changes. Please read [the release/migration notes](https://github.com/danielgindi/Charts/releases/tag/v3.0.0). +### Another heads up: ChartsRealm is now in a [separate repo](https://github.com/danielgindi/ChartsRealm). Pods is also now `Charts` and `ChartsRealm`, instead of ~`Charts/Core`~ and ~`Charts/Realm`~ +### One more heads up: As Swift evolves, if you are not using the latest Swift compiler, you shouldn't check out the master branch. Instead, you should go to the release page and pick up whatever suits you. + +* Xcode 10.2 / Swift 5.0 (master branch) +* iOS >= 8.0 (Use as an **Embedded** Framework) +* tvOS >= 9.0 +* macOS >= 10.11 + +Okay so there's this beautiful library called [MPAndroidChart](https://github.com/PhilJay/MPAndroidChart) by [Philipp Jahoda](https://www.linkedin.com/in/philippjahoda) which has become very popular amongst Android developers, but there was no decent solution to create charts for iOS. + +I've chosen to write it in `Swift` as it can be highly optimized by the compiler, and can be used in both `Swift` and `ObjC` project. The demo project is written in `ObjC` to demonstrate how it works. + +**An amazing feature** of this library now, for Android, iOS, tvOS and macOS, is the time it saves you when developing for both platforms, as the learning curve is singleton- it happens only once, and the code stays very similar so developers don't have to go around and re-invent the app to produce the same output with a different library. (And that's not even considering the fact that there's not really another good choice out there currently...) + +## Having trouble running the demo? + +* `ChartsDemo/ChartsDemo.xcodeproj` is the demo project for iOS/tvOS +* `ChartsDemo-OSX/ChartsDemo-OSX.xcodeproj` is the demo project for macOS +* Make sure you are running a supported version of Xcode. + * Usually it is specified here a few lines above. + * In most cases it will be the latest Xcode version. +* Make sure that your project supports Swift 5.0 +* Optional: Run `carthage checkout` in the project folder, to fetch dependencies (i.e testing dependencies). + * If you don't have Carthage - you can get it [here](https://github.com/Carthage/Carthage/releases). + + +## Usage + +In order to correctly compile: + +1. Drag the `Charts.xcodeproj` to your project +2. Go to your target's settings, hit the "+" under the "Embedded Binaries" section, and select the Charts.framework +3. `@import Charts` +4. When using Swift in an ObjC project: + - You need to import your Bridging Header. Usually it is "*YourProject-Swift.h*", so in ChartsDemo it's "*ChartsDemo-Swift.h*". Do not try to actually include "*ChartsDemo-Swift.h*" in your project :-) + - (Xcode 8.1 and earlier) Under "Build Options", mark "Embedded Content Contains Swift Code" + - (Xcode 8.2+) Under "Build Options", mark "Always Embed Swift Standard Libraries" +5. When using [Realm.io](https://realm.io/): + - Note that the Realm framework is not linked with Charts - it is only there for *optional* bindings. Which means that you need to have the framework in your project, and in a compatible version to whatever is compiled with Charts. We will do our best to always compile against the latest version. + - You'll need to add `ChartsRealm` as a dependency too. + +## 3rd party tutorials + +* [Using Realm and Charts with Swift 3 in iOS 10 (Sami Korpela)](https://medium.com/@skoli/using-realm-and-charts-with-swift-3-in-ios-10-40c42e3838c0#.2gyymwfh8) +* [Creating a Line Chart in Swift 3 and iOS 10 (Osian Smith)](https://medium.com/@OsianSmith/creating-a-line-chart-in-swift-3-and-ios-10-2f647c95392e) +* [Beginning Set-up and Example Using Charts with Swift 3](https://github.com/annalizhaz/ChartsForSwiftBasic) +* Want your tutorial to show here? Create a PR! + +## Troubleshooting + +#### Can't compile? + +* Please note the difference between installing a compiled framework from CocoaPods or Carthage, and copying the source code. +* Please read the **Usage** section again. +* Search in the issues +* Try to politely ask in the issues section + +#### Other problems / feature requests + +* Search in the issues +* Try to politely ask in the issues section + +## CocoaPods Install + +Add `pod 'Charts'` to your Podfile. "Charts" is the name of the library. +For [Realm](https://realm.io/) support, please add `pod 'ChartsRealm'` too. + +**Note:** ~~`pod 'ios-charts'`~~ is not the correct library, and refers to a different project by someone else. + +## Carthage Install + +Charts now include Carthage prebuilt binaries. + +```carthage +github "danielgindi/Charts" == 3.3.0 +github "danielgindi/Charts" ~> 3.3.0 +``` + +In order to build the binaries for a new release, use `carthage build --no-skip-current && carthage archive Charts`. + +## 3rd party bindings + +Xamarin (by @Flash3001): *iOS* - [GitHub](https://github.com/Flash3001/iOSCharts.Xamarin)/[NuGet](https://www.nuget.org/packages/iOSCharts/). *Android* - [GitHub](https://github.com/Flash3001/MPAndroidChart.Xamarin)/[NuGet](https://www.nuget.org/packages/MPAndroidChart/). + +## Help + +If you like what you see here, and want to support the work being done in this repository, you could: +* Contribute code, issues and pull requests +* Let people know this library exists (:fire: spread the word :fire:) +* [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=68UL6Y8KUPS96) (You can buy me a beer, or you can buy me dinner :-) + +**Note:** The author of [MPAndroidChart](https://github.com/PhilJay/MPAndroidChart) is the reason that this library exists, and is accepting [donations](https://github.com/PhilJay/MPAndroidChart#donations) on his page. He deserves them! + +Questions & Issues +----- + +If you are having questions or problems, you should: + + - Make sure you are using the latest version of the library. Check the [**release-section**](https://github.com/danielgindi/Charts/releases). + - Study the Android version's [**Documentation-Wiki**](https://github.com/PhilJay/MPAndroidChart/wiki) + - Study the (Still incomplete [![Doc-Percent](https://img.shields.io/cocoapods/metrics/doc-percent/Charts.svg)](http://cocoadocs.org/docsets/Charts/)) [**Pod-Documentation**](http://cocoadocs.org/docsets/Charts/) + - Search or open questions on [**stackoverflow**](http://stackoverflow.com/questions/tagged/ios-charts) with the `ios-charts` tag + - Search [**known issues**](https://github.com/danielgindi/Charts/issues) for your problem (open and closed) + - Create new issues (please :fire: **search known issues before** :fire:, do not create duplicate issues) + + +Features +======= + +**Core features:** + - 8 different chart types + - Scaling on both axes (with touch-gesture, axes separately or pinch-zoom) + - Dragging / Panning (with touch-gesture) + - Combined-Charts (line-, bar-, scatter-, candle-stick-, bubble-) + - Dual (separate) Axes + - Customizable Axes (both x- and y-axis) + - Highlighting values (with customizable popup-views) + - Save chart to camera-roll / export to PNG/JPEG + - Predefined color templates + - Legends (generated automatically, customizable) + - Animations (build up animations, on both x- and y-axis) + - Limit lines (providing additional information, maximums, ...) + - Fully customizable (paints, typefaces, legends, colors, background, gestures, dashed lines, ...) + - Plotting data directly from [**Realm.io**](https://realm.io) mobile database ([here](https://github.com/danielgindi/ChartsRealm)) + +**Chart types:** + +*Screenshots are currently taken from the original repository, as they render exactly the same :-)* + + + - **LineChart (with legend, simple design)** +![alt tag](https://raw.github.com/PhilJay/MPChart/master/screenshots/simpledesign_linechart4.png) + - **LineChart (with legend, simple design)** +![alt tag](https://raw.github.com/PhilJay/MPChart/master/screenshots/simpledesign_linechart3.png) + + - **LineChart (cubic lines)** +![alt tag](https://raw.github.com/PhilJay/MPChart/master/screenshots/cubiclinechart.png) + + - **LineChart (gradient fill)** +![alt tag](https://raw.github.com/PhilJay/MPAndroidChart/master/screenshots/line_chart_gradient.png) + + - **Combined-Chart (bar- and linechart in this case)** +![alt tag](https://raw.github.com/PhilJay/MPChart/master/screenshots/combined_chart.png) + + - **BarChart (with legend, simple design)** + +![alt tag](https://raw.github.com/PhilJay/MPChart/master/screenshots/simpledesign_barchart3.png) + + - **BarChart (grouped DataSets)** + +![alt tag](https://raw.github.com/PhilJay/MPChart/master/screenshots/groupedbarchart.png) + + - **Horizontal-BarChart** + +![alt tag](https://raw.github.com/PhilJay/MPChart/master/screenshots/horizontal_barchart.png) + + + - **PieChart (with selection, ...)** + +![alt tag](https://raw.github.com/PhilJay/MPAndroidChart/master/screenshots/simpledesign_piechart1.png) + + - **ScatterChart** (with squares, triangles, circles, ... and more) + +![alt tag](https://raw.github.com/PhilJay/MPAndroidChart/master/screenshots/scatterchart.png) + + - **CandleStickChart** (for financial data) + +![alt tag](https://raw.github.com/PhilJay/MPAndroidChart/master/screenshots/candlestickchart.png) + + - **BubbleChart** (area covered by bubbles indicates the value) + +![alt tag](https://raw.github.com/PhilJay/MPAndroidChart/master/screenshots/bubblechart.png) + + - **RadarChart** (spider web chart) + +![alt tag](https://raw.github.com/PhilJay/MPAndroidChart/master/screenshots/radarchart.png) + + +Documentation +======= +Currently there's no need for documentation for the iOS/tvOS/macOS version, as the API is **95% the same** as on Android. +You can read the official [MPAndroidChart](https://github.com/PhilJay/MPAndroidChart) documentation here: [**Wiki**](https://github.com/PhilJay/MPAndroidChart/wiki) + +Or you can see the Charts Demo project in both Objective-C and Swift ([**ChartsDemo-iOS**](https://github.com/danielgindi/Charts/tree/master/ChartsDemo-iOS), as well as macOS [**ChartsDemo-macOS**](https://github.com/danielgindi/Charts/tree/master/ChartsDemo-macOS)) and learn the how-tos from it. + + +Special Thanks +======= + +Goes to [@liuxuan30](https://github.com/liuxuan30), [@petester42](https://github.com/petester42) and [@AlBirdie](https://github.com/AlBirdie) for new features, bugfixes, and lots and lots of involvement in our open-sourced community! You guys are a huge help to all of those coming here with questions and issues, and I couldn't respond to all of those without you. + +License +======= +Copyright 2016 Daniel Cohen Gindi & Philipp Jahoda + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/Carthage/Checkouts/Charts/Rakefile b/Carthage/Checkouts/Charts/Rakefile new file mode 100644 index 00000000000..016faddc9f7 --- /dev/null +++ b/Carthage/Checkouts/Charts/Rakefile @@ -0,0 +1,182 @@ +def type + :project # set `:project` for xcodeproj and `:workspace` for xcworkspace +end + +def project_name + 'ChartsDemo-iOS/ChartsDemo-iOS.xcodeproj' +end + +def macos_project_name + 'ChartsDemo-macOS/ChartsDemo-macOS.xcodeproj' +end + +def configuration + 'Debug' +end + +def test_platforms + %i[ + iOS + tvOS + ] +end + +def build_platforms + [ + :macOS + ] +end + +def build_schemes + %w[ + Charts + ] +end + +def build_demo_schemes + %i[ + ChartsDemo-iOS + ChartsDemo-iOS-Swift + ] +end + +def build_macos_demo_schemes + [ + 'ChartsDemo-macOS' + ] +end + +def test_schemes + [ + 'ChartsTests' + ] +end + +def devices + { + iOS: { + sdk: 'iphonesimulator', + device: "name='iPhone 7'", + name: 'iPhone 7' + }, + macOS: { + sdk: 'macosx', + device: "arch='x86_64'", + uuid: nil + }, + tvOS: { + sdk: 'appletvsimulator', + device: "name='Apple TV'", + name: 'Apple TV' + } + } +end + +def open_simulator_and_sleep(uuid) + return if uuid.nil? # Don't need a sleep on macOS because it runs first. + sh "xcrun instruments -w '#{uuid}' || sleep 15" +end + +def xcodebuild(type, name, scheme, configuration, sdk, destination, tasks, xcprety_args) + # set either workspace or project flag for xcodebuild + case type + when :project + project_type = '-project' + when :workspace + project_type = '-workspace' + else + abort 'Invalid project type, use `:project` for xcodeproj and `:workspace` for xcworkspace.' + end + + sh "set -o pipefail && xcodebuild #{project_type} '#{name}' -scheme '#{scheme}' -configuration '#{configuration}' -sdk #{sdk} -destination #{destination} #{tasks} | bundle exec xcpretty -c #{xcprety_args}" +end + +def run_xcodebuild(tasks, destination, is_build_demo, xcprety_args) + sdk = destination[:sdk] + device = destination[:device] + uuid = destination[:uuid] + + is_test = tasks.include?('test') + is_macos = sdk == 'macosx' + + project = is_macos ? macos_project_name : project_name + + schemes_to_execute = [] + if is_test + schemes_to_execute = test_schemes + elsif is_build_demo + schemes_to_execute = is_macos ? build_macos_demo_schemes : build_demo_schemes + else + schemes_to_execute = build_schemes + end + + open_simulator_and_sleep uuid if is_test + + schemes_to_execute.each do |scheme| + xcodebuild type, project, scheme, configuration, sdk, device, tasks, xcprety_args + end +end + +def execute(tasks, platform, is_build_demo = false, xcprety_args: '') + # platform specific settings + destination = devices[platform] + + # check if xcodebuild needs to be run on multiple devices + if destination.is_a?(Array) + destination.each do |destination| + run_xcodebuild tasks, destination, is_build_demo, xcprety_args + end + else + run_xcodebuild tasks, destination, is_build_demo, xcprety_args + end +end + +def arg_to_key(string_key) + case string_key.downcase + when 'ios' + :iOS + when 'tvos' + :tvOS + when 'macos' + :macOS + when 'watchos' + :watchOS + else + abort 'Invalid platform, use `iOS`, `tvOS`, `macOS` or `watchOS`' + end +end + +desc 'Run CI tasks. Build and test or build depending on the platform.' +task :ci, [:platform] do |_task, args| + platform = arg_to_key(args[:platform]) if args.key?(:platform) + is_build_demo = test_platforms.include?(platform) || build_platforms.include?(platform) + + if test_platforms.include?(platform) # iOS and tvOS + if platform == :iOS + execute 'clean', platform, is_build_demo + execute 'build', platform, is_build_demo + execute 'test', platform # not use demo specifically + else + execute 'clean test', platform + end + elsif build_platforms.include?(platform) # macOS + execute 'clean build', platform, is_build_demo + else + test_platforms.each do |platform| + execute 'clean test', platform + end + build_platforms.each do |platform| + execute 'clean build', platform + end + end +end + +desc 'updated the podspec on cocoapods' +task :update_pod do + sh 'bundle exec pod trunk push Charts.podspec --allow-warnings' +end + +desc 'generate changelog' +task :generate_changelog do + sh 'github_changelog_generator' +end \ No newline at end of file diff --git a/Carthage/Checkouts/Charts/Source/Charts/Animation/Animator.swift b/Carthage/Checkouts/Charts/Source/Charts/Animation/Animator.swift new file mode 100644 index 00000000000..b94b21f4966 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Animation/Animator.swift @@ -0,0 +1,280 @@ +// +// Animator.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartAnimatorDelegate) +public protocol AnimatorDelegate +{ + /// Called when the Animator has stepped. + func animatorUpdated(_ animator: Animator) + + /// Called when the Animator has stopped. + func animatorStopped(_ animator: Animator) +} + +@objc(ChartAnimator) +open class Animator: NSObject +{ + @objc open weak var delegate: AnimatorDelegate? + @objc open var updateBlock: (() -> Void)? + @objc open var stopBlock: (() -> Void)? + + /// the phase that is animated and influences the drawn values on the x-axis + @objc open var phaseX: Double = 1.0 + + /// the phase that is animated and influences the drawn values on the y-axis + @objc open var phaseY: Double = 1.0 + + private var _startTimeX: TimeInterval = 0.0 + private var _startTimeY: TimeInterval = 0.0 + private var _displayLink: NSUIDisplayLink? + + private var _durationX: TimeInterval = 0.0 + private var _durationY: TimeInterval = 0.0 + + private var _endTimeX: TimeInterval = 0.0 + private var _endTimeY: TimeInterval = 0.0 + private var _endTime: TimeInterval = 0.0 + + private var _enabledX: Bool = false + private var _enabledY: Bool = false + + private var _easingX: ChartEasingFunctionBlock? + private var _easingY: ChartEasingFunctionBlock? + + public override init() + { + super.init() + } + + deinit + { + stop() + } + + @objc open func stop() + { + guard _displayLink != nil else { return } + + _displayLink?.remove(from: .main, forMode: RunLoop.Mode.common) + _displayLink = nil + + _enabledX = false + _enabledY = false + + // If we stopped an animation in the middle, we do not want to leave it like this + if phaseX != 1.0 || phaseY != 1.0 + { + phaseX = 1.0 + phaseY = 1.0 + + delegate?.animatorUpdated(self) + updateBlock?() + } + + delegate?.animatorStopped(self) + stopBlock?() + } + + private func updateAnimationPhases(_ currentTime: TimeInterval) + { + if _enabledX + { + let elapsedTime: TimeInterval = currentTime - _startTimeX + let duration: TimeInterval = _durationX + var elapsed: TimeInterval = elapsedTime + if elapsed > duration + { + elapsed = duration + } + + phaseX = _easingX?(elapsed, duration) ?? elapsed / duration + } + + if _enabledY + { + let elapsedTime: TimeInterval = currentTime - _startTimeY + let duration: TimeInterval = _durationY + var elapsed: TimeInterval = elapsedTime + if elapsed > duration + { + elapsed = duration + } + + phaseY = _easingY?(elapsed, duration) ?? elapsed / duration + } + } + + @objc private func animationLoop() + { + let currentTime: TimeInterval = CACurrentMediaTime() + + updateAnimationPhases(currentTime) + + delegate?.animatorUpdated(self) + updateBlock?() + + if currentTime >= _endTime + { + stop() + } + } + + /// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - yAxisDuration: duration for animating the y axis + /// - easingX: an easing function for the animation on the x axis + /// - easingY: an easing function for the animation on the y axis + @objc open func animate(xAxisDuration: TimeInterval, yAxisDuration: TimeInterval, easingX: ChartEasingFunctionBlock?, easingY: ChartEasingFunctionBlock?) + { + stop() + + _startTimeX = CACurrentMediaTime() + _startTimeY = _startTimeX + _durationX = xAxisDuration + _durationY = yAxisDuration + _endTimeX = _startTimeX + xAxisDuration + _endTimeY = _startTimeY + yAxisDuration + _endTime = _endTimeX > _endTimeY ? _endTimeX : _endTimeY + _enabledX = xAxisDuration > 0.0 + _enabledY = yAxisDuration > 0.0 + + _easingX = easingX + _easingY = easingY + + // Take care of the first frame if rendering is already scheduled... + updateAnimationPhases(_startTimeX) + + if _enabledX || _enabledY + { + _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop)) + _displayLink?.add(to: RunLoop.main, forMode: RunLoop.Mode.common) + } + } + + /// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - yAxisDuration: duration for animating the y axis + /// - easingOptionX: the easing function for the animation on the x axis + /// - easingOptionY: the easing function for the animation on the y axis + @objc open func animate(xAxisDuration: TimeInterval, yAxisDuration: TimeInterval, easingOptionX: ChartEasingOption, easingOptionY: ChartEasingOption) + { + animate(xAxisDuration: xAxisDuration, yAxisDuration: yAxisDuration, easingX: easingFunctionFromOption(easingOptionX), easingY: easingFunctionFromOption(easingOptionY)) + } + + /// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - yAxisDuration: duration for animating the y axis + /// - easing: an easing function for the animation + @objc open func animate(xAxisDuration: TimeInterval, yAxisDuration: TimeInterval, easing: ChartEasingFunctionBlock?) + { + animate(xAxisDuration: xAxisDuration, yAxisDuration: yAxisDuration, easingX: easing, easingY: easing) + } + + /// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - yAxisDuration: duration for animating the y axis + /// - easingOption: the easing function for the animation + @objc open func animate(xAxisDuration: TimeInterval, yAxisDuration: TimeInterval, easingOption: ChartEasingOption = .easeInOutSine) + { + animate(xAxisDuration: xAxisDuration, yAxisDuration: yAxisDuration, easing: easingFunctionFromOption(easingOption)) + } + + /// Animates the drawing / rendering of the chart the x-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - easing: an easing function for the animation + @objc open func animate(xAxisDuration: TimeInterval, easing: ChartEasingFunctionBlock?) + { + _startTimeX = CACurrentMediaTime() + _durationX = xAxisDuration + _endTimeX = _startTimeX + xAxisDuration + _endTime = _endTimeX > _endTimeY ? _endTimeX : _endTimeY + _enabledX = xAxisDuration > 0.0 + + _easingX = easing + + // Take care of the first frame if rendering is already scheduled... + updateAnimationPhases(_startTimeX) + + if _enabledX || _enabledY, + _displayLink == nil + { + _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop)) + _displayLink?.add(to: .main, forMode: RunLoop.Mode.common) + } + } + + /// Animates the drawing / rendering of the chart the x-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - easingOption: the easing function for the animation + @objc open func animate(xAxisDuration: TimeInterval, easingOption: ChartEasingOption = .easeInOutSine) + { + animate(xAxisDuration: xAxisDuration, easing: easingFunctionFromOption(easingOption)) + } + + /// Animates the drawing / rendering of the chart the y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - yAxisDuration: duration for animating the y axis + /// - easing: an easing function for the animation + @objc open func animate(yAxisDuration: TimeInterval, easing: ChartEasingFunctionBlock?) + { + _startTimeY = CACurrentMediaTime() + _durationY = yAxisDuration + _endTimeY = _startTimeY + yAxisDuration + _endTime = _endTimeX > _endTimeY ? _endTimeX : _endTimeY + _enabledY = yAxisDuration > 0.0 + + _easingY = easing + + // Take care of the first frame if rendering is already scheduled... + updateAnimationPhases(_startTimeY) + + if _enabledX || _enabledY, + _displayLink == nil + { + _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop)) + _displayLink?.add(to: .main, forMode: RunLoop.Mode.common) + } + } + + /// Animates the drawing / rendering of the chart the y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - yAxisDuration: duration for animating the y axis + /// - easingOption: the easing function for the animation + @objc open func animate(yAxisDuration: TimeInterval, easingOption: ChartEasingOption = .easeInOutSine) + { + animate(yAxisDuration: yAxisDuration, easing: easingFunctionFromOption(easingOption)) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Animation/ChartAnimationEasing.swift b/Carthage/Checkouts/Charts/Source/Charts/Animation/ChartAnimationEasing.swift new file mode 100644 index 00000000000..58b0b632d8a --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Animation/ChartAnimationEasing.swift @@ -0,0 +1,394 @@ +// +// ChartAnimationUtils.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public enum ChartEasingOption: Int +{ + case linear + case easeInQuad + case easeOutQuad + case easeInOutQuad + case easeInCubic + case easeOutCubic + case easeInOutCubic + case easeInQuart + case easeOutQuart + case easeInOutQuart + case easeInQuint + case easeOutQuint + case easeInOutQuint + case easeInSine + case easeOutSine + case easeInOutSine + case easeInExpo + case easeOutExpo + case easeInOutExpo + case easeInCirc + case easeOutCirc + case easeInOutCirc + case easeInElastic + case easeOutElastic + case easeInOutElastic + case easeInBack + case easeOutBack + case easeInOutBack + case easeInBounce + case easeOutBounce + case easeInOutBounce +} + +public typealias ChartEasingFunctionBlock = ((_ elapsed: TimeInterval, _ duration: TimeInterval) -> Double) + +internal func easingFunctionFromOption(_ easing: ChartEasingOption) -> ChartEasingFunctionBlock +{ + switch easing + { + case .linear: + return EasingFunctions.Linear + case .easeInQuad: + return EasingFunctions.EaseInQuad + case .easeOutQuad: + return EasingFunctions.EaseOutQuad + case .easeInOutQuad: + return EasingFunctions.EaseInOutQuad + case .easeInCubic: + return EasingFunctions.EaseInCubic + case .easeOutCubic: + return EasingFunctions.EaseOutCubic + case .easeInOutCubic: + return EasingFunctions.EaseInOutCubic + case .easeInQuart: + return EasingFunctions.EaseInQuart + case .easeOutQuart: + return EasingFunctions.EaseOutQuart + case .easeInOutQuart: + return EasingFunctions.EaseInOutQuart + case .easeInQuint: + return EasingFunctions.EaseInQuint + case .easeOutQuint: + return EasingFunctions.EaseOutQuint + case .easeInOutQuint: + return EasingFunctions.EaseInOutQuint + case .easeInSine: + return EasingFunctions.EaseInSine + case .easeOutSine: + return EasingFunctions.EaseOutSine + case .easeInOutSine: + return EasingFunctions.EaseInOutSine + case .easeInExpo: + return EasingFunctions.EaseInExpo + case .easeOutExpo: + return EasingFunctions.EaseOutExpo + case .easeInOutExpo: + return EasingFunctions.EaseInOutExpo + case .easeInCirc: + return EasingFunctions.EaseInCirc + case .easeOutCirc: + return EasingFunctions.EaseOutCirc + case .easeInOutCirc: + return EasingFunctions.EaseInOutCirc + case .easeInElastic: + return EasingFunctions.EaseInElastic + case .easeOutElastic: + return EasingFunctions.EaseOutElastic + case .easeInOutElastic: + return EasingFunctions.EaseInOutElastic + case .easeInBack: + return EasingFunctions.EaseInBack + case .easeOutBack: + return EasingFunctions.EaseOutBack + case .easeInOutBack: + return EasingFunctions.EaseInOutBack + case .easeInBounce: + return EasingFunctions.EaseInBounce + case .easeOutBounce: + return EasingFunctions.EaseOutBounce + case .easeInOutBounce: + return EasingFunctions.EaseInOutBounce + } +} + +internal struct EasingFunctions +{ + internal static let Linear = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in return Double(elapsed / duration) } + + internal static let EaseInQuad = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / duration) + return position * position + } + + internal static let EaseOutQuad = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / duration) + return -position * (position - 2.0) + } + + internal static let EaseInOutQuad = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / (duration / 2.0)) + if position < 1.0 + { + return 0.5 * position * position + } + + return -0.5 * ((position - 1.0) * (position - 3.0) - 1.0) + } + + internal static let EaseInCubic = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / duration) + return position * position * position + } + + internal static let EaseOutCubic = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / duration) + position -= 1.0 + return (position * position * position + 1.0) + } + + internal static let EaseInOutCubic = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / (duration / 2.0)) + if position < 1.0 + { + return 0.5 * position * position * position + } + position -= 2.0 + return 0.5 * (position * position * position + 2.0) + } + + internal static let EaseInQuart = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / duration) + return position * position * position * position + } + + internal static let EaseOutQuart = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / duration) + position -= 1.0 + return -(position * position * position * position - 1.0) + } + + internal static let EaseInOutQuart = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / (duration / 2.0)) + if position < 1.0 + { + return 0.5 * position * position * position * position + } + position -= 2.0 + return -0.5 * (position * position * position * position - 2.0) + } + + internal static let EaseInQuint = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / duration) + return position * position * position * position * position + } + + internal static let EaseOutQuint = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / duration) + position -= 1.0 + return (position * position * position * position * position + 1.0) + } + + internal static let EaseInOutQuint = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / (duration / 2.0)) + if position < 1.0 + { + return 0.5 * position * position * position * position * position + } + else + { + position -= 2.0 + return 0.5 * (position * position * position * position * position + 2.0) + } + } + + internal static let EaseInSine = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position: TimeInterval = elapsed / duration + return Double( -cos(position * Double.pi / 2) + 1.0 ) + } + + internal static let EaseOutSine = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position: TimeInterval = elapsed / duration + return Double( sin(position * Double.pi / 2) ) + } + + internal static let EaseInOutSine = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position: TimeInterval = elapsed / duration + return Double( -0.5 * (cos(Double.pi * position) - 1.0) ) + } + + internal static let EaseInExpo = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + return (elapsed == 0) ? 0.0 : Double(pow(2.0, 10.0 * (elapsed / duration - 1.0))) + } + + internal static let EaseOutExpo = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + return (elapsed == duration) ? 1.0 : (-Double(pow(2.0, -10.0 * elapsed / duration)) + 1.0) + } + + internal static let EaseInOutExpo = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + if elapsed == 0 + { + return 0.0 + } + if elapsed == duration + { + return 1.0 + } + + var position: TimeInterval = elapsed / (duration / 2.0) + if position < 1.0 + { + return Double( 0.5 * pow(2.0, 10.0 * (position - 1.0)) ) + } + + position = position - 1.0 + return Double( 0.5 * (-pow(2.0, -10.0 * position) + 2.0) ) + } + + internal static let EaseInCirc = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / duration) + return -(Double(sqrt(1.0 - position * position)) - 1.0) + } + + internal static let EaseOutCirc = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position = Double(elapsed / duration) + position -= 1.0 + return Double( sqrt(1 - position * position) ) + } + + internal static let EaseInOutCirc = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position: TimeInterval = elapsed / (duration / 2.0) + if position < 1.0 + { + return Double( -0.5 * (sqrt(1.0 - position * position) - 1.0) ) + } + position -= 2.0 + return Double( 0.5 * (sqrt(1.0 - position * position) + 1.0) ) + } + + internal static let EaseInElastic = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + if elapsed == 0.0 + { + return 0.0 + } + + var position: TimeInterval = elapsed / duration + if position == 1.0 + { + return 1.0 + } + + var p = duration * 0.3 + var s = p / (2.0 * Double.pi) * asin(1.0) + position -= 1.0 + return Double( -(pow(2.0, 10.0 * position) * sin((position * duration - s) * (2.0 * Double.pi) / p)) ) + } + + internal static let EaseOutElastic = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + if elapsed == 0.0 + { + return 0.0 + } + + var position: TimeInterval = elapsed / duration + if position == 1.0 + { + return 1.0 + } + + var p = duration * 0.3 + var s = p / (2.0 * Double.pi) * asin(1.0) + return Double( pow(2.0, -10.0 * position) * sin((position * duration - s) * (2.0 * Double.pi) / p) + 1.0 ) + } + + internal static let EaseInOutElastic = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + if elapsed == 0.0 + { + return 0.0 + } + + var position: TimeInterval = elapsed / (duration / 2.0) + if position == 2.0 + { + return 1.0 + } + + var p = duration * (0.3 * 1.5) + var s = p / (2.0 * Double.pi) * asin(1.0) + if position < 1.0 + { + position -= 1.0 + return Double( -0.5 * (pow(2.0, 10.0 * position) * sin((position * duration - s) * (2.0 * Double.pi) / p)) ) + } + position -= 1.0 + return Double( pow(2.0, -10.0 * position) * sin((position * duration - s) * (2.0 * Double.pi) / p) * 0.5 + 1.0 ) + } + + internal static let EaseInBack = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + let s: TimeInterval = 1.70158 + var position: TimeInterval = elapsed / duration + return Double( position * position * ((s + 1.0) * position - s) ) + } + + internal static let EaseOutBack = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + let s: TimeInterval = 1.70158 + var position: TimeInterval = elapsed / duration + position -= 1.0 + return Double( position * position * ((s + 1.0) * position + s) + 1.0 ) + } + + internal static let EaseInOutBack = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var s: TimeInterval = 1.70158 + var position: TimeInterval = elapsed / (duration / 2.0) + if position < 1.0 + { + s *= 1.525 + return Double( 0.5 * (position * position * ((s + 1.0) * position - s)) ) + } + s *= 1.525 + position -= 2.0 + return Double( 0.5 * (position * position * ((s + 1.0) * position + s) + 2.0) ) + } + + internal static let EaseInBounce = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + return 1.0 - EaseOutBounce(duration - elapsed, duration) + } + + internal static let EaseOutBounce = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + var position: TimeInterval = elapsed / duration + if position < (1.0 / 2.75) + { + return Double( 7.5625 * position * position ) + } + else if position < (2.0 / 2.75) + { + position -= (1.5 / 2.75) + return Double( 7.5625 * position * position + 0.75 ) + } + else if position < (2.5 / 2.75) + { + position -= (2.25 / 2.75) + return Double( 7.5625 * position * position + 0.9375 ) + } + else + { + position -= (2.625 / 2.75) + return Double( 7.5625 * position * position + 0.984375 ) + } + } + + internal static let EaseInOutBounce = { (elapsed: TimeInterval, duration: TimeInterval) -> Double in + if elapsed < (duration / 2.0) + { + return EaseInBounce(elapsed * 2.0, duration) * 0.5 + } + return EaseOutBounce(elapsed * 2.0 - duration, duration) * 0.5 + 0.5 + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Charts/BarChartView.swift b/Carthage/Checkouts/Charts/Source/Charts/Charts/BarChartView.swift new file mode 100644 index 00000000000..4f9aaa0bc9e --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Charts/BarChartView.swift @@ -0,0 +1,186 @@ +// +// BarChartView.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// Chart that draws bars. +open class BarChartView: BarLineChartViewBase, BarChartDataProvider +{ + /// if set to true, all values are drawn above their bars, instead of below their top + private var _drawValueAboveBarEnabled = true + + /// if set to true, a grey area is drawn behind each bar that indicates the maximum value + private var _drawBarShadowEnabled = false + + internal override func initialize() + { + super.initialize() + + renderer = BarChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) + + self.highlighter = BarHighlighter(chart: self) + + self.xAxis.spaceMin = 0.5 + self.xAxis.spaceMax = 0.5 + } + + internal override func calcMinMax() + { + guard let data = self.data as? BarChartData + else { return } + + if fitBars + { + _xAxis.calculate( + min: data.xMin - data.barWidth / 2.0, + max: data.xMax + data.barWidth / 2.0) + } + else + { + _xAxis.calculate(min: data.xMin, max: data.xMax) + } + + // calculate axis range (min / max) according to provided data + leftAxis.calculate( + min: data.getYMin(axis: .left), + max: data.getYMax(axis: .left)) + rightAxis.calculate( + min: data.getYMin(axis: .right), + max: data.getYMax(axis: .right)) + } + + /// - Returns: The Highlight object (contains x-index and DataSet index) of the selected value at the given touch point inside the BarChart. + open override func getHighlightByTouchPoint(_ pt: CGPoint) -> Highlight? + { + if _data === nil + { + Swift.print("Can't select by touch. No data set.") + return nil + } + + guard let h = self.highlighter?.getHighlight(x: pt.x, y: pt.y) + else { return nil } + + if !isHighlightFullBarEnabled { return h } + + // For isHighlightFullBarEnabled, remove stackIndex + return Highlight( + x: h.x, y: h.y, + xPx: h.xPx, yPx: h.yPx, + dataIndex: h.dataIndex, + dataSetIndex: h.dataSetIndex, + stackIndex: -1, + axis: h.axis) + } + + /// - Returns: The bounding box of the specified Entry in the specified DataSet. Returns null if the Entry could not be found in the charts data. + @objc open func getBarBounds(entry e: BarChartDataEntry) -> CGRect + { + guard let + data = _data as? BarChartData, + let set = data.getDataSetForEntry(e) as? IBarChartDataSet + else { return CGRect.null } + + let y = e.y + let x = e.x + + let barWidth = data.barWidth + + let left = x - barWidth / 2.0 + let right = x + barWidth / 2.0 + let top = y >= 0.0 ? y : 0.0 + let bottom = y <= 0.0 ? y : 0.0 + + var bounds = CGRect(x: left, y: top, width: right - left, height: bottom - top) + + getTransformer(forAxis: set.axisDependency).rectValueToPixel(&bounds) + + return bounds + } + + /// Groups all BarDataSet objects this data object holds together by modifying the x-value of their entries. + /// Previously set x-values of entries will be overwritten. Leaves space between bars and groups as specified by the parameters. + /// Calls `notifyDataSetChanged()` afterwards. + /// + /// - Parameters: + /// - fromX: the starting point on the x-axis where the grouping should begin + /// - groupSpace: the space between groups of bars in values (not pixels) e.g. 0.8f for bar width 1f + /// - barSpace: the space between individual bars in values (not pixels) e.g. 0.1f for bar width 1f + @objc open func groupBars(fromX: Double, groupSpace: Double, barSpace: Double) + { + guard let barData = self.barData + else + { + Swift.print("You need to set data for the chart before grouping bars.", terminator: "\n") + return + } + + barData.groupBars(fromX: fromX, groupSpace: groupSpace, barSpace: barSpace) + notifyDataSetChanged() + } + + /// Highlights the value at the given x-value in the given DataSet. Provide -1 as the dataSetIndex to undo all highlighting. + /// + /// - Parameters: + /// - x: + /// - dataSetIndex: + /// - stackIndex: the index inside the stack - only relevant for stacked entries + @objc open func highlightValue(x: Double, dataSetIndex: Int, stackIndex: Int) + { + highlightValue(Highlight(x: x, dataSetIndex: dataSetIndex, stackIndex: stackIndex)) + } + + // MARK: Accessors + + /// if set to true, all values are drawn above their bars, instead of below their top + @objc open var drawValueAboveBarEnabled: Bool + { + get { return _drawValueAboveBarEnabled } + set + { + _drawValueAboveBarEnabled = newValue + setNeedsDisplay() + } + } + + /// if set to true, a grey area is drawn behind each bar that indicates the maximum value + @objc open var drawBarShadowEnabled: Bool + { + get { return _drawBarShadowEnabled } + set + { + _drawBarShadowEnabled = newValue + setNeedsDisplay() + } + } + + /// Adds half of the bar width to each side of the x-axis range in order to allow the bars of the barchart to be fully displayed. + /// **default**: false + @objc open var fitBars = false + + /// Set this to `true` to make the highlight operation full-bar oriented, `false` to make it highlight single values (relevant only for stacked). + /// If enabled, highlighting operations will highlight the whole bar, even if only a single stack entry was tapped. + @objc open var highlightFullBarEnabled: Bool = false + + /// `true` the highlight is be full-bar oriented, `false` ifsingle-value + open var isHighlightFullBarEnabled: Bool { return highlightFullBarEnabled } + + // MARK: - BarChartDataProvider + + open var barData: BarChartData? { return _data as? BarChartData } + + /// `true` if drawing values above bars is enabled, `false` ifnot + open var isDrawValueAboveBarEnabled: Bool { return drawValueAboveBarEnabled } + + /// `true` if drawing shadows (maxvalue) for each bar is enabled, `false` ifnot + open var isDrawBarShadowEnabled: Bool { return drawBarShadowEnabled } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Charts/BarLineChartViewBase.swift b/Carthage/Checkouts/Charts/Source/Charts/Charts/BarLineChartViewBase.swift new file mode 100644 index 00000000000..2ae8256885a --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Charts/BarLineChartViewBase.swift @@ -0,0 +1,1958 @@ +// +// BarLineChartViewBase.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// Base-class of LineChart, BarChart, ScatterChart and CandleStickChart. +open class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChartDataProvider, NSUIGestureRecognizerDelegate +{ + /// the maximum number of entries to which values will be drawn + /// (entry numbers greater than this value will cause value-labels to disappear) + internal var _maxVisibleCount = 100 + + /// flag that indicates if auto scaling on the y axis is enabled + private var _autoScaleMinMaxEnabled = false + + private var _pinchZoomEnabled = false + private var _doubleTapToZoomEnabled = true + private var _dragXEnabled = true + private var _dragYEnabled = true + + private var _scaleXEnabled = true + private var _scaleYEnabled = true + + /// the color for the background of the chart-drawing area (everything behind the grid lines). + @objc open var gridBackgroundColor = NSUIColor(red: 240/255.0, green: 240/255.0, blue: 240/255.0, alpha: 1.0) + + @objc open var borderColor = NSUIColor.black + @objc open var borderLineWidth: CGFloat = 1.0 + + /// flag indicating if the grid background should be drawn or not + @objc open var drawGridBackgroundEnabled = false + + /// When enabled, the borders rectangle will be rendered. + /// If this is enabled, there is no point drawing the axis-lines of x- and y-axis. + @objc open var drawBordersEnabled = false + + /// When enabled, the values will be clipped to contentRect, otherwise they can bleed outside the content rect. + @objc open var clipValuesToContentEnabled: Bool = false + + /// When disabled, the data and/or highlights will not be clipped to contentRect. Disabling this option can + /// be useful, when the data lies fully within the content rect, but is drawn in such a way (such as thick lines) + /// that there is unwanted clipping. + @objc open var clipDataToContentEnabled: Bool = true + + /// Sets the minimum offset (padding) around the chart, defaults to 10 + @objc open var minOffset = CGFloat(10.0) + + /// Sets whether the chart should keep its position (zoom / scroll) after a rotation (orientation change) + /// **default**: false + @objc open var keepPositionOnRotation: Bool = false + + /// The left y-axis object. In the horizontal bar-chart, this is the + /// top axis. + @objc open internal(set) var leftAxis = YAxis(position: .left) + + /// The right y-axis object. In the horizontal bar-chart, this is the + /// bottom axis. + @objc open internal(set) var rightAxis = YAxis(position: .right) + + /// The left Y axis renderer. This is a read-write property so you can set your own custom renderer here. + /// **default**: An instance of YAxisRenderer + @objc open lazy var leftYAxisRenderer = YAxisRenderer(viewPortHandler: _viewPortHandler, yAxis: leftAxis, transformer: _leftAxisTransformer) + + /// The right Y axis renderer. This is a read-write property so you can set your own custom renderer here. + /// **default**: An instance of YAxisRenderer + @objc open lazy var rightYAxisRenderer = YAxisRenderer(viewPortHandler: _viewPortHandler, yAxis: rightAxis, transformer: _rightAxisTransformer) + + internal var _leftAxisTransformer: Transformer! + internal var _rightAxisTransformer: Transformer! + + /// The X axis renderer. This is a read-write property so you can set your own custom renderer here. + /// **default**: An instance of XAxisRenderer + @objc open lazy var xAxisRenderer = XAxisRenderer(viewPortHandler: _viewPortHandler, xAxis: _xAxis, transformer: _leftAxisTransformer) + + internal var _tapGestureRecognizer: NSUITapGestureRecognizer! + internal var _doubleTapGestureRecognizer: NSUITapGestureRecognizer! + #if !os(tvOS) + internal var _pinchGestureRecognizer: NSUIPinchGestureRecognizer! + #endif + internal var _panGestureRecognizer: NSUIPanGestureRecognizer! + + /// flag that indicates if a custom viewport offset has been set + private var _customViewPortEnabled = false + + public override init(frame: CGRect) + { + super.init(frame: frame) + } + + public required init?(coder aDecoder: NSCoder) + { + super.init(coder: aDecoder) + } + + deinit + { + stopDeceleration() + } + + internal override func initialize() + { + super.initialize() + + _leftAxisTransformer = Transformer(viewPortHandler: _viewPortHandler) + _rightAxisTransformer = Transformer(viewPortHandler: _viewPortHandler) + + self.highlighter = ChartHighlighter(chart: self) + + _tapGestureRecognizer = NSUITapGestureRecognizer(target: self, action: #selector(tapGestureRecognized(_:))) + _doubleTapGestureRecognizer = NSUITapGestureRecognizer(target: self, action: #selector(doubleTapGestureRecognized(_:))) + _doubleTapGestureRecognizer.nsuiNumberOfTapsRequired = 2 + _panGestureRecognizer = NSUIPanGestureRecognizer(target: self, action: #selector(panGestureRecognized(_:))) + + _panGestureRecognizer.delegate = self + + self.addGestureRecognizer(_tapGestureRecognizer) + self.addGestureRecognizer(_doubleTapGestureRecognizer) + self.addGestureRecognizer(_panGestureRecognizer) + + _doubleTapGestureRecognizer.isEnabled = _doubleTapToZoomEnabled + _panGestureRecognizer.isEnabled = _dragXEnabled || _dragYEnabled + + #if !os(tvOS) + _pinchGestureRecognizer = NSUIPinchGestureRecognizer(target: self, action: #selector(BarLineChartViewBase.pinchGestureRecognized(_:))) + _pinchGestureRecognizer.delegate = self + self.addGestureRecognizer(_pinchGestureRecognizer) + _pinchGestureRecognizer.isEnabled = _pinchZoomEnabled || _scaleXEnabled || _scaleYEnabled + #endif + } + + open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) + { + // Saving current position of chart. + var oldPoint: CGPoint? + if (keepPositionOnRotation && (keyPath == "frame" || keyPath == "bounds")) + { + oldPoint = viewPortHandler.contentRect.origin + getTransformer(forAxis: .left).pixelToValues(&oldPoint!) + } + + // Superclass transforms chart. + super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context) + + // Restoring old position of chart + if var newPoint = oldPoint , keepPositionOnRotation + { + getTransformer(forAxis: .left).pointValueToPixel(&newPoint) + viewPortHandler.centerViewPort(pt: newPoint, chart: self) + } + else + { + viewPortHandler.refresh(newMatrix: viewPortHandler.touchMatrix, chart: self, invalidate: true) + } + } + + open override func draw(_ rect: CGRect) + { + super.draw(rect) + + guard data != nil, let renderer = renderer else { return } + + let optionalContext = NSUIGraphicsGetCurrentContext() + guard let context = optionalContext else { return } + + // execute all drawing commands + drawGridBackground(context: context) + + + if _autoScaleMinMaxEnabled + { + autoScale() + } + + if leftAxis.isEnabled + { + leftYAxisRenderer.computeAxis(min: leftAxis._axisMinimum, max: leftAxis._axisMaximum, inverted: leftAxis.isInverted) + } + + if rightAxis.isEnabled + { + rightYAxisRenderer.computeAxis(min: rightAxis._axisMinimum, max: rightAxis._axisMaximum, inverted: rightAxis.isInverted) + } + + if _xAxis.isEnabled + { + xAxisRenderer.computeAxis(min: _xAxis._axisMinimum, max: _xAxis._axisMaximum, inverted: false) + } + + xAxisRenderer.renderAxisLine(context: context) + leftYAxisRenderer.renderAxisLine(context: context) + rightYAxisRenderer.renderAxisLine(context: context) + + // The renderers are responsible for clipping, to account for line-width center etc. + xAxisRenderer.renderGridLines(context: context) + leftYAxisRenderer.renderGridLines(context: context) + rightYAxisRenderer.renderGridLines(context: context) + + if _xAxis.isEnabled && _xAxis.isDrawLimitLinesBehindDataEnabled + { + xAxisRenderer.renderLimitLines(context: context) + } + + if leftAxis.isEnabled && leftAxis.isDrawLimitLinesBehindDataEnabled + { + leftYAxisRenderer.renderLimitLines(context: context) + } + + if rightAxis.isEnabled && rightAxis.isDrawLimitLinesBehindDataEnabled + { + rightYAxisRenderer.renderLimitLines(context: context) + } + + context.saveGState() + // make sure the data cannot be drawn outside the content-rect + if clipDataToContentEnabled { + context.clip(to: _viewPortHandler.contentRect) + } + renderer.drawData(context: context) + + // if highlighting is enabled + if (valuesToHighlight()) + { + renderer.drawHighlighted(context: context, indices: _indicesToHighlight) + } + + context.restoreGState() + + renderer.drawExtras(context: context) + + if _xAxis.isEnabled && !_xAxis.isDrawLimitLinesBehindDataEnabled + { + xAxisRenderer.renderLimitLines(context: context) + } + + if leftAxis.isEnabled && !leftAxis.isDrawLimitLinesBehindDataEnabled + { + leftYAxisRenderer.renderLimitLines(context: context) + } + + if rightAxis.isEnabled && !rightAxis.isDrawLimitLinesBehindDataEnabled + { + rightYAxisRenderer.renderLimitLines(context: context) + } + + xAxisRenderer.renderAxisLabels(context: context) + leftYAxisRenderer.renderAxisLabels(context: context) + rightYAxisRenderer.renderAxisLabels(context: context) + + if clipValuesToContentEnabled + { + context.saveGState() + context.clip(to: _viewPortHandler.contentRect) + + renderer.drawValues(context: context) + + context.restoreGState() + } + else + { + renderer.drawValues(context: context) + } + + _legendRenderer.renderLegend(context: context) + + drawDescription(context: context) + + drawMarkers(context: context) + } + + private var _autoScaleLastLowestVisibleX: Double? + private var _autoScaleLastHighestVisibleX: Double? + + /// Performs auto scaling of the axis by recalculating the minimum and maximum y-values based on the entries currently in view. + internal func autoScale() + { + guard let data = _data + else { return } + + data.calcMinMaxY(fromX: self.lowestVisibleX, toX: self.highestVisibleX) + + _xAxis.calculate(min: data.xMin, max: data.xMax) + + // calculate axis range (min / max) according to provided data + + if leftAxis.isEnabled + { + leftAxis.calculate(min: data.getYMin(axis: .left), max: data.getYMax(axis: .left)) + } + + if rightAxis.isEnabled + { + rightAxis.calculate(min: data.getYMin(axis: .right), max: data.getYMax(axis: .right)) + } + + calculateOffsets() + } + + internal func prepareValuePxMatrix() + { + _rightAxisTransformer.prepareMatrixValuePx(chartXMin: _xAxis._axisMinimum, deltaX: CGFloat(xAxis.axisRange), deltaY: CGFloat(rightAxis.axisRange), chartYMin: rightAxis._axisMinimum) + _leftAxisTransformer.prepareMatrixValuePx(chartXMin: xAxis._axisMinimum, deltaX: CGFloat(xAxis.axisRange), deltaY: CGFloat(leftAxis.axisRange), chartYMin: leftAxis._axisMinimum) + } + + internal func prepareOffsetMatrix() + { + _rightAxisTransformer.prepareMatrixOffset(inverted: rightAxis.isInverted) + _leftAxisTransformer.prepareMatrixOffset(inverted: leftAxis.isInverted) + } + + open override func notifyDataSetChanged() + { + renderer?.initBuffers() + + calcMinMax() + + leftYAxisRenderer.computeAxis(min: leftAxis._axisMinimum, max: leftAxis._axisMaximum, inverted: leftAxis.isInverted) + rightYAxisRenderer.computeAxis(min: rightAxis._axisMinimum, max: rightAxis._axisMaximum, inverted: rightAxis.isInverted) + + if let data = _data + { + xAxisRenderer.computeAxis( + min: _xAxis._axisMinimum, + max: _xAxis._axisMaximum, + inverted: false) + + if _legend !== nil + { + legendRenderer?.computeLegend(data: data) + } + } + + calculateOffsets() + + setNeedsDisplay() + } + + internal override func calcMinMax() + { + // calculate / set x-axis range + _xAxis.calculate(min: _data?.xMin ?? 0.0, max: _data?.xMax ?? 0.0) + + // calculate axis range (min / max) according to provided data + leftAxis.calculate(min: _data?.getYMin(axis: .left) ?? 0.0, max: _data?.getYMax(axis: .left) ?? 0.0) + rightAxis.calculate(min: _data?.getYMin(axis: .right) ?? 0.0, max: _data?.getYMax(axis: .right) ?? 0.0) + } + + internal func calculateLegendOffsets(offsetLeft: inout CGFloat, offsetTop: inout CGFloat, offsetRight: inout CGFloat, offsetBottom: inout CGFloat) + { + // setup offsets for legend + if _legend !== nil && _legend.isEnabled && !_legend.drawInside + { + switch _legend.orientation + { + case .vertical: + + switch _legend.horizontalAlignment + { + case .left: + offsetLeft += min(_legend.neededWidth, _viewPortHandler.chartWidth * _legend.maxSizePercent) + _legend.xOffset + + case .right: + offsetRight += min(_legend.neededWidth, _viewPortHandler.chartWidth * _legend.maxSizePercent) + _legend.xOffset + + case .center: + + switch _legend.verticalAlignment + { + case .top: + offsetTop += min(_legend.neededHeight, _viewPortHandler.chartHeight * _legend.maxSizePercent) + _legend.yOffset + + case .bottom: + offsetBottom += min(_legend.neededHeight, _viewPortHandler.chartHeight * _legend.maxSizePercent) + _legend.yOffset + + default: + break + } + } + + case .horizontal: + + switch _legend.verticalAlignment + { + case .top: + offsetTop += min(_legend.neededHeight, _viewPortHandler.chartHeight * _legend.maxSizePercent) + _legend.yOffset + if xAxis.isEnabled && xAxis.isDrawLabelsEnabled + { + offsetTop += xAxis.labelRotatedHeight + } + + case .bottom: + offsetBottom += min(_legend.neededHeight, _viewPortHandler.chartHeight * _legend.maxSizePercent) + _legend.yOffset + if xAxis.isEnabled && xAxis.isDrawLabelsEnabled + { + offsetBottom += xAxis.labelRotatedHeight + } + + default: + break + } + } + } + } + + internal override func calculateOffsets() + { + if !_customViewPortEnabled + { + var offsetLeft = CGFloat(0.0) + var offsetRight = CGFloat(0.0) + var offsetTop = CGFloat(0.0) + var offsetBottom = CGFloat(0.0) + + calculateLegendOffsets(offsetLeft: &offsetLeft, + offsetTop: &offsetTop, + offsetRight: &offsetRight, + offsetBottom: &offsetBottom) + + // offsets for y-labels + if leftAxis.needsOffset + { + offsetLeft += leftAxis.requiredSize().width + } + + if rightAxis.needsOffset + { + offsetRight += rightAxis.requiredSize().width + } + + if xAxis.isEnabled && xAxis.isDrawLabelsEnabled + { + let xlabelheight = xAxis.labelRotatedHeight + xAxis.yOffset + + // offsets for x-labels + if xAxis.labelPosition == .bottom + { + offsetBottom += xlabelheight + } + else if xAxis.labelPosition == .top + { + offsetTop += xlabelheight + } + else if xAxis.labelPosition == .bothSided + { + offsetBottom += xlabelheight + offsetTop += xlabelheight + } + } + + offsetTop += self.extraTopOffset + offsetRight += self.extraRightOffset + offsetBottom += self.extraBottomOffset + offsetLeft += self.extraLeftOffset + + _viewPortHandler.restrainViewPort( + offsetLeft: max(self.minOffset, offsetLeft), + offsetTop: max(self.minOffset, offsetTop), + offsetRight: max(self.minOffset, offsetRight), + offsetBottom: max(self.minOffset, offsetBottom)) + } + + prepareOffsetMatrix() + prepareValuePxMatrix() + } + + /// draws the grid background + internal func drawGridBackground(context: CGContext) + { + if drawGridBackgroundEnabled || drawBordersEnabled + { + context.saveGState() + } + + if drawGridBackgroundEnabled + { + // draw the grid background + context.setFillColor(gridBackgroundColor.cgColor) + context.fill(_viewPortHandler.contentRect) + } + + if drawBordersEnabled + { + context.setLineWidth(borderLineWidth) + context.setStrokeColor(borderColor.cgColor) + context.stroke(_viewPortHandler.contentRect) + } + + if drawGridBackgroundEnabled || drawBordersEnabled + { + context.restoreGState() + } + } + + // MARK: - Gestures + + private enum GestureScaleAxis + { + case both + case x + case y + } + + private var _isDragging = false + private var _isScaling = false + private var _gestureScaleAxis = GestureScaleAxis.both + private var _closestDataSetToTouch: IChartDataSet! + private var _panGestureReachedEdge: Bool = false + private weak var _outerScrollView: NSUIScrollView? + + private var _lastPanPoint = CGPoint() /// This is to prevent using setTranslation which resets velocity + + private var _decelerationLastTime: TimeInterval = 0.0 + private var _decelerationDisplayLink: NSUIDisplayLink! + private var _decelerationVelocity = CGPoint() + + @objc private func tapGestureRecognized(_ recognizer: NSUITapGestureRecognizer) + { + if _data === nil + { + return + } + + if recognizer.state == NSUIGestureRecognizerState.ended + { + if !isHighLightPerTapEnabled { return } + + let h = getHighlightByTouchPoint(recognizer.location(in: self)) + + if h === nil || h == self.lastHighlighted + { + lastHighlighted = nil + highlightValue(nil, callDelegate: true) + } + else + { + lastHighlighted = h + highlightValue(h, callDelegate: true) + } + } + } + + @objc private func doubleTapGestureRecognized(_ recognizer: NSUITapGestureRecognizer) + { + if _data === nil + { + return + } + + if recognizer.state == NSUIGestureRecognizerState.ended + { + if _data !== nil && _doubleTapToZoomEnabled && (data?.entryCount ?? 0) > 0 + { + var location = recognizer.location(in: self) + location.x = location.x - _viewPortHandler.offsetLeft + + if isTouchInverted() + { + location.y = -(location.y - _viewPortHandler.offsetTop) + } + else + { + location.y = -(self.bounds.size.height - location.y - _viewPortHandler.offsetBottom) + } + + let scaleX: CGFloat = isScaleXEnabled ? 1.4 : 1.0 + let scaleY: CGFloat = isScaleYEnabled ? 1.4 : 1.0 + + self.zoom(scaleX: scaleX, scaleY: scaleY, x: location.x, y: location.y) + delegate?.chartScaled?(self, scaleX: scaleX, scaleY: scaleY) + } + } + } + + #if !os(tvOS) + @objc private func pinchGestureRecognized(_ recognizer: NSUIPinchGestureRecognizer) + { + if recognizer.state == NSUIGestureRecognizerState.began + { + stopDeceleration() + + if _data !== nil && + (_pinchZoomEnabled || _scaleXEnabled || _scaleYEnabled) + { + _isScaling = true + + if _pinchZoomEnabled + { + _gestureScaleAxis = .both + } + else + { + let x = abs(recognizer.location(in: self).x - recognizer.nsuiLocationOfTouch(1, inView: self).x) + let y = abs(recognizer.location(in: self).y - recognizer.nsuiLocationOfTouch(1, inView: self).y) + + if _scaleXEnabled != _scaleYEnabled + { + _gestureScaleAxis = _scaleXEnabled ? .x : .y + } + else + { + _gestureScaleAxis = x > y ? .x : .y + } + } + } + } + else if recognizer.state == NSUIGestureRecognizerState.ended || + recognizer.state == NSUIGestureRecognizerState.cancelled + { + if _isScaling + { + _isScaling = false + + // Range might have changed, which means that Y-axis labels could have changed in size, affecting Y-axis size. So we need to recalculate offsets. + calculateOffsets() + setNeedsDisplay() + } + } + else if recognizer.state == NSUIGestureRecognizerState.changed + { + let isZoomingOut = (recognizer.nsuiScale < 1) + var canZoomMoreX = isZoomingOut ? _viewPortHandler.canZoomOutMoreX : _viewPortHandler.canZoomInMoreX + var canZoomMoreY = isZoomingOut ? _viewPortHandler.canZoomOutMoreY : _viewPortHandler.canZoomInMoreY + + if _isScaling + { + canZoomMoreX = canZoomMoreX && _scaleXEnabled && (_gestureScaleAxis == .both || _gestureScaleAxis == .x) + canZoomMoreY = canZoomMoreY && _scaleYEnabled && (_gestureScaleAxis == .both || _gestureScaleAxis == .y) + if canZoomMoreX || canZoomMoreY + { + var location = recognizer.location(in: self) + location.x = location.x - _viewPortHandler.offsetLeft + + if isTouchInverted() + { + location.y = -(location.y - _viewPortHandler.offsetTop) + } + else + { + location.y = -(_viewPortHandler.chartHeight - location.y - _viewPortHandler.offsetBottom) + } + + let scaleX = canZoomMoreX ? recognizer.nsuiScale : 1.0 + let scaleY = canZoomMoreY ? recognizer.nsuiScale : 1.0 + + var matrix = CGAffineTransform(translationX: location.x, y: location.y) + matrix = matrix.scaledBy(x: scaleX, y: scaleY) + matrix = matrix.translatedBy(x: -location.x, y: -location.y) + + matrix = _viewPortHandler.touchMatrix.concatenating(matrix) + + _viewPortHandler.refresh(newMatrix: matrix, chart: self, invalidate: true) + + if delegate !== nil + { + delegate?.chartScaled?(self, scaleX: scaleX, scaleY: scaleY) + } + } + + recognizer.nsuiScale = 1.0 + } + } + } + #endif + + @objc private func panGestureRecognized(_ recognizer: NSUIPanGestureRecognizer) + { + if recognizer.state == NSUIGestureRecognizerState.began && recognizer.nsuiNumberOfTouches() > 0 + { + stopDeceleration() + + if _data === nil || !self.isDragEnabled + { // If we have no data, we have nothing to pan and no data to highlight + return + } + + // If drag is enabled and we are in a position where there's something to drag: + // * If we're zoomed in, then obviously we have something to drag. + // * If we have a drag offset - we always have something to drag + if !self.hasNoDragOffset || !self.isFullyZoomedOut + { + _isDragging = true + + _closestDataSetToTouch = getDataSetByTouchPoint(point: recognizer.nsuiLocationOfTouch(0, inView: self)) + + var translation = recognizer.translation(in: self) + if !self.dragXEnabled + { + translation.x = 0.0 + } + else if !self.dragYEnabled + { + translation.y = 0.0 + } + + let didUserDrag = translation.x != 0.0 || translation.y != 0.0 + + // Check to see if user dragged at all and if so, can the chart be dragged by the given amount + if didUserDrag && !performPanChange(translation: translation) + { + if _outerScrollView !== nil + { + // We can stop dragging right now, and let the scroll view take control + _outerScrollView = nil + _isDragging = false + } + } + else + { + if _outerScrollView !== nil + { + // Prevent the parent scroll view from scrolling + _outerScrollView?.nsuiIsScrollEnabled = false + } + } + + _lastPanPoint = recognizer.translation(in: self) + } + else if self.isHighlightPerDragEnabled + { + // We will only handle highlights on NSUIGestureRecognizerState.Changed + + _isDragging = false + } + } + else if recognizer.state == NSUIGestureRecognizerState.changed + { + if _isDragging + { + let originalTranslation = recognizer.translation(in: self) + var translation = CGPoint(x: originalTranslation.x - _lastPanPoint.x, y: originalTranslation.y - _lastPanPoint.y) + + if !self.dragXEnabled + { + translation.x = 0.0 + } + else if !self.dragYEnabled + { + translation.y = 0.0 + } + + let _ = performPanChange(translation: translation) + + _lastPanPoint = originalTranslation + } + else if isHighlightPerDragEnabled + { + let h = getHighlightByTouchPoint(recognizer.location(in: self)) + + let lastHighlighted = self.lastHighlighted + + if h != lastHighlighted + { + self.lastHighlighted = h + self.highlightValue(h, callDelegate: true) + } + } + } + else if recognizer.state == NSUIGestureRecognizerState.ended || recognizer.state == NSUIGestureRecognizerState.cancelled + { + if _isDragging + { + if recognizer.state == NSUIGestureRecognizerState.ended && isDragDecelerationEnabled + { + stopDeceleration() + + _decelerationLastTime = CACurrentMediaTime() + _decelerationVelocity = recognizer.velocity(in: self) + + _decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(BarLineChartViewBase.decelerationLoop)) + _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoop.Mode.common) + } + + _isDragging = false + } + + if _outerScrollView !== nil + { + _outerScrollView?.nsuiIsScrollEnabled = true + _outerScrollView = nil + } + + delegate?.chartViewDidEndPanning?(self) + } + } + + private func performPanChange(translation: CGPoint) -> Bool + { + var translation = translation + + if isTouchInverted() + { + if self is HorizontalBarChartView + { + translation.x = -translation.x + } + else + { + translation.y = -translation.y + } + } + + let originalMatrix = _viewPortHandler.touchMatrix + + var matrix = CGAffineTransform(translationX: translation.x, y: translation.y) + matrix = originalMatrix.concatenating(matrix) + + matrix = _viewPortHandler.refresh(newMatrix: matrix, chart: self, invalidate: true) + + if matrix != originalMatrix + { + delegate?.chartTranslated?(self, dX: translation.x, dY: translation.y) + } + + // Did we managed to actually drag or did we reach the edge? + return matrix.tx != originalMatrix.tx || matrix.ty != originalMatrix.ty + } + + private func isTouchInverted() -> Bool + { + return isAnyAxisInverted && + _closestDataSetToTouch !== nil && + getAxis(_closestDataSetToTouch.axisDependency).isInverted + } + + @objc open func stopDeceleration() + { + if _decelerationDisplayLink !== nil + { + _decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoop.Mode.common) + _decelerationDisplayLink = nil + } + } + + @objc private func decelerationLoop() + { + let currentTime = CACurrentMediaTime() + + _decelerationVelocity.x *= self.dragDecelerationFrictionCoef + _decelerationVelocity.y *= self.dragDecelerationFrictionCoef + + let timeInterval = CGFloat(currentTime - _decelerationLastTime) + + let distance = CGPoint( + x: _decelerationVelocity.x * timeInterval, + y: _decelerationVelocity.y * timeInterval + ) + + if !performPanChange(translation: distance) + { + // We reached the edge, stop + _decelerationVelocity.x = 0.0 + _decelerationVelocity.y = 0.0 + } + + _decelerationLastTime = currentTime + + if abs(_decelerationVelocity.x) < 0.001 && abs(_decelerationVelocity.y) < 0.001 + { + stopDeceleration() + + // Range might have changed, which means that Y-axis labels could have changed in size, affecting Y-axis size. So we need to recalculate offsets. + calculateOffsets() + setNeedsDisplay() + } + } + + private func nsuiGestureRecognizerShouldBegin(_ gestureRecognizer: NSUIGestureRecognizer) -> Bool + { + if gestureRecognizer == _panGestureRecognizer + { + let velocity = _panGestureRecognizer.velocity(in: self) + if _data === nil || !isDragEnabled || + (self.hasNoDragOffset && self.isFullyZoomedOut && !self.isHighlightPerDragEnabled) || + (!_dragYEnabled && abs(velocity.y) > abs(velocity.x)) || + (!_dragXEnabled && abs(velocity.y) < abs(velocity.x)) + { + return false + } + } + else + { + #if !os(tvOS) + if gestureRecognizer == _pinchGestureRecognizer + { + if _data === nil || (!_pinchZoomEnabled && !_scaleXEnabled && !_scaleYEnabled) + { + return false + } + } + #endif + } + + return true + } + + #if !os(OSX) + open override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool + { + if !super.gestureRecognizerShouldBegin(gestureRecognizer) + { + return false + } + + return nsuiGestureRecognizerShouldBegin(gestureRecognizer) + } + #endif + + #if os(OSX) + public func gestureRecognizerShouldBegin(gestureRecognizer: NSGestureRecognizer) -> Bool + { + return nsuiGestureRecognizerShouldBegin(gestureRecognizer) + } + #endif + + open func gestureRecognizer(_ gestureRecognizer: NSUIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: NSUIGestureRecognizer) -> Bool + { + #if !os(tvOS) + if ((gestureRecognizer is NSUIPinchGestureRecognizer && otherGestureRecognizer is NSUIPanGestureRecognizer) || + (gestureRecognizer is NSUIPanGestureRecognizer && otherGestureRecognizer is NSUIPinchGestureRecognizer)) + { + return true + } + #endif + + if gestureRecognizer is NSUIPanGestureRecognizer, + otherGestureRecognizer is NSUIPanGestureRecognizer, + gestureRecognizer == _panGestureRecognizer + { + var scrollView = self.superview + while scrollView != nil && !(scrollView is NSUIScrollView) + { + scrollView = scrollView?.superview + } + + // If there is two scrollview together, we pick the superview of the inner scrollview. + // In the case of UITableViewWrepperView, the superview will be UITableView + if let superViewOfScrollView = scrollView?.superview, + superViewOfScrollView is NSUIScrollView + { + scrollView = superViewOfScrollView + } + + var foundScrollView = scrollView as? NSUIScrollView + + if !(foundScrollView?.nsuiIsScrollEnabled ?? true) + { + foundScrollView = nil + } + + let scrollViewPanGestureRecognizer = foundScrollView?.nsuiGestureRecognizers?.first { + $0 is NSUIPanGestureRecognizer + } + + if otherGestureRecognizer === scrollViewPanGestureRecognizer + { + _outerScrollView = foundScrollView + + return true + } + } + + return false + } + + /// MARK: Viewport modifiers + + /// Zooms in by 1.4, into the charts center. + @objc open func zoomIn() + { + let center = _viewPortHandler.contentCenter + + let matrix = _viewPortHandler.zoomIn(x: center.x, y: -center.y) + _viewPortHandler.refresh(newMatrix: matrix, chart: self, invalidate: false) + + // Range might have changed, which means that Y-axis labels could have changed in size, affecting Y-axis size. So we need to recalculate offsets. + calculateOffsets() + setNeedsDisplay() + } + + /// Zooms out by 0.7, from the charts center. + @objc open func zoomOut() + { + let center = _viewPortHandler.contentCenter + + let matrix = _viewPortHandler.zoomOut(x: center.x, y: -center.y) + _viewPortHandler.refresh(newMatrix: matrix, chart: self, invalidate: false) + + // Range might have changed, which means that Y-axis labels could have changed in size, affecting Y-axis size. So we need to recalculate offsets. + calculateOffsets() + setNeedsDisplay() + } + + /// Zooms out to original size. + @objc open func resetZoom() + { + let matrix = _viewPortHandler.resetZoom() + _viewPortHandler.refresh(newMatrix: matrix, chart: self, invalidate: false) + + // Range might have changed, which means that Y-axis labels could have changed in size, affecting Y-axis size. So we need to recalculate offsets. + calculateOffsets() + setNeedsDisplay() + } + + /// Zooms in or out by the given scale factor. x and y are the coordinates + /// (in pixels) of the zoom center. + /// + /// - Parameters: + /// - scaleX: if < 1 --> zoom out, if > 1 --> zoom in + /// - scaleY: if < 1 --> zoom out, if > 1 --> zoom in + /// - x: + /// - y: + @objc open func zoom( + scaleX: CGFloat, + scaleY: CGFloat, + x: CGFloat, + y: CGFloat) + { + let matrix = _viewPortHandler.zoom(scaleX: scaleX, scaleY: scaleY, x: x, y: -y) + _viewPortHandler.refresh(newMatrix: matrix, chart: self, invalidate: false) + + // Range might have changed, which means that Y-axis labels could have changed in size, affecting Y-axis size. So we need to recalculate offsets. + calculateOffsets() + setNeedsDisplay() + } + + /// Zooms in or out by the given scale factor. + /// x and y are the values (**not pixels**) of the zoom center. + /// + /// - Parameters: + /// - scaleX: if < 1 --> zoom out, if > 1 --> zoom in + /// - scaleY: if < 1 --> zoom out, if > 1 --> zoom in + /// - xValue: + /// - yValue: + /// - axis: + @objc open func zoom( + scaleX: CGFloat, + scaleY: CGFloat, + xValue: Double, + yValue: Double, + axis: YAxis.AxisDependency) + { + let job = ZoomViewJob( + viewPortHandler: viewPortHandler, + scaleX: scaleX, + scaleY: scaleY, + xValue: xValue, + yValue: yValue, + transformer: getTransformer(forAxis: axis), + axis: axis, + view: self) + addViewportJob(job) + } + + /// Zooms to the center of the chart with the given scale factor. + /// + /// - Parameters: + /// - scaleX: if < 1 --> zoom out, if > 1 --> zoom in + /// - scaleY: if < 1 --> zoom out, if > 1 --> zoom in + /// - xValue: + /// - yValue: + /// - axis: + @objc open func zoomToCenter( + scaleX: CGFloat, + scaleY: CGFloat) + { + let center = centerOffsets + let matrix = viewPortHandler.zoom( + scaleX: scaleX, + scaleY: scaleY, + x: center.x, + y: -center.y) + viewPortHandler.refresh(newMatrix: matrix, chart: self, invalidate: false) + } + + /// Zooms by the specified scale factor to the specified values on the specified axis. + /// + /// - Parameters: + /// - scaleX: + /// - scaleY: + /// - xValue: + /// - yValue: + /// - axis: which axis should be used as a reference for the y-axis + /// - duration: the duration of the animation in seconds + /// - easing: + @objc open func zoomAndCenterViewAnimated( + scaleX: CGFloat, + scaleY: CGFloat, + xValue: Double, + yValue: Double, + axis: YAxis.AxisDependency, + duration: TimeInterval, + easing: ChartEasingFunctionBlock?) + { + let origin = valueForTouchPoint( + point: CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentTop), + axis: axis) + + let job = AnimatedZoomViewJob( + viewPortHandler: viewPortHandler, + transformer: getTransformer(forAxis: axis), + view: self, + yAxis: getAxis(axis), + xAxisRange: _xAxis.axisRange, + scaleX: scaleX, + scaleY: scaleY, + xOrigin: viewPortHandler.scaleX, + yOrigin: viewPortHandler.scaleY, + zoomCenterX: CGFloat(xValue), + zoomCenterY: CGFloat(yValue), + zoomOriginX: origin.x, + zoomOriginY: origin.y, + duration: duration, + easing: easing) + + addViewportJob(job) + } + + /// Zooms by the specified scale factor to the specified values on the specified axis. + /// + /// - Parameters: + /// - scaleX: + /// - scaleY: + /// - xValue: + /// - yValue: + /// - axis: which axis should be used as a reference for the y-axis + /// - duration: the duration of the animation in seconds + /// - easing: + @objc open func zoomAndCenterViewAnimated( + scaleX: CGFloat, + scaleY: CGFloat, + xValue: Double, + yValue: Double, + axis: YAxis.AxisDependency, + duration: TimeInterval, + easingOption: ChartEasingOption) + { + zoomAndCenterViewAnimated(scaleX: scaleX, scaleY: scaleY, xValue: xValue, yValue: yValue, axis: axis, duration: duration, easing: easingFunctionFromOption(easingOption)) + } + + /// Zooms by the specified scale factor to the specified values on the specified axis. + /// + /// - Parameters: + /// - scaleX: + /// - scaleY: + /// - xValue: + /// - yValue: + /// - axis: which axis should be used as a reference for the y-axis + /// - duration: the duration of the animation in seconds + /// - easing: + @objc open func zoomAndCenterViewAnimated( + scaleX: CGFloat, + scaleY: CGFloat, + xValue: Double, + yValue: Double, + axis: YAxis.AxisDependency, + duration: TimeInterval) + { + zoomAndCenterViewAnimated(scaleX: scaleX, scaleY: scaleY, xValue: xValue, yValue: yValue, axis: axis, duration: duration, easingOption: .easeInOutSine) + } + + /// Resets all zooming and dragging and makes the chart fit exactly it's bounds. + @objc open func fitScreen() + { + let matrix = _viewPortHandler.fitScreen() + _viewPortHandler.refresh(newMatrix: matrix, chart: self, invalidate: false) + + calculateOffsets() + setNeedsDisplay() + } + + /// Sets the minimum scale value to which can be zoomed out. 1 = fitScreen + @objc open func setScaleMinima(_ scaleX: CGFloat, scaleY: CGFloat) + { + _viewPortHandler.setMinimumScaleX(scaleX) + _viewPortHandler.setMinimumScaleY(scaleY) + } + + @objc open var visibleXRange: Double + { + return abs(highestVisibleX - lowestVisibleX) + } + + /// Sets the size of the area (range on the x-axis) that should be maximum visible at once (no further zooming out allowed). + /// + /// If this is e.g. set to 10, no more than a range of 10 values on the x-axis can be viewed at once without scrolling. + /// + /// If you call this method, chart must have data or it has no effect. + @objc open func setVisibleXRangeMaximum(_ maxXRange: Double) + { + let xScale = _xAxis.axisRange / maxXRange + _viewPortHandler.setMinimumScaleX(CGFloat(xScale)) + } + + /// Sets the size of the area (range on the x-axis) that should be minimum visible at once (no further zooming in allowed). + /// + /// If this is e.g. set to 10, no less than a range of 10 values on the x-axis can be viewed at once without scrolling. + /// + /// If you call this method, chart must have data or it has no effect. + @objc open func setVisibleXRangeMinimum(_ minXRange: Double) + { + let xScale = _xAxis.axisRange / minXRange + _viewPortHandler.setMaximumScaleX(CGFloat(xScale)) + } + + /// Limits the maximum and minimum value count that can be visible by pinching and zooming. + /// + /// e.g. minRange=10, maxRange=100 no less than 10 values and no more that 100 values can be viewed + /// at once without scrolling. + /// + /// If you call this method, chart must have data or it has no effect. + @objc open func setVisibleXRange(minXRange: Double, maxXRange: Double) + { + let minScale = _xAxis.axisRange / maxXRange + let maxScale = _xAxis.axisRange / minXRange + _viewPortHandler.setMinMaxScaleX( + minScaleX: CGFloat(minScale), + maxScaleX: CGFloat(maxScale)) + } + + /// Sets the size of the area (range on the y-axis) that should be maximum visible at once. + /// + /// - Parameters: + /// - yRange: + /// - axis: - the axis for which this limit should apply + @objc open func setVisibleYRangeMaximum(_ maxYRange: Double, axis: YAxis.AxisDependency) + { + let yScale = getAxisRange(axis: axis) / maxYRange + _viewPortHandler.setMinimumScaleY(CGFloat(yScale)) + } + + /// Sets the size of the area (range on the y-axis) that should be minimum visible at once, no further zooming in possible. + /// + /// - Parameters: + /// - yRange: + /// - axis: - the axis for which this limit should apply + @objc open func setVisibleYRangeMinimum(_ minYRange: Double, axis: YAxis.AxisDependency) + { + let yScale = getAxisRange(axis: axis) / minYRange + _viewPortHandler.setMaximumScaleY(CGFloat(yScale)) + } + + /// Limits the maximum and minimum y range that can be visible by pinching and zooming. + /// + /// - Parameters: + /// - minYRange: + /// - maxYRange: + /// - axis: + @objc open func setVisibleYRange(minYRange: Double, maxYRange: Double, axis: YAxis.AxisDependency) + { + let minScale = getAxisRange(axis: axis) / minYRange + let maxScale = getAxisRange(axis: axis) / maxYRange + _viewPortHandler.setMinMaxScaleY(minScaleY: CGFloat(minScale), maxScaleY: CGFloat(maxScale)) + } + + /// Moves the left side of the current viewport to the specified x-value. + /// This also refreshes the chart by calling setNeedsDisplay(). + @objc open func moveViewToX(_ xValue: Double) + { + let job = MoveViewJob( + viewPortHandler: viewPortHandler, + xValue: xValue, + yValue: 0.0, + transformer: getTransformer(forAxis: .left), + view: self) + + addViewportJob(job) + } + + /// Centers the viewport to the specified y-value on the y-axis. + /// This also refreshes the chart by calling setNeedsDisplay(). + /// + /// - Parameters: + /// - yValue: + /// - axis: - which axis should be used as a reference for the y-axis + @objc open func moveViewToY(_ yValue: Double, axis: YAxis.AxisDependency) + { + let yInView = getAxisRange(axis: axis) / Double(_viewPortHandler.scaleY) + + let job = MoveViewJob( + viewPortHandler: viewPortHandler, + xValue: 0.0, + yValue: yValue + yInView / 2.0, + transformer: getTransformer(forAxis: axis), + view: self) + + addViewportJob(job) + } + + /// This will move the left side of the current viewport to the specified x-value on the x-axis, and center the viewport to the specified y-value on the y-axis. + /// This also refreshes the chart by calling setNeedsDisplay(). + /// + /// - Parameters: + /// - xValue: + /// - yValue: + /// - axis: - which axis should be used as a reference for the y-axis + @objc open func moveViewTo(xValue: Double, yValue: Double, axis: YAxis.AxisDependency) + { + let yInView = getAxisRange(axis: axis) / Double(_viewPortHandler.scaleY) + + let job = MoveViewJob( + viewPortHandler: viewPortHandler, + xValue: xValue, + yValue: yValue + yInView / 2.0, + transformer: getTransformer(forAxis: axis), + view: self) + + addViewportJob(job) + } + + /// This will move the left side of the current viewport to the specified x-position and center the viewport to the specified y-position animated. + /// This also refreshes the chart by calling setNeedsDisplay(). + /// + /// - Parameters: + /// - xValue: + /// - yValue: + /// - axis: which axis should be used as a reference for the y-axis + /// - duration: the duration of the animation in seconds + /// - easing: + @objc open func moveViewToAnimated( + xValue: Double, + yValue: Double, + axis: YAxis.AxisDependency, + duration: TimeInterval, + easing: ChartEasingFunctionBlock?) + { + let bounds = valueForTouchPoint( + point: CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentTop), + axis: axis) + + let yInView = getAxisRange(axis: axis) / Double(_viewPortHandler.scaleY) + + let job = AnimatedMoveViewJob( + viewPortHandler: viewPortHandler, + xValue: xValue, + yValue: yValue + yInView / 2.0, + transformer: getTransformer(forAxis: axis), + view: self, + xOrigin: bounds.x, + yOrigin: bounds.y, + duration: duration, + easing: easing) + + addViewportJob(job) + } + + /// This will move the left side of the current viewport to the specified x-position and center the viewport to the specified y-position animated. + /// This also refreshes the chart by calling setNeedsDisplay(). + /// + /// - Parameters: + /// - xValue: + /// - yValue: + /// - axis: which axis should be used as a reference for the y-axis + /// - duration: the duration of the animation in seconds + /// - easing: + @objc open func moveViewToAnimated( + xValue: Double, + yValue: Double, + axis: YAxis.AxisDependency, + duration: TimeInterval, + easingOption: ChartEasingOption) + { + moveViewToAnimated(xValue: xValue, yValue: yValue, axis: axis, duration: duration, easing: easingFunctionFromOption(easingOption)) + } + + /// This will move the left side of the current viewport to the specified x-position and center the viewport to the specified y-position animated. + /// This also refreshes the chart by calling setNeedsDisplay(). + /// + /// - Parameters: + /// - xValue: + /// - yValue: + /// - axis: which axis should be used as a reference for the y-axis + /// - duration: the duration of the animation in seconds + /// - easing: + @objc open func moveViewToAnimated( + xValue: Double, + yValue: Double, + axis: YAxis.AxisDependency, + duration: TimeInterval) + { + moveViewToAnimated(xValue: xValue, yValue: yValue, axis: axis, duration: duration, easingOption: .easeInOutSine) + } + + /// This will move the center of the current viewport to the specified x-value and y-value. + /// This also refreshes the chart by calling setNeedsDisplay(). + /// + /// - Parameters: + /// - xValue: + /// - yValue: + /// - axis: - which axis should be used as a reference for the y-axis + @objc open func centerViewTo( + xValue: Double, + yValue: Double, + axis: YAxis.AxisDependency) + { + let yInView = getAxisRange(axis: axis) / Double(_viewPortHandler.scaleY) + let xInView = xAxis.axisRange / Double(_viewPortHandler.scaleX) + + let job = MoveViewJob( + viewPortHandler: viewPortHandler, + xValue: xValue - xInView / 2.0, + yValue: yValue + yInView / 2.0, + transformer: getTransformer(forAxis: axis), + view: self) + + addViewportJob(job) + } + + /// This will move the center of the current viewport to the specified x-value and y-value animated. + /// + /// - Parameters: + /// - xValue: + /// - yValue: + /// - axis: which axis should be used as a reference for the y-axis + /// - duration: the duration of the animation in seconds + /// - easing: + @objc open func centerViewToAnimated( + xValue: Double, + yValue: Double, + axis: YAxis.AxisDependency, + duration: TimeInterval, + easing: ChartEasingFunctionBlock?) + { + let bounds = valueForTouchPoint( + point: CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentTop), + axis: axis) + + let yInView = getAxisRange(axis: axis) / Double(_viewPortHandler.scaleY) + let xInView = xAxis.axisRange / Double(_viewPortHandler.scaleX) + + let job = AnimatedMoveViewJob( + viewPortHandler: viewPortHandler, + xValue: xValue - xInView / 2.0, + yValue: yValue + yInView / 2.0, + transformer: getTransformer(forAxis: axis), + view: self, + xOrigin: bounds.x, + yOrigin: bounds.y, + duration: duration, + easing: easing) + + addViewportJob(job) + } + + /// This will move the center of the current viewport to the specified x-value and y-value animated. + /// + /// - Parameters: + /// - xValue: + /// - yValue: + /// - axis: which axis should be used as a reference for the y-axis + /// - duration: the duration of the animation in seconds + /// - easing: + @objc open func centerViewToAnimated( + xValue: Double, + yValue: Double, + axis: YAxis.AxisDependency, + duration: TimeInterval, + easingOption: ChartEasingOption) + { + centerViewToAnimated(xValue: xValue, yValue: yValue, axis: axis, duration: duration, easing: easingFunctionFromOption(easingOption)) + } + + /// This will move the center of the current viewport to the specified x-value and y-value animated. + /// + /// - Parameters: + /// - xValue: + /// - yValue: + /// - axis: which axis should be used as a reference for the y-axis + /// - duration: the duration of the animation in seconds + /// - easing: + @objc open func centerViewToAnimated( + xValue: Double, + yValue: Double, + axis: YAxis.AxisDependency, + duration: TimeInterval) + { + centerViewToAnimated(xValue: xValue, yValue: yValue, axis: axis, duration: duration, easingOption: .easeInOutSine) + } + + /// Sets custom offsets for the current `ChartViewPort` (the offsets on the sides of the actual chart window). Setting this will prevent the chart from automatically calculating it's offsets. Use `resetViewPortOffsets()` to undo this. + /// ONLY USE THIS WHEN YOU KNOW WHAT YOU ARE DOING, else use `setExtraOffsets(...)`. + @objc open func setViewPortOffsets(left: CGFloat, top: CGFloat, right: CGFloat, bottom: CGFloat) + { + _customViewPortEnabled = true + + if Thread.isMainThread + { + self._viewPortHandler.restrainViewPort(offsetLeft: left, offsetTop: top, offsetRight: right, offsetBottom: bottom) + prepareOffsetMatrix() + prepareValuePxMatrix() + } + else + { + DispatchQueue.main.async(execute: { + self.setViewPortOffsets(left: left, top: top, right: right, bottom: bottom) + }) + } + } + + /// Resets all custom offsets set via `setViewPortOffsets(...)` method. Allows the chart to again calculate all offsets automatically. + @objc open func resetViewPortOffsets() + { + _customViewPortEnabled = false + calculateOffsets() + } + + // MARK: - Accessors + + /// - Returns: The range of the specified axis. + @objc open func getAxisRange(axis: YAxis.AxisDependency) -> Double + { + if axis == .left + { + return leftAxis.axisRange + } + else + { + return rightAxis.axisRange + } + } + + /// - Returns: The position (in pixels) the provided Entry has inside the chart view + @objc open func getPosition(entry e: ChartDataEntry, axis: YAxis.AxisDependency) -> CGPoint + { + var vals = CGPoint(x: CGFloat(e.x), y: CGFloat(e.y)) + + getTransformer(forAxis: axis).pointValueToPixel(&vals) + + return vals + } + + /// is dragging enabled? (moving the chart with the finger) for the chart (this does not affect scaling). + @objc open var dragEnabled: Bool + { + get + { + return _dragXEnabled || _dragYEnabled + } + set + { + _dragYEnabled = newValue + _dragXEnabled = newValue + } + } + + /// is dragging enabled? (moving the chart with the finger) for the chart (this does not affect scaling). + @objc open var isDragEnabled: Bool + { + return dragEnabled + } + + /// is dragging on the X axis enabled? + @objc open var dragXEnabled: Bool + { + get + { + return _dragXEnabled + } + set + { + _dragXEnabled = newValue + } + } + + /// is dragging on the Y axis enabled? + @objc open var dragYEnabled: Bool + { + get + { + return _dragYEnabled + } + set + { + _dragYEnabled = newValue + } + } + + /// is scaling enabled? (zooming in and out by gesture) for the chart (this does not affect dragging). + @objc open func setScaleEnabled(_ enabled: Bool) + { + if _scaleXEnabled != enabled || _scaleYEnabled != enabled + { + _scaleXEnabled = enabled + _scaleYEnabled = enabled + #if !os(tvOS) + _pinchGestureRecognizer.isEnabled = _pinchZoomEnabled || _scaleXEnabled || _scaleYEnabled + #endif + } + } + + @objc open var scaleXEnabled: Bool + { + get + { + return _scaleXEnabled + } + set + { + if _scaleXEnabled != newValue + { + _scaleXEnabled = newValue + #if !os(tvOS) + _pinchGestureRecognizer.isEnabled = _pinchZoomEnabled || _scaleXEnabled || _scaleYEnabled + #endif + } + } + } + + @objc open var scaleYEnabled: Bool + { + get + { + return _scaleYEnabled + } + set + { + if _scaleYEnabled != newValue + { + _scaleYEnabled = newValue + #if !os(tvOS) + _pinchGestureRecognizer.isEnabled = _pinchZoomEnabled || _scaleXEnabled || _scaleYEnabled + #endif + } + } + } + + @objc open var isScaleXEnabled: Bool { return scaleXEnabled } + @objc open var isScaleYEnabled: Bool { return scaleYEnabled } + + /// flag that indicates if double tap zoom is enabled or not + @objc open var doubleTapToZoomEnabled: Bool + { + get + { + return _doubleTapToZoomEnabled + } + set + { + if _doubleTapToZoomEnabled != newValue + { + _doubleTapToZoomEnabled = newValue + _doubleTapGestureRecognizer.isEnabled = _doubleTapToZoomEnabled + } + } + } + + /// **default**: true + /// `true` if zooming via double-tap is enabled `false` ifnot. + @objc open var isDoubleTapToZoomEnabled: Bool + { + return doubleTapToZoomEnabled + } + + /// flag that indicates if highlighting per dragging over a fully zoomed out chart is enabled + @objc open var highlightPerDragEnabled = true + + /// If set to true, highlighting per dragging over a fully zoomed out chart is enabled + /// You might want to disable this when using inside a `NSUIScrollView` + /// + /// **default**: true + @objc open var isHighlightPerDragEnabled: Bool + { + return highlightPerDragEnabled + } + + /// **default**: true + /// `true` if drawing the grid background is enabled, `false` ifnot. + @objc open var isDrawGridBackgroundEnabled: Bool + { + return drawGridBackgroundEnabled + } + + /// **default**: false + /// `true` if drawing the borders rectangle is enabled, `false` ifnot. + @objc open var isDrawBordersEnabled: Bool + { + return drawBordersEnabled + } + + /// - Returns: The x and y values in the chart at the given touch point + /// (encapsulated in a `CGPoint`). This method transforms pixel coordinates to + /// coordinates / values in the chart. This is the opposite method to + /// `getPixelsForValues(...)`. + @objc open func valueForTouchPoint(point pt: CGPoint, axis: YAxis.AxisDependency) -> CGPoint + { + return getTransformer(forAxis: axis).valueForTouchPoint(pt) + } + + /// Transforms the given chart values into pixels. This is the opposite + /// method to `valueForTouchPoint(...)`. + @objc open func pixelForValues(x: Double, y: Double, axis: YAxis.AxisDependency) -> CGPoint + { + return getTransformer(forAxis: axis).pixelForValues(x: x, y: y) + } + + /// - Returns: The Entry object displayed at the touched position of the chart + @objc open func getEntryByTouchPoint(point pt: CGPoint) -> ChartDataEntry! + { + if let h = getHighlightByTouchPoint(pt) + { + return _data!.entryForHighlight(h) + } + return nil + } + + /// - Returns: The DataSet object displayed at the touched position of the chart + @objc open func getDataSetByTouchPoint(point pt: CGPoint) -> IBarLineScatterCandleBubbleChartDataSet? + { + let h = getHighlightByTouchPoint(pt) + if h !== nil + { + return _data?.getDataSetByIndex(h!.dataSetIndex) as? IBarLineScatterCandleBubbleChartDataSet + } + return nil + } + + /// The current x-scale factor + @objc open var scaleX: CGFloat + { + if _viewPortHandler === nil + { + return 1.0 + } + return _viewPortHandler.scaleX + } + + /// The current y-scale factor + @objc open var scaleY: CGFloat + { + if _viewPortHandler === nil + { + return 1.0 + } + return _viewPortHandler.scaleY + } + + /// if the chart is fully zoomed out, return true + @objc open var isFullyZoomedOut: Bool { return _viewPortHandler.isFullyZoomedOut } + + /// - Returns: The y-axis object to the corresponding AxisDependency. In the + /// horizontal bar-chart, LEFT == top, RIGHT == BOTTOM + @objc open func getAxis(_ axis: YAxis.AxisDependency) -> YAxis + { + if axis == .left + { + return leftAxis + } + else + { + return rightAxis + } + } + + /// flag that indicates if pinch-zoom is enabled. if true, both x and y axis can be scaled simultaneously with 2 fingers, if false, x and y axis can be scaled separately + @objc open var pinchZoomEnabled: Bool + { + get + { + return _pinchZoomEnabled + } + set + { + if _pinchZoomEnabled != newValue + { + _pinchZoomEnabled = newValue + #if !os(tvOS) + _pinchGestureRecognizer.isEnabled = _pinchZoomEnabled || _scaleXEnabled || _scaleYEnabled + #endif + } + } + } + + /// **default**: false + /// `true` if pinch-zoom is enabled, `false` ifnot + @objc open var isPinchZoomEnabled: Bool { return pinchZoomEnabled } + + /// Set an offset in dp that allows the user to drag the chart over it's + /// bounds on the x-axis. + @objc open func setDragOffsetX(_ offset: CGFloat) + { + _viewPortHandler.setDragOffsetX(offset) + } + + /// Set an offset in dp that allows the user to drag the chart over it's + /// bounds on the y-axis. + @objc open func setDragOffsetY(_ offset: CGFloat) + { + _viewPortHandler.setDragOffsetY(offset) + } + + /// `true` if both drag offsets (x and y) are zero or smaller. + @objc open var hasNoDragOffset: Bool { return _viewPortHandler.hasNoDragOffset } + + open override var chartYMax: Double + { + return max(leftAxis._axisMaximum, rightAxis._axisMaximum) + } + + open override var chartYMin: Double + { + return min(leftAxis._axisMinimum, rightAxis._axisMinimum) + } + + /// `true` if either the left or the right or both axes are inverted. + @objc open var isAnyAxisInverted: Bool + { + return leftAxis.isInverted || rightAxis.isInverted + } + + /// flag that indicates if auto scaling on the y axis is enabled. + /// if yes, the y axis automatically adjusts to the min and max y values of the current x axis range whenever the viewport changes + @objc open var autoScaleMinMaxEnabled: Bool + { + get { return _autoScaleMinMaxEnabled } + set { _autoScaleMinMaxEnabled = newValue } + } + + /// **default**: false + /// `true` if auto scaling on the y axis is enabled. + @objc open var isAutoScaleMinMaxEnabled : Bool { return autoScaleMinMaxEnabled } + + /// Sets a minimum width to the specified y axis. + @objc open func setYAxisMinWidth(_ axis: YAxis.AxisDependency, width: CGFloat) + { + if axis == .left + { + leftAxis.minWidth = width + } + else + { + rightAxis.minWidth = width + } + } + + /// **default**: 0.0 + /// + /// - Returns: The (custom) minimum width of the specified Y axis. + @objc open func getYAxisMinWidth(_ axis: YAxis.AxisDependency) -> CGFloat + { + if axis == .left + { + return leftAxis.minWidth + } + else + { + return rightAxis.minWidth + } + } + /// Sets a maximum width to the specified y axis. + /// Zero (0.0) means there's no maximum width + @objc open func setYAxisMaxWidth(_ axis: YAxis.AxisDependency, width: CGFloat) + { + if axis == .left + { + leftAxis.maxWidth = width + } + else + { + rightAxis.maxWidth = width + } + } + + /// Zero (0.0) means there's no maximum width + /// + /// **default**: 0.0 (no maximum specified) + /// + /// - Returns: The (custom) maximum width of the specified Y axis. + @objc open func getYAxisMaxWidth(_ axis: YAxis.AxisDependency) -> CGFloat + { + if axis == .left + { + return leftAxis.maxWidth + } + else + { + return rightAxis.maxWidth + } + } + + /// - Returns the width of the specified y axis. + @objc open func getYAxisWidth(_ axis: YAxis.AxisDependency) -> CGFloat + { + if axis == .left + { + return leftAxis.requiredSize().width + } + else + { + return rightAxis.requiredSize().width + } + } + + // MARK: - BarLineScatterCandleBubbleChartDataProvider + + /// - Returns: The Transformer class that contains all matrices and is + /// responsible for transforming values into pixels on the screen and + /// backwards. + open func getTransformer(forAxis axis: YAxis.AxisDependency) -> Transformer + { + if axis == .left + { + return _leftAxisTransformer + } + else + { + return _rightAxisTransformer + } + } + + /// the number of maximum visible drawn values on the chart only active when `drawValuesEnabled` is enabled + open override var maxVisibleCount: Int + { + get + { + return _maxVisibleCount + } + set + { + _maxVisibleCount = newValue + } + } + + open func isInverted(axis: YAxis.AxisDependency) -> Bool + { + return getAxis(axis).isInverted + } + + /// The lowest x-index (value on the x-axis) that is still visible on he chart. + open var lowestVisibleX: Double + { + var pt = CGPoint( + x: viewPortHandler.contentLeft, + y: viewPortHandler.contentBottom) + + getTransformer(forAxis: .left).pixelToValues(&pt) + + return max(xAxis._axisMinimum, Double(pt.x)) + } + + /// The highest x-index (value on the x-axis) that is still visible on the chart. + open var highestVisibleX: Double + { + var pt = CGPoint( + x: viewPortHandler.contentRight, + y: viewPortHandler.contentBottom) + + getTransformer(forAxis: .left).pixelToValues(&pt) + + return min(xAxis._axisMaximum, Double(pt.x)) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Charts/BubbleChartView.swift b/Carthage/Checkouts/Charts/Source/Charts/Charts/BubbleChartView.swift new file mode 100644 index 00000000000..1b13677564a --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Charts/BubbleChartView.swift @@ -0,0 +1,27 @@ +// +// BubbleChartView.swift +// Charts +// +// Bubble chart implementation: +// Copyright 2015 Pierre-Marc Airoldi +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class BubbleChartView: BarLineChartViewBase, BubbleChartDataProvider +{ + open override func initialize() + { + super.initialize() + + renderer = BubbleChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) + } + + // MARK: - BubbleChartDataProvider + + open var bubbleData: BubbleChartData? { return _data as? BubbleChartData } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Charts/CandleStickChartView.swift b/Carthage/Checkouts/Charts/Source/Charts/Charts/CandleStickChartView.swift new file mode 100644 index 00000000000..0366e8b8734 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Charts/CandleStickChartView.swift @@ -0,0 +1,34 @@ +// +// CandleStickChartView.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// Financial chart type that draws candle-sticks. +open class CandleStickChartView: BarLineChartViewBase, CandleChartDataProvider +{ + internal override func initialize() + { + super.initialize() + + renderer = CandleStickChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) + + self.xAxis.spaceMin = 0.5 + self.xAxis.spaceMax = 0.5 + } + + // MARK: - CandleChartDataProvider + + open var candleData: CandleChartData? + { + return _data as? CandleChartData + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Charts/ChartViewBase.swift b/Carthage/Checkouts/Charts/Source/Charts/Charts/ChartViewBase.swift new file mode 100644 index 00000000000..0b58b263356 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Charts/ChartViewBase.swift @@ -0,0 +1,1034 @@ +// +// ChartViewBase.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// +// Based on https://github.com/PhilJay/MPAndroidChart/commit/c42b880 + +import Foundation +import CoreGraphics + +@objc +public protocol ChartViewDelegate +{ + /// Called when a value has been selected inside the chart. + /// + /// - Parameters: + /// - entry: The selected Entry. + /// - highlight: The corresponding highlight object that contains information about the highlighted position such as dataSetIndex etc. + @objc optional func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) + + /// Called when a user stops panning between values on the chart + @objc optional func chartViewDidEndPanning(_ chartView: ChartViewBase) + + // Called when nothing has been selected or an "un-select" has been made. + @objc optional func chartValueNothingSelected(_ chartView: ChartViewBase) + + // Callbacks when the chart is scaled / zoomed via pinch zoom gesture. + @objc optional func chartScaled(_ chartView: ChartViewBase, scaleX: CGFloat, scaleY: CGFloat) + + // Callbacks when the chart is moved / translated via drag gesture. + @objc optional func chartTranslated(_ chartView: ChartViewBase, dX: CGFloat, dY: CGFloat) + + // Callbacks when Animator stops animating + @objc optional func chartView(_ chartView: ChartViewBase, animatorDidStop animator: Animator) +} + +open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate +{ + // MARK: - Properties + + /// - Returns: The object representing all x-labels, this method can be used to + /// acquire the XAxis object and modify it (e.g. change the position of the + /// labels) + @objc open var xAxis: XAxis + { + return _xAxis + } + + /// The default IValueFormatter that has been determined by the chart considering the provided minimum and maximum values. + internal var _defaultValueFormatter: IValueFormatter? = DefaultValueFormatter(decimals: 0) + + /// object that holds all data that was originally set for the chart, before it was modified or any filtering algorithms had been applied + internal var _data: ChartData? + + /// Flag that indicates if highlighting per tap (touch) is enabled + private var _highlightPerTapEnabled = true + + /// If set to true, chart continues to scroll after touch up + @objc open var dragDecelerationEnabled = true + + /// Deceleration friction coefficient in [0 ; 1] interval, higher values indicate that speed will decrease slowly, for example if it set to 0, it will stop immediately. + /// 1 is an invalid value, and will be converted to 0.999 automatically. + private var _dragDecelerationFrictionCoef: CGFloat = 0.9 + + /// if true, units are drawn next to the values in the chart + internal var _drawUnitInChart = false + + /// The object representing the labels on the x-axis + internal var _xAxis: XAxis! + + /// The `Description` object of the chart. + /// This should have been called just "description", but + @objc open var chartDescription: Description? + + /// The legend object containing all data associated with the legend + internal var _legend: Legend! + + /// delegate to receive chart events + @objc open weak var delegate: ChartViewDelegate? + + /// text that is displayed when the chart is empty + @objc open var noDataText = "No chart data available." + + /// Font to be used for the no data text. + @objc open var noDataFont = NSUIFont.systemFont(ofSize: 12) + + /// color of the no data text + @objc open var noDataTextColor: NSUIColor = NSUIColor.black + + /// alignment of the no data text + @objc open var noDataTextAlignment: NSTextAlignment = .left + + internal var _legendRenderer: LegendRenderer! + + /// object responsible for rendering the data + @objc open var renderer: DataRenderer? + + @objc open var highlighter: IHighlighter? + + /// object that manages the bounds and drawing constraints of the chart + internal var _viewPortHandler: ViewPortHandler! + + /// object responsible for animations + internal var _animator: Animator! + + /// flag that indicates if offsets calculation has already been done or not + private var _offsetsCalculated = false + + /// array of Highlight objects that reference the highlighted slices in the chart + internal var _indicesToHighlight = [Highlight]() + + /// `true` if drawing the marker is enabled when tapping on values + /// (use the `marker` property to specify a marker) + @objc open var drawMarkers = true + + /// - Returns: `true` if drawing the marker is enabled when tapping on values + /// (use the `marker` property to specify a marker) + @objc open var isDrawMarkersEnabled: Bool { return drawMarkers } + + /// The marker that is displayed when a value is clicked on the chart + @objc open var marker: IMarker? + + private var _interceptTouchEvents = false + + /// An extra offset to be appended to the viewport's top + @objc open var extraTopOffset: CGFloat = 0.0 + + /// An extra offset to be appended to the viewport's right + @objc open var extraRightOffset: CGFloat = 0.0 + + /// An extra offset to be appended to the viewport's bottom + @objc open var extraBottomOffset: CGFloat = 0.0 + + /// An extra offset to be appended to the viewport's left + @objc open var extraLeftOffset: CGFloat = 0.0 + + @objc open func setExtraOffsets(left: CGFloat, top: CGFloat, right: CGFloat, bottom: CGFloat) + { + extraLeftOffset = left + extraTopOffset = top + extraRightOffset = right + extraBottomOffset = bottom + } + + // MARK: - Initializers + + public override init(frame: CGRect) + { + super.init(frame: frame) + initialize() + } + + public required init?(coder aDecoder: NSCoder) + { + super.init(coder: aDecoder) + initialize() + } + + deinit + { + self.removeObserver(self, forKeyPath: "bounds") + self.removeObserver(self, forKeyPath: "frame") + } + + internal func initialize() + { + #if os(iOS) + self.backgroundColor = NSUIColor.clear + #endif + + _animator = Animator() + _animator.delegate = self + + _viewPortHandler = ViewPortHandler(width: bounds.size.width, height: bounds.size.height) + + chartDescription = Description() + + _legend = Legend() + _legendRenderer = LegendRenderer(viewPortHandler: _viewPortHandler, legend: _legend) + + _xAxis = XAxis() + + self.addObserver(self, forKeyPath: "bounds", options: .new, context: nil) + self.addObserver(self, forKeyPath: "frame", options: .new, context: nil) + } + + // MARK: - ChartViewBase + + /// The data for the chart + open var data: ChartData? + { + get + { + return _data + } + set + { + _data = newValue + _offsetsCalculated = false + + guard let _data = _data else + { + setNeedsDisplay() + return + } + + // calculate how many digits are needed + setupDefaultFormatter(min: _data.getYMin(), max: _data.getYMax()) + + for set in _data.dataSets + { + if set.needsFormatter || set.valueFormatter === _defaultValueFormatter + { + set.valueFormatter = _defaultValueFormatter + } + } + + // let the chart know there is new data + notifyDataSetChanged() + } + } + + /// Clears the chart from all data (sets it to null) and refreshes it (by calling setNeedsDisplay()). + @objc open func clear() + { + _data = nil + _offsetsCalculated = false + _indicesToHighlight.removeAll() + lastHighlighted = nil + + setNeedsDisplay() + } + + /// Removes all DataSets (and thereby Entries) from the chart. Does not set the data object to nil. Also refreshes the chart by calling setNeedsDisplay(). + @objc open func clearValues() + { + _data?.clearValues() + setNeedsDisplay() + } + + /// - Returns: `true` if the chart is empty (meaning it's data object is either null or contains no entries). + @objc open func isEmpty() -> Bool + { + guard let data = _data else { return true } + + if data.entryCount <= 0 + { + return true + } + else + { + return false + } + } + + /// Lets the chart know its underlying data has changed and should perform all necessary recalculations. + /// It is crucial that this method is called everytime data is changed dynamically. Not calling this method can lead to crashes or unexpected behaviour. + @objc open func notifyDataSetChanged() + { + fatalError("notifyDataSetChanged() cannot be called on ChartViewBase") + } + + /// Calculates the offsets of the chart to the border depending on the position of an eventual legend or depending on the length of the y-axis and x-axis labels and their position + internal func calculateOffsets() + { + fatalError("calculateOffsets() cannot be called on ChartViewBase") + } + + /// calcualtes the y-min and y-max value and the y-delta and x-delta value + internal func calcMinMax() + { + fatalError("calcMinMax() cannot be called on ChartViewBase") + } + + /// calculates the required number of digits for the values that might be drawn in the chart (if enabled), and creates the default value formatter + internal func setupDefaultFormatter(min: Double, max: Double) + { + // check if a custom formatter is set or not + var reference = Double(0.0) + + if let data = _data , data.entryCount >= 2 + { + reference = fabs(max - min) + } + else + { + let absMin = fabs(min) + let absMax = fabs(max) + reference = absMin > absMax ? absMin : absMax + } + + + if _defaultValueFormatter is DefaultValueFormatter + { + // setup the formatter with a new number of digits + let digits = reference.decimalPlaces + + (_defaultValueFormatter as? DefaultValueFormatter)?.decimals + = digits + } + } + + open override func draw(_ rect: CGRect) + { + let optionalContext = NSUIGraphicsGetCurrentContext() + guard let context = optionalContext else { return } + + let frame = self.bounds + + if _data === nil && noDataText.count > 0 + { + context.saveGState() + defer { context.restoreGState() } + + let paragraphStyle = NSMutableParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle + paragraphStyle.minimumLineHeight = noDataFont.lineHeight + paragraphStyle.lineBreakMode = .byWordWrapping + paragraphStyle.alignment = noDataTextAlignment + + ChartUtils.drawMultilineText( + context: context, + text: noDataText, + point: CGPoint(x: frame.width / 2.0, y: frame.height / 2.0), + attributes: + [.font: noDataFont, + .foregroundColor: noDataTextColor, + .paragraphStyle: paragraphStyle], + constrainedToSize: self.bounds.size, + anchor: CGPoint(x: 0.5, y: 0.5), + angleRadians: 0.0) + + return + } + + if !_offsetsCalculated + { + calculateOffsets() + _offsetsCalculated = true + } + } + + /// Draws the description text in the bottom right corner of the chart (per default) + internal func drawDescription(context: CGContext) + { + // check if description should be drawn + guard + let description = chartDescription, + description.isEnabled, + let descriptionText = description.text, + descriptionText.count > 0 + else { return } + + let position = description.position ?? CGPoint(x: bounds.width - _viewPortHandler.offsetRight - description.xOffset, + y: bounds.height - _viewPortHandler.offsetBottom - description.yOffset - description.font.lineHeight) + + var attrs = [NSAttributedString.Key : Any]() + + attrs[NSAttributedString.Key.font] = description.font + attrs[NSAttributedString.Key.foregroundColor] = description.textColor + + ChartUtils.drawText( + context: context, + text: descriptionText, + point: position, + align: description.textAlign, + attributes: attrs) + } + + // MARK: - Accessibility + + open override func accessibilityChildren() -> [Any]? { + return renderer?.accessibleChartElements + } + + // MARK: - Highlighting + + /// The array of currently highlighted values. This might an empty if nothing is highlighted. + @objc open var highlighted: [Highlight] + { + return _indicesToHighlight + } + + /// Set this to false to prevent values from being highlighted by tap gesture. + /// Values can still be highlighted via drag or programmatically. + /// **default**: true + @objc open var highlightPerTapEnabled: Bool + { + get { return _highlightPerTapEnabled } + set { _highlightPerTapEnabled = newValue } + } + + /// `true` if values can be highlighted via tap gesture, `false` ifnot. + @objc open var isHighLightPerTapEnabled: Bool + { + return highlightPerTapEnabled + } + + /// Checks if the highlight array is null, has a length of zero or if the first object is null. + /// + /// - Returns: `true` if there are values to highlight, `false` ifthere are no values to highlight. + @objc open func valuesToHighlight() -> Bool + { + return !_indicesToHighlight.isEmpty + } + + /// Highlights the values at the given indices in the given DataSets. Provide + /// null or an empty array to undo all highlighting. + /// This should be used to programmatically highlight values. + /// This method *will not* call the delegate. + @objc open func highlightValues(_ highs: [Highlight]?) + { + // set the indices to highlight + _indicesToHighlight = highs ?? [Highlight]() + + if _indicesToHighlight.isEmpty + { + self.lastHighlighted = nil + } + else + { + self.lastHighlighted = _indicesToHighlight[0] + } + + // redraw the chart + setNeedsDisplay() + } + + /// Highlights any y-value at the given x-value in the given DataSet. + /// Provide -1 as the dataSetIndex to undo all highlighting. + /// This method will call the delegate. + /// + /// - Parameters: + /// - x: The x-value to highlight + /// - dataSetIndex: The dataset index to search in + /// - dataIndex: The data index to search in (only used in CombinedChartView currently) + @objc open func highlightValue(x: Double, dataSetIndex: Int, dataIndex: Int = -1) + { + highlightValue(x: x, dataSetIndex: dataSetIndex, dataIndex: dataIndex, callDelegate: true) + } + + /// Highlights the value at the given x-value and y-value in the given DataSet. + /// Provide -1 as the dataSetIndex to undo all highlighting. + /// This method will call the delegate. + /// + /// - Parameters: + /// - x: The x-value to highlight + /// - y: The y-value to highlight. Supply `NaN` for "any" + /// - dataSetIndex: The dataset index to search in + /// - dataIndex: The data index to search in (only used in CombinedChartView currently) + @objc open func highlightValue(x: Double, y: Double, dataSetIndex: Int, dataIndex: Int = -1) + { + highlightValue(x: x, y: y, dataSetIndex: dataSetIndex, dataIndex: dataIndex, callDelegate: true) + } + + /// Highlights any y-value at the given x-value in the given DataSet. + /// Provide -1 as the dataSetIndex to undo all highlighting. + /// + /// - Parameters: + /// - x: The x-value to highlight + /// - dataSetIndex: The dataset index to search in + /// - dataIndex: The data index to search in (only used in CombinedChartView currently) + /// - callDelegate: Should the delegate be called for this change + @objc open func highlightValue(x: Double, dataSetIndex: Int, dataIndex: Int = -1, callDelegate: Bool) + { + highlightValue(x: x, y: .nan, dataSetIndex: dataSetIndex, dataIndex: dataIndex, callDelegate: callDelegate) + } + + /// Highlights the value at the given x-value and y-value in the given DataSet. + /// Provide -1 as the dataSetIndex to undo all highlighting. + /// + /// - Parameters: + /// - x: The x-value to highlight + /// - y: The y-value to highlight. Supply `NaN` for "any" + /// - dataSetIndex: The dataset index to search in + /// - dataIndex: The data index to search in (only used in CombinedChartView currently) + /// - callDelegate: Should the delegate be called for this change + @objc open func highlightValue(x: Double, y: Double, dataSetIndex: Int, dataIndex: Int = -1, callDelegate: Bool) + { + guard let data = _data else + { + Swift.print("Value not highlighted because data is nil") + return + } + + if dataSetIndex < 0 || dataSetIndex >= data.dataSetCount + { + highlightValue(nil, callDelegate: callDelegate) + } + else + { + highlightValue(Highlight(x: x, y: y, dataSetIndex: dataSetIndex, dataIndex: dataIndex), callDelegate: callDelegate) + } + } + + /// Highlights the values represented by the provided Highlight object + /// This method *will not* call the delegate. + /// + /// - Parameters: + /// - highlight: contains information about which entry should be highlighted + @objc open func highlightValue(_ highlight: Highlight?) + { + highlightValue(highlight, callDelegate: false) + } + + /// Highlights the value selected by touch gesture. + @objc open func highlightValue(_ highlight: Highlight?, callDelegate: Bool) + { + var entry: ChartDataEntry? + var h = highlight + + if h == nil + { + self.lastHighlighted = nil + _indicesToHighlight.removeAll(keepingCapacity: false) + } + else + { + // set the indices to highlight + entry = _data?.entryForHighlight(h!) + if entry == nil + { + h = nil + _indicesToHighlight.removeAll(keepingCapacity: false) + } + else + { + _indicesToHighlight = [h!] + } + } + + if callDelegate, let delegate = delegate + { + if let h = h + { + // notify the listener + delegate.chartValueSelected?(self, entry: entry!, highlight: h) + } + else + { + delegate.chartValueNothingSelected?(self) + } + } + + // redraw the chart + setNeedsDisplay() + } + + /// - Returns: The Highlight object (contains x-index and DataSet index) of the + /// selected value at the given touch point inside the Line-, Scatter-, or + /// CandleStick-Chart. + @objc open func getHighlightByTouchPoint(_ pt: CGPoint) -> Highlight? + { + if _data === nil + { + Swift.print("Can't select by touch. No data set.") + return nil + } + + return self.highlighter?.getHighlight(x: pt.x, y: pt.y) + } + + /// The last value that was highlighted via touch. + @objc open var lastHighlighted: Highlight? + + // MARK: - Markers + + /// draws all MarkerViews on the highlighted positions + internal func drawMarkers(context: CGContext) + { + // if there is no marker view or drawing marker is disabled + guard + let marker = marker + , isDrawMarkersEnabled && + valuesToHighlight() + else { return } + + for i in 0 ..< _indicesToHighlight.count + { + let highlight = _indicesToHighlight[i] + + guard let + set = data?.getDataSetByIndex(highlight.dataSetIndex), + let e = _data?.entryForHighlight(highlight) + else { continue } + + let entryIndex = set.entryIndex(entry: e) + if entryIndex > Int(Double(set.entryCount) * _animator.phaseX) + { + continue + } + + let pos = getMarkerPosition(highlight: highlight) + + // check bounds + if !_viewPortHandler.isInBounds(x: pos.x, y: pos.y) + { + continue + } + + // callbacks to update the content + marker.refreshContent(entry: e, highlight: highlight) + + // draw the marker + marker.draw(context: context, point: pos) + } + } + + /// - Returns: The actual position in pixels of the MarkerView for the given Entry in the given DataSet. + @objc open func getMarkerPosition(highlight: Highlight) -> CGPoint + { + return CGPoint(x: highlight.drawX, y: highlight.drawY) + } + + // MARK: - Animation + + /// The animator responsible for animating chart values. + @objc open var chartAnimator: Animator! + { + return _animator + } + + /// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - yAxisDuration: duration for animating the y axis + /// - easingX: an easing function for the animation on the x axis + /// - easingY: an easing function for the animation on the y axis + @objc open func animate(xAxisDuration: TimeInterval, yAxisDuration: TimeInterval, easingX: ChartEasingFunctionBlock?, easingY: ChartEasingFunctionBlock?) + { + _animator.animate(xAxisDuration: xAxisDuration, yAxisDuration: yAxisDuration, easingX: easingX, easingY: easingY) + } + + /// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - yAxisDuration: duration for animating the y axis + /// - easingOptionX: the easing function for the animation on the x axis + /// - easingOptionY: the easing function for the animation on the y axis + @objc open func animate(xAxisDuration: TimeInterval, yAxisDuration: TimeInterval, easingOptionX: ChartEasingOption, easingOptionY: ChartEasingOption) + { + _animator.animate(xAxisDuration: xAxisDuration, yAxisDuration: yAxisDuration, easingOptionX: easingOptionX, easingOptionY: easingOptionY) + } + + /// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - yAxisDuration: duration for animating the y axis + /// - easing: an easing function for the animation + @objc open func animate(xAxisDuration: TimeInterval, yAxisDuration: TimeInterval, easing: ChartEasingFunctionBlock?) + { + _animator.animate(xAxisDuration: xAxisDuration, yAxisDuration: yAxisDuration, easing: easing) + } + + /// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - yAxisDuration: duration for animating the y axis + /// - easingOption: the easing function for the animation + @objc open func animate(xAxisDuration: TimeInterval, yAxisDuration: TimeInterval, easingOption: ChartEasingOption) + { + _animator.animate(xAxisDuration: xAxisDuration, yAxisDuration: yAxisDuration, easingOption: easingOption) + } + + /// Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - yAxisDuration: duration for animating the y axis + @objc open func animate(xAxisDuration: TimeInterval, yAxisDuration: TimeInterval) + { + _animator.animate(xAxisDuration: xAxisDuration, yAxisDuration: yAxisDuration) + } + + /// Animates the drawing / rendering of the chart the x-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - easing: an easing function for the animation + @objc open func animate(xAxisDuration: TimeInterval, easing: ChartEasingFunctionBlock?) + { + _animator.animate(xAxisDuration: xAxisDuration, easing: easing) + } + + /// Animates the drawing / rendering of the chart the x-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + /// - easingOption: the easing function for the animation + @objc open func animate(xAxisDuration: TimeInterval, easingOption: ChartEasingOption) + { + _animator.animate(xAxisDuration: xAxisDuration, easingOption: easingOption) + } + + /// Animates the drawing / rendering of the chart the x-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - xAxisDuration: duration for animating the x axis + @objc open func animate(xAxisDuration: TimeInterval) + { + _animator.animate(xAxisDuration: xAxisDuration) + } + + /// Animates the drawing / rendering of the chart the y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - yAxisDuration: duration for animating the y axis + /// - easing: an easing function for the animation + @objc open func animate(yAxisDuration: TimeInterval, easing: ChartEasingFunctionBlock?) + { + _animator.animate(yAxisDuration: yAxisDuration, easing: easing) + } + + /// Animates the drawing / rendering of the chart the y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - yAxisDuration: duration for animating the y axis + /// - easingOption: the easing function for the animation + @objc open func animate(yAxisDuration: TimeInterval, easingOption: ChartEasingOption) + { + _animator.animate(yAxisDuration: yAxisDuration, easingOption: easingOption) + } + + /// Animates the drawing / rendering of the chart the y-axis with the specified animation time. + /// If `animate(...)` is called, no further calling of `invalidate()` is necessary to refresh the chart. + /// + /// - Parameters: + /// - yAxisDuration: duration for animating the y axis + @objc open func animate(yAxisDuration: TimeInterval) + { + _animator.animate(yAxisDuration: yAxisDuration) + } + + // MARK: - Accessors + + /// The current y-max value across all DataSets + open var chartYMax: Double + { + return _data?.yMax ?? 0.0 + } + + /// The current y-min value across all DataSets + open var chartYMin: Double + { + return _data?.yMin ?? 0.0 + } + + open var chartXMax: Double + { + return _xAxis._axisMaximum + } + + open var chartXMin: Double + { + return _xAxis._axisMinimum + } + + open var xRange: Double + { + return _xAxis.axisRange + } + + /// - Note: (Equivalent of getCenter() in MPAndroidChart, as center is already a standard in iOS that returns the center point relative to superview, and MPAndroidChart returns relative to self)* + /// The center point of the chart (the whole View) in pixels. + @objc open var midPoint: CGPoint + { + let bounds = self.bounds + return CGPoint(x: bounds.origin.x + bounds.size.width / 2.0, y: bounds.origin.y + bounds.size.height / 2.0) + } + + /// The center of the chart taking offsets under consideration. (returns the center of the content rectangle) + open var centerOffsets: CGPoint + { + return _viewPortHandler.contentCenter + } + + /// The Legend object of the chart. This method can be used to get an instance of the legend in order to customize the automatically generated Legend. + @objc open var legend: Legend + { + return _legend + } + + /// The renderer object responsible for rendering / drawing the Legend. + @objc open var legendRenderer: LegendRenderer! + { + return _legendRenderer + } + + /// The rectangle that defines the borders of the chart-value surface (into which the actual values are drawn). + @objc open var contentRect: CGRect + { + return _viewPortHandler.contentRect + } + + /// - Returns: The ViewPortHandler of the chart that is responsible for the + /// content area of the chart and its offsets and dimensions. + @objc open var viewPortHandler: ViewPortHandler! + { + return _viewPortHandler + } + + /// - Returns: The bitmap that represents the chart. + @objc open func getChartImage(transparent: Bool) -> NSUIImage? + { + NSUIGraphicsBeginImageContextWithOptions(bounds.size, isOpaque || !transparent, NSUIMainScreen()?.nsuiScale ?? 1.0) + + guard let context = NSUIGraphicsGetCurrentContext() + else { return nil } + + let rect = CGRect(origin: CGPoint(x: 0, y: 0), size: bounds.size) + + if isOpaque || !transparent + { + // Background color may be partially transparent, we must fill with white if we want to output an opaque image + context.setFillColor(NSUIColor.white.cgColor) + context.fill(rect) + + if let backgroundColor = self.backgroundColor + { + context.setFillColor(backgroundColor.cgColor) + context.fill(rect) + } + } + + nsuiLayer?.render(in: context) + + let image = NSUIGraphicsGetImageFromCurrentImageContext() + + NSUIGraphicsEndImageContext() + + return image + } + + public enum ImageFormat + { + case jpeg + case png + } + + /// Saves the current chart state with the given name to the given path on + /// the sdcard leaving the path empty "" will put the saved file directly on + /// the SD card chart is saved as a PNG image, example: + /// saveToPath("myfilename", "foldername1/foldername2") + /// + /// - Parameters: + /// - to: path to the image to save + /// - format: the format to save + /// - compressionQuality: compression quality for lossless formats (JPEG) + /// - Returns: `true` if the image was saved successfully + open func save(to path: String, format: ImageFormat, compressionQuality: Double) -> Bool + { + guard let image = getChartImage(transparent: format != .jpeg) else { return false } + + let imageData: Data? + switch (format) + { + case .png: imageData = NSUIImagePNGRepresentation(image) + case .jpeg: imageData = NSUIImageJPEGRepresentation(image, CGFloat(compressionQuality)) + } + + guard let data = imageData else { return false } + + do + { + try data.write(to: URL(fileURLWithPath: path), options: .atomic) + } + catch + { + return false + } + + return true + } + + internal var _viewportJobs = [ViewPortJob]() + + open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) + { + if keyPath == "bounds" || keyPath == "frame" + { + let bounds = self.bounds + + if (_viewPortHandler !== nil && + (bounds.size.width != _viewPortHandler.chartWidth || + bounds.size.height != _viewPortHandler.chartHeight)) + { + _viewPortHandler.setChartDimens(width: bounds.size.width, height: bounds.size.height) + + // This may cause the chart view to mutate properties affecting the view port -- lets do this + // before we try to run any pending jobs on the view port itself + notifyDataSetChanged() + + // Finish any pending viewport changes + while (!_viewportJobs.isEmpty) + { + let job = _viewportJobs.remove(at: 0) + job.doJob() + } + } + } + } + + @objc open func removeViewportJob(_ job: ViewPortJob) + { + if let index = _viewportJobs.firstIndex(where: { $0 === job }) + { + _viewportJobs.remove(at: index) + } + } + + @objc open func clearAllViewportJobs() + { + _viewportJobs.removeAll(keepingCapacity: false) + } + + @objc open func addViewportJob(_ job: ViewPortJob) + { + if _viewPortHandler.hasChartDimens + { + job.doJob() + } + else + { + _viewportJobs.append(job) + } + } + + /// **default**: true + /// `true` if chart continues to scroll after touch up, `false` ifnot. + @objc open var isDragDecelerationEnabled: Bool + { + return dragDecelerationEnabled + } + + /// Deceleration friction coefficient in [0 ; 1] interval, higher values indicate that speed will decrease slowly, for example if it set to 0, it will stop immediately. + /// 1 is an invalid value, and will be converted to 0.999 automatically. + /// + /// **default**: true + @objc open var dragDecelerationFrictionCoef: CGFloat + { + get + { + return _dragDecelerationFrictionCoef + } + set + { + var val = newValue + if val < 0.0 + { + val = 0.0 + } + if val >= 1.0 + { + val = 0.999 + } + + _dragDecelerationFrictionCoef = val + } + } + + /// The maximum distance in screen pixels away from an entry causing it to highlight. + /// **default**: 500.0 + open var maxHighlightDistance: CGFloat = 500.0 + + /// the number of maximum visible drawn values on the chart only active when `drawValuesEnabled` is enabled + open var maxVisibleCount: Int + { + return Int(INT_MAX) + } + + // MARK: - AnimatorDelegate + + open func animatorUpdated(_ chartAnimator: Animator) + { + setNeedsDisplay() + } + + open func animatorStopped(_ chartAnimator: Animator) + { + delegate?.chartView?(self, animatorDidStop: chartAnimator) + } + + // MARK: - Touches + + open override func nsuiTouchesBegan(_ touches: Set, withEvent event: NSUIEvent?) + { + if !_interceptTouchEvents + { + super.nsuiTouchesBegan(touches, withEvent: event) + } + } + + open override func nsuiTouchesMoved(_ touches: Set, withEvent event: NSUIEvent?) + { + if !_interceptTouchEvents + { + super.nsuiTouchesMoved(touches, withEvent: event) + } + } + + open override func nsuiTouchesEnded(_ touches: Set, withEvent event: NSUIEvent?) + { + if !_interceptTouchEvents + { + super.nsuiTouchesEnded(touches, withEvent: event) + } + } + + open override func nsuiTouchesCancelled(_ touches: Set?, withEvent event: NSUIEvent?) + { + if !_interceptTouchEvents + { + super.nsuiTouchesCancelled(touches, withEvent: event) + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Charts/CombinedChartView.swift b/Carthage/Checkouts/Charts/Source/Charts/Charts/CombinedChartView.swift new file mode 100644 index 00000000000..47eebd6c785 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Charts/CombinedChartView.swift @@ -0,0 +1,246 @@ +// +// CombinedChartView.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// This chart class allows the combination of lines, bars, scatter and candle data all displayed in one chart area. +open class CombinedChartView: BarLineChartViewBase, CombinedChartDataProvider +{ + /// the fill-formatter used for determining the position of the fill-line + internal var _fillFormatter: IFillFormatter! + + /// enum that allows to specify the order in which the different data objects for the combined-chart are drawn + @objc(CombinedChartDrawOrder) + public enum DrawOrder: Int + { + case bar + case bubble + case line + case candle + case scatter + } + + open override func initialize() + { + super.initialize() + + self.highlighter = CombinedHighlighter(chart: self, barDataProvider: self) + + // Old default behaviour + self.highlightFullBarEnabled = true + + _fillFormatter = DefaultFillFormatter() + + renderer = CombinedChartRenderer(chart: self, animator: _animator, viewPortHandler: _viewPortHandler) + } + + open override var data: ChartData? + { + get + { + return super.data + } + set + { + super.data = newValue + + self.highlighter = CombinedHighlighter(chart: self, barDataProvider: self) + + (renderer as? CombinedChartRenderer)?.createRenderers() + renderer?.initBuffers() + } + } + + @objc open var fillFormatter: IFillFormatter + { + get + { + return _fillFormatter + } + set + { + _fillFormatter = newValue + if _fillFormatter == nil + { + _fillFormatter = DefaultFillFormatter() + } + } + } + + /// - Returns: The Highlight object (contains x-index and DataSet index) of the selected value at the given touch point inside the CombinedChart. + open override func getHighlightByTouchPoint(_ pt: CGPoint) -> Highlight? + { + if _data === nil + { + Swift.print("Can't select by touch. No data set.") + return nil + } + + guard let h = self.highlighter?.getHighlight(x: pt.x, y: pt.y) + else { return nil } + + if !isHighlightFullBarEnabled { return h } + + // For isHighlightFullBarEnabled, remove stackIndex + return Highlight( + x: h.x, y: h.y, + xPx: h.xPx, yPx: h.yPx, + dataIndex: h.dataIndex, + dataSetIndex: h.dataSetIndex, + stackIndex: -1, + axis: h.axis) + } + + // MARK: - CombinedChartDataProvider + + open var combinedData: CombinedChartData? + { + get + { + return _data as? CombinedChartData + } + } + + // MARK: - LineChartDataProvider + + open var lineData: LineChartData? + { + get + { + return combinedData?.lineData + } + } + + // MARK: - BarChartDataProvider + + open var barData: BarChartData? + { + get + { + return combinedData?.barData + } + } + + // MARK: - ScatterChartDataProvider + + open var scatterData: ScatterChartData? + { + get + { + return combinedData?.scatterData + } + } + + // MARK: - CandleChartDataProvider + + open var candleData: CandleChartData? + { + get + { + return combinedData?.candleData + } + } + + // MARK: - BubbleChartDataProvider + + open var bubbleData: BubbleChartData? + { + get + { + return combinedData?.bubbleData + } + } + + // MARK: - Accessors + + /// if set to true, all values are drawn above their bars, instead of below their top + @objc open var drawValueAboveBarEnabled: Bool + { + get { return (renderer as! CombinedChartRenderer).drawValueAboveBarEnabled } + set { (renderer as! CombinedChartRenderer).drawValueAboveBarEnabled = newValue } + } + + /// if set to true, a grey area is drawn behind each bar that indicates the maximum value + @objc open var drawBarShadowEnabled: Bool + { + get { return (renderer as! CombinedChartRenderer).drawBarShadowEnabled } + set { (renderer as! CombinedChartRenderer).drawBarShadowEnabled = newValue } + } + + /// `true` if drawing values above bars is enabled, `false` ifnot + open var isDrawValueAboveBarEnabled: Bool { return (renderer as! CombinedChartRenderer).drawValueAboveBarEnabled } + + /// `true` if drawing shadows (maxvalue) for each bar is enabled, `false` ifnot + open var isDrawBarShadowEnabled: Bool { return (renderer as! CombinedChartRenderer).drawBarShadowEnabled } + + /// the order in which the provided data objects should be drawn. + /// The earlier you place them in the provided array, the further they will be in the background. + /// e.g. if you provide [DrawOrder.Bar, DrawOrder.Line], the bars will be drawn behind the lines. + @objc open var drawOrder: [Int] + { + get + { + return (renderer as! CombinedChartRenderer).drawOrder.map { $0.rawValue } + } + set + { + (renderer as! CombinedChartRenderer).drawOrder = newValue.map { DrawOrder(rawValue: $0)! } + } + } + + /// Set this to `true` to make the highlight operation full-bar oriented, `false` to make it highlight single values + @objc open var highlightFullBarEnabled: Bool = false + + /// `true` the highlight is be full-bar oriented, `false` ifsingle-value + open var isHighlightFullBarEnabled: Bool { return highlightFullBarEnabled } + + // MARK: - ChartViewBase + + /// draws all MarkerViews on the highlighted positions + override func drawMarkers(context: CGContext) + { + guard + let marker = marker, + isDrawMarkersEnabled && valuesToHighlight() + else { return } + + for i in 0 ..< _indicesToHighlight.count + { + let highlight = _indicesToHighlight[i] + + guard + let set = combinedData?.getDataSetByHighlight(highlight), + let e = _data?.entryForHighlight(highlight) + else { continue } + + let entryIndex = set.entryIndex(entry: e) + if entryIndex > Int(Double(set.entryCount) * _animator.phaseX) + { + continue + } + + let pos = getMarkerPosition(highlight: highlight) + + // check bounds + if !_viewPortHandler.isInBounds(x: pos.x, y: pos.y) + { + continue + } + + // callbacks to update the content + marker.refreshContent(entry: e, highlight: highlight) + + // draw the marker + marker.draw(context: context, point: pos) + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Charts/HorizontalBarChartView.swift b/Carthage/Checkouts/Charts/Source/Charts/Charts/HorizontalBarChartView.swift new file mode 100644 index 00000000000..7b6163c8c96 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Charts/HorizontalBarChartView.swift @@ -0,0 +1,270 @@ +// +// HorizontalBarChartView.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// BarChart with horizontal bar orientation. In this implementation, x- and y-axis are switched. +open class HorizontalBarChartView: BarChartView +{ + internal override func initialize() + { + super.initialize() + + _leftAxisTransformer = TransformerHorizontalBarChart(viewPortHandler: _viewPortHandler) + _rightAxisTransformer = TransformerHorizontalBarChart(viewPortHandler: _viewPortHandler) + + renderer = HorizontalBarChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) + leftYAxisRenderer = YAxisRendererHorizontalBarChart(viewPortHandler: _viewPortHandler, yAxis: leftAxis, transformer: _leftAxisTransformer) + rightYAxisRenderer = YAxisRendererHorizontalBarChart(viewPortHandler: _viewPortHandler, yAxis: rightAxis, transformer: _rightAxisTransformer) + xAxisRenderer = XAxisRendererHorizontalBarChart(viewPortHandler: _viewPortHandler, xAxis: _xAxis, transformer: _leftAxisTransformer, chart: self) + + self.highlighter = HorizontalBarHighlighter(chart: self) + } + + internal override func calculateLegendOffsets(offsetLeft: inout CGFloat, offsetTop: inout CGFloat, offsetRight: inout CGFloat, offsetBottom: inout CGFloat) + { + guard + let legend = _legend, + legend.isEnabled, + !legend.drawInside + else { return } + + // setup offsets for legend + switch legend.orientation + { + case .vertical: + switch legend.horizontalAlignment + { + case .left: + offsetLeft += min(legend.neededWidth, _viewPortHandler.chartWidth * legend.maxSizePercent) + legend.xOffset + + case .right: + offsetRight += min(legend.neededWidth, _viewPortHandler.chartWidth * legend.maxSizePercent) + legend.xOffset + + case .center: + + switch legend.verticalAlignment + { + case .top: + offsetTop += min(legend.neededHeight, _viewPortHandler.chartHeight * legend.maxSizePercent) + legend.yOffset + + case .bottom: + offsetBottom += min(legend.neededHeight, _viewPortHandler.chartHeight * legend.maxSizePercent) + legend.yOffset + + default: + break + } + } + + case .horizontal: + switch legend.verticalAlignment + { + case .top: + offsetTop += min(legend.neededHeight, _viewPortHandler.chartHeight * legend.maxSizePercent) + legend.yOffset + + // left axis equals the top x-axis in a horizontal chart + if leftAxis.isEnabled && leftAxis.isDrawLabelsEnabled + { + offsetTop += leftAxis.getRequiredHeightSpace() + } + + case .bottom: + offsetBottom += min(legend.neededHeight, _viewPortHandler.chartHeight * legend.maxSizePercent) + legend.yOffset + + // right axis equals the bottom x-axis in a horizontal chart + if rightAxis.isEnabled && rightAxis.isDrawLabelsEnabled + { + offsetBottom += rightAxis.getRequiredHeightSpace() + } + default: + break + } + } + } + + internal override func calculateOffsets() + { + var offsetLeft: CGFloat = 0.0, + offsetRight: CGFloat = 0.0, + offsetTop: CGFloat = 0.0, + offsetBottom: CGFloat = 0.0 + + calculateLegendOffsets(offsetLeft: &offsetLeft, + offsetTop: &offsetTop, + offsetRight: &offsetRight, + offsetBottom: &offsetBottom) + + // offsets for y-labels + if leftAxis.needsOffset + { + offsetTop += leftAxis.getRequiredHeightSpace() + } + + if rightAxis.needsOffset + { + offsetBottom += rightAxis.getRequiredHeightSpace() + } + + let xlabelwidth = _xAxis.labelRotatedWidth + + if _xAxis.isEnabled + { + // offsets for x-labels + if _xAxis.labelPosition == .bottom + { + offsetLeft += xlabelwidth + } + else if _xAxis.labelPosition == .top + { + offsetRight += xlabelwidth + } + else if _xAxis.labelPosition == .bothSided + { + offsetLeft += xlabelwidth + offsetRight += xlabelwidth + } + } + + offsetTop += self.extraTopOffset + offsetRight += self.extraRightOffset + offsetBottom += self.extraBottomOffset + offsetLeft += self.extraLeftOffset + + _viewPortHandler.restrainViewPort( + offsetLeft: max(self.minOffset, offsetLeft), + offsetTop: max(self.minOffset, offsetTop), + offsetRight: max(self.minOffset, offsetRight), + offsetBottom: max(self.minOffset, offsetBottom)) + + prepareOffsetMatrix() + prepareValuePxMatrix() + } + + internal override func prepareValuePxMatrix() + { + _rightAxisTransformer.prepareMatrixValuePx(chartXMin: rightAxis._axisMinimum, deltaX: CGFloat(rightAxis.axisRange), deltaY: CGFloat(_xAxis.axisRange), chartYMin: _xAxis._axisMinimum) + _leftAxisTransformer.prepareMatrixValuePx(chartXMin: leftAxis._axisMinimum, deltaX: CGFloat(leftAxis.axisRange), deltaY: CGFloat(_xAxis.axisRange), chartYMin: _xAxis._axisMinimum) + } + + open override func getMarkerPosition(highlight: Highlight) -> CGPoint + { + return CGPoint(x: highlight.drawY, y: highlight.drawX) + } + + open override func getBarBounds(entry e: BarChartDataEntry) -> CGRect + { + guard + let data = _data as? BarChartData, + let set = data.getDataSetForEntry(e) as? IBarChartDataSet + else { return CGRect.null } + + let y = e.y + let x = e.x + + let barWidth = data.barWidth + + let top = x - 0.5 + barWidth / 2.0 + let bottom = x + 0.5 - barWidth / 2.0 + let left = y >= 0.0 ? y : 0.0 + let right = y <= 0.0 ? y : 0.0 + + var bounds = CGRect(x: left, y: top, width: right - left, height: bottom - top) + + getTransformer(forAxis: set.axisDependency).rectValueToPixel(&bounds) + + return bounds + } + + open override func getPosition(entry e: ChartDataEntry, axis: YAxis.AxisDependency) -> CGPoint + { + var vals = CGPoint(x: CGFloat(e.y), y: CGFloat(e.x)) + + getTransformer(forAxis: axis).pointValueToPixel(&vals) + + return vals + } + + open override func getHighlightByTouchPoint(_ pt: CGPoint) -> Highlight? + { + if _data === nil + { + Swift.print("Can't select by touch. No data set.", terminator: "\n") + return nil + } + + return self.highlighter?.getHighlight(x: pt.y, y: pt.x) + } + + /// The lowest x-index (value on the x-axis) that is still visible on he chart. + open override var lowestVisibleX: Double + { + var pt = CGPoint( + x: viewPortHandler.contentLeft, + y: viewPortHandler.contentBottom) + + getTransformer(forAxis: .left).pixelToValues(&pt) + + return max(xAxis._axisMinimum, Double(pt.y)) + } + + /// The highest x-index (value on the x-axis) that is still visible on the chart. + open override var highestVisibleX: Double + { + var pt = CGPoint( + x: viewPortHandler.contentLeft, + y: viewPortHandler.contentTop) + + getTransformer(forAxis: .left).pixelToValues(&pt) + + return min(xAxis._axisMaximum, Double(pt.y)) + } + + // MARK: - Viewport + + open override func setVisibleXRangeMaximum(_ maxXRange: Double) + { + let xScale = xAxis.axisRange / maxXRange + viewPortHandler.setMinimumScaleY(CGFloat(xScale)) + } + + open override func setVisibleXRangeMinimum(_ minXRange: Double) + { + let xScale = xAxis.axisRange / minXRange + viewPortHandler.setMaximumScaleY(CGFloat(xScale)) + } + + open override func setVisibleXRange(minXRange: Double, maxXRange: Double) + { + let minScale = xAxis.axisRange / minXRange + let maxScale = xAxis.axisRange / maxXRange + viewPortHandler.setMinMaxScaleY(minScaleY: CGFloat(minScale), maxScaleY: CGFloat(maxScale)) + } + + open override func setVisibleYRangeMaximum(_ maxYRange: Double, axis: YAxis.AxisDependency) + { + let yScale = getAxisRange(axis: axis) / maxYRange + viewPortHandler.setMinimumScaleX(CGFloat(yScale)) + } + + open override func setVisibleYRangeMinimum(_ minYRange: Double, axis: YAxis.AxisDependency) + { + let yScale = getAxisRange(axis: axis) / minYRange + viewPortHandler.setMaximumScaleX(CGFloat(yScale)) + } + + open override func setVisibleYRange(minYRange: Double, maxYRange: Double, axis: YAxis.AxisDependency) + { + let minScale = getAxisRange(axis: axis) / minYRange + let maxScale = getAxisRange(axis: axis) / maxYRange + viewPortHandler.setMinMaxScaleX(minScaleX: CGFloat(minScale), maxScaleX: CGFloat(maxScale)) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Charts/LineChartView.swift b/Carthage/Checkouts/Charts/Source/Charts/Charts/LineChartView.swift new file mode 100644 index 00000000000..c5fbecfacfb --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Charts/LineChartView.swift @@ -0,0 +1,28 @@ +// +// LineChartView.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// Chart that draws lines, surfaces, circles, ... +open class LineChartView: BarLineChartViewBase, LineChartDataProvider +{ + internal override func initialize() + { + super.initialize() + + renderer = LineChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) + } + + // MARK: - LineChartDataProvider + + open var lineData: LineChartData? { return _data as? LineChartData } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Charts/PieChartView.swift b/Carthage/Checkouts/Charts/Source/Charts/Charts/PieChartView.swift new file mode 100644 index 00000000000..1010434f9fa --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Charts/PieChartView.swift @@ -0,0 +1,599 @@ +// +// PieChartView.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// View that represents a pie chart. Draws cake like slices. +open class PieChartView: PieRadarChartViewBase +{ + /// rect object that represents the bounds of the piechart, needed for drawing the circle + private var _circleBox = CGRect() + + /// flag indicating if entry labels should be drawn or not + private var _drawEntryLabelsEnabled = true + + /// array that holds the width of each pie-slice in degrees + private var _drawAngles = [CGFloat]() + + /// array that holds the absolute angle in degrees of each slice + private var _absoluteAngles = [CGFloat]() + + /// if true, the hole inside the chart will be drawn + private var _drawHoleEnabled = true + + private var _holeColor: NSUIColor? = NSUIColor.white + + /// Sets the color the entry labels are drawn with. + private var _entryLabelColor: NSUIColor? = NSUIColor.white + + /// Sets the font the entry labels are drawn with. + private var _entryLabelFont: NSUIFont? = NSUIFont(name: "HelveticaNeue", size: 13.0) + + /// if true, the hole will see-through to the inner tips of the slices + private var _drawSlicesUnderHoleEnabled = false + + /// if true, the values inside the piechart are drawn as percent values + private var _usePercentValuesEnabled = false + + /// variable for the text that is drawn in the center of the pie-chart + private var _centerAttributedText: NSAttributedString? + + /// the offset on the x- and y-axis the center text has in dp. + private var _centerTextOffset: CGPoint = CGPoint() + + /// indicates the size of the hole in the center of the piechart + /// + /// **default**: `0.5` + private var _holeRadiusPercent = CGFloat(0.5) + + private var _transparentCircleColor: NSUIColor? = NSUIColor(white: 1.0, alpha: 105.0/255.0) + + /// the radius of the transparent circle next to the chart-hole in the center + private var _transparentCircleRadiusPercent = CGFloat(0.55) + + /// if enabled, centertext is drawn + private var _drawCenterTextEnabled = true + + private var _centerTextRadiusPercent: CGFloat = 1.0 + + /// maximum angle for this pie + private var _maxAngle: CGFloat = 360.0 + + public override init(frame: CGRect) + { + super.init(frame: frame) + } + + public required init?(coder aDecoder: NSCoder) + { + super.init(coder: aDecoder) + } + + internal override func initialize() + { + super.initialize() + + renderer = PieChartRenderer(chart: self, animator: _animator, viewPortHandler: _viewPortHandler) + _xAxis = nil + + self.highlighter = PieHighlighter(chart: self) + } + + open override func draw(_ rect: CGRect) + { + super.draw(rect) + + if _data === nil + { + return + } + + let optionalContext = NSUIGraphicsGetCurrentContext() + guard let context = optionalContext, let renderer = renderer else + { + return + } + + renderer.drawData(context: context) + + if (valuesToHighlight()) + { + renderer.drawHighlighted(context: context, indices: _indicesToHighlight) + } + + renderer.drawExtras(context: context) + + renderer.drawValues(context: context) + + legendRenderer.renderLegend(context: context) + + drawDescription(context: context) + + drawMarkers(context: context) + } + + internal override func calculateOffsets() + { + super.calculateOffsets() + + // prevent nullpointer when no data set + if _data === nil + { + return + } + + let radius = diameter / 2.0 + + let c = self.centerOffsets + + let shift = (data as? PieChartData)?.dataSet?.selectionShift ?? 0.0 + + // create the circle box that will contain the pie-chart (the bounds of the pie-chart) + _circleBox.origin.x = (c.x - radius) + shift + _circleBox.origin.y = (c.y - radius) + shift + _circleBox.size.width = diameter - shift * 2.0 + _circleBox.size.height = diameter - shift * 2.0 + } + + internal override func calcMinMax() + { + calcAngles() + } + + open override func getMarkerPosition(highlight: Highlight) -> CGPoint + { + let center = self.centerCircleBox + var r = self.radius + + var off = r / 10.0 * 3.6 + + if self.isDrawHoleEnabled + { + off = (r - (r * self.holeRadiusPercent)) / 2.0 + } + + r -= off // offset to keep things inside the chart + + let rotationAngle = self.rotationAngle + + let entryIndex = Int(highlight.x) + + // offset needed to center the drawn text in the slice + let offset = drawAngles[entryIndex] / 2.0 + + // calculate the text position + let x: CGFloat = (r * cos(((rotationAngle + absoluteAngles[entryIndex] - offset) * CGFloat(_animator.phaseY)).DEG2RAD) + center.x) + let y: CGFloat = (r * sin(((rotationAngle + absoluteAngles[entryIndex] - offset) * CGFloat(_animator.phaseY)).DEG2RAD) + center.y) + + return CGPoint(x: x, y: y) + } + + /// calculates the needed angles for the chart slices + private func calcAngles() + { + _drawAngles = [CGFloat]() + _absoluteAngles = [CGFloat]() + + guard let data = _data else { return } + + let entryCount = data.entryCount + + _drawAngles.reserveCapacity(entryCount) + _absoluteAngles.reserveCapacity(entryCount) + + let yValueSum = (_data as! PieChartData).yValueSum + + var cnt = 0 + + for set in data.dataSets + { + for j in 0 ..< set.entryCount + { + guard let e = set.entryForIndex(j) else { continue } + + _drawAngles.append(calcAngle(value: abs(e.y), yValueSum: yValueSum)) + + if cnt == 0 + { + _absoluteAngles.append(_drawAngles[cnt]) + } + else + { + _absoluteAngles.append(_absoluteAngles[cnt - 1] + _drawAngles[cnt]) + } + + cnt += 1 + } + } + } + + /// Checks if the given index is set to be highlighted. + @objc open func needsHighlight(index: Int) -> Bool + { + return _indicesToHighlight.contains { Int($0.x) == index } + } + + /// calculates the needed angle for a given value + private func calcAngle(_ value: Double) -> CGFloat + { + return calcAngle(value: value, yValueSum: (_data as! PieChartData).yValueSum) + } + + /// calculates the needed angle for a given value + private func calcAngle(value: Double, yValueSum: Double) -> CGFloat + { + return CGFloat(value) / CGFloat(yValueSum) * _maxAngle + } + + /// This will throw an exception, PieChart has no XAxis object. + open override var xAxis: XAxis + { + fatalError("PieChart has no XAxis") + } + + open override func indexForAngle(_ angle: CGFloat) -> Int + { + // TODO: Return nil instead of -1 + // take the current angle of the chart into consideration + let a = (angle - self.rotationAngle).normalizedAngle + return _absoluteAngles.firstIndex { $0 > a } ?? -1 + } + + /// - Returns: The index of the DataSet this x-index belongs to. + @objc open func dataSetIndexForIndex(_ xValue: Double) -> Int + { + // TODO: Return nil instead of -1 + return _data?.dataSets.firstIndex { + $0.entryForXValue(xValue, closestToY: .nan) != nil + } ?? -1 + } + + /// - Returns: An integer array of all the different angles the chart slices + /// have the angles in the returned array determine how much space (of 360°) + /// each slice takes + @objc open var drawAngles: [CGFloat] + { + return _drawAngles + } + + /// - Returns: The absolute angles of the different chart slices (where the + /// slices end) + @objc open var absoluteAngles: [CGFloat] + { + return _absoluteAngles + } + + /// The color for the hole that is drawn in the center of the PieChart (if enabled). + /// + /// - Note: Use holeTransparent with holeColor = nil to make the hole transparent.* + @objc open var holeColor: NSUIColor? + { + get + { + return _holeColor + } + set + { + _holeColor = newValue + setNeedsDisplay() + } + } + + /// if true, the hole will see-through to the inner tips of the slices + /// + /// **default**: `false` + @objc open var drawSlicesUnderHoleEnabled: Bool + { + get + { + return _drawSlicesUnderHoleEnabled + } + set + { + _drawSlicesUnderHoleEnabled = newValue + setNeedsDisplay() + } + } + + /// `true` if the inner tips of the slices are visible behind the hole, `false` if not. + @objc open var isDrawSlicesUnderHoleEnabled: Bool + { + return drawSlicesUnderHoleEnabled + } + + /// `true` if the hole in the center of the pie-chart is set to be visible, `false` ifnot + @objc open var drawHoleEnabled: Bool + { + get + { + return _drawHoleEnabled + } + set + { + _drawHoleEnabled = newValue + setNeedsDisplay() + } + } + + /// `true` if the hole in the center of the pie-chart is set to be visible, `false` ifnot + @objc open var isDrawHoleEnabled: Bool + { + get + { + return drawHoleEnabled + } + } + + /// the text that is displayed in the center of the pie-chart + @objc open var centerText: String? + { + get + { + return self.centerAttributedText?.string + } + set + { + var attrString: NSMutableAttributedString? + if newValue == nil + { + attrString = nil + } + else + { + let paragraphStyle = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle + paragraphStyle.lineBreakMode = .byTruncatingTail + paragraphStyle.alignment = .center + + attrString = NSMutableAttributedString(string: newValue!) + attrString?.setAttributes([ + .foregroundColor: NSUIColor.black, + .font: NSUIFont.systemFont(ofSize: 12.0), + .paragraphStyle: paragraphStyle + ], range: NSMakeRange(0, attrString!.length)) + } + self.centerAttributedText = attrString + } + } + + /// the text that is displayed in the center of the pie-chart + @objc open var centerAttributedText: NSAttributedString? + { + get + { + return _centerAttributedText + } + set + { + _centerAttributedText = newValue + setNeedsDisplay() + } + } + + /// Sets the offset the center text should have from it's original position in dp. Default x = 0, y = 0 + @objc open var centerTextOffset: CGPoint + { + get + { + return _centerTextOffset + } + set + { + _centerTextOffset = newValue + setNeedsDisplay() + } + } + + /// `true` if drawing the center text is enabled + @objc open var drawCenterTextEnabled: Bool + { + get + { + return _drawCenterTextEnabled + } + set + { + _drawCenterTextEnabled = newValue + setNeedsDisplay() + } + } + + /// `true` if drawing the center text is enabled + @objc open var isDrawCenterTextEnabled: Bool + { + get + { + return drawCenterTextEnabled + } + } + + internal override var requiredLegendOffset: CGFloat + { + return _legend.font.pointSize * 2.0 + } + + internal override var requiredBaseOffset: CGFloat + { + return 0.0 + } + + open override var radius: CGFloat + { + return _circleBox.width / 2.0 + } + + /// The circlebox, the boundingbox of the pie-chart slices + @objc open var circleBox: CGRect + { + return _circleBox + } + + /// The center of the circlebox + @objc open var centerCircleBox: CGPoint + { + return CGPoint(x: _circleBox.midX, y: _circleBox.midY) + } + + /// the radius of the hole in the center of the piechart in percent of the maximum radius (max = the radius of the whole chart) + /// + /// **default**: 0.5 (50%) (half the pie) + @objc open var holeRadiusPercent: CGFloat + { + get + { + return _holeRadiusPercent + } + set + { + _holeRadiusPercent = newValue + setNeedsDisplay() + } + } + + /// The color that the transparent-circle should have. + /// + /// **default**: `nil` + @objc open var transparentCircleColor: NSUIColor? + { + get + { + return _transparentCircleColor + } + set + { + _transparentCircleColor = newValue + setNeedsDisplay() + } + } + + /// the radius of the transparent circle that is drawn next to the hole in the piechart in percent of the maximum radius (max = the radius of the whole chart) + /// + /// **default**: 0.55 (55%) -> means 5% larger than the center-hole by default + @objc open var transparentCircleRadiusPercent: CGFloat + { + get + { + return _transparentCircleRadiusPercent + } + set + { + _transparentCircleRadiusPercent = newValue + setNeedsDisplay() + } + } + + /// The color the entry labels are drawn with. + @objc open var entryLabelColor: NSUIColor? + { + get { return _entryLabelColor } + set + { + _entryLabelColor = newValue + setNeedsDisplay() + } + } + + /// The font the entry labels are drawn with. + @objc open var entryLabelFont: NSUIFont? + { + get { return _entryLabelFont } + set + { + _entryLabelFont = newValue + setNeedsDisplay() + } + } + + /// Set this to true to draw the enrty labels into the pie slices + @objc open var drawEntryLabelsEnabled: Bool + { + get + { + return _drawEntryLabelsEnabled + } + set + { + _drawEntryLabelsEnabled = newValue + setNeedsDisplay() + } + } + + /// `true` if drawing entry labels is enabled, `false` ifnot + @objc open var isDrawEntryLabelsEnabled: Bool + { + get + { + return drawEntryLabelsEnabled + } + } + + /// If this is enabled, values inside the PieChart are drawn in percent and not with their original value. Values provided for the ValueFormatter to format are then provided in percent. + @objc open var usePercentValuesEnabled: Bool + { + get + { + return _usePercentValuesEnabled + } + set + { + _usePercentValuesEnabled = newValue + setNeedsDisplay() + } + } + + /// `true` if drawing x-values is enabled, `false` ifnot + @objc open var isUsePercentValuesEnabled: Bool + { + get + { + return usePercentValuesEnabled + } + } + + /// the rectangular radius of the bounding box for the center text, as a percentage of the pie hole + @objc open var centerTextRadiusPercent: CGFloat + { + get + { + return _centerTextRadiusPercent + } + set + { + _centerTextRadiusPercent = newValue + setNeedsDisplay() + } + } + + /// The max angle that is used for calculating the pie-circle. + /// 360 means it's a full pie-chart, 180 results in a half-pie-chart. + /// **default**: 360.0 + @objc open var maxAngle: CGFloat + { + get + { + return _maxAngle + } + set + { + _maxAngle = newValue + + if _maxAngle > 360.0 + { + _maxAngle = 360.0 + } + + if _maxAngle < 90.0 + { + _maxAngle = 90.0 + } + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift b/Carthage/Checkouts/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift new file mode 100644 index 00000000000..bbdc8d826fb --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Charts/PieRadarChartViewBase.swift @@ -0,0 +1,837 @@ +// +// PieRadarChartViewBase.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// Base class of PieChartView and RadarChartView. +open class PieRadarChartViewBase: ChartViewBase +{ + /// holds the normalized version of the current rotation angle of the chart + private var _rotationAngle = CGFloat(270.0) + + /// holds the raw version of the current rotation angle of the chart + private var _rawRotationAngle = CGFloat(270.0) + + /// flag that indicates if rotation is enabled or not + @objc open var rotationEnabled = true + + /// Sets the minimum offset (padding) around the chart, defaults to 0.0 + @objc open var minOffset = CGFloat(0.0) + + /// iOS && OSX only: Enabled multi-touch rotation using two fingers. + private var _rotationWithTwoFingers = false + + private var _tapGestureRecognizer: NSUITapGestureRecognizer! + #if !os(tvOS) + private var _rotationGestureRecognizer: NSUIRotationGestureRecognizer! + #endif + + public override init(frame: CGRect) + { + super.init(frame: frame) + } + + public required init?(coder aDecoder: NSCoder) + { + super.init(coder: aDecoder) + } + + deinit + { + stopDeceleration() + } + + internal override func initialize() + { + super.initialize() + + _tapGestureRecognizer = NSUITapGestureRecognizer(target: self, action: #selector(tapGestureRecognized(_:))) + + self.addGestureRecognizer(_tapGestureRecognizer) + + #if !os(tvOS) + _rotationGestureRecognizer = NSUIRotationGestureRecognizer(target: self, action: #selector(rotationGestureRecognized(_:))) + self.addGestureRecognizer(_rotationGestureRecognizer) + _rotationGestureRecognizer.isEnabled = rotationWithTwoFingers + #endif + } + + internal override func calcMinMax() + { + /*_xAxis.axisRange = Double((_data?.xVals.count ?? 0) - 1)*/ + } + + open override var maxVisibleCount: Int + { + get + { + return data?.entryCount ?? 0 + } + } + + open override func notifyDataSetChanged() + { + calcMinMax() + + if let data = _data , _legend !== nil + { + legendRenderer.computeLegend(data: data) + } + + calculateOffsets() + + setNeedsDisplay() + } + + internal override func calculateOffsets() + { + var legendLeft = CGFloat(0.0) + var legendRight = CGFloat(0.0) + var legendBottom = CGFloat(0.0) + var legendTop = CGFloat(0.0) + + if _legend != nil && _legend.enabled && !_legend.drawInside + { + let fullLegendWidth = min(_legend.neededWidth, _viewPortHandler.chartWidth * _legend.maxSizePercent) + + switch _legend.orientation + { + case .vertical: + + var xLegendOffset: CGFloat = 0.0 + + if _legend.horizontalAlignment == .left + || _legend.horizontalAlignment == .right + { + if _legend.verticalAlignment == .center + { + // this is the space between the legend and the chart + let spacing = CGFloat(13.0) + + xLegendOffset = fullLegendWidth + spacing + } + else + { + // this is the space between the legend and the chart + let spacing = CGFloat(8.0) + + let legendWidth = fullLegendWidth + spacing + let legendHeight = _legend.neededHeight + _legend.textHeightMax + + let c = self.midPoint + + let bottomX = _legend.horizontalAlignment == .right + ? self.bounds.width - legendWidth + 15.0 + : legendWidth - 15.0 + let bottomY = legendHeight + 15 + let distLegend = distanceToCenter(x: bottomX, y: bottomY) + + let reference = getPosition(center: c, dist: self.radius, + angle: angleForPoint(x: bottomX, y: bottomY)) + + let distReference = distanceToCenter(x: reference.x, y: reference.y) + let minOffset = CGFloat(5.0) + + if bottomY >= c.y + && self.bounds.height - legendWidth > self.bounds.width + { + xLegendOffset = legendWidth + } + else if distLegend < distReference + { + let diff = distReference - distLegend + xLegendOffset = minOffset + diff + } + } + } + + switch _legend.horizontalAlignment + { + case .left: + legendLeft = xLegendOffset + + case .right: + legendRight = xLegendOffset + + case .center: + + switch _legend.verticalAlignment + { + case .top: + legendTop = min(_legend.neededHeight, _viewPortHandler.chartHeight * _legend.maxSizePercent) + + case .bottom: + legendBottom = min(_legend.neededHeight, _viewPortHandler.chartHeight * _legend.maxSizePercent) + + default: + break + } + } + + case .horizontal: + + var yLegendOffset: CGFloat = 0.0 + + if _legend.verticalAlignment == .top + || _legend.verticalAlignment == .bottom + { + // It's possible that we do not need this offset anymore as it + // is available through the extraOffsets, but changing it can mean + // changing default visibility for existing apps. + let yOffset = self.requiredLegendOffset + + yLegendOffset = min( + _legend.neededHeight + yOffset, + _viewPortHandler.chartHeight * _legend.maxSizePercent) + } + + switch _legend.verticalAlignment + { + case .top: + + legendTop = yLegendOffset + + case .bottom: + + legendBottom = yLegendOffset + + default: + break + } + } + + legendLeft += self.requiredBaseOffset + legendRight += self.requiredBaseOffset + legendTop += self.requiredBaseOffset + legendBottom += self.requiredBaseOffset + } + + legendTop += self.extraTopOffset + legendRight += self.extraRightOffset + legendBottom += self.extraBottomOffset + legendLeft += self.extraLeftOffset + + var minOffset = self.minOffset + + if self is RadarChartView + { + let x = self.xAxis + + if x.isEnabled && x.drawLabelsEnabled + { + minOffset = max(minOffset, x.labelRotatedWidth) + } + } + + let offsetLeft = max(minOffset, legendLeft) + let offsetTop = max(minOffset, legendTop) + let offsetRight = max(minOffset, legendRight) + let offsetBottom = max(minOffset, max(self.requiredBaseOffset, legendBottom)) + + _viewPortHandler.restrainViewPort(offsetLeft: offsetLeft, offsetTop: offsetTop, offsetRight: offsetRight, offsetBottom: offsetBottom) + } + + /// - Returns: The angle relative to the chart center for the given point on the chart in degrees. + /// The angle is always between 0 and 360°, 0° is NORTH, 90° is EAST, ... + @objc open func angleForPoint(x: CGFloat, y: CGFloat) -> CGFloat + { + let c = centerOffsets + + let tx = Double(x - c.x) + let ty = Double(y - c.y) + let length = sqrt(tx * tx + ty * ty) + let r = acos(ty / length) + + var angle = r.RAD2DEG + + if x > c.x + { + angle = 360.0 - angle + } + + // add 90° because chart starts EAST + angle = angle + 90.0 + + // neutralize overflow + if angle > 360.0 + { + angle = angle - 360.0 + } + + return CGFloat(angle) + } + + /// Calculates the position around a center point, depending on the distance + /// from the center, and the angle of the position around the center. + @objc open func getPosition(center: CGPoint, dist: CGFloat, angle: CGFloat) -> CGPoint + { + return CGPoint(x: center.x + dist * cos(angle.DEG2RAD), + y: center.y + dist * sin(angle.DEG2RAD)) + } + + /// - Returns: The distance of a certain point on the chart to the center of the chart. + @objc open func distanceToCenter(x: CGFloat, y: CGFloat) -> CGFloat + { + let c = self.centerOffsets + + var dist = CGFloat(0.0) + + var xDist = CGFloat(0.0) + var yDist = CGFloat(0.0) + + if x > c.x + { + xDist = x - c.x + } + else + { + xDist = c.x - x + } + + if y > c.y + { + yDist = y - c.y + } + else + { + yDist = c.y - y + } + + // pythagoras + dist = sqrt(pow(xDist, 2.0) + pow(yDist, 2.0)) + + return dist + } + + /// - Returns: The xIndex for the given angle around the center of the chart. + /// -1 if not found / outofbounds. + @objc open func indexForAngle(_ angle: CGFloat) -> Int + { + fatalError("indexForAngle() cannot be called on PieRadarChartViewBase") + } + + /// current rotation angle of the pie chart + /// + /// **default**: 270 --> top (NORTH) + /// Will always return a normalized value, which will be between 0.0 < 360.0 + @objc open var rotationAngle: CGFloat + { + get + { + return _rotationAngle + } + set + { + _rawRotationAngle = newValue + _rotationAngle = newValue.normalizedAngle + setNeedsDisplay() + } + } + + /// gets the raw version of the current rotation angle of the pie chart the returned value could be any value, negative or positive, outside of the 360 degrees. + /// this is used when working with rotation direction, mainly by gestures and animations. + @objc open var rawRotationAngle: CGFloat + { + return _rawRotationAngle + } + + /// The diameter of the pie- or radar-chart + @objc open var diameter: CGFloat + { + var content = _viewPortHandler.contentRect + content.origin.x += extraLeftOffset + content.origin.y += extraTopOffset + content.size.width -= extraLeftOffset + extraRightOffset + content.size.height -= extraTopOffset + extraBottomOffset + return min(content.width, content.height) + } + + /// The radius of the chart in pixels. + @objc open var radius: CGFloat + { + fatalError("radius cannot be called on PieRadarChartViewBase") + } + + /// The required offset for the chart legend. + internal var requiredLegendOffset: CGFloat + { + fatalError("requiredLegendOffset cannot be called on PieRadarChartViewBase") + } + + /// - Returns: The base offset needed for the chart without calculating the + /// legend size. + internal var requiredBaseOffset: CGFloat + { + fatalError("requiredBaseOffset cannot be called on PieRadarChartViewBase") + } + + open override var chartYMax: Double + { + return 0.0 + } + + open override var chartYMin: Double + { + return 0.0 + } + + @objc open var isRotationEnabled: Bool { return rotationEnabled } + + /// flag that indicates if rotation is done with two fingers or one. + /// when the chart is inside a scrollview, you need a two-finger rotation because a one-finger rotation eats up all touch events. + /// + /// On iOS this will disable one-finger rotation. + /// On OSX this will keep two-finger multitouch rotation, and one-pointer mouse rotation. + /// + /// **default**: false + @objc open var rotationWithTwoFingers: Bool + { + get + { + return _rotationWithTwoFingers + } + set + { + _rotationWithTwoFingers = newValue + #if !os(tvOS) + _rotationGestureRecognizer.isEnabled = _rotationWithTwoFingers + #endif + } + } + + /// flag that indicates if rotation is done with two fingers or one. + /// when the chart is inside a scrollview, you need a two-finger rotation because a one-finger rotation eats up all touch events. + /// + /// On iOS this will disable one-finger rotation. + /// On OSX this will keep two-finger multitouch rotation, and one-pointer mouse rotation. + /// + /// **default**: false + @objc open var isRotationWithTwoFingers: Bool + { + return _rotationWithTwoFingers + } + + // MARK: - Animation + + private var _spinAnimator: Animator! + + /// Applys a spin animation to the Chart. + @objc open func spin(duration: TimeInterval, fromAngle: CGFloat, toAngle: CGFloat, easing: ChartEasingFunctionBlock?) + { + if _spinAnimator != nil + { + _spinAnimator.stop() + } + + _spinAnimator = Animator() + _spinAnimator.updateBlock = { + self.rotationAngle = (toAngle - fromAngle) * CGFloat(self._spinAnimator.phaseX) + fromAngle + } + _spinAnimator.stopBlock = { self._spinAnimator = nil } + + _spinAnimator.animate(xAxisDuration: duration, easing: easing) + } + + @objc open func spin(duration: TimeInterval, fromAngle: CGFloat, toAngle: CGFloat, easingOption: ChartEasingOption) + { + spin(duration: duration, fromAngle: fromAngle, toAngle: toAngle, easing: easingFunctionFromOption(easingOption)) + } + + @objc open func spin(duration: TimeInterval, fromAngle: CGFloat, toAngle: CGFloat) + { + spin(duration: duration, fromAngle: fromAngle, toAngle: toAngle, easing: nil) + } + + @objc open func stopSpinAnimation() + { + if _spinAnimator != nil + { + _spinAnimator.stop() + } + } + + // MARK: - Gestures + + private var _rotationGestureStartPoint: CGPoint! + private var _isRotating = false + private var _startAngle = CGFloat(0.0) + + private struct AngularVelocitySample + { + var time: TimeInterval + var angle: CGFloat + } + + private var velocitySamples = [AngularVelocitySample]() + + private var _decelerationLastTime: TimeInterval = 0.0 + private var _decelerationDisplayLink: NSUIDisplayLink! + private var _decelerationAngularVelocity: CGFloat = 0.0 + + internal final func processRotationGestureBegan(location: CGPoint) + { + self.resetVelocity() + + if rotationEnabled + { + self.sampleVelocity(touchLocation: location) + } + + self.setGestureStartAngle(x: location.x, y: location.y) + + _rotationGestureStartPoint = location + } + + internal final func processRotationGestureMoved(location: CGPoint) + { + if isDragDecelerationEnabled + { + sampleVelocity(touchLocation: location) + } + + if !_isRotating && + distance( + eventX: location.x, + startX: _rotationGestureStartPoint.x, + eventY: location.y, + startY: _rotationGestureStartPoint.y) > CGFloat(8.0) + { + _isRotating = true + } + else + { + self.updateGestureRotation(x: location.x, y: location.y) + setNeedsDisplay() + } + } + + internal final func processRotationGestureEnded(location: CGPoint) + { + if isDragDecelerationEnabled + { + stopDeceleration() + + sampleVelocity(touchLocation: location) + + _decelerationAngularVelocity = calculateVelocity() + + if _decelerationAngularVelocity != 0.0 + { + _decelerationLastTime = CACurrentMediaTime() + _decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(PieRadarChartViewBase.decelerationLoop)) + _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoop.Mode.common) + } + } + } + + internal final func processRotationGestureCancelled() + { + if _isRotating + { + _isRotating = false + } + } + + #if !os(OSX) + open override func nsuiTouchesBegan(_ touches: Set, withEvent event: NSUIEvent?) + { + // if rotation by touch is enabled + if rotationEnabled + { + stopDeceleration() + + if !rotationWithTwoFingers, let touchLocation = touches.first?.location(in: self) + { + processRotationGestureBegan(location: touchLocation) + } + } + + if !_isRotating + { + super.nsuiTouchesBegan(touches, withEvent: event) + } + } + + open override func nsuiTouchesMoved(_ touches: Set, withEvent event: NSUIEvent?) + { + if rotationEnabled && !rotationWithTwoFingers, let touch = touches.first + { + let touchLocation = touch.location(in: self) + processRotationGestureMoved(location: touchLocation) + } + + if !_isRotating + { + super.nsuiTouchesMoved(touches, withEvent: event) + } + } + + open override func nsuiTouchesEnded(_ touches: Set, withEvent event: NSUIEvent?) + { + if !_isRotating + { + super.nsuiTouchesEnded(touches, withEvent: event) + } + + if rotationEnabled && !rotationWithTwoFingers, let touch = touches.first + { + let touchLocation = touch.location(in: self) + processRotationGestureEnded(location: touchLocation) + } + + if _isRotating + { + _isRotating = false + } + } + + open override func nsuiTouchesCancelled(_ touches: Set?, withEvent event: NSUIEvent?) + { + super.nsuiTouchesCancelled(touches, withEvent: event) + + processRotationGestureCancelled() + } + #endif + + #if os(OSX) + open override func mouseDown(with theEvent: NSEvent) + { + // if rotation by touch is enabled + if rotationEnabled + { + stopDeceleration() + + let location = self.convert(theEvent.locationInWindow, from: nil) + + processRotationGestureBegan(location: location) + } + + if !_isRotating + { + super.mouseDown(with: theEvent) + } + } + + open override func mouseDragged(with theEvent: NSEvent) + { + if rotationEnabled + { + let location = self.convert(theEvent.locationInWindow, from: nil) + + processRotationGestureMoved(location: location) + } + + if !_isRotating + { + super.mouseDragged(with: theEvent) + } + } + + open override func mouseUp(with theEvent: NSEvent) + { + if !_isRotating + { + super.mouseUp(with: theEvent) + } + + if rotationEnabled + { + let location = self.convert(theEvent.locationInWindow, from: nil) + + processRotationGestureEnded(location: location) + } + + if _isRotating + { + _isRotating = false + } + } + #endif + + private func resetVelocity() + { + velocitySamples.removeAll(keepingCapacity: false) + } + + private func sampleVelocity(touchLocation: CGPoint) + { + let currentSample: AngularVelocitySample = { + let time = CACurrentMediaTime() + let angle = angleForPoint(x: touchLocation.x, y: touchLocation.y) + return AngularVelocitySample(time: time, angle: angle) + }() + + // Remove samples older than our sample time - 1 seconds + // while keeping at least one samples + let index = velocitySamples + .dropLast() + .lastIndex { $0.time < currentSample.time - 1 } + if let index = index { + velocitySamples.remove(at: index) + } + velocitySamples.append(currentSample) + } + + private func calculateVelocity() -> CGFloat + { + guard var firstSample = velocitySamples.first, + var lastSample = velocitySamples.last + else { return 0 } + + // Look for a sample that's closest to the latest sample, but not the same, so we can deduce the direction + let beforeLastSample = velocitySamples.last { $0.angle != lastSample.angle } + ?? firstSample + + // Calculate the sampling time + let timeDelta: CGFloat = { + let delta = CGFloat(lastSample.time - firstSample.time) + return delta == 0 ? 0.1 : delta + }() + + // Calculate clockwise/ccw by choosing two values that should be closest to each other, + // so if the angles are two far from each other we know they are inverted "for sure" + let isClockwise: Bool = { + let isClockwise = lastSample.angle >= beforeLastSample.angle + let isInverted = abs(lastSample.angle - beforeLastSample.angle) > 270.0 + return isInverted ? !isClockwise : isClockwise + }() + + // Now if the "gesture" is over a too big of an angle - then we know the angles are inverted, and we need to move them closer to each other from both sides of the 360.0 wrapping point + if lastSample.angle - firstSample.angle > 180.0 + { + firstSample.angle += 360.0 + } + else if firstSample.angle - lastSample.angle > 180.0 + { + lastSample.angle += 360.0 + } + + // The velocity + let velocity = abs((lastSample.angle - firstSample.angle) / timeDelta) + return isClockwise ? velocity : -velocity + } + + /// sets the starting angle of the rotation, this is only used by the touch listener, x and y is the touch position + private func setGestureStartAngle(x: CGFloat, y: CGFloat) + { + _startAngle = angleForPoint(x: x, y: y) + + // take the current angle into consideration when starting a new drag + _startAngle -= _rotationAngle + } + + /// updates the view rotation depending on the given touch position, also takes the starting angle into consideration + private func updateGestureRotation(x: CGFloat, y: CGFloat) + { + self.rotationAngle = angleForPoint(x: x, y: y) - _startAngle + } + + @objc open func stopDeceleration() + { + if _decelerationDisplayLink !== nil + { + _decelerationDisplayLink.remove(from: RunLoop.main, forMode: RunLoop.Mode.common) + _decelerationDisplayLink = nil + } + } + + @objc private func decelerationLoop() + { + let currentTime = CACurrentMediaTime() + + _decelerationAngularVelocity *= self.dragDecelerationFrictionCoef + + let timeInterval = CGFloat(currentTime - _decelerationLastTime) + + self.rotationAngle += _decelerationAngularVelocity * timeInterval + + _decelerationLastTime = currentTime + + if(abs(_decelerationAngularVelocity) < 0.001) + { + stopDeceleration() + } + } + + /// - Returns: The distance between two points + private func distance(eventX: CGFloat, startX: CGFloat, eventY: CGFloat, startY: CGFloat) -> CGFloat + { + let dx = eventX - startX + let dy = eventY - startY + return sqrt(dx * dx + dy * dy) + } + + /// - Returns: The distance between two points + private func distance(from: CGPoint, to: CGPoint) -> CGFloat + { + let dx = from.x - to.x + let dy = from.y - to.y + return sqrt(dx * dx + dy * dy) + } + + /// reference to the last highlighted object + private var _lastHighlight: Highlight! + + @objc private func tapGestureRecognized(_ recognizer: NSUITapGestureRecognizer) + { + if recognizer.state == NSUIGestureRecognizerState.ended + { + if !self.isHighLightPerTapEnabled { return } + + let location = recognizer.location(in: self) + + let high = self.getHighlightByTouchPoint(location) + self.highlightValue(high, callDelegate: true) + } + } + + #if !os(tvOS) + @objc private func rotationGestureRecognized(_ recognizer: NSUIRotationGestureRecognizer) + { + if recognizer.state == NSUIGestureRecognizerState.began + { + stopDeceleration() + + _startAngle = self.rawRotationAngle + } + + if recognizer.state == NSUIGestureRecognizerState.began || recognizer.state == NSUIGestureRecognizerState.changed + { + let angle = recognizer.nsuiRotation.RAD2DEG + + self.rotationAngle = _startAngle + angle + setNeedsDisplay() + } + else if recognizer.state == NSUIGestureRecognizerState.ended + { + let angle = recognizer.nsuiRotation.RAD2DEG + + self.rotationAngle = _startAngle + angle + setNeedsDisplay() + + if isDragDecelerationEnabled + { + stopDeceleration() + + _decelerationAngularVelocity = recognizer.velocity.RAD2DEG + + if _decelerationAngularVelocity != 0.0 + { + _decelerationLastTime = CACurrentMediaTime() + _decelerationDisplayLink = NSUIDisplayLink(target: self, selector: #selector(PieRadarChartViewBase.decelerationLoop)) + _decelerationDisplayLink.add(to: RunLoop.main, forMode: RunLoop.Mode.common) + } + } + } + } + #endif +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Charts/RadarChartView.swift b/Carthage/Checkouts/Charts/Source/Charts/Charts/RadarChartView.swift new file mode 100644 index 00000000000..85892bff3ff --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Charts/RadarChartView.swift @@ -0,0 +1,220 @@ +// +// RadarChartView.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +/// Implementation of the RadarChart, a "spidernet"-like chart. It works best +/// when displaying 5-10 entries per DataSet. +open class RadarChartView: PieRadarChartViewBase +{ + /// width of the web lines that come from the center. + @objc open var webLineWidth = CGFloat(1.5) + + /// width of the web lines that are in between the lines coming from the center + @objc open var innerWebLineWidth = CGFloat(0.75) + + /// color for the web lines that come from the center + @objc open var webColor = NSUIColor(red: 122/255.0, green: 122/255.0, blue: 122.0/255.0, alpha: 1.0) + + /// color for the web lines in between the lines that come from the center. + @objc open var innerWebColor = NSUIColor(red: 122/255.0, green: 122/255.0, blue: 122.0/255.0, alpha: 1.0) + + /// transparency the grid is drawn with (0.0 - 1.0) + @objc open var webAlpha: CGFloat = 150.0 / 255.0 + + /// flag indicating if the web lines should be drawn or not + @objc open var drawWeb = true + + /// modulus that determines how many labels and web-lines are skipped before the next is drawn + private var _skipWebLineCount = 0 + + /// the object reprsenting the y-axis labels + private var _yAxis: YAxis! + + internal var _yAxisRenderer: YAxisRendererRadarChart! + internal var _xAxisRenderer: XAxisRendererRadarChart! + + public override init(frame: CGRect) + { + super.init(frame: frame) + } + + public required init?(coder aDecoder: NSCoder) + { + super.init(coder: aDecoder) + } + + internal override func initialize() + { + super.initialize() + + _yAxis = YAxis(position: .left) + + renderer = RadarChartRenderer(chart: self, animator: _animator, viewPortHandler: _viewPortHandler) + + _yAxisRenderer = YAxisRendererRadarChart(viewPortHandler: _viewPortHandler, yAxis: _yAxis, chart: self) + _xAxisRenderer = XAxisRendererRadarChart(viewPortHandler: _viewPortHandler, xAxis: _xAxis, chart: self) + + self.highlighter = RadarHighlighter(chart: self) + } + + internal override func calcMinMax() + { + super.calcMinMax() + + guard let data = _data else { return } + + _yAxis.calculate(min: data.getYMin(axis: .left), max: data.getYMax(axis: .left)) + _xAxis.calculate(min: 0.0, max: Double(data.maxEntryCountSet?.entryCount ?? 0)) + } + + open override func notifyDataSetChanged() + { + calcMinMax() + + _yAxisRenderer?.computeAxis(min: _yAxis._axisMinimum, max: _yAxis._axisMaximum, inverted: _yAxis.isInverted) + _xAxisRenderer?.computeAxis(min: _xAxis._axisMinimum, max: _xAxis._axisMaximum, inverted: false) + + if let data = _data, + let legend = _legend, + !legend.isLegendCustom + { + legendRenderer?.computeLegend(data: data) + } + + calculateOffsets() + + setNeedsDisplay() + } + + open override func draw(_ rect: CGRect) + { + super.draw(rect) + + guard data != nil, let renderer = renderer else { return } + + let optionalContext = NSUIGraphicsGetCurrentContext() + guard let context = optionalContext else { return } + + if _xAxis.isEnabled + { + _xAxisRenderer.computeAxis(min: _xAxis._axisMinimum, max: _xAxis._axisMaximum, inverted: false) + } + + _xAxisRenderer?.renderAxisLabels(context: context) + + if drawWeb + { + renderer.drawExtras(context: context) + } + + if _yAxis.isEnabled && _yAxis.isDrawLimitLinesBehindDataEnabled + { + _yAxisRenderer.renderLimitLines(context: context) + } + + renderer.drawData(context: context) + + if valuesToHighlight() + { + renderer.drawHighlighted(context: context, indices: _indicesToHighlight) + } + + if _yAxis.isEnabled && !_yAxis.isDrawLimitLinesBehindDataEnabled + { + _yAxisRenderer.renderLimitLines(context: context) + } + + _yAxisRenderer.renderAxisLabels(context: context) + + renderer.drawValues(context: context) + + legendRenderer.renderLegend(context: context) + + drawDescription(context: context) + + drawMarkers(context: context) + } + + /// The factor that is needed to transform values into pixels. + @objc open var factor: CGFloat + { + let content = _viewPortHandler.contentRect + return min(content.width / 2.0, content.height / 2.0) + / CGFloat(_yAxis.axisRange) + } + + /// The angle that each slice in the radar chart occupies. + @objc open var sliceAngle: CGFloat + { + return 360.0 / CGFloat(_data?.maxEntryCountSet?.entryCount ?? 0) + } + + open override func indexForAngle(_ angle: CGFloat) -> Int + { + // take the current angle of the chart into consideration + let a = (angle - self.rotationAngle).normalizedAngle + + let sliceAngle = self.sliceAngle + + let max = _data?.maxEntryCountSet?.entryCount ?? 0 + return (0.. a + } ?? max + } + + /// The object that represents all y-labels of the RadarChart. + @objc open var yAxis: YAxis + { + return _yAxis + } + + /// Sets the number of web-lines that should be skipped on chart web before the next one is drawn. This targets the lines that come from the center of the RadarChart. + /// if count = 1 -> 1 line is skipped in between + @objc open var skipWebLineCount: Int + { + get + { + return _skipWebLineCount + } + set + { + _skipWebLineCount = max(0, newValue) + } + } + + internal override var requiredLegendOffset: CGFloat + { + return _legend.font.pointSize * 4.0 + } + + internal override var requiredBaseOffset: CGFloat + { + return _xAxis.isEnabled && _xAxis.isDrawLabelsEnabled ? _xAxis.labelRotatedWidth : 10.0 + } + + open override var radius: CGFloat + { + let content = _viewPortHandler.contentRect + return min(content.width / 2.0, content.height / 2.0) + } + + /// The maximum value this chart can display on it's y-axis. + open override var chartYMax: Double { return _yAxis._axisMaximum } + + /// The minimum value this chart can display on it's y-axis. + open override var chartYMin: Double { return _yAxis._axisMinimum } + + /// The range of y-values this chart can display. + @objc open var yRange: Double { return _yAxis.axisRange } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Charts/ScatterChartView.swift b/Carthage/Checkouts/Charts/Source/Charts/Charts/ScatterChartView.swift new file mode 100644 index 00000000000..22c710ad834 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Charts/ScatterChartView.swift @@ -0,0 +1,31 @@ +// +// ScatterChartView.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// The ScatterChart. Draws dots, triangles, squares and custom shapes into the chartview. +open class ScatterChartView: BarLineChartViewBase, ScatterChartDataProvider +{ + open override func initialize() + { + super.initialize() + + renderer = ScatterChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) + + xAxis.spaceMin = 0.5 + xAxis.spaceMax = 0.5 + } + + // MARK: - ScatterChartDataProvider + + open var scatterData: ScatterChartData? { return _data as? ScatterChartData } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Components/AxisBase.swift b/Carthage/Checkouts/Charts/Source/Charts/Components/AxisBase.swift new file mode 100644 index 00000000000..437d4afa072 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Components/AxisBase.swift @@ -0,0 +1,359 @@ +// +// AxisBase.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// Base class for all axes +@objc(ChartAxisBase) +open class AxisBase: ComponentBase +{ + public override init() + { + super.init() + } + + /// Custom formatter that is used instead of the auto-formatter if set + private var _axisValueFormatter: IAxisValueFormatter? + + @objc open var labelFont = NSUIFont.systemFont(ofSize: 10.0) + @objc open var labelTextColor = NSUIColor.black + + @objc open var axisLineColor = NSUIColor.gray + @objc open var axisLineWidth = CGFloat(0.5) + @objc open var axisLineDashPhase = CGFloat(0.0) + @objc open var axisLineDashLengths: [CGFloat]! + + @objc open var gridColor = NSUIColor.gray.withAlphaComponent(0.9) + @objc open var gridLineWidth = CGFloat(0.5) + @objc open var gridLineDashPhase = CGFloat(0.0) + @objc open var gridLineDashLengths: [CGFloat]! + @objc open var gridLineCap = CGLineCap.butt + + @objc open var drawGridLinesEnabled = true + @objc open var drawAxisLineEnabled = true + + /// flag that indicates of the labels of this axis should be drawn or not + @objc open var drawLabelsEnabled = true + + private var _centerAxisLabelsEnabled = false + + /// Centers the axis labels instead of drawing them at their original position. + /// This is useful especially for grouped BarChart. + @objc open var centerAxisLabelsEnabled: Bool + { + get { return _centerAxisLabelsEnabled && entryCount > 0 } + set { _centerAxisLabelsEnabled = newValue } + } + + @objc open var isCenterAxisLabelsEnabled: Bool + { + get { return centerAxisLabelsEnabled } + } + + /// array of limitlines that can be set for the axis + private var _limitLines = [ChartLimitLine]() + + /// Are the LimitLines drawn behind the data or in front of the data? + /// + /// **default**: false + @objc open var drawLimitLinesBehindDataEnabled = false + + /// the flag can be used to turn off the antialias for grid lines + @objc open var gridAntialiasEnabled = true + + /// the actual array of entries + @objc open var entries = [Double]() + + /// axis label entries only used for centered labels + @objc open var centeredEntries = [Double]() + + /// the number of entries the legend contains + @objc open var entryCount: Int { return entries.count } + + /// the number of label entries the axis should have + /// + /// **default**: 6 + private var _labelCount = Int(6) + + /// the number of decimal digits to use (for the default formatter + @objc open var decimals: Int = 0 + + /// When true, axis labels are controlled by the `granularity` property. + /// When false, axis values could possibly be repeated. + /// This could happen if two adjacent axis values are rounded to same value. + /// If using granularity this could be avoided by having fewer axis values visible. + @objc open var granularityEnabled = false + + private var _granularity = Double(1.0) + + /// The minimum interval between axis values. + /// This can be used to avoid label duplicating when zooming in. + /// + /// **default**: 1.0 + @objc open var granularity: Double + { + get + { + return _granularity + } + set + { + _granularity = newValue + + // set this to `true` if it was disabled, as it makes no sense to set this property with granularity disabled + granularityEnabled = true + } + } + + /// The minimum interval between axis values. + @objc open var isGranularityEnabled: Bool + { + get + { + return granularityEnabled + } + } + + /// if true, the set number of y-labels will be forced + @objc open var forceLabelsEnabled = false + + @objc open func getLongestLabel() -> String + { + var longest = "" + + for i in 0 ..< entries.count + { + let text = getFormattedLabel(i) + + if longest.count < text.count + { + longest = text + } + } + + return longest + } + + /// - Returns: The formatted label at the specified index. This will either use the auto-formatter or the custom formatter (if one is set). + @objc open func getFormattedLabel(_ index: Int) -> String + { + if index < 0 || index >= entries.count + { + return "" + } + + return valueFormatter?.stringForValue(entries[index], axis: self) ?? "" + } + + /// Sets the formatter to be used for formatting the axis labels. + /// If no formatter is set, the chart will automatically determine a reasonable formatting (concerning decimals) for all the values that are drawn inside the chart. + /// Use `nil` to use the formatter calculated by the chart. + @objc open var valueFormatter: IAxisValueFormatter? + { + get + { + if _axisValueFormatter == nil || + (_axisValueFormatter is DefaultAxisValueFormatter && + (_axisValueFormatter as! DefaultAxisValueFormatter).hasAutoDecimals && + (_axisValueFormatter as! DefaultAxisValueFormatter).decimals != decimals) + { + _axisValueFormatter = DefaultAxisValueFormatter(decimals: decimals) + } + + return _axisValueFormatter + } + set + { + _axisValueFormatter = newValue ?? DefaultAxisValueFormatter(decimals: decimals) + } + } + + @objc open var isDrawGridLinesEnabled: Bool { return drawGridLinesEnabled } + + @objc open var isDrawAxisLineEnabled: Bool { return drawAxisLineEnabled } + + @objc open var isDrawLabelsEnabled: Bool { return drawLabelsEnabled } + + /// Are the LimitLines drawn behind the data or in front of the data? + /// + /// **default**: false + @objc open var isDrawLimitLinesBehindDataEnabled: Bool { return drawLimitLinesBehindDataEnabled } + + /// Extra spacing for `axisMinimum` to be added to automatically calculated `axisMinimum` + @objc open var spaceMin: Double = 0.0 + + /// Extra spacing for `axisMaximum` to be added to automatically calculated `axisMaximum` + @objc open var spaceMax: Double = 0.0 + + /// Flag indicating that the axis-min value has been customized + internal var _customAxisMin: Bool = false + + /// Flag indicating that the axis-max value has been customized + internal var _customAxisMax: Bool = false + + /// Do not touch this directly, instead, use axisMinimum. + /// This is automatically calculated to represent the real min value, + /// and is used when calculating the effective minimum. + internal var _axisMinimum = Double(0) + + /// Do not touch this directly, instead, use axisMaximum. + /// This is automatically calculated to represent the real max value, + /// and is used when calculating the effective maximum. + internal var _axisMaximum = Double(0) + + /// the total range of values this axis covers + @objc open var axisRange = Double(0) + + /// The minumum number of labels on the axis + @objc open var axisMinLabels = Int(2) { + didSet { axisMinLabels = axisMinLabels > 0 ? axisMinLabels : oldValue } + } + + /// The maximum number of labels on the axis + @objc open var axisMaxLabels = Int(25) { + didSet { axisMaxLabels = axisMaxLabels > 0 ? axisMaxLabels : oldValue } + } + + /// the number of label entries the axis should have + /// max = 25, + /// min = 2, + /// default = 6, + /// be aware that this number is not fixed and can only be approximated + @objc open var labelCount: Int + { + get + { + return _labelCount + } + set + { + let range = axisMinLabels...axisMaxLabels as ClosedRange + _labelCount = newValue.clamped(to: range) + + forceLabelsEnabled = false + } + } + + @objc open func setLabelCount(_ count: Int, force: Bool) + { + self.labelCount = count + forceLabelsEnabled = force + } + + /// `true` if focing the y-label count is enabled. Default: false + @objc open var isForceLabelsEnabled: Bool { return forceLabelsEnabled } + + /// Adds a new ChartLimitLine to this axis. + @objc open func addLimitLine(_ line: ChartLimitLine) + { + _limitLines.append(line) + } + + /// Removes the specified ChartLimitLine from the axis. + @objc open func removeLimitLine(_ line: ChartLimitLine) + { + guard let i = _limitLines.firstIndex(of: line) else { return } + _limitLines.remove(at: i) + } + + /// Removes all LimitLines from the axis. + @objc open func removeAllLimitLines() + { + _limitLines.removeAll(keepingCapacity: false) + } + + /// The LimitLines of this axis. + @objc open var limitLines : [ChartLimitLine] + { + return _limitLines + } + + // MARK: Custom axis ranges + + /// By calling this method, any custom minimum value that has been previously set is reseted, and the calculation is done automatically. + @objc open func resetCustomAxisMin() + { + _customAxisMin = false + } + + @objc open var isAxisMinCustom: Bool { return _customAxisMin } + + /// By calling this method, any custom maximum value that has been previously set is reseted, and the calculation is done automatically. + @objc open func resetCustomAxisMax() + { + _customAxisMax = false + } + + @objc open var isAxisMaxCustom: Bool { return _customAxisMax } + + /// The minimum value for this axis. + /// If set, this value will not be calculated automatically depending on the provided data. + /// Use `resetCustomAxisMin()` to undo this. + @objc open var axisMinimum: Double + { + get + { + return _axisMinimum + } + set + { + _customAxisMin = true + _axisMinimum = newValue + axisRange = abs(_axisMaximum - newValue) + } + } + + /// The maximum value for this axis. + /// If set, this value will not be calculated automatically depending on the provided data. + /// Use `resetCustomAxisMax()` to undo this. + @objc open var axisMaximum: Double + { + get + { + return _axisMaximum + } + set + { + _customAxisMax = true + _axisMaximum = newValue + axisRange = abs(newValue - _axisMinimum) + } + } + + /// Calculates the minimum, maximum and range values of the YAxis with the given minimum and maximum values from the chart data. + /// + /// - Parameters: + /// - dataMin: the y-min value according to chart data + /// - dataMax: the y-max value according to chart + @objc open func calculate(min dataMin: Double, max dataMax: Double) + { + // if custom, use value as is, else use data value + var min = _customAxisMin ? _axisMinimum : (dataMin - spaceMin) + var max = _customAxisMax ? _axisMaximum : (dataMax + spaceMax) + + // temporary range (before calculations) + let range = abs(max - min) + + // in case all values are equal + if range == 0.0 + { + max = max + 1.0 + min = min - 1.0 + } + + _axisMinimum = min + _axisMaximum = max + + // actual range + axisRange = abs(max - min) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Components/ChartLimitLine.swift b/Carthage/Checkouts/Charts/Source/Charts/Components/ChartLimitLine.swift new file mode 100644 index 00000000000..41a2fe07b99 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Components/ChartLimitLine.swift @@ -0,0 +1,74 @@ +// +// ChartLimitLine.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +/// The limit line is an additional feature for all Line, Bar and ScatterCharts. +/// It allows the displaying of an additional line in the chart that marks a certain maximum / limit on the specified axis (x- or y-axis). +open class ChartLimitLine: ComponentBase +{ + @objc(ChartLimitLabelPosition) + public enum LabelPosition: Int + { + case topLeft + case topRight + case bottomLeft + case bottomRight + } + + /// limit / maximum (the y-value or xIndex) + @objc open var limit = Double(0.0) + + private var _lineWidth = CGFloat(2.0) + @objc open var lineColor = NSUIColor(red: 237.0/255.0, green: 91.0/255.0, blue: 91.0/255.0, alpha: 1.0) + @objc open var lineDashPhase = CGFloat(0.0) + @objc open var lineDashLengths: [CGFloat]? + + @objc open var valueTextColor = NSUIColor.black + @objc open var valueFont = NSUIFont.systemFont(ofSize: 13.0) + + @objc open var drawLabelEnabled = true + @objc open var label = "" + @objc open var labelPosition = LabelPosition.topRight + + public override init() + { + super.init() + } + + @objc public init(limit: Double) + { + super.init() + self.limit = limit + } + + @objc public init(limit: Double, label: String) + { + super.init() + self.limit = limit + self.label = label + } + + /// set the line width of the chart (min = 0.2, max = 12); default 2 + @objc open var lineWidth: CGFloat + { + get + { + return _lineWidth + } + set + { + _lineWidth = newValue.clamped(to: 0.2...12) + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Components/ComponentBase.swift b/Carthage/Checkouts/Charts/Source/Charts/Components/ComponentBase.swift new file mode 100644 index 00000000000..6014a175613 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Components/ComponentBase.swift @@ -0,0 +1,37 @@ +// +// ComponentBase.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +/// This class encapsulates everything both Axis, Legend and LimitLines have in common +@objc(ChartComponentBase) +open class ComponentBase: NSObject +{ + /// flag that indicates if this component is enabled or not + @objc open var enabled = true + + /// The offset this component has on the x-axis + /// **default**: 5.0 + @objc open var xOffset = CGFloat(5.0) + + /// The offset this component has on the x-axis + /// **default**: 5.0 (or 0.0 on ChartYAxis) + @objc open var yOffset = CGFloat(5.0) + + public override init() + { + super.init() + } + + @objc open var isEnabled: Bool { return enabled } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Components/Description.swift b/Carthage/Checkouts/Charts/Source/Charts/Components/Description.swift new file mode 100644 index 00000000000..84990885ad2 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Components/Description.swift @@ -0,0 +1,46 @@ +// +// Description.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartDescription) +open class Description: ComponentBase +{ + public override init() + { + #if os(tvOS) + // 23 is the smallest recommended font size on the TV + font = .systemFont(ofSize: 23) + #elseif os(OSX) + font = .systemFont(ofSize: NSUIFont.systemFontSize) + #else + font = .systemFont(ofSize: 8.0) + #endif + + super.init() + } + + /// The text to be shown as the description. + @objc open var text: String? + + /// Custom position for the description text in pixels on the screen. + open var position: CGPoint? = nil + + /// The text alignment of the description text. Default RIGHT. + @objc open var textAlign: NSTextAlignment = NSTextAlignment.right + + /// Font object used for drawing the description text. + @objc open var font: NSUIFont + + /// Text color used for drawing the description text + @objc open var textColor = NSUIColor.black +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Components/IMarker.swift b/Carthage/Checkouts/Charts/Source/Charts/Components/IMarker.swift new file mode 100644 index 00000000000..a4b75260987 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Components/IMarker.swift @@ -0,0 +1,39 @@ +// +// ChartMarker.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(IChartMarker) +public protocol IMarker: class +{ + /// - Returns: The desired (general) offset you wish the IMarker to have on the x-axis. + /// By returning x: -(width / 2) you will center the IMarker horizontally. + /// By returning y: -(height / 2) you will center the IMarker vertically. + var offset: CGPoint { get } + + /// - Parameters: + /// - point: This is the point at which the marker wants to be drawn. You can adjust the offset conditionally based on this argument. + /// - Returns: The offset for drawing at the specific `point`. + /// This allows conditional adjusting of the Marker position. + /// If you have no adjustments to make, return self.offset(). + func offsetForDrawing(atPoint: CGPoint) -> CGPoint + + /// This method enables a custom IMarker to update it's content every time the IMarker is redrawn according to the data entry it points to. + /// + /// - Parameters: + /// - entry: The Entry the IMarker belongs to. This can also be any subclass of Entry, like BarEntry or CandleEntry, simply cast it at runtime. + /// - highlight: The highlight object contains information about the highlighted value such as it's dataset-index, the selected range or stack-index (only stacked bar entries). + func refreshContent(entry: ChartDataEntry, highlight: Highlight) + + /// Draws the IMarker on the given position on the given context + func draw(context: CGContext, point: CGPoint) +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Components/Legend.swift b/Carthage/Checkouts/Charts/Source/Charts/Components/Legend.swift new file mode 100644 index 00000000000..f50676ef3db --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Components/Legend.swift @@ -0,0 +1,420 @@ +// +// Legend.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartLegend) +open class Legend: ComponentBase +{ + @objc(ChartLegendForm) + public enum Form: Int + { + /// Avoid drawing a form + case none + + /// Do not draw the a form, but leave space for it + case empty + + /// Use default (default dataset's form to the legend's form) + case `default` + + /// Draw a square + case square + + /// Draw a circle + case circle + + /// Draw a horizontal line + case line + } + + @objc(ChartLegendHorizontalAlignment) + public enum HorizontalAlignment: Int + { + case left + case center + case right + } + + @objc(ChartLegendVerticalAlignment) + public enum VerticalAlignment: Int + { + case top + case center + case bottom + } + + @objc(ChartLegendOrientation) + public enum Orientation: Int + { + case horizontal + case vertical + } + + @objc(ChartLegendDirection) + public enum Direction: Int + { + case leftToRight + case rightToLeft + } + + /// The legend entries array + @objc open var entries = [LegendEntry]() + + /// Entries that will be appended to the end of the auto calculated entries after calculating the legend. + /// (if the legend has already been calculated, you will need to call notifyDataSetChanged() to let the changes take effect) + @objc open var extraEntries = [LegendEntry]() + + /// Are the legend labels/colors a custom value or auto calculated? If false, then it's auto, if true, then custom. + /// + /// **default**: false (automatic legend) + private var _isLegendCustom = false + + /// The horizontal alignment of the legend + @objc open var horizontalAlignment: HorizontalAlignment = HorizontalAlignment.left + + /// The vertical alignment of the legend + @objc open var verticalAlignment: VerticalAlignment = VerticalAlignment.bottom + + /// The orientation of the legend + @objc open var orientation: Orientation = Orientation.horizontal + + /// Flag indicating whether the legend will draw inside the chart or outside + @objc open var drawInside: Bool = false + + /// Flag indicating whether the legend will draw inside the chart or outside + @objc open var isDrawInsideEnabled: Bool { return drawInside } + + /// The text direction of the legend + @objc open var direction: Direction = Direction.leftToRight + + @objc open var font: NSUIFont = NSUIFont.systemFont(ofSize: 10.0) + @objc open var textColor = NSUIColor.black + + /// The form/shape of the legend forms + @objc open var form = Form.square + + /// The size of the legend forms + @objc open var formSize = CGFloat(8.0) + + /// The line width for forms that consist of lines + @objc open var formLineWidth = CGFloat(3.0) + + /// Line dash configuration for shapes that consist of lines. + /// + /// This is how much (in pixels) into the dash pattern are we starting from. + @objc open var formLineDashPhase: CGFloat = 0.0 + + /// Line dash configuration for shapes that consist of lines. + /// + /// This is the actual dash pattern. + /// I.e. [2, 3] will paint [-- -- ] + /// [1, 3, 4, 2] will paint [- ---- - ---- ] + @objc open var formLineDashLengths: [CGFloat]? + + @objc open var xEntrySpace = CGFloat(6.0) + @objc open var yEntrySpace = CGFloat(0.0) + @objc open var formToTextSpace = CGFloat(5.0) + @objc open var stackSpace = CGFloat(3.0) + + @objc open var calculatedLabelSizes = [CGSize]() + @objc open var calculatedLabelBreakPoints = [Bool]() + @objc open var calculatedLineSizes = [CGSize]() + + public override init() + { + super.init() + + self.xOffset = 5.0 + self.yOffset = 3.0 + } + + @objc public init(entries: [LegendEntry]) + { + super.init() + + self.entries = entries + } + + @objc open func getMaximumEntrySize(withFont font: NSUIFont) -> CGSize + { + var maxW = CGFloat(0.0) + var maxH = CGFloat(0.0) + + var maxFormSize: CGFloat = 0.0 + + for entry in entries + { + let formSize = entry.formSize.isNaN ? self.formSize : entry.formSize + if formSize > maxFormSize + { + maxFormSize = formSize + } + + guard let label = entry.label + else { continue } + + let size = (label as NSString).size(withAttributes: [.font: font]) + + if size.width > maxW + { + maxW = size.width + } + if size.height > maxH + { + maxH = size.height + } + } + + return CGSize( + width: maxW + maxFormSize + formToTextSpace, + height: maxH + ) + } + + @objc open var neededWidth = CGFloat(0.0) + @objc open var neededHeight = CGFloat(0.0) + @objc open var textWidthMax = CGFloat(0.0) + @objc open var textHeightMax = CGFloat(0.0) + + /// flag that indicates if word wrapping is enabled + /// this is currently supported only for `orientation == Horizontal`. + /// you may want to set maxSizePercent when word wrapping, to set the point where the text wraps. + /// + /// **default**: true + @objc open var wordWrapEnabled = true + + /// if this is set, then word wrapping the legend is enabled. + @objc open var isWordWrapEnabled: Bool { return wordWrapEnabled } + + /// The maximum relative size out of the whole chart view in percent. + /// If the legend is to the right/left of the chart, then this affects the width of the legend. + /// If the legend is to the top/bottom of the chart, then this affects the height of the legend. + /// + /// **default**: 0.95 (95%) + @objc open var maxSizePercent: CGFloat = 0.95 + + @objc open func calculateDimensions(labelFont: NSUIFont, viewPortHandler: ViewPortHandler) + { + let maxEntrySize = getMaximumEntrySize(withFont: labelFont) + let defaultFormSize = self.formSize + let stackSpace = self.stackSpace + let formToTextSpace = self.formToTextSpace + let xEntrySpace = self.xEntrySpace + let yEntrySpace = self.yEntrySpace + let wordWrapEnabled = self.wordWrapEnabled + let entries = self.entries + let entryCount = entries.count + + textWidthMax = maxEntrySize.width + textHeightMax = maxEntrySize.height + + switch orientation + { + case .vertical: + + var maxWidth = CGFloat(0.0) + var width = CGFloat(0.0) + var maxHeight = CGFloat(0.0) + let labelLineHeight = labelFont.lineHeight + + var wasStacked = false + + for i in 0 ..< entryCount + { + let e = entries[i] + let drawingForm = e.form != .none + let formSize = e.formSize.isNaN ? defaultFormSize : e.formSize + let label = e.label + + if !wasStacked + { + width = 0.0 + } + + if drawingForm + { + if wasStacked + { + width += stackSpace + } + width += formSize + } + + if label != nil + { + let size = (label! as NSString).size(withAttributes: [.font: labelFont]) + + if drawingForm && !wasStacked + { + width += formToTextSpace + } + else if wasStacked + { + maxWidth = max(maxWidth, width) + maxHeight += labelLineHeight + yEntrySpace + width = 0.0 + wasStacked = false + } + + width += size.width + maxHeight += labelLineHeight + yEntrySpace + } + else + { + wasStacked = true + width += formSize + + if i < entryCount - 1 + { + width += stackSpace + } + } + + maxWidth = max(maxWidth, width) + } + + neededWidth = maxWidth + neededHeight = maxHeight + + case .horizontal: + + let labelLineHeight = labelFont.lineHeight + + let contentWidth: CGFloat = viewPortHandler.contentWidth * maxSizePercent + + // Prepare arrays for calculated layout + if calculatedLabelSizes.count != entryCount + { + calculatedLabelSizes = [CGSize](repeating: CGSize(), count: entryCount) + } + + if calculatedLabelBreakPoints.count != entryCount + { + calculatedLabelBreakPoints = [Bool](repeating: false, count: entryCount) + } + + calculatedLineSizes.removeAll(keepingCapacity: true) + + // Start calculating layout + + let labelAttrs = [NSAttributedString.Key.font: labelFont] + var maxLineWidth: CGFloat = 0.0 + var currentLineWidth: CGFloat = 0.0 + var requiredWidth: CGFloat = 0.0 + var stackedStartIndex: Int = -1 + + for i in 0 ..< entryCount + { + let e = entries[i] + let drawingForm = e.form != .none + let label = e.label + + calculatedLabelBreakPoints[i] = false + + if stackedStartIndex == -1 + { + // we are not stacking, so required width is for this label only + requiredWidth = 0.0 + } + else + { + // add the spacing appropriate for stacked labels/forms + requiredWidth += stackSpace + } + + // grouped forms have null labels + if label != nil + { + calculatedLabelSizes[i] = (label! as NSString).size(withAttributes: labelAttrs) + requiredWidth += drawingForm ? formToTextSpace + formSize : 0.0 + requiredWidth += calculatedLabelSizes[i].width + } + else + { + calculatedLabelSizes[i] = CGSize() + requiredWidth += drawingForm ? formSize : 0.0 + + if stackedStartIndex == -1 + { + // mark this index as we might want to break here later + stackedStartIndex = i + } + } + + if label != nil || i == entryCount - 1 + { + let requiredSpacing = currentLineWidth == 0.0 ? 0.0 : xEntrySpace + + if (!wordWrapEnabled || // No word wrapping, it must fit. + currentLineWidth == 0.0 || // The line is empty, it must fit. + (contentWidth - currentLineWidth >= requiredSpacing + requiredWidth)) // It simply fits + { + // Expand current line + currentLineWidth += requiredSpacing + requiredWidth + } + else + { // It doesn't fit, we need to wrap a line + + // Add current line size to array + calculatedLineSizes.append(CGSize(width: currentLineWidth, height: labelLineHeight)) + maxLineWidth = max(maxLineWidth, currentLineWidth) + + // Start a new line + calculatedLabelBreakPoints[stackedStartIndex > -1 ? stackedStartIndex : i] = true + currentLineWidth = requiredWidth + } + + if i == entryCount - 1 + { // Add last line size to array + calculatedLineSizes.append(CGSize(width: currentLineWidth, height: labelLineHeight)) + maxLineWidth = max(maxLineWidth, currentLineWidth) + } + } + + stackedStartIndex = label != nil ? -1 : stackedStartIndex + } + + neededWidth = maxLineWidth + neededHeight = labelLineHeight * CGFloat(calculatedLineSizes.count) + + yEntrySpace * CGFloat(calculatedLineSizes.count == 0 ? 0 : (calculatedLineSizes.count - 1)) + } + + neededWidth += xOffset + neededHeight += yOffset + } + + /// MARK: - Custom legend + + /// Sets a custom legend's entries array. + /// * A nil label will start a group. + /// This will disable the feature that automatically calculates the legend entries from the datasets. + /// Call `resetCustom(...)` to re-enable automatic calculation (and then `notifyDataSetChanged()` is needed). + @objc open func setCustom(entries: [LegendEntry]) + { + self.entries = entries + _isLegendCustom = true + } + + /// Calling this will disable the custom legend entries (set by `setLegend(...)`). Instead, the entries will again be calculated automatically (after `notifyDataSetChanged()` is called). + @objc open func resetCustom() + { + _isLegendCustom = false + } + + /// **default**: false (automatic legend) + /// `true` if a custom legend entries has been set + @objc open var isLegendCustom: Bool + { + return _isLegendCustom + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Components/LegendEntry.swift b/Carthage/Checkouts/Charts/Source/Charts/Components/LegendEntry.swift new file mode 100644 index 00000000000..5868137ef9f --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Components/LegendEntry.swift @@ -0,0 +1,88 @@ +// +// LegendEntry.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartLegendEntry) +open class LegendEntry: NSObject +{ + public override init() + { + super.init() + } + + /// - Parameters: + /// - label: The legend entry text. + /// A `nil` label will start a group. + /// - form: The form to draw for this entry. + /// - formSize: Set to NaN to use the legend's default. + /// - formLineWidth: Set to NaN to use the legend's default. + /// - formLineDashPhase: Line dash configuration. + /// - formLineDashLengths: Line dash configurationas NaN to use the legend's default. + /// - formColor: The color for drawing the form. + @objc public init(label: String?, + form: Legend.Form, + formSize: CGFloat, + formLineWidth: CGFloat, + formLineDashPhase: CGFloat, + formLineDashLengths: [CGFloat]?, + formColor: NSUIColor?) + { + self.label = label + self.form = form + self.formSize = formSize + self.formLineWidth = formLineWidth + self.formLineDashPhase = formLineDashPhase + self.formLineDashLengths = formLineDashLengths + self.formColor = formColor + } + + /// The legend entry text. + /// A `nil` label will start a group. + @objc open var label: String? + + /// The form to draw for this entry. + /// + /// `None` will avoid drawing a form, and any related space. + /// `Empty` will avoid drawing a form, but keep its space. + /// `Default` will use the Legend's default. + @objc open var form: Legend.Form = .default + + /// Form size will be considered except for when .None is used + /// + /// Set as NaN to use the legend's default + @objc open var formSize: CGFloat = CGFloat.nan + + /// Line width used for shapes that consist of lines. + /// + /// Set to NaN to use the legend's default. + @objc open var formLineWidth: CGFloat = CGFloat.nan + + /// Line dash configuration for shapes that consist of lines. + /// + /// This is how much (in pixels) into the dash pattern are we starting from. + /// + /// Set to NaN to use the legend's default. + @objc open var formLineDashPhase: CGFloat = 0.0 + + /// Line dash configuration for shapes that consist of lines. + /// + /// This is the actual dash pattern. + /// I.e. [2, 3] will paint [-- -- ] + /// [1, 3, 4, 2] will paint [- ---- - ---- ] + /// + /// Set to nil to use the legend's default. + @objc open var formLineDashLengths: [CGFloat]? + + /// The color for drawing the form + @objc open var formColor: NSUIColor? +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Components/MarkerImage.swift b/Carthage/Checkouts/Charts/Source/Charts/Components/MarkerImage.swift new file mode 100644 index 00000000000..341b1186c03 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Components/MarkerImage.swift @@ -0,0 +1,106 @@ +// +// ChartMarkerImage.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartMarkerImage) +open class MarkerImage: NSObject, IMarker +{ + /// The marker image to render + @objc open var image: NSUIImage? + + open var offset: CGPoint = CGPoint() + + @objc open weak var chartView: ChartViewBase? + + /// As long as size is 0.0/0.0 - it will default to the image's size + @objc open var size: CGSize = CGSize() + + public override init() + { + super.init() + } + + open func offsetForDrawing(atPoint point: CGPoint) -> CGPoint + { + var offset = self.offset + + let chart = self.chartView + + var size = self.size + + if size.width == 0.0 && image != nil + { + size.width = image?.size.width ?? 0.0 + } + if size.height == 0.0 && image != nil + { + size.height = image?.size.height ?? 0.0 + } + + let width = size.width + let height = size.height + + if point.x + offset.x < 0.0 + { + offset.x = -point.x + } + else if chart != nil && point.x + width + offset.x > chart!.bounds.size.width + { + offset.x = chart!.bounds.size.width - point.x - width + } + + if point.y + offset.y < 0 + { + offset.y = -point.y + } + else if chart != nil && point.y + height + offset.y > chart!.bounds.size.height + { + offset.y = chart!.bounds.size.height - point.y - height + } + + return offset + } + + open func refreshContent(entry: ChartDataEntry, highlight: Highlight) + { + // Do nothing here... + } + + open func draw(context: CGContext, point: CGPoint) + { + guard let image = image else { return } + + let offset = offsetForDrawing(atPoint: point) + + var size = self.size + + if size.width == 0.0 + { + size.width = image.size.width + } + if size.height == 0.0 + { + size.height = image.size.height + } + + let rect = CGRect( + x: point.x + offset.x, + y: point.y + offset.y, + width: size.width, + height: size.height) + + NSUIGraphicsPushContext(context) + image.draw(in: rect) + NSUIGraphicsPopContext() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Components/MarkerView.swift b/Carthage/Checkouts/Charts/Source/Charts/Components/MarkerView.swift new file mode 100644 index 00000000000..e4d682ce843 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Components/MarkerView.swift @@ -0,0 +1,95 @@ +// +// ChartMarkerView.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartMarkerView) +open class MarkerView: NSUIView, IMarker +{ + open var offset: CGPoint = CGPoint() + + @objc open weak var chartView: ChartViewBase? + + open func offsetForDrawing(atPoint point: CGPoint) -> CGPoint + { + guard let chart = chartView else { return self.offset } + + var offset = self.offset + + let width = self.bounds.size.width + let height = self.bounds.size.height + + if point.x + offset.x < 0.0 + { + offset.x = -point.x + } + else if point.x + width + offset.x > chart.bounds.size.width + { + offset.x = chart.bounds.size.width - point.x - width + } + + if point.y + offset.y < 0 + { + offset.y = -point.y + } + else if point.y + height + offset.y > chart.bounds.size.height + { + offset.y = chart.bounds.size.height - point.y - height + } + + return offset + } + + open func refreshContent(entry: ChartDataEntry, highlight: Highlight) + { + // Do nothing here... + } + + open func draw(context: CGContext, point: CGPoint) + { + let offset = self.offsetForDrawing(atPoint: point) + + context.saveGState() + context.translateBy(x: point.x + offset.x, + y: point.y + offset.y) + NSUIGraphicsPushContext(context) + self.nsuiLayer?.render(in: context) + NSUIGraphicsPopContext() + context.restoreGState() + } + + @objc + open class func viewFromXib(in bundle: Bundle = .main) -> MarkerView? + { + #if !os(OSX) + return bundle.loadNibNamed( + String(describing: self), + owner: nil, + options: nil)?[0] as? MarkerView + #else + + var loadedObjects = NSArray() + let loadedObjectsPointer = AutoreleasingUnsafeMutablePointer(&loadedObjects) + + if bundle.loadNibNamed( + NSNib.Name(String(describing: self)), + owner: nil, + topLevelObjects: loadedObjectsPointer) + { + return loadedObjects[0] as? MarkerView + } + + return nil + #endif + } + +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Components/XAxis.swift b/Carthage/Checkouts/Charts/Source/Charts/Components/XAxis.swift new file mode 100644 index 00000000000..77dbbd69744 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Components/XAxis.swift @@ -0,0 +1,75 @@ +// +// XAxis.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartXAxis) +open class XAxis: AxisBase +{ + @objc(XAxisLabelPosition) + public enum LabelPosition: Int + { + case top + case bottom + case bothSided + case topInside + case bottomInside + } + + /// width of the x-axis labels in pixels - this is automatically calculated by the `computeSize()` methods in the renderers + @objc open var labelWidth = CGFloat(1.0) + + /// height of the x-axis labels in pixels - this is automatically calculated by the `computeSize()` methods in the renderers + @objc open var labelHeight = CGFloat(1.0) + + /// width of the (rotated) x-axis labels in pixels - this is automatically calculated by the `computeSize()` methods in the renderers + @objc open var labelRotatedWidth = CGFloat(1.0) + + /// height of the (rotated) x-axis labels in pixels - this is automatically calculated by the `computeSize()` methods in the renderers + @objc open var labelRotatedHeight = CGFloat(1.0) + + /// This is the angle for drawing the X axis labels (in degrees) + @objc open var labelRotationAngle = CGFloat(0.0) + + /// if set to true, the chart will avoid that the first and last label entry in the chart "clip" off the edge of the chart + @objc open var avoidFirstLastClippingEnabled = false + + /// the position of the x-labels relative to the chart + @objc open var labelPosition = LabelPosition.top + + /// if set to true, word wrapping the labels will be enabled. + /// word wrapping is done using `(value width * labelRotatedWidth)` + /// + /// - Note: currently supports all charts except pie/radar/horizontal-bar* + @objc open var wordWrapEnabled = false + + /// `true` if word wrapping the labels is enabled + @objc open var isWordWrapEnabled: Bool { return wordWrapEnabled } + + /// the width for wrapping the labels, as percentage out of one value width. + /// used only when isWordWrapEnabled = true. + /// + /// **default**: 1.0 + @objc open var wordWrapWidthPercent: CGFloat = 1.0 + + public override init() + { + super.init() + + self.yOffset = 4.0 + } + + @objc open var isAvoidFirstLastClippingEnabled: Bool + { + return avoidFirstLastClippingEnabled + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Components/YAxis.swift b/Carthage/Checkouts/Charts/Source/Charts/Components/YAxis.swift new file mode 100644 index 00000000000..01e41b51af3 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Components/YAxis.swift @@ -0,0 +1,198 @@ +// +// YAxis.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +/// Class representing the y-axis labels settings and its entries. +/// Be aware that not all features the YLabels class provides are suitable for the RadarChart. +/// Customizations that affect the value range of the axis need to be applied before setting data for the chart. +@objc(ChartYAxis) +open class YAxis: AxisBase +{ + @objc(YAxisLabelPosition) + public enum LabelPosition: Int + { + case outsideChart + case insideChart + } + + /// Enum that specifies the axis a DataSet should be plotted against, either Left or Right. + @objc + public enum AxisDependency: Int + { + case left + case right + } + + /// indicates if the bottom y-label entry is drawn or not + @objc open var drawBottomYLabelEntryEnabled = true + + /// indicates if the top y-label entry is drawn or not + @objc open var drawTopYLabelEntryEnabled = true + + /// flag that indicates if the axis is inverted or not + @objc open var inverted = false + + /// flag that indicates if the zero-line should be drawn regardless of other grid lines + @objc open var drawZeroLineEnabled = false + + /// Color of the zero line + @objc open var zeroLineColor: NSUIColor? = NSUIColor.gray + + /// Width of the zero line + @objc open var zeroLineWidth: CGFloat = 1.0 + + /// This is how much (in pixels) into the dash pattern are we starting from. + @objc open var zeroLineDashPhase = CGFloat(0.0) + + /// This is the actual dash pattern. + /// I.e. [2, 3] will paint [-- -- ] + /// [1, 3, 4, 2] will paint [- ---- - ---- ] + @objc open var zeroLineDashLengths: [CGFloat]? + + /// axis space from the largest value to the top in percent of the total axis range + @objc open var spaceTop = CGFloat(0.1) + + /// axis space from the smallest value to the bottom in percent of the total axis range + @objc open var spaceBottom = CGFloat(0.1) + + /// the position of the y-labels relative to the chart + @objc open var labelPosition = LabelPosition.outsideChart + + /// the alignment of the text in the y-label + @objc open var labelAlignment: NSTextAlignment = .left + + /// the horizontal offset of the y-label + @objc open var labelXOffset: CGFloat = 10.0 + + /// the side this axis object represents + private var _axisDependency = AxisDependency.left + + /// the minimum width that the axis should take + /// + /// **default**: 0.0 + @objc open var minWidth = CGFloat(0) + + /// the maximum width that the axis can take. + /// use Infinity for disabling the maximum. + /// + /// **default**: CGFloat.infinity + @objc open var maxWidth = CGFloat(CGFloat.infinity) + + public override init() + { + super.init() + + self.yOffset = 0.0 + } + + @objc public init(position: AxisDependency) + { + super.init() + + _axisDependency = position + + self.yOffset = 0.0 + } + + @objc open var axisDependency: AxisDependency + { + return _axisDependency + } + + @objc open func requiredSize() -> CGSize + { + let label = getLongestLabel() as NSString + var size = label.size(withAttributes: [NSAttributedString.Key.font: labelFont]) + size.width += xOffset * 2.0 + size.height += yOffset * 2.0 + size.width = max(minWidth, min(size.width, maxWidth > 0.0 ? maxWidth : size.width)) + return size + } + + @objc open func getRequiredHeightSpace() -> CGFloat + { + return requiredSize().height + } + + /// `true` if this axis needs horizontal offset, `false` ifno offset is needed. + @objc open var needsOffset: Bool + { + if isEnabled && isDrawLabelsEnabled && labelPosition == .outsideChart + { + return true + } + else + { + return false + } + } + + @objc open var isInverted: Bool { return inverted } + + open override func calculate(min dataMin: Double, max dataMax: Double) + { + // if custom, use value as is, else use data value + var min = _customAxisMin ? _axisMinimum : dataMin + var max = _customAxisMax ? _axisMaximum : dataMax + + // Make sure max is greater than min + // Discussion: https://github.com/danielgindi/Charts/pull/3650#discussion_r221409991 + if min > max + { + switch(_customAxisMax, _customAxisMin) + { + case(true, true): + (min, max) = (max, min) + case(true, false): + min = max < 0 ? max * 1.5 : max * 0.5 + case(false, true): + max = min < 0 ? min * 0.5 : min * 1.5 + case(false, false): + break + } + } + + // temporary range (before calculations) + let range = abs(max - min) + + // in case all values are equal + if range == 0.0 + { + max = max + 1.0 + min = min - 1.0 + } + + // bottom-space only effects non-custom min + if !_customAxisMin + { + let bottomSpace = range * Double(spaceBottom) + _axisMinimum = (min - bottomSpace) + } + + // top-space only effects non-custom max + if !_customAxisMax + { + let topSpace = range * Double(spaceTop) + _axisMaximum = (max + topSpace) + } + + // calc actual range + axisRange = abs(_axisMaximum - _axisMinimum) + } + + @objc open var isDrawBottomYLabelEntryEnabled: Bool { return drawBottomYLabelEntryEnabled } + + @objc open var isDrawTopYLabelEntryEnabled: Bool { return drawTopYLabelEntryEnabled } + +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift new file mode 100644 index 00000000000..b331405b050 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/ChartBaseDataSet.swift @@ -0,0 +1,435 @@ +// +// BaseDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +open class ChartBaseDataSet: NSObject, IChartDataSet, NSCopying +{ + public required override init() + { + super.init() + + // default color + colors.append(NSUIColor(red: 140.0/255.0, green: 234.0/255.0, blue: 255.0/255.0, alpha: 1.0)) + valueColors.append(NSUIColor.black) + } + + @objc public init(label: String?) + { + super.init() + + // default color + colors.append(NSUIColor(red: 140.0/255.0, green: 234.0/255.0, blue: 255.0/255.0, alpha: 1.0)) + valueColors.append(NSUIColor.black) + + self.label = label + } + + // MARK: - Data functions and accessors + + /// Use this method to tell the data set that the underlying data has changed + open func notifyDataSetChanged() + { + calcMinMax() + } + + open func calcMinMax() + { + fatalError("calcMinMax is not implemented in ChartBaseDataSet") + } + + open func calcMinMaxY(fromX: Double, toX: Double) + { + fatalError("calcMinMaxY(fromX:, toX:) is not implemented in ChartBaseDataSet") + } + + open var yMin: Double + { + fatalError("yMin is not implemented in ChartBaseDataSet") + } + + open var yMax: Double + { + fatalError("yMax is not implemented in ChartBaseDataSet") + } + + open var xMin: Double + { + fatalError("xMin is not implemented in ChartBaseDataSet") + } + + open var xMax: Double + { + fatalError("xMax is not implemented in ChartBaseDataSet") + } + + open var entryCount: Int + { + fatalError("entryCount is not implemented in ChartBaseDataSet") + } + + open func entryForIndex(_ i: Int) -> ChartDataEntry? + { + fatalError("entryForIndex is not implemented in ChartBaseDataSet") + } + + open func entryForXValue( + _ x: Double, + closestToY y: Double, + rounding: ChartDataSetRounding) -> ChartDataEntry? + { + fatalError("entryForXValue(x, closestToY, rounding) is not implemented in ChartBaseDataSet") + } + + open func entryForXValue( + _ x: Double, + closestToY y: Double) -> ChartDataEntry? + { + fatalError("entryForXValue(x, closestToY) is not implemented in ChartBaseDataSet") + } + + open func entriesForXValue(_ x: Double) -> [ChartDataEntry] + { + fatalError("entriesForXValue is not implemented in ChartBaseDataSet") + } + + open func entryIndex( + x xValue: Double, + closestToY y: Double, + rounding: ChartDataSetRounding) -> Int + { + fatalError("entryIndex(x, closestToY, rounding) is not implemented in ChartBaseDataSet") + } + + open func entryIndex(entry e: ChartDataEntry) -> Int + { + fatalError("entryIndex(entry) is not implemented in ChartBaseDataSet") + } + + open func addEntry(_ e: ChartDataEntry) -> Bool + { + fatalError("addEntry is not implemented in ChartBaseDataSet") + } + + open func addEntryOrdered(_ e: ChartDataEntry) -> Bool + { + fatalError("addEntryOrdered is not implemented in ChartBaseDataSet") + } + + @discardableResult open func removeEntry(_ entry: ChartDataEntry) -> Bool + { + fatalError("removeEntry is not implemented in ChartBaseDataSet") + } + + @discardableResult open func removeEntry(index: Int) -> Bool + { + if let entry = entryForIndex(index) + { + return removeEntry(entry) + } + return false + } + + @discardableResult open func removeEntry(x: Double) -> Bool + { + if let entry = entryForXValue(x, closestToY: Double.nan) + { + return removeEntry(entry) + } + return false + } + + @discardableResult open func removeFirst() -> Bool + { + if entryCount > 0 + { + if let entry = entryForIndex(0) + { + return removeEntry(entry) + } + } + return false + } + + @discardableResult open func removeLast() -> Bool + { + if entryCount > 0 + { + if let entry = entryForIndex(entryCount - 1) + { + return removeEntry(entry) + } + } + return false + } + + open func contains(_ e: ChartDataEntry) -> Bool + { + fatalError("removeEntry is not implemented in ChartBaseDataSet") + } + + open func clear() + { + fatalError("clear is not implemented in ChartBaseDataSet") + } + + // MARK: - Styling functions and accessors + + /// All the colors that are used for this DataSet. + /// Colors are reused as soon as the number of Entries the DataSet represents is higher than the size of the colors array. + open var colors = [NSUIColor]() + + /// List representing all colors that are used for drawing the actual values for this DataSet + open var valueColors = [NSUIColor]() + + /// The label string that describes the DataSet. + open var label: String? = "DataSet" + + /// The axis this DataSet should be plotted against. + open var axisDependency = YAxis.AxisDependency.left + + /// - Returns: The color at the given index of the DataSet's color array. + /// This prevents out-of-bounds by performing a modulus on the color index, so colours will repeat themselves. + open func color(atIndex index: Int) -> NSUIColor + { + var index = index + if index < 0 + { + index = 0 + } + return colors[index % colors.count] + } + + /// Resets all colors of this DataSet and recreates the colors array. + open func resetColors() + { + colors.removeAll(keepingCapacity: false) + } + + /// Adds a new color to the colors array of the DataSet. + /// + /// - Parameters: + /// - color: the color to add + open func addColor(_ color: NSUIColor) + { + colors.append(color) + } + + /// Sets the one and **only** color that should be used for this DataSet. + /// Internally, this recreates the colors array and adds the specified color. + /// + /// - Parameters: + /// - color: the color to set + open func setColor(_ color: NSUIColor) + { + colors.removeAll(keepingCapacity: false) + colors.append(color) + } + + /// Sets colors to a single color a specific alpha value. + /// + /// - Parameters: + /// - color: the color to set + /// - alpha: alpha to apply to the set `color` + @objc open func setColor(_ color: NSUIColor, alpha: CGFloat) + { + setColor(color.withAlphaComponent(alpha)) + } + + /// Sets colors with a specific alpha value. + /// + /// - Parameters: + /// - colors: the colors to set + /// - alpha: alpha to apply to the set `colors` + @objc open func setColors(_ colors: [NSUIColor], alpha: CGFloat) + { + self.colors = colors.map { $0.withAlphaComponent(alpha) } + } + + /// Sets colors with a specific alpha value. + /// + /// - Parameters: + /// - colors: the colors to set + /// - alpha: alpha to apply to the set `colors` + open func setColors(_ colors: NSUIColor...) + { + self.colors = colors + } + + /// if true, value highlighting is enabled + open var highlightEnabled = true + + /// `true` if value highlighting is enabled for this dataset + open var isHighlightEnabled: Bool { return highlightEnabled } + + /// Custom formatter that is used instead of the auto-formatter if set + internal var _valueFormatter: IValueFormatter? + + /// Custom formatter that is used instead of the auto-formatter if set + open var valueFormatter: IValueFormatter? + { + get + { + if needsFormatter + { + return ChartUtils.defaultValueFormatter() + } + + return _valueFormatter + } + set + { + if newValue == nil { return } + + _valueFormatter = newValue + } + } + + open var needsFormatter: Bool + { + return _valueFormatter == nil + } + + /// Sets/get a single color for value text. + /// Setting the color clears the colors array and adds a single color. + /// Getting will return the first color in the array. + open var valueTextColor: NSUIColor + { + get + { + return valueColors[0] + } + set + { + valueColors.removeAll(keepingCapacity: false) + valueColors.append(newValue) + } + } + + /// - Returns: The color at the specified index that is used for drawing the values inside the chart. Uses modulus internally. + open func valueTextColorAt(_ index: Int) -> NSUIColor + { + var index = index + if index < 0 + { + index = 0 + } + return valueColors[index % valueColors.count] + } + + /// the font for the value-text labels + open var valueFont: NSUIFont = NSUIFont.systemFont(ofSize: 7.0) + + /// The form to draw for this dataset in the legend. + open var form = Legend.Form.default + + /// The form size to draw for this dataset in the legend. + /// + /// Return `NaN` to use the default legend form size. + open var formSize: CGFloat = CGFloat.nan + + /// The line width for drawing the form of this dataset in the legend + /// + /// Return `NaN` to use the default legend form line width. + open var formLineWidth: CGFloat = CGFloat.nan + + /// Line dash configuration for legend shapes that consist of lines. + /// + /// This is how much (in pixels) into the dash pattern are we starting from. + open var formLineDashPhase: CGFloat = 0.0 + + /// Line dash configuration for legend shapes that consist of lines. + /// + /// This is the actual dash pattern. + /// I.e. [2, 3] will paint [-- -- ] + /// [1, 3, 4, 2] will paint [- ---- - ---- ] + open var formLineDashLengths: [CGFloat]? = nil + + /// Set this to true to draw y-values on the chart. + /// + /// - Note: For bar and line charts: if `maxVisibleCount` is reached, no values will be drawn even if this is enabled. + open var drawValuesEnabled = true + + /// `true` if y-value drawing is enabled, `false` ifnot + open var isDrawValuesEnabled: Bool + { + return drawValuesEnabled + } + + /// Set this to true to draw y-icons on the chart. + /// + /// - Note: For bar and line charts: if `maxVisibleCount` is reached, no icons will be drawn even if this is enabled. + open var drawIconsEnabled = true + + /// Returns true if y-icon drawing is enabled, false if not + open var isDrawIconsEnabled: Bool + { + return drawIconsEnabled + } + + /// Offset of icons drawn on the chart. + /// + /// For all charts except Pie and Radar it will be ordinary (x offset, y offset). + /// + /// For Pie and Radar chart it will be (y offset, distance from center offset); so if you want icon to be rendered under value, you should increase X component of CGPoint, and if you want icon to be rendered closet to center, you should decrease height component of CGPoint. + open var iconsOffset = CGPoint(x: 0, y: 0) + + /// Set the visibility of this DataSet. If not visible, the DataSet will not be drawn to the chart upon refreshing it. + open var visible = true + + /// `true` if this DataSet is visible inside the chart, or `false` ifit is currently hidden. + open var isVisible: Bool + { + return visible + } + + // MARK: - NSObject + + open override var description: String + { + return String(format: "%@, label: %@, %i entries", arguments: [NSStringFromClass(type(of: self)), self.label ?? "", self.entryCount]) + } + + open override var debugDescription: String + { + return (0.. Any + { + let copy = type(of: self).init() + + copy.colors = colors + copy.valueColors = valueColors + copy.label = label + copy.axisDependency = axisDependency + copy.highlightEnabled = highlightEnabled + copy._valueFormatter = _valueFormatter + copy.valueFont = valueFont + copy.form = form + copy.formSize = formSize + copy.formLineWidth = formLineWidth + copy.formLineDashPhase = formLineDashPhase + copy.formLineDashLengths = formLineDashLengths + copy.drawValuesEnabled = drawValuesEnabled + copy.drawValuesEnabled = drawValuesEnabled + copy.iconsOffset = iconsOffset + copy.visible = visible + + return copy + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift new file mode 100644 index 00000000000..6697c32cf22 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarChartData.swift @@ -0,0 +1,107 @@ +// +// BarChartData.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class BarChartData: BarLineScatterCandleBubbleChartData +{ + public override init() + { + super.init() + } + + public override init(dataSets: [IChartDataSet]?) + { + super.init(dataSets: dataSets) + } + + /// The width of the bars on the x-axis, in values (not pixels) + /// + /// **default**: 0.85 + @objc open var barWidth = Double(0.85) + + /// Groups all BarDataSet objects this data object holds together by modifying the x-value of their entries. + /// Previously set x-values of entries will be overwritten. Leaves space between bars and groups as specified by the parameters. + /// Do not forget to call notifyDataSetChanged() on your BarChart object after calling this method. + /// + /// - Parameters: + /// - fromX: the starting point on the x-axis where the grouping should begin + /// - groupSpace: The space between groups of bars in values (not pixels) e.g. 0.8f for bar width 1f + /// - barSpace: The space between individual bars in values (not pixels) e.g. 0.1f for bar width 1f + @objc open func groupBars(fromX: Double, groupSpace: Double, barSpace: Double) + { + let setCount = _dataSets.count + if setCount <= 1 + { + print("BarData needs to hold at least 2 BarDataSets to allow grouping.", terminator: "\n") + return + } + + let max = maxEntryCountSet + let maxEntryCount = max?.entryCount ?? 0 + + let groupSpaceWidthHalf = groupSpace / 2.0 + let barSpaceHalf = barSpace / 2.0 + let barWidthHalf = self.barWidth / 2.0 + + var fromX = fromX + + let interval = groupWidth(groupSpace: groupSpace, barSpace: barSpace) + + for i in stride(from: 0, to: maxEntryCount, by: 1) + { + let start = fromX + fromX += groupSpaceWidthHalf + + (_dataSets as? [IBarChartDataSet])?.forEach { set in + fromX += barSpaceHalf + fromX += barWidthHalf + + if i < set.entryCount + { + if let entry = set.entryForIndex(i) + { + entry.x = fromX + } + } + + fromX += barWidthHalf + fromX += barSpaceHalf + } + + fromX += groupSpaceWidthHalf + let end = fromX + let innerInterval = end - start + let diff = interval - innerInterval + + // correct rounding errors + if diff > 0 || diff < 0 + { + fromX += diff + } + + } + + notifyDataChanged() + } + + /// In case of grouped bars, this method returns the space an individual group of bar needs on the x-axis. + /// + /// - Parameters: + /// - groupSpace: + /// - barSpace: + @objc open func groupWidth(groupSpace: Double, barSpace: Double) -> Double + { + return Double(_dataSets.count) * (self.barWidth + barSpace) + groupSpace + } + +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift new file mode 100644 index 00000000000..31c51b0f863 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift @@ -0,0 +1,230 @@ +// +// BarChartDataEntry.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +open class BarChartDataEntry: ChartDataEntry +{ + /// the values the stacked barchart holds + private var _yVals: [Double]? + + /// the ranges for the individual stack values - automatically calculated + private var _ranges: [Range]? + + /// the sum of all negative values this entry (if stacked) contains + private var _negativeSum: Double = 0.0 + + /// the sum of all positive values this entry (if stacked) contains + private var _positiveSum: Double = 0.0 + + public required init() + { + super.init() + } + + /// Constructor for normal bars (not stacked). + public override init(x: Double, y: Double) + { + super.init(x: x, y: y) + } + + /// Constructor for normal bars (not stacked). + public convenience init(x: Double, y: Double, data: Any?) + { + self.init(x: x, y: y) + self.data = data + } + + /// Constructor for normal bars (not stacked). + public convenience init(x: Double, y: Double, icon: NSUIImage?) + { + self.init(x: x, y: y) + self.icon = icon + } + + /// Constructor for normal bars (not stacked). + public convenience init(x: Double, y: Double, icon: NSUIImage?, data: Any?) + { + self.init(x: x, y: y) + self.icon = icon + self.data = data + } + + /// Constructor for stacked bar entries. + @objc public init(x: Double, yValues: [Double]) + { + super.init(x: x, y: BarChartDataEntry.calcSum(values: yValues)) + self._yVals = yValues + calcPosNegSum() + calcRanges() + } + + /// Constructor for stacked bar entries. One data object for whole stack + @objc public convenience init(x: Double, yValues: [Double], icon: NSUIImage?) + { + self.init(x: x, yValues: yValues) + self.icon = icon + } + + /// Constructor for stacked bar entries. One data object for whole stack + @objc public convenience init(x: Double, yValues: [Double], data: Any?) + { + self.init(x: x, yValues: yValues) + self.data = data + } + + /// Constructor for stacked bar entries. One data object for whole stack + @objc public convenience init(x: Double, yValues: [Double], icon: NSUIImage?, data: Any?) + { + self.init(x: x, yValues: yValues) + self.icon = icon + self.data = data + } + + @objc open func sumBelow(stackIndex :Int) -> Double + { + guard let yVals = _yVals else + { + return 0 + } + + var remainder: Double = 0.0 + var index = yVals.count - 1 + + while (index > stackIndex && index >= 0) + { + remainder += yVals[index] + index -= 1 + } + + return remainder + } + + /// The sum of all negative values this entry (if stacked) contains. (this is a positive number) + @objc open var negativeSum: Double + { + return _negativeSum + } + + /// The sum of all positive values this entry (if stacked) contains. + @objc open var positiveSum: Double + { + return _positiveSum + } + + @objc open func calcPosNegSum() + { + (_negativeSum, _positiveSum) = _yVals?.reduce(into: (0,0)) { (result, y) in + if y < 0 + { + result.0 += -y + } + else + { + result.1 += y + } + } ?? (0,0) + } + + /// Splits up the stack-values of the given bar-entry into Range objects. + /// + /// - Parameters: + /// - entry: + /// - Returns: + @objc open func calcRanges() + { + guard let values = yValues, !values.isEmpty else { return } + + if _ranges == nil + { + _ranges = [Range]() + } + else + { + _ranges!.removeAll() + } + + _ranges!.reserveCapacity(values.count) + + var negRemain = -negativeSum + var posRemain: Double = 0.0 + + for value in values + { + if value < 0 + { + _ranges!.append(Range(from: negRemain, to: negRemain - value)) + negRemain -= value + } + else + { + _ranges!.append(Range(from: posRemain, to: posRemain + value)) + posRemain += value + } + } + } + + // MARK: Accessors + + /// the values the stacked barchart holds + @objc open var isStacked: Bool { return _yVals != nil } + + /// the values the stacked barchart holds + @objc open var yValues: [Double]? + { + get { return self._yVals } + set + { + self.y = BarChartDataEntry.calcSum(values: newValue) + self._yVals = newValue + calcPosNegSum() + calcRanges() + } + } + + /// The ranges of the individual stack-entries. Will return null if this entry is not stacked. + @objc open var ranges: [Range]? + { + return _ranges + } + + // MARK: NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! BarChartDataEntry + copy._yVals = _yVals + copy.y = y + copy._negativeSum = _negativeSum + copy._positiveSum = _positiveSum + return copy + } + + /// Calculates the sum across all values of the given stack. + /// + /// - Parameters: + /// - vals: + /// - Returns: + private static func calcSum(values: [Double]?) -> Double + { + guard let values = values + else { return 0.0 } + + var sum = 0.0 + + for f in values + { + sum += f + } + + return sum + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift new file mode 100644 index 00000000000..2478aeccf88 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift @@ -0,0 +1,167 @@ +// +// BarChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +open class BarChartDataSet: BarLineScatterCandleBubbleChartDataSet, IBarChartDataSet +{ + private func initialize() + { + self.highlightColor = NSUIColor.black + + self.calcStackSize(entries: entries as! [BarChartDataEntry]) + self.calcEntryCountIncludingStacks(entries: entries as! [BarChartDataEntry]) + } + + public required init() + { + super.init() + initialize() + } + + public override init(entries: [ChartDataEntry]?, label: String?) + { + super.init(entries: entries, label: label) + initialize() + } + + // MARK: - Data functions and accessors + + /// the maximum number of bars that are stacked upon each other, this value + /// is calculated from the Entries that are added to the DataSet + private var _stackSize = 1 + + /// the overall entry count, including counting each stack-value individually + private var _entryCountStacks = 0 + + /// Calculates the total number of entries this DataSet represents, including + /// stacks. All values belonging to a stack are calculated separately. + private func calcEntryCountIncludingStacks(entries: [BarChartDataEntry]) + { + _entryCountStacks = 0 + + for i in 0 ..< entries.count + { + if let vals = entries[i].yValues + { + _entryCountStacks += vals.count + } + else + { + _entryCountStacks += 1 + } + } + } + + /// calculates the maximum stacksize that occurs in the Entries array of this DataSet + private func calcStackSize(entries: [BarChartDataEntry]) + { + for i in 0 ..< entries.count + { + if let vals = entries[i].yValues + { + if vals.count > _stackSize + { + _stackSize = vals.count + } + } + } + } + + open override func calcMinMax(entry e: ChartDataEntry) + { + guard let e = e as? BarChartDataEntry + else { return } + + if !e.y.isNaN + { + if e.yValues == nil + { + if e.y < _yMin + { + _yMin = e.y + } + + if e.y > _yMax + { + _yMax = e.y + } + } + else + { + if -e.negativeSum < _yMin + { + _yMin = -e.negativeSum + } + + if e.positiveSum > _yMax + { + _yMax = e.positiveSum + } + } + + calcMinMaxX(entry: e) + } + } + + /// The maximum number of bars that can be stacked upon another in this DataSet. + open var stackSize: Int + { + return _stackSize + } + + /// `true` if this DataSet is stacked (stacksize > 1) or not. + open var isStacked: Bool + { + return _stackSize > 1 ? true : false + } + + /// The overall entry count, including counting each stack-value individually + @objc open var entryCountStacks: Int + { + return _entryCountStacks + } + + /// array of labels used to describe the different values of the stacked bars + open var stackLabels: [String] = [] + + // MARK: - Styling functions and accessors + + /// the color used for drawing the bar-shadows. The bar shadows is a surface behind the bar that indicates the maximum value + open var barShadowColor = NSUIColor(red: 215.0/255.0, green: 215.0/255.0, blue: 215.0/255.0, alpha: 1.0) + + /// the width used for drawing borders around the bars. If borderWidth == 0, no border will be drawn. + open var barBorderWidth : CGFloat = 0.0 + + /// the color drawing borders around the bars. + open var barBorderColor = NSUIColor.black + + /// the alpha value (transparency) that is used for drawing the highlight indicator bar. min = 0.0 (fully transparent), max = 1.0 (fully opaque) + open var highlightAlpha = CGFloat(120.0 / 255.0) + + // MARK: - NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! BarChartDataSet + copy._stackSize = _stackSize + copy._entryCountStacks = _entryCountStacks + copy.stackLabels = stackLabels + + copy.barShadowColor = barShadowColor + copy.barBorderWidth = barBorderWidth + copy.barBorderColor = barBorderColor + copy.highlightAlpha = highlightAlpha + return copy + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift new file mode 100644 index 00000000000..c98bb1d075a --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift @@ -0,0 +1,25 @@ +// +// BarLineScatterCandleBubbleChartData.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +open class BarLineScatterCandleBubbleChartData: ChartData +{ + public override init() + { + super.init() + } + + public override init(dataSets: [IChartDataSet]?) + { + super.init(dataSets: dataSets) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift new file mode 100644 index 00000000000..91382515a83 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift @@ -0,0 +1,38 @@ +// +// BarLineScatterCandleBubbleChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +open class BarLineScatterCandleBubbleChartDataSet: ChartDataSet, IBarLineScatterCandleBubbleChartDataSet +{ + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + open var highlightColor = NSUIColor(red: 255.0/255.0, green: 187.0/255.0, blue: 115.0/255.0, alpha: 1.0) + open var highlightLineWidth = CGFloat(0.5) + open var highlightLineDashPhase = CGFloat(0.0) + open var highlightLineDashLengths: [CGFloat]? + + // MARK: - NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! BarLineScatterCandleBubbleChartDataSet + copy.highlightColor = highlightColor + copy.highlightLineWidth = highlightLineWidth + copy.highlightLineDashPhase = highlightLineDashPhase + copy.highlightLineDashLengths = highlightLineDashLengths + return copy + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift new file mode 100644 index 00000000000..433f384f75a --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartData.swift @@ -0,0 +1,32 @@ +// +// BubbleChartData.swift +// Charts +// +// Bubble chart implementation: +// Copyright 2015 Pierre-Marc Airoldi +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class BubbleChartData: BarLineScatterCandleBubbleChartData +{ + public override init() + { + super.init() + } + + public override init(dataSets: [IChartDataSet]?) + { + super.init(dataSets: dataSets) + } + + /// Sets the width of the circle that surrounds the bubble when highlighted for all DataSet objects this data object contains + @objc open func setHighlightCircleWidth(_ width: CGFloat) + { + (_dataSets as? [IBubbleChartDataSet])?.forEach { $0.highlightCircleWidth = width } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift new file mode 100644 index 00000000000..01f9fc968d9 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataEntry.swift @@ -0,0 +1,79 @@ +// +// BubbleDataEntry.swift +// Charts +// +// Bubble chart implementation: +// Copyright 2015 Pierre-Marc Airoldi +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class BubbleChartDataEntry: ChartDataEntry +{ + /// The size of the bubble. + @objc open var size = CGFloat(0.0) + + public required init() + { + super.init() + } + + /// - Parameters: + /// - x: The index on the x-axis. + /// - y: The value on the y-axis. + /// - size: The size of the bubble. + @objc public init(x: Double, y: Double, size: CGFloat) + { + super.init(x: x, y: y) + + self.size = size + } + + /// - Parameters: + /// - x: The index on the x-axis. + /// - y: The value on the y-axis. + /// - size: The size of the bubble. + /// - data: Spot for additional data this Entry represents. + @objc public convenience init(x: Double, y: Double, size: CGFloat, data: Any?) + { + self.init(x: x, y: y, size: size) + self.data = data + } + + /// - Parameters: + /// - x: The index on the x-axis. + /// - y: The value on the y-axis. + /// - size: The size of the bubble. + /// - icon: icon image + @objc public convenience init(x: Double, y: Double, size: CGFloat, icon: NSUIImage?) + { + self.init(x: x, y: y, size: size) + self.icon = icon + } + + /// - Parameters: + /// - x: The index on the x-axis. + /// - y: The value on the y-axis. + /// - size: The size of the bubble. + /// - icon: icon image + /// - data: Spot for additional data this Entry represents. + @objc public convenience init(x: Double, y: Double, size: CGFloat, icon: NSUIImage?, data: Any?) + { + self.init(x: x, y: y, size: size) + self.icon = icon + self.data = data + } + + // MARK: NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! BubbleChartDataEntry + copy.size = size + return copy + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift new file mode 100644 index 00000000000..775fafb8bdb --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift @@ -0,0 +1,58 @@ +// +// BubbleChartDataSet.swift +// Charts +// +// Bubble chart implementation: +// Copyright 2015 Pierre-Marc Airoldi +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +open class BubbleChartDataSet: BarLineScatterCandleBubbleChartDataSet, IBubbleChartDataSet +{ + // MARK: - Data functions and accessors + + internal var _maxSize = CGFloat(0.0) + + open var maxSize: CGFloat { return _maxSize } + @objc open var normalizeSizeEnabled: Bool = true + open var isNormalizeSizeEnabled: Bool { return normalizeSizeEnabled } + + open override func calcMinMax(entry e: ChartDataEntry) + { + guard let e = e as? BubbleChartDataEntry + else { return } + + super.calcMinMax(entry: e) + + let size = e.size + + if size > _maxSize + { + _maxSize = size + } + } + + // MARK: - Styling functions and accessors + + /// Sets/gets the width of the circle that surrounds the bubble when highlighted + open var highlightCircleWidth: CGFloat = 2.5 + + // MARK: - NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! BubbleChartDataSet + copy._xMin = _xMin + copy._xMax = _xMax + copy._maxSize = _maxSize + copy.normalizeSizeEnabled = normalizeSizeEnabled + copy.highlightCircleWidth = highlightCircleWidth + return copy + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift new file mode 100644 index 00000000000..5158668ad9d --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/CandleChartData.swift @@ -0,0 +1,25 @@ +// +// CandleChartData.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +open class CandleChartData: BarLineScatterCandleBubbleChartData +{ + public override init() + { + super.init() + } + + public override init(dataSets: [IChartDataSet]?) + { + super.init(dataSets: dataSets) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift new file mode 100644 index 00000000000..467bc168d12 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataEntry.swift @@ -0,0 +1,98 @@ +// +// CandleChartDataEntry.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +open class CandleChartDataEntry: ChartDataEntry +{ + /// shadow-high value + @objc open var high = Double(0.0) + + /// shadow-low value + @objc open var low = Double(0.0) + + /// close value + @objc open var close = Double(0.0) + + /// open value + @objc open var open = Double(0.0) + + public required init() + { + super.init() + } + + @objc public init(x: Double, shadowH: Double, shadowL: Double, open: Double, close: Double) + { + super.init(x: x, y: (shadowH + shadowL) / 2.0) + + self.high = shadowH + self.low = shadowL + self.open = open + self.close = close + } + + @objc public convenience init(x: Double, shadowH: Double, shadowL: Double, open: Double, close: Double, icon: NSUIImage?) + { + self.init(x: x, shadowH: shadowH, shadowL: shadowL, open: open, close: close) + self.icon = icon + } + + @objc public convenience init(x: Double, shadowH: Double, shadowL: Double, open: Double, close: Double, data: Any?) + { + self.init(x: x, shadowH: shadowH, shadowL: shadowL, open: open, close: close) + self.data = data + } + + @objc public convenience init(x: Double, shadowH: Double, shadowL: Double, open: Double, close: Double, icon: NSUIImage?, data: Any?) + { + self.init(x: x, shadowH: shadowH, shadowL: shadowL, open: open, close: close) + self.icon = icon + self.data = data + } + + /// The overall range (difference) between shadow-high and shadow-low. + @objc open var shadowRange: Double + { + return abs(high - low) + } + + /// The body size (difference between open and close). + @objc open var bodyRange: Double + { + return abs(open - close) + } + + /// the center value of the candle. (Middle value between high and low) + open override var y: Double + { + get + { + return super.y + } + set + { + super.y = (high + low) / 2.0 + } + } + + // MARK: NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! CandleChartDataEntry + copy.high = high + copy.low = low + copy.open = open + copy.close = close + return copy + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift new file mode 100644 index 00000000000..1c51da7d26e --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/CandleChartDataSet.swift @@ -0,0 +1,136 @@ +// +// CandleChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +open class CandleChartDataSet: LineScatterCandleRadarChartDataSet, ICandleChartDataSet +{ + + public required init() + { + super.init() + } + + public override init(entries: [ChartDataEntry]?, label: String?) + { + super.init(entries: entries, label: label) + } + + // MARK: - Data functions and accessors + + open override func calcMinMax(entry e: ChartDataEntry) + { + guard let e = e as? CandleChartDataEntry + else { return } + + if e.low < _yMin + { + _yMin = e.low + } + + if e.high > _yMax + { + _yMax = e.high + } + + calcMinMaxX(entry: e) + } + + open override func calcMinMaxY(entry e: ChartDataEntry) + { + guard let e = e as? CandleChartDataEntry + else { return } + + if e.high < _yMin + { + _yMin = e.high + } + if e.high > _yMax + { + _yMax = e.high + } + + if e.low < _yMin + { + _yMin = e.low + } + if e.low > _yMax + { + _yMax = e.low + } + } + + // MARK: - Styling functions and accessors + + /// the space between the candle entries + /// + /// **default**: 0.1 (10%) + private var _barSpace = CGFloat(0.1) + + /// the space that is left out on the left and right side of each candle, + /// **default**: 0.1 (10%), max 0.45, min 0.0 + open var barSpace: CGFloat + { + get + { + return _barSpace + } + set + { + _barSpace = newValue.clamped(to: 0...0.45) + } + } + + /// should the candle bars show? + /// when false, only "ticks" will show + /// + /// **default**: true + open var showCandleBar: Bool = true + + /// the width of the candle-shadow-line in pixels. + /// + /// **default**: 1.5 + open var shadowWidth = CGFloat(1.5) + + /// the color of the shadow line + open var shadowColor: NSUIColor? + + /// use candle color for the shadow + open var shadowColorSameAsCandle = false + + /// Is the shadow color same as the candle color? + open var isShadowColorSameAsCandle: Bool { return shadowColorSameAsCandle } + + /// color for open == close + open var neutralColor: NSUIColor? + + /// color for open > close + open var increasingColor: NSUIColor? + + /// color for open < close + open var decreasingColor: NSUIColor? + + /// Are increasing values drawn as filled? + /// increasing candlesticks are traditionally hollow + open var increasingFilled = false + + /// Are increasing values drawn as filled? + open var isIncreasingFilled: Bool { return increasingFilled } + + /// Are decreasing values drawn as filled? + /// descreasing candlesticks are traditionally filled + open var decreasingFilled = true + + /// Are decreasing values drawn as filled? + open var isDecreasingFilled: Bool { return decreasingFilled } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift new file mode 100644 index 00000000000..1cb1fd93f7c --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ChartData.swift @@ -0,0 +1,612 @@ +// +// ChartData.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +open class ChartData: NSObject +{ + internal var _yMax: Double = -Double.greatestFiniteMagnitude + internal var _yMin: Double = Double.greatestFiniteMagnitude + internal var _xMax: Double = -Double.greatestFiniteMagnitude + internal var _xMin: Double = Double.greatestFiniteMagnitude + internal var _leftAxisMax: Double = -Double.greatestFiniteMagnitude + internal var _leftAxisMin: Double = Double.greatestFiniteMagnitude + internal var _rightAxisMax: Double = -Double.greatestFiniteMagnitude + internal var _rightAxisMin: Double = Double.greatestFiniteMagnitude + + internal var _dataSets = [IChartDataSet]() + + public override init() + { + super.init() + + _dataSets = [IChartDataSet]() + } + + @objc public init(dataSets: [IChartDataSet]?) + { + super.init() + + _dataSets = dataSets ?? [IChartDataSet]() + + self.initialize(dataSets: _dataSets) + } + + @objc public convenience init(dataSet: IChartDataSet?) + { + self.init(dataSets: dataSet === nil ? nil : [dataSet!]) + } + + internal func initialize(dataSets: [IChartDataSet]) + { + notifyDataChanged() + } + + /// Call this method to let the ChartData know that the underlying data has changed. + /// Calling this performs all necessary recalculations needed when the contained data has changed. + @objc open func notifyDataChanged() + { + calcMinMax() + } + + @objc open func calcMinMaxY(fromX: Double, toX: Double) + { + _dataSets.forEach { $0.calcMinMaxY(fromX: fromX, toX: toX) } + // apply the new data + calcMinMax() + } + + /// calc minimum and maximum y value over all datasets + @objc open func calcMinMax() + { + _yMax = -Double.greatestFiniteMagnitude + _yMin = Double.greatestFiniteMagnitude + _xMax = -Double.greatestFiniteMagnitude + _xMin = Double.greatestFiniteMagnitude + + _dataSets.forEach { calcMinMax(dataSet: $0) } + + _leftAxisMax = -Double.greatestFiniteMagnitude + _leftAxisMin = Double.greatestFiniteMagnitude + _rightAxisMax = -Double.greatestFiniteMagnitude + _rightAxisMin = Double.greatestFiniteMagnitude + + // left axis + let firstLeft = getFirstLeft(dataSets: dataSets) + + if firstLeft !== nil + { + _leftAxisMax = firstLeft!.yMax + _leftAxisMin = firstLeft!.yMin + + for dataSet in _dataSets + { + if dataSet.axisDependency == .left + { + if dataSet.yMin < _leftAxisMin + { + _leftAxisMin = dataSet.yMin + } + + if dataSet.yMax > _leftAxisMax + { + _leftAxisMax = dataSet.yMax + } + } + } + } + + // right axis + let firstRight = getFirstRight(dataSets: dataSets) + + if firstRight !== nil + { + _rightAxisMax = firstRight!.yMax + _rightAxisMin = firstRight!.yMin + + for dataSet in _dataSets + { + if dataSet.axisDependency == .right + { + if dataSet.yMin < _rightAxisMin + { + _rightAxisMin = dataSet.yMin + } + + if dataSet.yMax > _rightAxisMax + { + _rightAxisMax = dataSet.yMax + } + } + } + } + } + + /// Adjusts the current minimum and maximum values based on the provided Entry object. + @objc open func calcMinMax(entry e: ChartDataEntry, axis: YAxis.AxisDependency) + { + if _yMax < e.y + { + _yMax = e.y + } + + if _yMin > e.y + { + _yMin = e.y + } + + if _xMax < e.x + { + _xMax = e.x + } + + if _xMin > e.x + { + _xMin = e.x + } + + if axis == .left + { + if _leftAxisMax < e.y + { + _leftAxisMax = e.y + } + + if _leftAxisMin > e.y + { + _leftAxisMin = e.y + } + } + else + { + if _rightAxisMax < e.y + { + _rightAxisMax = e.y + } + + if _rightAxisMin > e.y + { + _rightAxisMin = e.y + } + } + } + + /// Adjusts the minimum and maximum values based on the given DataSet. + @objc open func calcMinMax(dataSet d: IChartDataSet) + { + if _yMax < d.yMax + { + _yMax = d.yMax + } + + if _yMin > d.yMin + { + _yMin = d.yMin + } + + if _xMax < d.xMax + { + _xMax = d.xMax + } + + if _xMin > d.xMin + { + _xMin = d.xMin + } + + if d.axisDependency == .left + { + if _leftAxisMax < d.yMax + { + _leftAxisMax = d.yMax + } + + if _leftAxisMin > d.yMin + { + _leftAxisMin = d.yMin + } + } + else + { + if _rightAxisMax < d.yMax + { + _rightAxisMax = d.yMax + } + + if _rightAxisMin > d.yMin + { + _rightAxisMin = d.yMin + } + } + } + + /// The number of LineDataSets this object contains + @objc open var dataSetCount: Int + { + return _dataSets.count + } + + /// The smallest y-value the data object contains. + @objc open var yMin: Double + { + return _yMin + } + + @nonobjc + open func getYMin() -> Double + { + return _yMin + } + + @objc open func getYMin(axis: YAxis.AxisDependency) -> Double + { + if axis == .left + { + if _leftAxisMin == Double.greatestFiniteMagnitude + { + return _rightAxisMin + } + else + { + return _leftAxisMin + } + } + else + { + if _rightAxisMin == Double.greatestFiniteMagnitude + { + return _leftAxisMin + } + else + { + return _rightAxisMin + } + } + } + + /// The greatest y-value the data object contains. + @objc open var yMax: Double + { + return _yMax + } + + @nonobjc + open func getYMax() -> Double + { + return _yMax + } + + @objc open func getYMax(axis: YAxis.AxisDependency) -> Double + { + if axis == .left + { + if _leftAxisMax == -Double.greatestFiniteMagnitude + { + return _rightAxisMax + } + else + { + return _leftAxisMax + } + } + else + { + if _rightAxisMax == -Double.greatestFiniteMagnitude + { + return _leftAxisMax + } + else + { + return _rightAxisMax + } + } + } + + /// The minimum x-value the data object contains. + @objc open var xMin: Double + { + return _xMin + } + /// The maximum x-value the data object contains. + @objc open var xMax: Double + { + return _xMax + } + + /// All DataSet objects this ChartData object holds. + @objc open var dataSets: [IChartDataSet] + { + get + { + return _dataSets + } + set + { + _dataSets = newValue + notifyDataChanged() + } + } + + /// Retrieve the index of a ChartDataSet with a specific label from the ChartData. Search can be case sensitive or not. + /// + /// **IMPORTANT: This method does calculations at runtime, do not over-use in performance critical situations.** + /// + /// - Parameters: + /// - dataSets: the DataSet array to search + /// - type: + /// - ignorecase: if true, the search is not case-sensitive + /// - Returns: The index of the DataSet Object with the given label. Sensitive or not. + internal func getDataSetIndexByLabel(_ label: String, ignorecase: Bool) -> Int + { + // TODO: Return nil instead of -1 + if ignorecase + { + return dataSets.firstIndex { + guard let label = $0.label else { return false } + return label.caseInsensitiveCompare(label) == .orderedSame + } ?? -1 + } + else + { + return dataSets.firstIndex { $0.label == label } + ?? -1 + } + } + + /// Get the Entry for a corresponding highlight object + /// + /// - Parameters: + /// - highlight: + /// - Returns: The entry that is highlighted + @objc open func entryForHighlight(_ highlight: Highlight) -> ChartDataEntry? + { + if highlight.dataSetIndex >= dataSets.count + { + return nil + } + else + { + return dataSets[highlight.dataSetIndex].entryForXValue(highlight.x, closestToY: highlight.y) + } + } + + /// **IMPORTANT: This method does calculations at runtime. Use with care in performance critical situations.** + /// + /// - Parameters: + /// - label: + /// - ignorecase: + /// - Returns: The DataSet Object with the given label. Sensitive or not. + @objc open func getDataSetByLabel(_ label: String, ignorecase: Bool) -> IChartDataSet? + { + let index = getDataSetIndexByLabel(label, ignorecase: ignorecase) + + if index < 0 || index >= _dataSets.count + { + return nil + } + else + { + return _dataSets[index] + } + } + + @objc open func getDataSetByIndex(_ index: Int) -> IChartDataSet! + { + if index < 0 || index >= _dataSets.count + { + return nil + } + + return _dataSets[index] + } + + @objc open func addDataSet(_ dataSet: IChartDataSet!) + { + calcMinMax(dataSet: dataSet) + + _dataSets.append(dataSet) + } + + /// Removes the given DataSet from this data object. + /// Also recalculates all minimum and maximum values. + /// + /// - Returns: `true` if a DataSet was removed, `false` ifno DataSet could be removed. + @objc @discardableResult open func removeDataSet(_ dataSet: IChartDataSet) -> Bool + { + guard let i = _dataSets.firstIndex(where: { $0 === dataSet }) else { return false } + return removeDataSetByIndex(i) + } + + /// Removes the DataSet at the given index in the DataSet array from the data object. + /// Also recalculates all minimum and maximum values. + /// + /// - Returns: `true` if a DataSet was removed, `false` ifno DataSet could be removed. + @objc @discardableResult open func removeDataSetByIndex(_ index: Int) -> Bool + { + if index >= _dataSets.count || index < 0 + { + return false + } + + _dataSets.remove(at: index) + + calcMinMax() + + return true + } + + /// Adds an Entry to the DataSet at the specified index. Entries are added to the end of the list. + @objc open func addEntry(_ e: ChartDataEntry, dataSetIndex: Int) + { + if _dataSets.count > dataSetIndex && dataSetIndex >= 0 + { + let set = _dataSets[dataSetIndex] + + if !set.addEntry(e) { return } + + calcMinMax(entry: e, axis: set.axisDependency) + } + else + { + print("ChartData.addEntry() - Cannot add Entry because dataSetIndex too high or too low.", terminator: "\n") + } + } + + /// Removes the given Entry object from the DataSet at the specified index. + @objc @discardableResult open func removeEntry(_ entry: ChartDataEntry, dataSetIndex: Int) -> Bool + { + // entry outofbounds + if dataSetIndex >= _dataSets.count + { + return false + } + + // remove the entry from the dataset + let removed = _dataSets[dataSetIndex].removeEntry(entry) + + if removed + { + calcMinMax() + } + + return removed + } + + /// Removes the Entry object closest to the given xIndex from the ChartDataSet at the + /// specified index. + /// + /// - Returns: `true` if an entry was removed, `false` ifno Entry was found that meets the specified requirements. + @objc @discardableResult open func removeEntry(xValue: Double, dataSetIndex: Int) -> Bool + { + if dataSetIndex >= _dataSets.count + { + return false + } + + if let entry = _dataSets[dataSetIndex].entryForXValue(xValue, closestToY: Double.nan) + { + return removeEntry(entry, dataSetIndex: dataSetIndex) + } + + return false + } + + /// - Returns: The DataSet that contains the provided Entry, or null, if no DataSet contains this entry. + @objc open func getDataSetForEntry(_ e: ChartDataEntry) -> IChartDataSet? + { + return _dataSets.first { $0.entryForXValue(e.x, closestToY: e.y) === e } + } + + /// - Returns: The index of the provided DataSet in the DataSet array of this data object, or -1 if it does not exist. + @objc open func indexOfDataSet(_ dataSet: IChartDataSet) -> Int + { + // TODO: Return nil instead of -1 + return _dataSets.firstIndex { $0 === dataSet } ?? -1 + } + + /// - Returns: The first DataSet from the datasets-array that has it's dependency on the left axis. Returns null if no DataSet with left dependency could be found. + @objc open func getFirstLeft(dataSets: [IChartDataSet]) -> IChartDataSet? + { + return dataSets.first { $0.axisDependency == .left } + } + + /// - Returns: The first DataSet from the datasets-array that has it's dependency on the right axis. Returns null if no DataSet with right dependency could be found. + @objc open func getFirstRight(dataSets: [IChartDataSet]) -> IChartDataSet? + { + return dataSets.first { $0.axisDependency == .right } + } + + /// - Returns: All colors used across all DataSet objects this object represents. + @objc open func getColors() -> [NSUIColor]? + { + // TODO: Don't return nil + return _dataSets.flatMap { $0.colors } + } + + /// Sets a custom IValueFormatter for all DataSets this data object contains. + @objc open func setValueFormatter(_ formatter: IValueFormatter) + { + dataSets.forEach { $0.valueFormatter = formatter } + } + + /// Sets the color of the value-text (color in which the value-labels are drawn) for all DataSets this data object contains. + @objc open func setValueTextColor(_ color: NSUIColor) + { + dataSets.forEach { $0.valueTextColor = color } + } + + /// Sets the font for all value-labels for all DataSets this data object contains. + @objc open func setValueFont(_ font: NSUIFont) + { + dataSets.forEach { $0.valueFont = font } + } + + /// Enables / disables drawing values (value-text) for all DataSets this data object contains. + @objc open func setDrawValues(_ enabled: Bool) + { + dataSets.forEach { $0.drawValuesEnabled = enabled } + } + + /// Enables / disables highlighting values for all DataSets this data object contains. + /// If set to true, this means that values can be highlighted programmatically or by touch gesture. + @objc open var highlightEnabled: Bool + { + get { return dataSets.allSatisfy { $0.highlightEnabled } } + set { dataSets.forEach { $0.highlightEnabled = newValue } } + } + + /// if true, value highlightning is enabled + @objc open var isHighlightEnabled: Bool { return highlightEnabled } + + /// Clears this data object from all DataSets and removes all Entries. + /// Don't forget to invalidate the chart after this. + @objc open func clearValues() + { + dataSets.removeAll(keepingCapacity: false) + notifyDataChanged() + } + + /// Checks if this data object contains the specified DataSet. + /// + /// - Returns: `true` if so, `false` ifnot. + @objc open func contains(dataSet: IChartDataSet) -> Bool + { + return dataSets.contains { $0 === dataSet } + } + + /// The total entry count across all DataSet objects this data object contains. + @objc open var entryCount: Int + { + return _dataSets.reduce(0) { $0 + $1.entryCount } + } + + /// The DataSet object with the maximum number of entries or null if there are no DataSets. + @objc open var maxEntryCountSet: IChartDataSet? + { + return dataSets.max { $0.entryCount < $1.entryCount } + } + + // MARK: - Accessibility + + /// When the data entry labels are generated identifiers, set this property to prepend a string before each identifier + /// + /// For example, if a label is "#3", settings this property to "Item" allows it to be spoken as "Item #3" + @objc open var accessibilityEntryLabelPrefix: String? + + /// When the data entry value requires a unit, use this property to append the string representation of the unit to the value + /// + /// For example, if a value is "44.1", setting this property to "m" allows it to be spoken as "44.1 m" + @objc open var accessibilityEntryLabelSuffix: String? + + /// If the data entry value is a count, set this to true to allow plurals and other grammatical changes + /// **default**: false + @objc open var accessibilityEntryLabelSuffixIsCount: Bool = false +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift new file mode 100644 index 00000000000..3f29f964fc5 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift @@ -0,0 +1,110 @@ +// +// ChartDataEntry.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +open class ChartDataEntry: ChartDataEntryBase, NSCopying +{ + /// the x value + @objc open var x = 0.0 + + public required init() + { + super.init() + } + + /// An Entry represents one single entry in the chart. + /// + /// - Parameters: + /// - x: the x value + /// - y: the y value (the actual value of the entry) + @objc public init(x: Double, y: Double) + { + super.init(y: y) + self.x = x + } + + /// An Entry represents one single entry in the chart. + /// + /// - Parameters: + /// - x: the x value + /// - y: the y value (the actual value of the entry) + /// - data: Space for additional data this Entry represents. + + @objc public convenience init(x: Double, y: Double, data: Any?) + { + self.init(x: x, y: y) + self.data = data + } + + /// An Entry represents one single entry in the chart. + /// + /// - Parameters: + /// - x: the x value + /// - y: the y value (the actual value of the entry) + /// - icon: icon image + + @objc public convenience init(x: Double, y: Double, icon: NSUIImage?) + { + self.init(x: x, y: y) + self.icon = icon + } + + /// An Entry represents one single entry in the chart. + /// + /// - Parameters: + /// - x: the x value + /// - y: the y value (the actual value of the entry) + /// - icon: icon image + /// - data: Space for additional data this Entry represents. + + @objc public convenience init(x: Double, y: Double, icon: NSUIImage?, data: Any?) + { + self.init(x: x, y: y) + self.icon = icon + self.data = data + } + + // MARK: NSObject + + open override var description: String + { + return "ChartDataEntry, x: \(x), y \(y)" + } + + // MARK: NSCopying + + open func copy(with zone: NSZone? = nil) -> Any + { + let copy = type(of: self).init() + + copy.x = x + copy.y = y + copy.data = data + + return copy + } +} + +// MARK: Equatable +extension ChartDataEntry/*: Equatable*/ { + open override func isEqual(_ object: Any?) -> Bool { + guard let object = object as? ChartDataEntry else { return false } + + if self === object + { + return true + } + + return y == object.y + && x == object.x + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift new file mode 100644 index 00000000000..2c9d0d57441 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ChartDataEntryBase.swift @@ -0,0 +1,96 @@ +// +// ChartDataEntryBase.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +open class ChartDataEntryBase: NSObject +{ + /// the y value + @objc open var y = 0.0 + + /// optional spot for additional data this Entry represents + @objc open var data: Any? + + /// optional icon image + @objc open var icon: NSUIImage? + + public override required init() + { + super.init() + } + + /// An Entry represents one single entry in the chart. + /// + /// - Parameters: + /// - y: the y value (the actual value of the entry) + @objc public init(y: Double) + { + super.init() + + self.y = y + } + + /// - Parameters: + /// - y: the y value (the actual value of the entry) + /// - data: Space for additional data this Entry represents. + + @objc public convenience init(y: Double, data: Any?) + { + self.init(y: y) + + self.data = data + } + + /// - Parameters: + /// - y: the y value (the actual value of the entry) + /// - icon: icon image + + @objc public convenience init(y: Double, icon: NSUIImage?) + { + self.init(y: y) + + self.icon = icon + } + + /// - Parameters: + /// - y: the y value (the actual value of the entry) + /// - icon: icon image + /// - data: Space for additional data this Entry represents. + + @objc public convenience init(y: Double, icon: NSUIImage?, data: Any?) + { + self.init(y: y) + + self.icon = icon + self.data = data + } + + // MARK: NSObject + + open override var description: String + { + return "ChartDataEntryBase, y \(y)" + } +} + +// MARK: Equatable +extension ChartDataEntryBase/*: Equatable*/ { + open override func isEqual(_ object: Any?) -> Bool { + guard let object = object as? ChartDataEntryBase else { return false } + + if self === object + { + return true + } + + return y == object.y + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift new file mode 100644 index 00000000000..1a9d2353954 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift @@ -0,0 +1,576 @@ +// +// ChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +/// Determines how to round DataSet index values for `ChartDataSet.entryIndex(x, rounding)` when an exact x-value is not found. +@objc +public enum ChartDataSetRounding: Int +{ + case up = 0 + case down = 1 + case closest = 2 +} + +/// The DataSet class represents one group or type of entries (Entry) in the Chart that belong together. +/// It is designed to logically separate different groups of values inside the Chart (e.g. the values for a specific line in the LineChart, or the values of a specific group of bars in the BarChart). +open class ChartDataSet: ChartBaseDataSet +{ + public required init() + { + entries = [] + + super.init() + } + + public override init(label: String?) + { + entries = [] + + super.init(label: label) + } + + @objc public init(entries: [ChartDataEntry]?, label: String?) + { + self.entries = entries ?? [] + + super.init(label: label) + + self.calcMinMax() + } + + @objc public convenience init(entries: [ChartDataEntry]?) + { + self.init(entries: entries, label: "DataSet") + } + + // MARK: - Data functions and accessors + + /// - Note: Calls `notifyDataSetChanged()` after setting a new value. + /// - Returns: The array of y-values that this DataSet represents. + /// the entries that this dataset represents / holds together + @available(*, unavailable, renamed: "entries") + @objc + open var values: [ChartDataEntry] { return entries } + + @objc + open private(set) var entries: [ChartDataEntry] + + /// Used to replace all entries of a data set while retaining styling properties. + /// This is a separate method from a setter on `entries` to encourage usage + /// of `Collection` conformances. + /// + /// - Parameter entries: new entries to replace existing entries in the dataset + @objc + public func replaceEntries(_ entries: [ChartDataEntry]) { + self.entries = entries + notifyDataSetChanged() + } + + /// maximum y-value in the value array + internal var _yMax: Double = -Double.greatestFiniteMagnitude + + /// minimum y-value in the value array + internal var _yMin: Double = Double.greatestFiniteMagnitude + + /// maximum x-value in the value array + internal var _xMax: Double = -Double.greatestFiniteMagnitude + + /// minimum x-value in the value array + internal var _xMin: Double = Double.greatestFiniteMagnitude + + open override func calcMinMax() + { + _yMax = -Double.greatestFiniteMagnitude + _yMin = Double.greatestFiniteMagnitude + _xMax = -Double.greatestFiniteMagnitude + _xMin = Double.greatestFiniteMagnitude + + guard !isEmpty else { return } + + forEach(calcMinMax) + } + + open override func calcMinMaxY(fromX: Double, toX: Double) + { + _yMax = -Double.greatestFiniteMagnitude + _yMin = Double.greatestFiniteMagnitude + + guard !isEmpty else { return } + + let indexFrom = entryIndex(x: fromX, closestToY: Double.nan, rounding: .down) + let indexTo = entryIndex(x: toX, closestToY: Double.nan, rounding: .up) + + guard !(indexTo < indexFrom) else { return } + // only recalculate y + self[indexFrom...indexTo].forEach(calcMinMaxY) + } + + @objc open func calcMinMaxX(entry e: ChartDataEntry) + { + if e.x < _xMin + { + _xMin = e.x + } + if e.x > _xMax + { + _xMax = e.x + } + } + + @objc open func calcMinMaxY(entry e: ChartDataEntry) + { + if e.y < _yMin + { + _yMin = e.y + } + if e.y > _yMax + { + _yMax = e.y + } + } + + /// Updates the min and max x and y value of this DataSet based on the given Entry. + /// + /// - Parameters: + /// - e: + internal func calcMinMax(entry e: ChartDataEntry) + { + calcMinMaxX(entry: e) + calcMinMaxY(entry: e) + } + + /// The minimum y-value this DataSet holds + open override var yMin: Double { return _yMin } + + /// The maximum y-value this DataSet holds + open override var yMax: Double { return _yMax } + + /// The minimum x-value this DataSet holds + open override var xMin: Double { return _xMin } + + /// The maximum x-value this DataSet holds + open override var xMax: Double { return _xMax } + + /// The number of y-values this DataSet represents + @available(*, deprecated, message: "Use `count` instead") + open override var entryCount: Int { return count } + + /// - Throws: out of bounds + /// if `i` is out of bounds, it may throw an out-of-bounds exception + /// - Returns: The entry object found at the given index (not x-value!) + @available(*, deprecated, message: "Use `subscript(index:)` instead.") + open override func entryForIndex(_ i: Int) -> ChartDataEntry? + { + guard i >= startIndex, i < endIndex else { + return nil + } + return self[i] + } + + /// - Parameters: + /// - xValue: the x-value + /// - closestToY: If there are multiple y-values for the specified x-value, + /// - rounding: determine whether to round up/down/closest if there is no Entry matching the provided x-value + /// - Returns: The first Entry object found at the given x-value with binary search. + /// If the no Entry at the specified x-value is found, this method returns the Entry at the closest x-value according to the rounding. + /// nil if no Entry object at that x-value. + open override func entryForXValue( + _ xValue: Double, + closestToY yValue: Double, + rounding: ChartDataSetRounding) -> ChartDataEntry? + { + let index = entryIndex(x: xValue, closestToY: yValue, rounding: rounding) + if index > -1 + { + return self[index] + } + return nil + } + + /// - Parameters: + /// - xValue: the x-value + /// - closestToY: If there are multiple y-values for the specified x-value, + /// - Returns: The first Entry object found at the given x-value with binary search. + /// If the no Entry at the specified x-value is found, this method returns the Entry at the closest x-value. + /// nil if no Entry object at that x-value. + open override func entryForXValue( + _ xValue: Double, + closestToY yValue: Double) -> ChartDataEntry? + { + return entryForXValue(xValue, closestToY: yValue, rounding: .closest) + } + + /// - Returns: All Entry objects found at the given xIndex with binary search. + /// An empty array if no Entry object at that index. + open override func entriesForXValue(_ xValue: Double) -> [ChartDataEntry] + { + var entries = [ChartDataEntry]() + + var low = startIndex + var high = endIndex - 1 + + while low <= high + { + var m = (high + low) / 2 + var entry = self[m] + + // if we have a match + if xValue == entry.x + { + while m > 0 && self[m - 1].x == xValue + { + m -= 1 + } + + high = endIndex + + // loop over all "equal" entries + while m < high + { + entry = self[m] + if entry.x == xValue + { + entries.append(entry) + } + else + { + break + } + + m += 1 + } + + break + } + else + { + if xValue > entry.x + { + low = m + 1 + } + else + { + high = m - 1 + } + } + } + + return entries + } + + /// - Parameters: + /// - xValue: x-value of the entry to search for + /// - closestToY: If there are multiple y-values for the specified x-value, + /// - rounding: Rounding method if exact value was not found + /// - Returns: The array-index of the specified entry. + /// If the no Entry at the specified x-value is found, this method returns the index of the Entry at the closest x-value according to the rounding. + open override func entryIndex( + x xValue: Double, + closestToY yValue: Double, + rounding: ChartDataSetRounding) -> Int + { + var low = startIndex + var high = endIndex - 1 + var closest = high + + while low < high + { + let m = (low + high) / 2 + + let d1 = self[m].x - xValue + let d2 = self[m + 1].x - xValue + let ad1 = abs(d1), ad2 = abs(d2) + + if ad2 < ad1 + { + // [m + 1] is closer to xValue + // Search in an higher place + low = m + 1 + } + else if ad1 < ad2 + { + // [m] is closer to xValue + // Search in a lower place + high = m + } + else + { + // We have multiple sequential x-value with same distance + + if d1 >= 0.0 + { + // Search in a lower place + high = m + } + else if d1 < 0.0 + { + // Search in an higher place + low = m + 1 + } + } + + closest = high + } + + if closest != -1 + { + let closestXValue = self[closest].x + + if rounding == .up + { + // If rounding up, and found x-value is lower than specified x, and we can go upper... + if closestXValue < xValue && closest < endIndex - 1 + { + closest += 1 + } + } + else if rounding == .down + { + // If rounding down, and found x-value is upper than specified x, and we can go lower... + if closestXValue > xValue && closest > 0 + { + closest -= 1 + } + } + + // Search by closest to y-value + if !yValue.isNaN + { + while closest > 0 && self[closest - 1].x == closestXValue + { + closest -= 1 + } + + var closestYValue = self[closest].y + var closestYIndex = closest + + while true + { + closest += 1 + if closest >= endIndex { break } + + let value = self[closest] + + if value.x != closestXValue { break } + if abs(value.y - yValue) <= abs(closestYValue - yValue) + { + closestYValue = yValue + closestYIndex = closest + } + } + + closest = closestYIndex + } + } + + return closest + } + + /// - Parameters: + /// - e: the entry to search for + /// - Returns: The array-index of the specified entry + @available(*, deprecated, message: "Use `firstIndex(of:)` or `lastIndex(of:)`") + open override func entryIndex(entry e: ChartDataEntry) -> Int + { + return firstIndex(of: e) ?? -1 + } + + /// Adds an Entry to the DataSet dynamically. + /// Entries are added to the end of the list. + /// This will also recalculate the current minimum and maximum values of the DataSet and the value-sum. + /// + /// - Parameters: + /// - e: the entry to add + /// - Returns: True + @available(*, deprecated, message: "Use `append(_:)` instead") + open override func addEntry(_ e: ChartDataEntry) -> Bool + { + append(e) + return true + } + + /// Adds an Entry to the DataSet dynamically. + /// Entries are added to their appropriate index respective to it's x-index. + /// This will also recalculate the current minimum and maximum values of the DataSet and the value-sum. + /// + /// - Parameters: + /// - e: the entry to add + /// - Returns: True + open override func addEntryOrdered(_ e: ChartDataEntry) -> Bool + { + calcMinMax(entry: e) + + if let last = last, last.x > e.x + { + var closestIndex = entryIndex(x: e.x, closestToY: e.y, rounding: .up) + while self[closestIndex].x < e.x + { + closestIndex += 1 + } + entries.insert(e, at: closestIndex) + } + else + { + append(e) + } + + return true + } + + @available(*, renamed: "remove(_:)") + open override func removeEntry(_ entry: ChartDataEntry) -> Bool + { + return remove(entry) + } + + /// Removes an Entry from the DataSet dynamically. + /// This will also recalculate the current minimum and maximum values of the DataSet and the value-sum. + /// + /// - Parameters: + /// - entry: the entry to remove + /// - Returns: `true` if the entry was removed successfully, else if the entry does not exist + open func remove(_ entry: ChartDataEntry) -> Bool + { + guard let index = firstIndex(of: entry) else { return false } + _ = remove(at: index) + return true + } + + /// Removes the first Entry (at index 0) of this DataSet from the entries array. + /// + /// - Returns: `true` if successful, `false` if not. + @available(*, deprecated, message: "Use `func removeFirst() -> ChartDataEntry` instead.") + open override func removeFirst() -> Bool + { + let entry: ChartDataEntry? = isEmpty ? nil : removeFirst() + return entry != nil + } + + /// Removes the last Entry (at index size-1) of this DataSet from the entries array. + /// + /// - Returns: `true` if successful, `false` if not. + @available(*, deprecated, message: "Use `func removeLast() -> ChartDataEntry` instead.") + open override func removeLast() -> Bool + { + let entry: ChartDataEntry? = isEmpty ? nil : removeLast() + return entry != nil + } + + /// Removes all values from this DataSet and recalculates min and max value. + @available(*, deprecated, message: "Use `removeAll(keepingCapacity:)` instead.") + open override func clear() + { + removeAll(keepingCapacity: true) + } + + // MARK: - Data functions and accessors + + // MARK: - NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! ChartDataSet + + copy.entries = entries + copy._yMax = _yMax + copy._yMin = _yMin + copy._xMax = _xMax + copy._xMin = _xMin + + return copy + } +} + +// MARK: MutableCollection +extension ChartDataSet: MutableCollection { + public typealias Index = Int + public typealias Element = ChartDataEntry + + public var startIndex: Index { + return entries.startIndex + } + + public var endIndex: Index { + return entries.endIndex + } + + public func index(after: Index) -> Index { + return entries.index(after: after) + } + + @objc + public subscript(position: Index) -> Element { + get { + // This is intentionally not a safe subscript to mirror + // the behaviour of the built in Swift Collection Types + return entries[position] + } + set { + calcMinMax(entry: newValue) + entries[position] = newValue + } + } +} + +// MARK: RandomAccessCollection +extension ChartDataSet: RandomAccessCollection { + public func index(before: Index) -> Index { + return entries.index(before: before) + } +} + +// MARK: RangeReplaceableCollection +extension ChartDataSet: RangeReplaceableCollection { + public func append(_ newElement: Element) { + calcMinMax(entry: newElement) + entries.append(newElement) + } + + public func remove(at position: Index) -> Element { + let element = entries.remove(at: position) + notifyDataSetChanged() + return element + } + + public func removeFirst() -> Element { + let element = entries.removeFirst() + notifyDataSetChanged() + return element + } + + public func removeFirst(_ n: Int) { + entries.removeFirst(n) + notifyDataSetChanged() + } + + public func removeLast() -> Element { + let element = entries.removeLast() + notifyDataSetChanged() + return element + } + + public func removeLast(_ n: Int) { + entries.removeLast(n) + notifyDataSetChanged() + } + + public func removeSubrange(_ bounds: R) where R : RangeExpression, Index == R.Bound { + entries.removeSubrange(bounds) + notifyDataSetChanged() + } + + @objc + public func removeAll(keepingCapacity keepCapacity: Bool) { + entries.removeAll(keepingCapacity: keepCapacity) + notifyDataSetChanged() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift new file mode 100644 index 00000000000..e883c8b7f34 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/CombinedChartData.swift @@ -0,0 +1,301 @@ +// +// CombinedChartData.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +open class CombinedChartData: BarLineScatterCandleBubbleChartData +{ + private var _lineData: LineChartData! + private var _barData: BarChartData! + private var _scatterData: ScatterChartData! + private var _candleData: CandleChartData! + private var _bubbleData: BubbleChartData! + + public override init() + { + super.init() + } + + public override init(dataSets: [IChartDataSet]?) + { + super.init(dataSets: dataSets) + } + + @objc open var lineData: LineChartData! + { + get + { + return _lineData + } + set + { + _lineData = newValue + notifyDataChanged() + } + } + + @objc open var barData: BarChartData! + { + get + { + return _barData + } + set + { + _barData = newValue + notifyDataChanged() + } + } + + @objc open var scatterData: ScatterChartData! + { + get + { + return _scatterData + } + set + { + _scatterData = newValue + notifyDataChanged() + } + } + + @objc open var candleData: CandleChartData! + { + get + { + return _candleData + } + set + { + _candleData = newValue + notifyDataChanged() + } + } + + @objc open var bubbleData: BubbleChartData! + { + get + { + return _bubbleData + } + set + { + _bubbleData = newValue + notifyDataChanged() + } + } + + open override func calcMinMax() + { + _dataSets.removeAll() + + _yMax = -Double.greatestFiniteMagnitude + _yMin = Double.greatestFiniteMagnitude + _xMax = -Double.greatestFiniteMagnitude + _xMin = Double.greatestFiniteMagnitude + + _leftAxisMax = -Double.greatestFiniteMagnitude + _leftAxisMin = Double.greatestFiniteMagnitude + _rightAxisMax = -Double.greatestFiniteMagnitude + _rightAxisMin = Double.greatestFiniteMagnitude + + let allData = self.allData + + for data in allData + { + data.calcMinMax() + + let sets = data.dataSets + _dataSets.append(contentsOf: sets) + + if data.yMax > _yMax + { + _yMax = data.yMax + } + + if data.yMin < _yMin + { + _yMin = data.yMin + } + + if data.xMax > _xMax + { + _xMax = data.xMax + } + + if data.xMin < _xMin + { + _xMin = data.xMin + } + + for dataset in sets + { + if dataset.axisDependency == .left + { + if dataset.yMax > _leftAxisMax + { + _leftAxisMax = dataset.yMax + } + if dataset.yMin < _leftAxisMin + { + _leftAxisMin = dataset.yMin + } + } + else + { + if dataset.yMax > _rightAxisMax + { + _rightAxisMax = dataset.yMax + } + if dataset.yMin < _rightAxisMin + { + _rightAxisMin = dataset.yMin + } + } + } + } + } + + /// All data objects in row: line-bar-scatter-candle-bubble if not null. + @objc open var allData: [ChartData] + { + var data = [ChartData]() + + if lineData !== nil + { + data.append(lineData) + } + if barData !== nil + { + data.append(barData) + } + if scatterData !== nil + { + data.append(scatterData) + } + if candleData !== nil + { + data.append(candleData) + } + if bubbleData !== nil + { + data.append(bubbleData) + } + + return data + } + + @objc open func dataByIndex(_ index: Int) -> ChartData + { + return allData[index] + } + + open func dataIndex(_ data: ChartData) -> Int? + { + return allData.firstIndex(of: data) + } + + open override func removeDataSet(_ dataSet: IChartDataSet) -> Bool + { + return allData.contains { $0.removeDataSet(dataSet) } + } + + open override func removeDataSetByIndex(_ index: Int) -> Bool + { + print("removeDataSet(index) not supported for CombinedData", terminator: "\n") + return false + } + + open override func removeEntry(_ entry: ChartDataEntry, dataSetIndex: Int) -> Bool + { + print("removeEntry(entry, dataSetIndex) not supported for CombinedData", terminator: "\n") + return false + } + + open override func removeEntry(xValue: Double, dataSetIndex: Int) -> Bool + { + print("removeEntry(xValue, dataSetIndex) not supported for CombinedData", terminator: "\n") + return false + } + + open override func notifyDataChanged() + { + if _lineData !== nil + { + _lineData.notifyDataChanged() + } + if _barData !== nil + { + _barData.notifyDataChanged() + } + if _scatterData !== nil + { + _scatterData.notifyDataChanged() + } + if _candleData !== nil + { + _candleData.notifyDataChanged() + } + if _bubbleData !== nil + { + _bubbleData.notifyDataChanged() + } + + super.notifyDataChanged() // recalculate everything + } + + /// Get the Entry for a corresponding highlight object + /// + /// - Parameters: + /// - highlight: + /// - Returns: The entry that is highlighted + open override func entryForHighlight(_ highlight: Highlight) -> ChartDataEntry? + { + if highlight.dataIndex >= allData.count + { + return nil + } + + let data = dataByIndex(highlight.dataIndex) + + if highlight.dataSetIndex >= data.dataSetCount + { + return nil + } + + // The value of the highlighted entry could be NaN - if we are not interested in highlighting a specific value. + let entries = data.getDataSetByIndex(highlight.dataSetIndex).entriesForXValue(highlight.x) + return entries.first { $0.y == highlight.y || highlight.y.isNaN } + } + + /// Get dataset for highlight + /// + /// - Parameters: + /// - highlight: current highlight + /// - Returns: dataset related to highlight + @objc open func getDataSetByHighlight(_ highlight: Highlight) -> IChartDataSet! + { + if highlight.dataIndex >= allData.count + { + return nil + } + + let data = dataByIndex(highlight.dataIndex) + + if highlight.dataSetIndex >= data.dataSetCount + { + return nil + } + + return data.dataSets[highlight.dataSetIndex] + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift new file mode 100644 index 00000000000..2ebd6b42a9d --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/LineChartData.swift @@ -0,0 +1,26 @@ +// +// LineChartData.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +/// Data object that encapsulates all data associated with a LineChart. +open class LineChartData: ChartData +{ + public override init() + { + super.init() + } + + public override init(dataSets: [IChartDataSet]?) + { + super.init(dataSets: dataSets) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift new file mode 100644 index 00000000000..b53ddd4d056 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift @@ -0,0 +1,173 @@ +// +// LineChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +open class LineChartDataSet: LineRadarChartDataSet, ILineChartDataSet +{ + @objc(LineChartMode) + public enum Mode: Int + { + case linear + case stepped + case cubicBezier + case horizontalBezier + } + + private func initialize() + { + // default color + circleColors.append(NSUIColor(red: 140.0/255.0, green: 234.0/255.0, blue: 255.0/255.0, alpha: 1.0)) + } + + public required init() + { + super.init() + initialize() + } + + public override init(entries: [ChartDataEntry]?, label: String?) + { + super.init(entries: entries, label: label) + initialize() + } + + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + /// The drawing mode for this line dataset + /// + /// **default**: Linear + open var mode: Mode = Mode.linear + + private var _cubicIntensity = CGFloat(0.2) + + /// Intensity for cubic lines (min = 0.05, max = 1) + /// + /// **default**: 0.2 + open var cubicIntensity: CGFloat + { + get + { + return _cubicIntensity + } + set + { + _cubicIntensity = newValue.clamped(to: 0.05...1) + } + } + + /// The radius of the drawn circles. + open var circleRadius = CGFloat(8.0) + + /// The hole radius of the drawn circles + open var circleHoleRadius = CGFloat(4.0) + + open var circleColors = [NSUIColor]() + + /// - Returns: The color at the given index of the DataSet's circle-color array. + /// Performs a IndexOutOfBounds check by modulus. + open func getCircleColor(atIndex index: Int) -> NSUIColor? + { + let size = circleColors.count + let index = index % size + if index >= size + { + return nil + } + return circleColors[index] + } + + /// Sets the one and ONLY color that should be used for this DataSet. + /// Internally, this recreates the colors array and adds the specified color. + open func setCircleColor(_ color: NSUIColor) + { + circleColors.removeAll(keepingCapacity: false) + circleColors.append(color) + } + + open func setCircleColors(_ colors: NSUIColor...) + { + circleColors.removeAll(keepingCapacity: false) + circleColors.append(contentsOf: colors) + } + + /// Resets the circle-colors array and creates a new one + open func resetCircleColors(_ index: Int) + { + circleColors.removeAll(keepingCapacity: false) + } + + /// If true, drawing circles is enabled + open var drawCirclesEnabled = true + + /// `true` if drawing circles for this DataSet is enabled, `false` ifnot + open var isDrawCirclesEnabled: Bool { return drawCirclesEnabled } + + /// The color of the inner circle (the circle-hole). + open var circleHoleColor: NSUIColor? = NSUIColor.white + + /// `true` if drawing circles for this DataSet is enabled, `false` ifnot + open var drawCircleHoleEnabled = true + + /// `true` if drawing the circle-holes is enabled, `false` ifnot. + open var isDrawCircleHoleEnabled: Bool { return drawCircleHoleEnabled } + + /// This is how much (in pixels) into the dash pattern are we starting from. + open var lineDashPhase = CGFloat(0.0) + + /// This is the actual dash pattern. + /// I.e. [2, 3] will paint [-- -- ] + /// [1, 3, 4, 2] will paint [- ---- - ---- ] + open var lineDashLengths: [CGFloat]? + + /// Line cap type, default is CGLineCap.Butt + open var lineCapType = CGLineCap.butt + + /// formatter for customizing the position of the fill-line + private var _fillFormatter: IFillFormatter = DefaultFillFormatter() + + /// Sets a custom IFillFormatter to the chart that handles the position of the filled-line for each DataSet. Set this to null to use the default logic. + open var fillFormatter: IFillFormatter? + { + get + { + return _fillFormatter + } + set + { + _fillFormatter = newValue ?? DefaultFillFormatter() + } + } + + // MARK: NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! LineChartDataSet + copy.circleColors = circleColors + copy.circleHoleColor = circleHoleColor + copy.circleRadius = circleRadius + copy.circleHoleRadius = circleHoleRadius + copy.cubicIntensity = cubicIntensity + copy.lineDashPhase = lineDashPhase + copy.lineDashLengths = lineDashLengths + copy.lineCapType = lineCapType + copy.drawCirclesEnabled = drawCirclesEnabled + copy.drawCircleHoleEnabled = drawCircleHoleEnabled + copy.mode = mode + copy._fillFormatter = _fillFormatter + return copy + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift new file mode 100644 index 00000000000..54a3af6929c --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/LineRadarChartDataSet.swift @@ -0,0 +1,85 @@ +// +// LineRadarChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +open class LineRadarChartDataSet: LineScatterCandleRadarChartDataSet, ILineRadarChartDataSet +{ + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + /// The color that is used for filling the line surface area. + private var _fillColor = NSUIColor(red: 140.0/255.0, green: 234.0/255.0, blue: 255.0/255.0, alpha: 1.0) + + /// The color that is used for filling the line surface area. + open var fillColor: NSUIColor + { + get { return _fillColor } + set + { + _fillColor = newValue + fill = nil + } + } + + /// The object that is used for filling the area below the line. + /// **default**: nil + open var fill: Fill? + + /// The alpha value that is used for filling the line surface, + /// **default**: 0.33 + open var fillAlpha = CGFloat(0.33) + + private var _lineWidth = CGFloat(1.0) + + /// line width of the chart (min = 0.0, max = 10) + /// + /// **default**: 1 + open var lineWidth: CGFloat + { + get + { + return _lineWidth + } + set + { + _lineWidth = newValue.clamped(to: 0...10) + } + } + + /// Set to `true` if the DataSet should be drawn filled (surface), and not just as a line. + /// Disabling this will give great performance boost. + /// Please note that this method uses the path clipping for drawing the filled area (with images, gradients and layers). + open var drawFilledEnabled = false + + /// `true` if filled drawing is enabled, `false` ifnot + open var isDrawFilledEnabled: Bool + { + return drawFilledEnabled + } + + // MARK: NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! LineRadarChartDataSet + copy.fill = fill + copy.fillAlpha = fillAlpha + copy._fillColor = _fillColor + copy._lineWidth = _lineWidth + copy.drawFilledEnabled = drawFilledEnabled + return copy + } + +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift new file mode 100644 index 00000000000..1c68983bbc8 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift @@ -0,0 +1,51 @@ +// +// LineScatterCandleRadarChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + + +open class LineScatterCandleRadarChartDataSet: BarLineScatterCandleBubbleChartDataSet, ILineScatterCandleRadarChartDataSet +{ + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + /// Enables / disables the horizontal highlight-indicator. If disabled, the indicator is not drawn. + open var drawHorizontalHighlightIndicatorEnabled = true + + /// Enables / disables the vertical highlight-indicator. If disabled, the indicator is not drawn. + open var drawVerticalHighlightIndicatorEnabled = true + + /// `true` if horizontal highlight indicator lines are enabled (drawn) + open var isHorizontalHighlightIndicatorEnabled: Bool { return drawHorizontalHighlightIndicatorEnabled } + + /// `true` if vertical highlight indicator lines are enabled (drawn) + open var isVerticalHighlightIndicatorEnabled: Bool { return drawVerticalHighlightIndicatorEnabled } + + /// Enables / disables both vertical and horizontal highlight-indicators. + /// :param: enabled + open func setDrawHighlightIndicators(_ enabled: Bool) + { + drawHorizontalHighlightIndicatorEnabled = enabled + drawVerticalHighlightIndicatorEnabled = enabled + } + + // MARK: NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! LineScatterCandleRadarChartDataSet + copy.drawHorizontalHighlightIndicatorEnabled = drawHorizontalHighlightIndicatorEnabled + copy.drawVerticalHighlightIndicatorEnabled = drawVerticalHighlightIndicatorEnabled + return copy + } + +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift new file mode 100644 index 00000000000..7f343835172 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/PieChartData.swift @@ -0,0 +1,124 @@ +// +// PieData.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +open class PieChartData: ChartData +{ + public override init() + { + super.init() + } + + public override init(dataSets: [IChartDataSet]?) + { + super.init(dataSets: dataSets) + } + + /// All DataSet objects this ChartData object holds. + @objc open override var dataSets: [IChartDataSet] + { + get + { + assert(super.dataSets.count <= 1, "Found multiple data sets while pie chart only allows one") + return super.dataSets + } + set + { + super.dataSets = newValue + } + } + + @objc var dataSet: IPieChartDataSet? + { + get + { + return dataSets.count > 0 ? dataSets[0] as? IPieChartDataSet : nil + } + set + { + if let newValue = newValue + { + dataSets = [newValue] + } + else + { + dataSets = [] + } + } + } + + open override func getDataSetByIndex(_ index: Int) -> IChartDataSet? + { + if index != 0 + { + return nil + } + return super.getDataSetByIndex(index) + } + + open override func getDataSetByLabel(_ label: String, ignorecase: Bool) -> IChartDataSet? + { + if dataSets.count == 0 || dataSets[0].label == nil + { + return nil + } + + if ignorecase + { + if let label = dataSets[0].label, label.caseInsensitiveCompare(label) == .orderedSame + { + return dataSets[0] + } + } + else + { + if label == dataSets[0].label + { + return dataSets[0] + } + } + return nil + } + + open override func entryForHighlight(_ highlight: Highlight) -> ChartDataEntry? + { + return dataSet?.entryForIndex(Int(highlight.x)) + } + + open override func addDataSet(_ d: IChartDataSet!) + { + super.addDataSet(d) + } + + /// Removes the DataSet at the given index in the DataSet array from the data object. + /// Also recalculates all minimum and maximum values. + /// + /// - Returns: `true` if a DataSet was removed, `false` ifno DataSet could be removed. + open override func removeDataSetByIndex(_ index: Int) -> Bool + { + if index >= _dataSets.count || index < 0 + { + return false + } + + return false + } + + /// The total y-value sum across all DataSet objects the this object represents. + @objc open var yValueSum: Double + { + guard let dataSet = dataSet else { return 0.0 } + return (0.. Any + { + let copy = super.copy(with: zone) as! PieChartDataEntry + copy.label = label + return copy + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift new file mode 100644 index 00000000000..ac0e63489a2 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift @@ -0,0 +1,135 @@ +// +// PieChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class PieChartDataSet: ChartDataSet, IPieChartDataSet +{ + @objc(PieChartValuePosition) + public enum ValuePosition: Int + { + case insideSlice + case outsideSlice + } + + private func initialize() + { + self.valueTextColor = NSUIColor.white + self.valueFont = NSUIFont.systemFont(ofSize: 13.0) + } + + public required init() + { + super.init() + initialize() + } + + public override init(entries: [ChartDataEntry]?, label: String?) + { + super.init(entries: entries, label: label) + initialize() + } + + internal override func calcMinMax(entry e: ChartDataEntry) + { + calcMinMaxY(entry: e) + } + + // MARK: - Styling functions and accessors + + private var _sliceSpace = CGFloat(0.0) + + /// the space in pixels between the pie-slices + /// **default**: 0 + /// **maximum**: 20 + open var sliceSpace: CGFloat + { + get + { + return _sliceSpace + } + set + { + var space = newValue + if space > 20.0 + { + space = 20.0 + } + if space < 0.0 + { + space = 0.0 + } + _sliceSpace = space + } + } + + /// When enabled, slice spacing will be 0.0 when the smallest value is going to be smaller than the slice spacing itself. + open var automaticallyDisableSliceSpacing: Bool = false + + /// indicates the selection distance of a pie slice + open var selectionShift = CGFloat(18.0) + + open var xValuePosition: ValuePosition = .insideSlice + open var yValuePosition: ValuePosition = .insideSlice + + /// When valuePosition is OutsideSlice, indicates line color + open var valueLineColor: NSUIColor? = NSUIColor.black + + /// When valuePosition is OutsideSlice and enabled, line will have the same color as the slice + open var useValueColorForLine: Bool = false + + /// When valuePosition is OutsideSlice, indicates line width + open var valueLineWidth: CGFloat = 1.0 + + /// When valuePosition is OutsideSlice, indicates offset as percentage out of the slice size + open var valueLinePart1OffsetPercentage: CGFloat = 0.75 + + /// When valuePosition is OutsideSlice, indicates length of first half of the line + open var valueLinePart1Length: CGFloat = 0.3 + + /// When valuePosition is OutsideSlice, indicates length of second half of the line + open var valueLinePart2Length: CGFloat = 0.4 + + /// When valuePosition is OutsideSlice, this allows variable line length + open var valueLineVariableLength: Bool = true + + /// the font for the slice-text labels + open var entryLabelFont: NSUIFont? = nil + + /// the color for the slice-text labels + open var entryLabelColor: NSUIColor? = nil + + /// the color for the highlighted sector + open var highlightColor: NSUIColor? = nil + + // MARK: - NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! PieChartDataSet + copy._sliceSpace = _sliceSpace + copy.automaticallyDisableSliceSpacing = automaticallyDisableSliceSpacing + copy.selectionShift = selectionShift + copy.xValuePosition = xValuePosition + copy.yValuePosition = yValuePosition + copy.valueLineColor = valueLineColor + copy.valueLineWidth = valueLineWidth + copy.valueLinePart1OffsetPercentage = valueLinePart1OffsetPercentage + copy.valueLinePart1Length = valueLinePart1Length + copy.valueLinePart2Length = valueLinePart2Length + copy.valueLineVariableLength = valueLineVariableLength + copy.entryLabelFont = entryLabelFont + copy.entryLabelColor = entryLabelColor + copy.highlightColor = highlightColor + return copy + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift new file mode 100644 index 00000000000..31fd7d2ba07 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/RadarChartData.swift @@ -0,0 +1,46 @@ +// +// RadarChartData.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +open class RadarChartData: ChartData +{ + @objc open var highlightColor = NSUIColor(red: 255.0/255.0, green: 187.0/255.0, blue: 115.0/255.0, alpha: 1.0) + @objc open var highlightLineWidth = CGFloat(1.0) + @objc open var highlightLineDashPhase = CGFloat(0.0) + @objc open var highlightLineDashLengths: [CGFloat]? + + /// Sets labels that should be drawn around the RadarChart at the end of each web line. + @objc open var labels = [String]() + + /// Sets the labels that should be drawn around the RadarChart at the end of each web line. + open func setLabels(_ labels: String...) + { + self.labels = labels + } + + public override init() + { + super.init() + } + + public override init(dataSets: [IChartDataSet]?) + { + super.init(dataSets: dataSets) + } + + open override func entryForHighlight(_ highlight: Highlight) -> ChartDataEntry? + { + return getDataSetByIndex(highlight.dataSetIndex)?.entryForIndex(Int(highlight.x)) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift new file mode 100644 index 00000000000..e557ba9205d --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataEntry.swift @@ -0,0 +1,54 @@ +// +// RadarChartDataEntry.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class RadarChartDataEntry: ChartDataEntry +{ + public required init() + { + super.init() + } + + /// - Parameters: + /// - value: The value on the y-axis. + @objc public init(value: Double) + { + super.init(x: .nan, y: value) + } + + /// - Parameters: + /// - value: The value on the y-axis. + /// - data: Spot for additional data this Entry represents. + @objc public convenience init(value: Double, data: Any?) + { + self.init(value: value) + self.data = data + } + + // MARK: Data property accessors + + @objc open var value: Double + { + get { return y } + set { y = value } + } + + // MARK: NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! RadarChartDataEntry + + return copy + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift new file mode 100644 index 00000000000..030269d6a2f --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift @@ -0,0 +1,59 @@ +// +// RadarChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +open class RadarChartDataSet: LineRadarChartDataSet, IRadarChartDataSet +{ + private func initialize() + { + self.valueFont = NSUIFont.systemFont(ofSize: 13.0) + } + + public required init() + { + super.init() + initialize() + } + + public required override init(entries: [ChartDataEntry]?, label: String?) + { + super.init(entries: entries, label: label) + initialize() + } + + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + /// flag indicating whether highlight circle should be drawn or not + /// **default**: false + open var drawHighlightCircleEnabled: Bool = false + + /// `true` if highlight circle should be drawn, `false` ifnot + open var isDrawHighlightCircleEnabled: Bool { return drawHighlightCircleEnabled } + + open var highlightCircleFillColor: NSUIColor? = NSUIColor.white + + /// The stroke color for highlight circle. + /// If `nil`, the color of the dataset is taken. + open var highlightCircleStrokeColor: NSUIColor? + + open var highlightCircleStrokeAlpha: CGFloat = 0.3 + + open var highlightCircleInnerRadius: CGFloat = 3.0 + + open var highlightCircleOuterRadius: CGFloat = 4.0 + + open var highlightCircleStrokeWidth: CGFloat = 2.0 +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift new file mode 100644 index 00000000000..e06a60325d5 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartData.swift @@ -0,0 +1,34 @@ +// +// ScatterChartData.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class ScatterChartData: BarLineScatterCandleBubbleChartData +{ + public override init() + { + super.init() + } + + public override init(dataSets: [IChartDataSet]?) + { + super.init(dataSets: dataSets) + } + + /// - Returns: The maximum shape-size across all DataSets. + @objc open func getGreatestShapeSize() -> CGFloat + { + return (_dataSets as? [IScatterChartDataSet])? + .max { $0.scatterShapeSize < $1.scatterShapeSize }? + .scatterShapeSize ?? 0 + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift new file mode 100644 index 00000000000..bc9767a06cf --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Implementations/Standard/ScatterChartDataSet.swift @@ -0,0 +1,78 @@ +// +// ScatterChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class ScatterChartDataSet: LineScatterCandleRadarChartDataSet, IScatterChartDataSet +{ + + @objc(ScatterShape) + public enum Shape: Int + { + case square + case circle + case triangle + case cross + case x + case chevronUp + case chevronDown + } + + /// The size the scatter shape will have + open var scatterShapeSize = CGFloat(10.0) + + /// The radius of the hole in the shape (applies to Square, Circle and Triangle) + /// **default**: 0.0 + open var scatterShapeHoleRadius: CGFloat = 0.0 + + /// Color for the hole in the shape. Setting to `nil` will behave as transparent. + /// **default**: nil + open var scatterShapeHoleColor: NSUIColor? = nil + + /// Sets the ScatterShape this DataSet should be drawn with. + /// This will search for an available IShapeRenderer and set this renderer for the DataSet + @objc open func setScatterShape(_ shape: Shape) + { + self.shapeRenderer = ScatterChartDataSet.renderer(forShape: shape) + } + + /// The IShapeRenderer responsible for rendering this DataSet. + /// This can also be used to set a custom IShapeRenderer aside from the default ones. + /// **default**: `SquareShapeRenderer` + open var shapeRenderer: IShapeRenderer? = SquareShapeRenderer() + + @objc open class func renderer(forShape shape: Shape) -> IShapeRenderer + { + switch shape + { + case .square: return SquareShapeRenderer() + case .circle: return CircleShapeRenderer() + case .triangle: return TriangleShapeRenderer() + case .cross: return CrossShapeRenderer() + case .x: return XShapeRenderer() + case .chevronUp: return ChevronUpShapeRenderer() + case .chevronDown: return ChevronDownShapeRenderer() + } + } + + // MARK: NSCopying + + open override func copy(with zone: NSZone? = nil) -> Any + { + let copy = super.copy(with: zone) as! ScatterChartDataSet + copy.scatterShapeSize = scatterShapeSize + copy.scatterShapeHoleRadius = scatterShapeHoleRadius + copy.scatterShapeHoleColor = scatterShapeHoleColor + copy.shapeRenderer = shapeRenderer + return copy + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift new file mode 100644 index 00000000000..b90b4dc0c22 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IBarChartDataSet.swift @@ -0,0 +1,42 @@ +// +// IBarChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol IBarChartDataSet: IBarLineScatterCandleBubbleChartDataSet +{ + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + /// `true` if this DataSet is stacked (stacksize > 1) or not. + var isStacked: Bool { get } + + /// The maximum number of bars that can be stacked upon another in this DataSet. + var stackSize: Int { get } + + /// the color used for drawing the bar-shadows. The bar shadows is a surface behind the bar that indicates the maximum value + var barShadowColor: NSUIColor { get set } + + /// the width used for drawing borders around the bars. If borderWidth == 0, no border will be drawn. + var barBorderWidth : CGFloat { get set } + + /// the color drawing borders around the bars. + var barBorderColor: NSUIColor { get set } + + /// the alpha value (transparency) that is used for drawing the highlight indicator bar. min = 0.0 (fully transparent), max = 1.0 (fully opaque) + var highlightAlpha: CGFloat { get set } + + /// array of labels used to describe the different values of the stacked bars + var stackLabels: [String] { get set } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift new file mode 100644 index 00000000000..8af47ff4a74 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift @@ -0,0 +1,26 @@ +// +// IBarLineScatterCandleBubbleChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol IBarLineScatterCandleBubbleChartDataSet: IChartDataSet +{ + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + var highlightColor: NSUIColor { get set } + var highlightLineWidth: CGFloat { get set } + var highlightLineDashPhase: CGFloat { get set } + var highlightLineDashLengths: [CGFloat]? { get set } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift new file mode 100644 index 00000000000..10c5d9eecba --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IBubbleChartDataSet.swift @@ -0,0 +1,27 @@ +// +// IBubbleChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol IBubbleChartDataSet: IBarLineScatterCandleBubbleChartDataSet +{ + // MARK: - Data functions and accessors + + var maxSize: CGFloat { get } + var isNormalizeSizeEnabled: Bool { get } + + // MARK: - Styling functions and accessors + + /// Sets/gets the width of the circle that surrounds the bubble when highlighted + var highlightCircleWidth: CGFloat { get set } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift new file mode 100644 index 00000000000..fac88d3b2e2 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/ICandleChartDataSet.swift @@ -0,0 +1,66 @@ +// +// ICandleChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol ICandleChartDataSet: ILineScatterCandleRadarChartDataSet +{ + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + /// the space that is left out on the left and right side of each candle, + /// **default**: 0.1 (10%), max 0.45, min 0.0 + var barSpace: CGFloat { get set } + + /// should the candle bars show? + /// when false, only "ticks" will show + /// + /// **default**: true + var showCandleBar: Bool { get set } + + /// the width of the candle-shadow-line in pixels. + /// + /// **default**: 3.0 + var shadowWidth: CGFloat { get set } + + /// the color of the shadow line + var shadowColor: NSUIColor? { get set } + + /// use candle color for the shadow + var shadowColorSameAsCandle: Bool { get set } + + /// Is the shadow color same as the candle color? + var isShadowColorSameAsCandle: Bool { get } + + /// color for open == close + var neutralColor: NSUIColor? { get set } + + /// color for open > close + var increasingColor: NSUIColor? { get set } + + /// color for open < close + var decreasingColor: NSUIColor? { get set } + + /// Are increasing values drawn as filled? + var increasingFilled: Bool { get set } + + /// Are increasing values drawn as filled? + var isIncreasingFilled: Bool { get } + + /// Are decreasing values drawn as filled? + var decreasingFilled: Bool { get set } + + /// Are decreasing values drawn as filled? + var isDecreasingFilled: Bool { get } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift new file mode 100644 index 00000000000..849da103b75 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IChartDataSet.swift @@ -0,0 +1,270 @@ +// +// IChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol IChartDataSet +{ + // MARK: - Data functions and accessors + + /// Use this method to tell the data set that the underlying data has changed + func notifyDataSetChanged() + + /// Calculates the minimum and maximum x and y values (_xMin, _xMax, _yMin, _yMax). + func calcMinMax() + + /// Calculates the min and max y-values from the Entry closest to the given fromX to the Entry closest to the given toX value. + /// This is only needed for the autoScaleMinMax feature. + func calcMinMaxY(fromX: Double, toX: Double) + + /// The minimum y-value this DataSet holds + var yMin: Double { get } + + /// The maximum y-value this DataSet holds + var yMax: Double { get } + + /// The minimum x-value this DataSet holds + var xMin: Double { get } + + /// The maximum x-value this DataSet holds + var xMax: Double { get } + + /// The number of y-values this DataSet represents + var entryCount: Int { get } + + /// - Throws: out of bounds + /// if `i` is out of bounds, it may throw an out-of-bounds exception + /// - Returns: The entry object found at the given index (not x-value!) + func entryForIndex(_ i: Int) -> ChartDataEntry? + + /// - Parameters: + /// - xValue: the x-value + /// - closestToY: If there are multiple y-values for the specified x-value, + /// - rounding: determine whether to round up/down/closest if there is no Entry matching the provided x-value + /// - Returns: The first Entry object found at the given x-value with binary search. + /// If the no Entry at the specified x-value is found, this method returns the Entry at the closest x-value according to the rounding. + /// nil if no Entry object at that x-value. + func entryForXValue( + _ xValue: Double, + closestToY yValue: Double, + rounding: ChartDataSetRounding) -> ChartDataEntry? + + /// - Parameters: + /// - xValue: the x-value + /// - closestToY: If there are multiple y-values for the specified x-value, + /// - Returns: The first Entry object found at the given x-value with binary search. + /// If the no Entry at the specified x-value is found, this method returns the Entry at the closest x-value. + /// nil if no Entry object at that x-value. + func entryForXValue( + _ xValue: Double, + closestToY yValue: Double) -> ChartDataEntry? + + /// - Returns: All Entry objects found at the given x-value with binary search. + /// An empty array if no Entry object at that x-value. + func entriesForXValue(_ xValue: Double) -> [ChartDataEntry] + + /// - Parameters: + /// - xValue: x-value of the entry to search for + /// - closestToY: If there are multiple y-values for the specified x-value, + /// - rounding: Rounding method if exact value was not found + /// - Returns: The array-index of the specified entry. + /// If the no Entry at the specified x-value is found, this method returns the index of the Entry at the closest x-value according to the rounding. + func entryIndex( + x xValue: Double, + closestToY yValue: Double, + rounding: ChartDataSetRounding) -> Int + + /// - Parameters: + /// - e: the entry to search for + /// - Returns: The array-index of the specified entry + func entryIndex(entry e: ChartDataEntry) -> Int + + /// Adds an Entry to the DataSet dynamically. + /// + /// *optional feature, can return `false` ifnot implemented* + /// + /// Entries are added to the end of the list. + /// + /// - Parameters: + /// - e: the entry to add + /// - Returns: `true` if the entry was added successfully, `false` ifthis feature is not supported + func addEntry(_ e: ChartDataEntry) -> Bool + + /// Adds an Entry to the DataSet dynamically. + /// Entries are added to their appropriate index in the values array respective to their x-position. + /// This will also recalculate the current minimum and maximum values of the DataSet and the value-sum. + /// + /// *optional feature, can return `false` ifnot implemented* + /// + /// Entries are added to the end of the list. + /// + /// - Parameters: + /// - e: the entry to add + /// - Returns: `true` if the entry was added successfully, `false` ifthis feature is not supported + func addEntryOrdered(_ e: ChartDataEntry) -> Bool + + /// Removes an Entry from the DataSet dynamically. + /// + /// *optional feature, can return `false` ifnot implemented* + /// + /// - Parameters: + /// - entry: the entry to remove + /// - Returns: `true` if the entry was removed successfully, `false` ifthe entry does not exist or if this feature is not supported + func removeEntry(_ entry: ChartDataEntry) -> Bool + + /// Removes the Entry object at the given index in the values array from the DataSet. + /// + /// *optional feature, can return `false` ifnot implemented* + /// + /// - Parameters: + /// - index: the index of the entry to remove + /// - Returns: `true` if the entry was removed successfully, `false` ifthe entry does not exist or if this feature is not supported + func removeEntry(index: Int) -> Bool + + /// Removes the Entry object closest to the given x-value from the DataSet. + /// + /// *optional feature, can return `false` ifnot implemented* + /// + /// - Parameters: + /// - x: the x-value to remove + /// - Returns: `true` if the entry was removed successfully, `false` ifthe entry does not exist or if this feature is not supported + func removeEntry(x: Double) -> Bool + + /// Removes the first Entry (at index 0) of this DataSet from the entries array. + /// + /// *optional feature, can return `false` ifnot implemented* + /// + /// - Returns: `true` if the entry was removed successfully, `false` ifthe entry does not exist or if this feature is not supported + func removeFirst() -> Bool + + /// Removes the last Entry (at index 0) of this DataSet from the entries array. + /// + /// *optional feature, can return `false` ifnot implemented* + /// + /// - Returns: `true` if the entry was removed successfully, `false` ifthe entry does not exist or if this feature is not supported + func removeLast() -> Bool + + /// Checks if this DataSet contains the specified Entry. + /// + /// - Returns: `true` if contains the entry, `false` ifnot. + func contains(_ e: ChartDataEntry) -> Bool + + /// Removes all values from this DataSet and does all necessary recalculations. + /// + /// *optional feature, could throw if not implemented* + func clear() + + // MARK: - Styling functions and accessors + + /// The label string that describes the DataSet. + var label: String? { get } + + /// The axis this DataSet should be plotted against. + var axisDependency: YAxis.AxisDependency { get } + + /// List representing all colors that are used for drawing the actual values for this DataSet + var valueColors: [NSUIColor] { get } + + /// All the colors that are used for this DataSet. + /// Colors are reused as soon as the number of Entries the DataSet represents is higher than the size of the colors array. + var colors: [NSUIColor] { get } + + /// - Returns: The color at the given index of the DataSet's color array. + /// This prevents out-of-bounds by performing a modulus on the color index, so colours will repeat themselves. + func color(atIndex: Int) -> NSUIColor + + func resetColors() + + func addColor(_ color: NSUIColor) + + func setColor(_ color: NSUIColor) + + /// if true, value highlighting is enabled + var highlightEnabled: Bool { get set } + + /// `true` if value highlighting is enabled for this dataset + var isHighlightEnabled: Bool { get } + + /// Custom formatter that is used instead of the auto-formatter if set + var valueFormatter: IValueFormatter? { get set } + + /// `true` if the valueFormatter object of this DataSet is null. + var needsFormatter: Bool { get } + + /// Sets/get a single color for value text. + /// Setting the color clears the colors array and adds a single color. + /// Getting will return the first color in the array. + var valueTextColor: NSUIColor { get set } + + /// - Returns: The color at the specified index that is used for drawing the values inside the chart. Uses modulus internally. + func valueTextColorAt(_ index: Int) -> NSUIColor + + /// the font for the value-text labels + var valueFont: NSUIFont { get set } + + /// The form to draw for this dataset in the legend. + /// + /// Return `.Default` to use the default legend form. + var form: Legend.Form { get } + + /// The form size to draw for this dataset in the legend. + /// + /// Return `NaN` to use the default legend form size. + var formSize: CGFloat { get } + + /// The line width for drawing the form of this dataset in the legend + /// + /// Return `NaN` to use the default legend form line width. + var formLineWidth: CGFloat { get } + + /// Line dash configuration for legend shapes that consist of lines. + /// + /// This is how much (in pixels) into the dash pattern are we starting from. + var formLineDashPhase: CGFloat { get } + + /// Line dash configuration for legend shapes that consist of lines. + /// + /// This is the actual dash pattern. + /// I.e. [2, 3] will paint [-- -- ] + /// [1, 3, 4, 2] will paint [- ---- - ---- ] + var formLineDashLengths: [CGFloat]? { get } + + /// Set this to true to draw y-values on the chart. + /// + /// - Note: For bar and line charts: if `maxVisibleCount` is reached, no values will be drawn even if this is enabled. + var drawValuesEnabled: Bool { get set } + + /// `true` if y-value drawing is enabled, `false` ifnot + var isDrawValuesEnabled: Bool { get } + + /// Set this to true to draw y-icons on the chart + /// + /// - Note: For bar and line charts: if `maxVisibleCount` is reached, no icons will be drawn even if this is enabled. + var drawIconsEnabled: Bool { get set } + + /// Returns true if y-icon drawing is enabled, false if not + var isDrawIconsEnabled: Bool { get } + + /// Offset of icons drawn on the chart. + /// + /// For all charts except Pie and Radar it will be ordinary (x offset, y offset). + /// + /// For Pie and Radar chart it will be (y offset, distance from center offset); so if you want icon to be rendered under value, you should increase X component of CGPoint, and if you want icon to be rendered closet to center, you should decrease height component of CGPoint. + var iconsOffset: CGPoint { get set } + + /// Set the visibility of this DataSet. If not visible, the DataSet will not be drawn to the chart upon refreshing it. + var visible: Bool { get set } + + /// `true` if this DataSet is visible inside the chart, or `false` ifit is currently hidden. + var isVisible: Bool { get } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift new file mode 100644 index 00000000000..071f269535a --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/ILineChartDataSet.swift @@ -0,0 +1,80 @@ +// +// ILineChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + + +@objc +public protocol ILineChartDataSet: ILineRadarChartDataSet +{ + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + /// The drawing mode for this line dataset + /// + /// **default**: Linear + var mode: LineChartDataSet.Mode { get set } + + /// Intensity for cubic lines (min = 0.05, max = 1) + /// + /// **default**: 0.2 + var cubicIntensity: CGFloat { get set } + + /// The radius of the drawn circles. + var circleRadius: CGFloat { get set } + + /// The hole radius of the drawn circles. + var circleHoleRadius: CGFloat { get set } + + var circleColors: [NSUIColor] { get set } + + /// - Returns: The color at the given index of the DataSet's circle-color array. + /// Performs a IndexOutOfBounds check by modulus. + func getCircleColor(atIndex: Int) -> NSUIColor? + + /// Sets the one and ONLY color that should be used for this DataSet. + /// Internally, this recreates the colors array and adds the specified color. + func setCircleColor(_ color: NSUIColor) + + /// Resets the circle-colors array and creates a new one + func resetCircleColors(_ index: Int) + + /// If true, drawing circles is enabled + var drawCirclesEnabled: Bool { get set } + + /// `true` if drawing circles for this DataSet is enabled, `false` ifnot + var isDrawCirclesEnabled: Bool { get } + + /// The color of the inner circle (the circle-hole). + var circleHoleColor: NSUIColor? { get set } + + /// `true` if drawing circles for this DataSet is enabled, `false` ifnot + var drawCircleHoleEnabled: Bool { get set } + + /// `true` if drawing the circle-holes is enabled, `false` ifnot. + var isDrawCircleHoleEnabled: Bool { get } + + /// This is how much (in pixels) into the dash pattern are we starting from. + var lineDashPhase: CGFloat { get } + + /// This is the actual dash pattern. + /// I.e. [2, 3] will paint [-- -- ] + /// [1, 3, 4, 2] will paint [- ---- - ---- ] + var lineDashLengths: [CGFloat]? { get set } + + /// Line cap type, default is CGLineCap.Butt + var lineCapType: CGLineCap { get set } + + /// Sets a custom IFillFormatter to the chart that handles the position of the filled-line for each DataSet. Set this to null to use the default logic. + var fillFormatter: IFillFormatter? { get set } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift new file mode 100644 index 00000000000..d9f8980b47d --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/ILineRadarChartDataSet.swift @@ -0,0 +1,45 @@ +// +// ILineRadarChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol ILineRadarChartDataSet: ILineScatterCandleRadarChartDataSet +{ + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + /// The color that is used for filling the line surface area. + var fillColor: NSUIColor { get set } + + /// - Returns: The object that is used for filling the area below the line. + /// **default**: nil + var fill: Fill? { get set } + + /// The alpha value that is used for filling the line surface. + /// **default**: 0.33 + var fillAlpha: CGFloat { get set } + + /// line width of the chart (min = 0.0, max = 10) + /// + /// **default**: 1 + var lineWidth: CGFloat { get set } + + /// Set to `true` if the DataSet should be drawn filled (surface), and not just as a line. + /// Disabling this will give great performance boost. + /// Please note that this method uses the path clipping for drawing the filled area (with images, gradients and layers). + var drawFilledEnabled: Bool { get set } + + /// `true` if filled drawing is enabled, `false` if not + var isDrawFilledEnabled: Bool { get } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift new file mode 100644 index 00000000000..27c2bca944b --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift @@ -0,0 +1,36 @@ +// +// ILineScatterCandleRadarChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +@objc +public protocol ILineScatterCandleRadarChartDataSet: IBarLineScatterCandleBubbleChartDataSet +{ + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + /// Enables / disables the horizontal highlight-indicator. If disabled, the indicator is not drawn. + var drawHorizontalHighlightIndicatorEnabled: Bool { get set } + + /// Enables / disables the vertical highlight-indicator. If disabled, the indicator is not drawn. + var drawVerticalHighlightIndicatorEnabled: Bool { get set } + + /// `true` if horizontal highlight indicator lines are enabled (drawn) + var isHorizontalHighlightIndicatorEnabled: Bool { get } + + /// `true` if vertical highlight indicator lines are enabled (drawn) + var isVerticalHighlightIndicatorEnabled: Bool { get } + + /// Enables / disables both vertical and horizontal highlight-indicators. + /// :param: enabled + func setDrawHighlightIndicators(_ enabled: Bool) +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift new file mode 100644 index 00000000000..433c08f2626 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IPieChartDataSet.swift @@ -0,0 +1,64 @@ +// +// IPieChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol IPieChartDataSet: IChartDataSet +{ + // MARK: - Styling functions and accessors + + /// the space in pixels between the pie-slices + /// **default**: 0 + /// **maximum**: 20 + var sliceSpace: CGFloat { get set } + + /// When enabled, slice spacing will be 0.0 when the smallest value is going to be smaller than the slice spacing itself. + var automaticallyDisableSliceSpacing: Bool { get set } + + /// indicates the selection distance of a pie slice + var selectionShift: CGFloat { get set } + + var xValuePosition: PieChartDataSet.ValuePosition { get set } + var yValuePosition: PieChartDataSet.ValuePosition { get set } + + /// When valuePosition is OutsideSlice, indicates line color + var valueLineColor: NSUIColor? { get set } + + /// When valuePosition is OutsideSlice and enabled, line will have the same color as the slice + var useValueColorForLine: Bool { get set } + + /// When valuePosition is OutsideSlice, indicates line width + var valueLineWidth: CGFloat { get set } + + /// When valuePosition is OutsideSlice, indicates offset as percentage out of the slice size + var valueLinePart1OffsetPercentage: CGFloat { get set } + + /// When valuePosition is OutsideSlice, indicates length of first half of the line + var valueLinePart1Length: CGFloat { get set } + + /// When valuePosition is OutsideSlice, indicates length of second half of the line + var valueLinePart2Length: CGFloat { get set } + + /// When valuePosition is OutsideSlice, this allows variable line length + var valueLineVariableLength: Bool { get set } + + /// the font for the slice-text labels + var entryLabelFont: NSUIFont? { get set } + + /// the color for the slice-text labels + var entryLabelColor: NSUIColor? { get set } + + /// get/sets the color for the highlighted sector + var highlightColor: NSUIColor? { get set } + +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift new file mode 100644 index 00000000000..2e37b4ffd5b --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IRadarChartDataSet.swift @@ -0,0 +1,40 @@ +// +// IRadarChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol IRadarChartDataSet: ILineRadarChartDataSet +{ + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + /// flag indicating whether highlight circle should be drawn or not + var drawHighlightCircleEnabled: Bool { get set } + + var isDrawHighlightCircleEnabled: Bool { get } + + var highlightCircleFillColor: NSUIColor? { get set } + + /// The stroke color for highlight circle. + /// If `nil`, the color of the dataset is taken. + var highlightCircleStrokeColor: NSUIColor? { get set } + + var highlightCircleStrokeAlpha: CGFloat { get set } + + var highlightCircleInnerRadius: CGFloat { get set } + + var highlightCircleOuterRadius: CGFloat { get set } + + var highlightCircleStrokeWidth: CGFloat { get set } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift new file mode 100644 index 00000000000..05651467255 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Data/Interfaces/IScatterChartDataSet.swift @@ -0,0 +1,36 @@ +// +// IScatterChartDataSet.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol IScatterChartDataSet: ILineScatterCandleRadarChartDataSet +{ + // MARK: - Data functions and accessors + + // MARK: - Styling functions and accessors + + /// The size the scatter shape will have + var scatterShapeSize: CGFloat { get } + + /// - Returns: The radius of the hole in the shape (applies to Square, Circle and Triangle) + /// Set this to <= 0 to remove holes. + /// **default**: 0.0 + var scatterShapeHoleRadius: CGFloat { get } + + /// - Returns: Color for the hole in the shape. Setting to `nil` will behave as transparent. + /// **default**: nil + var scatterShapeHoleColor: NSUIColor? { get } + + /// The IShapeRenderer responsible for rendering this DataSet. + var shapeRenderer: IShapeRenderer? { get } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Filters/DataApproximator+N.swift b/Carthage/Checkouts/Charts/Source/Charts/Filters/DataApproximator+N.swift new file mode 100644 index 00000000000..36bbeec4248 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Filters/DataApproximator+N.swift @@ -0,0 +1,152 @@ +// +// DataApproximator+N.swift +// Charts +// +// Created by M Ivaniushchenko on 9/6/17. +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +extension CGPoint { + fileprivate func distanceToLine(from linePoint1: CGPoint, to linePoint2: CGPoint) -> CGFloat { + let dx = linePoint2.x - linePoint1.x + let dy = linePoint2.y - linePoint1.y + + let dividend = abs(dy * self.x - dx * self.y - linePoint1.x * linePoint2.y + linePoint2.x * linePoint1.y) + let divisor = sqrt(dx * dx + dy * dy) + + return dividend / divisor + } +} + +private struct LineAlt { + let start: Int + let end: Int + + var distance: CGFloat = 0 + var index: Int = 0 + + init(start: Int, end: Int, points: [CGPoint]) { + self.start = start + self.end = end + + let startPoint = points[start] + let endPoint = points[end] + + guard (end > start + 1) else { + return + } + + for i in start + 1 ..< end { + let currentPoint = points[i] + + let distance = currentPoint.distanceToLine(from: startPoint, to: endPoint) + + if distance > self.distance { + self.index = i + self.distance = distance + } + } + } +} + +extension LineAlt: Comparable { + static func ==(lhs: LineAlt, rhs: LineAlt) -> Bool { + return (lhs.start == rhs.start) && (lhs.end == rhs.end) && (lhs.index == rhs.index) + } + + static func <(lhs: LineAlt, rhs: LineAlt) -> Bool { + return lhs.distance < rhs.distance + } +} + + +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] + { + // if a shape has 2 or less points it cannot be reduced + if resultCount <= 2 || resultCount >= points.count + { + return points + } + var keep = [Bool](repeating: false, count: points.count) + + // first and last always stay + keep[0] = true + keep[points.count - 1] = true + var currentStoredPoints = 2 + + var queue = [LineAlt]() + let line = LineAlt(start: 0, end: points.count - 1, points: points) + queue.append(line) + + repeat { + let line = queue.popLast()! + + // store the key + keep[line.index] = true + + // check point count tolerance + currentStoredPoints += 1 + + if (currentStoredPoints == resultCount) { + break; + } + + // split the polyline at the key and recurse + let left = LineAlt(start: line.start, end: line.index, points: points) + if (left.index > 0) { + self.insertLine(left, into: &queue) + } + + let right = LineAlt(start: line.index, end: line.end, points: points) + if (right.index > 0) { + self.insertLine(right, into: &queue) + } + + } while !queue.isEmpty + + // create a new array with series, only take the kept ones + let reducedEntries = points.enumerated().compactMap { (index: Int, point: CGPoint) -> CGPoint? in + return keep[index] ? point : nil + } + + return reducedEntries + } + + // Keeps array sorted + private static func insertLine(_ line: LineAlt, into array: inout [LineAlt]) { + let insertionIndex = self.insertionIndex(for: line, into: &array) + array.insert(line, at: insertionIndex) + } + + private static func insertionIndex(for line: LineAlt, into array: inout [LineAlt]) -> Int { + var indices = array.indices + + while !indices.isEmpty { + let midIndex = indices.lowerBound.advanced(by: indices.count / 2) + let midLine = array[midIndex] + + if midLine == line { + return midIndex + } + else if (line < midLine) { + // perform search in left half + indices = indices.lowerBound.. [CGPoint] + { + // if a shape has 2 or less points it cannot be reduced + if tolerance <= 0 || points.count < 3 + { + return points + } + + var keep = [Bool](repeating: false, count: points.count) + + // first and last always stay + keep[0] = true + keep[points.count - 1] = true + + // first and last entry are entry point to recursion + reduceWithDouglasPeuker(points: points, + tolerance: tolerance, + start: 0, + end: points.count - 1, + keep: &keep) + + // create a new array with series, only take the kept ones + return zip(keep, points).compactMap { $0 ? nil : $1 } + } + + /// apply the Douglas-Peucker-Reduction to an array of `CGPoint`s with a given tolerance + /// + /// - Parameters: + /// - points: + /// - tolerance: + /// - start: + /// - end: + open class func reduceWithDouglasPeuker( + points: [CGPoint], + tolerance: CGFloat, + start: Int, + end: Int, + keep: inout [Bool]) + { + if end <= start + 1 + { + // recursion finished + return + } + + var greatestIndex = Int(0) + var greatestDistance = CGFloat(0.0) + + let line = Line(pt1: points[start], pt2: points[end]) + + for i in start + 1 ..< end + { + let distance = line.distance(toPoint: points[i]) + + if distance > greatestDistance + { + greatestDistance = distance + greatestIndex = i + } + } + + if greatestDistance > tolerance + { + // keep max dist point + keep[greatestIndex] = true + + // recursive call + reduceWithDouglasPeuker(points: points, tolerance: tolerance, start: start, end: greatestIndex, keep: &keep) + reduceWithDouglasPeuker(points: points, tolerance: tolerance, start: greatestIndex, end: end, keep: &keep) + } // else don't keep the point... + } + + private class Line + { + var sxey: CGFloat + var exsy: CGFloat + + var dx: CGFloat + var dy: CGFloat + + var length: CGFloat + + init(pt1: CGPoint, pt2: CGPoint) + { + dx = pt1.x - pt2.x + dy = pt1.y - pt2.y + sxey = pt1.x * pt2.y + exsy = pt2.x * pt1.y + length = sqrt(dx * dx + dy * dy) + } + + func distance(toPoint pt: CGPoint) -> CGFloat + { + return abs(dy * pt.x - dx * pt.y + sxey - exsy) / length + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift b/Carthage/Checkouts/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift new file mode 100644 index 00000000000..85193d0c467 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Formatters/DefaultAxisValueFormatter.swift @@ -0,0 +1,100 @@ +// +// DefaultAxisValueFormatter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +@objc(ChartDefaultAxisValueFormatter) +open class DefaultAxisValueFormatter: NSObject, IAxisValueFormatter +{ + public typealias Block = ( + _ value: Double, + _ axis: AxisBase?) -> String + + @objc open var block: Block? + + @objc open var hasAutoDecimals: Bool = false + + private var _formatter: NumberFormatter? + @objc open var formatter: NumberFormatter? + { + get { return _formatter } + set + { + hasAutoDecimals = false + _formatter = newValue + } + } + + // TODO: Documentation. Especially the nil case + private var _decimals: Int? + open var decimals: Int? + { + get { return _decimals } + set + { + _decimals = newValue + + if let digits = newValue + { + self.formatter?.minimumFractionDigits = digits + self.formatter?.maximumFractionDigits = digits + self.formatter?.usesGroupingSeparator = true + } + } + } + + public override init() + { + super.init() + + self.formatter = NumberFormatter() + hasAutoDecimals = true + } + + @objc public init(formatter: NumberFormatter) + { + super.init() + + self.formatter = formatter + } + + @objc public init(decimals: Int) + { + super.init() + + self.formatter = NumberFormatter() + self.formatter?.usesGroupingSeparator = true + self.decimals = decimals + hasAutoDecimals = true + } + + @objc public init(block: @escaping Block) + { + super.init() + + self.block = block + } + + @objc public static func with(block: @escaping Block) -> DefaultAxisValueFormatter? + { + return DefaultAxisValueFormatter(block: block) + } + + open func stringForValue(_ value: Double, + axis: AxisBase?) -> String + { + if let block = block { + return block(value, axis) + } else { + return formatter?.string(from: NSNumber(floatLiteral: value)) ?? "" + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift b/Carthage/Checkouts/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift new file mode 100644 index 00000000000..3afadf35fa0 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Formatters/DefaultFillFormatter.swift @@ -0,0 +1,58 @@ +// +// DefaultFillFormatter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// Default formatter that calculates the position of the filled line. +@objc(ChartDefaultFillFormatter) +open class DefaultFillFormatter: NSObject, IFillFormatter +{ + public typealias Block = ( + _ dataSet: ILineChartDataSet, + _ dataProvider: LineChartDataProvider) -> CGFloat + + @objc open var block: Block? + + public override init() { } + + @objc public init(block: @escaping Block) + { + self.block = block + } + + @objc public static func with(block: @escaping Block) -> DefaultFillFormatter? + { + return DefaultFillFormatter(block: block) + } + + open func getFillLinePosition( + dataSet: ILineChartDataSet, + dataProvider: LineChartDataProvider) -> CGFloat + { + guard block == nil else { return block!(dataSet, dataProvider) } + var fillMin: CGFloat = 0.0 + + if dataSet.yMax > 0.0 && dataSet.yMin < 0.0 + { + fillMin = 0.0 + } + else if let data = dataProvider.data + { + let max = data.yMax > 0.0 ? 0.0 : dataProvider.chartYMax + let min = data.yMin < 0.0 ? 0.0 : dataProvider.chartYMin + + fillMin = CGFloat(dataSet.yMin >= 0.0 ? min : max) + } + + return fillMin + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift b/Carthage/Checkouts/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift new file mode 100644 index 00000000000..b3fff70ac9a --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Formatters/DefaultValueFormatter.swift @@ -0,0 +1,103 @@ +// +// DefaultValueFormatter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +@objc(ChartDefaultValueFormatter) +open class DefaultValueFormatter: NSObject, IValueFormatter +{ + public typealias Block = ( + _ value: Double, + _ entry: ChartDataEntry, + _ dataSetIndex: Int, + _ viewPortHandler: ViewPortHandler?) -> String + + @objc open var block: Block? + + @objc open var hasAutoDecimals: Bool = false + + private var _formatter: NumberFormatter? + @objc open var formatter: NumberFormatter? + { + get { return _formatter } + set + { + hasAutoDecimals = false + _formatter = newValue + } + } + + private var _decimals: Int? + open var decimals: Int? + { + get { return _decimals } + set + { + _decimals = newValue + + if let digits = newValue + { + self.formatter?.minimumFractionDigits = digits + self.formatter?.maximumFractionDigits = digits + self.formatter?.usesGroupingSeparator = true + } + } + } + + public override init() + { + super.init() + + self.formatter = NumberFormatter() + hasAutoDecimals = true + } + + @objc public init(formatter: NumberFormatter) + { + super.init() + + self.formatter = formatter + } + + @objc public init(decimals: Int) + { + super.init() + + self.formatter = NumberFormatter() + self.formatter?.usesGroupingSeparator = true + self.decimals = decimals + hasAutoDecimals = true + } + + @objc public init(block: @escaping Block) + { + super.init() + + self.block = block + } + + @objc public static func with(block: @escaping Block) -> DefaultValueFormatter? + { + return DefaultValueFormatter(block: block) + } + + open func stringForValue(_ value: Double, + entry: ChartDataEntry, + dataSetIndex: Int, + viewPortHandler: ViewPortHandler?) -> String + { + if let block = block { + return block(value, entry, dataSetIndex, viewPortHandler) + } else { + return formatter?.string(from: NSNumber(floatLiteral: value)) ?? "" + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift b/Carthage/Checkouts/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift new file mode 100644 index 00000000000..302eee18f8b --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Formatters/IAxisValueFormatter.swift @@ -0,0 +1,30 @@ +// +// IAxisValueFormatter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +/// An interface for providing custom axis Strings. +@objc(IChartAxisValueFormatter) +public protocol IAxisValueFormatter: class +{ + + /// Called when a value from an axis is formatted before being drawn. + /// + /// For performance reasons, avoid excessive calculations and memory allocations inside this method. + /// + /// - Parameters: + /// - value: the value that is currently being drawn + /// - axis: the axis that the value belongs to + /// - Returns: The customized label that is drawn on the x-axis. + func stringForValue(_ value: Double, + axis: AxisBase?) -> String + +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Formatters/IFillFormatter.swift b/Carthage/Checkouts/Charts/Source/Charts/Formatters/IFillFormatter.swift new file mode 100644 index 00000000000..7b684fd84e4 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Formatters/IFillFormatter.swift @@ -0,0 +1,21 @@ +// +// IFillFormatter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// Protocol for providing a custom logic to where the filling line of a LineDataSet should end. This of course only works if setFillEnabled(...) is set to true. +@objc(IChartFillFormatter) +public protocol IFillFormatter +{ + /// - Returns: The vertical (y-axis) position where the filled-line of the LineDataSet should end. + func getFillLinePosition(dataSet: ILineChartDataSet, dataProvider: LineChartDataProvider) -> CGFloat +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Formatters/IValueFormatter.swift b/Carthage/Checkouts/Charts/Source/Charts/Formatters/IValueFormatter.swift new file mode 100644 index 00000000000..53ca7a40c20 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Formatters/IValueFormatter.swift @@ -0,0 +1,36 @@ +// +// IValueFormatter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +/// Interface that allows custom formatting of all values inside the chart before they are drawn to the screen. +/// +/// Simply create your own formatting class and let it implement ValueFormatter. Then override the stringForValue() +/// method and return whatever you want. + +@objc(IChartValueFormatter) +public protocol IValueFormatter: class +{ + + /// Called when a value (from labels inside the chart) is formatted before being drawn. + /// + /// For performance reasons, avoid excessive calculations and memory allocations inside this method. + /// + /// - Parameters: + /// - value: The value to be formatted + /// - dataSetIndex: The index of the DataSet the entry in focus belongs to + /// - viewPortHandler: provides information about the current chart state (scale, translation, ...) + /// - Returns: The formatted label ready to be drawn + func stringForValue(_ value: Double, + entry: ChartDataEntry, + dataSetIndex: Int, + viewPortHandler: ViewPortHandler?) -> String +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift b/Carthage/Checkouts/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift new file mode 100644 index 00000000000..ae86509d059 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Formatters/IndexAxisValueFormatter.swift @@ -0,0 +1,59 @@ +// +// IndexAxisValueFormatter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +/// This formatter is used for passing an array of x-axis labels, on whole x steps. +@objc(ChartIndexAxisValueFormatter) +open class IndexAxisValueFormatter: NSObject, IAxisValueFormatter +{ + private var _values: [String] = [String]() + private var _valueCount: Int = 0 + + @objc public var values: [String] + { + get + { + return _values + } + set + { + _values = newValue + _valueCount = _values.count + } + } + + public override init() + { + super.init() + + } + + @objc public init(values: [String]) + { + super.init() + + self.values = values + } + + @objc public static func with(values: [String]) -> IndexAxisValueFormatter? + { + return IndexAxisValueFormatter(values: values) + } + + open func stringForValue(_ value: Double, + axis: AxisBase?) -> String + { + let index = Int(value.rounded()) + guard values.indices.contains(index), index == Int(value) else { return "" } + return _values[index] + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Highlight/BarHighlighter.swift b/Carthage/Checkouts/Charts/Source/Charts/Highlight/BarHighlighter.swift new file mode 100644 index 00000000000..da9e6da733a --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Highlight/BarHighlighter.swift @@ -0,0 +1,108 @@ +// +// BarHighlighter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(BarChartHighlighter) +open class BarHighlighter: ChartHighlighter +{ + open override func getHighlight(x: CGFloat, y: CGFloat) -> Highlight? + { + guard + let barData = (self.chart as? BarChartDataProvider)?.barData, + let high = super.getHighlight(x: x, y: y) + else { return nil } + + let pos = getValsForTouch(x: x, y: y) + + if let set = barData.getDataSetByIndex(high.dataSetIndex) as? IBarChartDataSet, + set.isStacked + { + return getStackedHighlight(high: high, + set: set, + xValue: Double(pos.x), + yValue: Double(pos.y)) + } + else + { + return high + } + } + + internal override func getDistance(x1: CGFloat, y1: CGFloat, x2: CGFloat, y2: CGFloat) -> CGFloat + { + return abs(x1 - x2) + } + + internal override var data: ChartData? + { + return (chart as? BarChartDataProvider)?.barData + } + + /// This method creates the Highlight object that also indicates which value of a stacked BarEntry has been selected. + /// + /// - Parameters: + /// - high: the Highlight to work with looking for stacked values + /// - set: + /// - xIndex: + /// - yValue: + /// - Returns: + @objc open func getStackedHighlight(high: Highlight, + set: IBarChartDataSet, + xValue: Double, + yValue: Double) -> Highlight? + { + guard + let chart = self.chart as? BarLineScatterCandleBubbleChartDataProvider, + let entry = set.entryForXValue(xValue, closestToY: yValue) as? BarChartDataEntry + else { return nil } + + // Not stacked + if entry.yValues == nil + { + return high + } + + guard + let ranges = entry.ranges, + ranges.count > 0 + else { return nil } + + let stackIndex = getClosestStackIndex(ranges: ranges, value: yValue) + let pixel = chart + .getTransformer(forAxis: set.axisDependency) + .pixelForValues(x: high.x, y: ranges[stackIndex].to) + + return Highlight(x: entry.x, + y: entry.y, + xPx: pixel.x, + yPx: pixel.y, + dataSetIndex: high.dataSetIndex, + stackIndex: stackIndex, + axis: high.axis) + } + + /// - Parameters: + /// - entry: + /// - value: + /// - Returns: The index of the closest value inside the values array / ranges (stacked barchart) to the value given as a parameter. + @objc open func getClosestStackIndex(ranges: [Range]?, value: Double) -> Int + { + guard let ranges = ranges else { return 0 } + if let stackIndex = ranges.firstIndex(where: { $0.contains(value) }) { + return stackIndex + } else { + let length = max(ranges.count - 1, 0) + return (value > ranges[length].to) ? length : 0 + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Highlight/ChartHighlighter.swift b/Carthage/Checkouts/Charts/Source/Charts/Highlight/ChartHighlighter.swift new file mode 100644 index 00000000000..417ba0d0af6 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Highlight/ChartHighlighter.swift @@ -0,0 +1,180 @@ +// +// ChartHighlighter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class ChartHighlighter : NSObject, IHighlighter +{ + /// instance of the data-provider + @objc open weak var chart: ChartDataProvider? + + @objc public init(chart: ChartDataProvider) + { + self.chart = chart + } + + open func getHighlight(x: CGFloat, y: CGFloat) -> Highlight? + { + let xVal = Double(getValsForTouch(x: x, y: y).x) + return getHighlight(xValue: xVal, x: x, y: y) + } + + /// - Parameters: + /// - x: + /// - Returns: The corresponding x-pos for a given touch-position in pixels. + @objc open func getValsForTouch(x: CGFloat, y: CGFloat) -> CGPoint + { + guard let chart = self.chart as? BarLineScatterCandleBubbleChartDataProvider else { return .zero } + + // take any transformer to determine the values + return chart.getTransformer(forAxis: .left).valueForTouchPoint(x: x, y: y) + } + + /// - Parameters: + /// - xValue: + /// - x: + /// - y: + /// - Returns: The corresponding ChartHighlight for a given x-value and xy-touch position in pixels. + @objc open func getHighlight(xValue xVal: Double, x: CGFloat, y: CGFloat) -> Highlight? + { + guard let chart = chart else { return nil } + + let closestValues = getHighlights(xValue: xVal, x: x, y: y) + guard !closestValues.isEmpty else { return nil } + + let leftAxisMinDist = getMinimumDistance(closestValues: closestValues, y: y, axis: .left) + let rightAxisMinDist = getMinimumDistance(closestValues: closestValues, y: y, axis: .right) + + let axis: YAxis.AxisDependency = leftAxisMinDist < rightAxisMinDist ? .left : .right + + let detail = closestSelectionDetailByPixel(closestValues: closestValues, x: x, y: y, axis: axis, minSelectionDistance: chart.maxHighlightDistance) + + return detail + } + + /// - Parameters: + /// - xValue: the transformed x-value of the x-touch position + /// - x: touch position + /// - y: touch position + /// - Returns: A list of Highlight objects representing the entries closest to the given xVal. + /// The returned list contains two objects per DataSet (closest rounding up, closest rounding down). + @objc open func getHighlights(xValue: Double, x: CGFloat, y: CGFloat) -> [Highlight] + { + var vals = [Highlight]() + + guard let data = self.data else { return vals } + + for i in 0 ..< data.dataSetCount + { + guard + let dataSet = data.getDataSetByIndex(i), + dataSet.isHighlightEnabled // don't include datasets that cannot be highlighted + else { continue } + + + // extract all y-values from all DataSets at the given x-value. + // some datasets (i.e bubble charts) make sense to have multiple values for an x-value. We'll have to find a way to handle that later on. It's more complicated now when x-indices are floating point. + vals.append(contentsOf: buildHighlights(dataSet: dataSet, dataSetIndex: i, xValue: xValue, rounding: .closest)) + } + + return vals + } + + /// - Returns: An array of `Highlight` objects corresponding to the selected xValue and dataSetIndex. + internal func buildHighlights( + dataSet set: IChartDataSet, + dataSetIndex: Int, + xValue: Double, + rounding: ChartDataSetRounding) -> [Highlight] + { + guard let chart = self.chart as? BarLineScatterCandleBubbleChartDataProvider else { return [] } + + var entries = set.entriesForXValue(xValue) + if entries.count == 0, let closest = set.entryForXValue(xValue, closestToY: .nan, rounding: rounding) + { + // Try to find closest x-value and take all entries for that x-value + entries = set.entriesForXValue(closest.x) + } + + return entries.map { e in + let px = chart.getTransformer(forAxis: set.axisDependency) + .pixelForValues(x: e.x, y: e.y) + + return Highlight(x: e.x, y: e.y, xPx: px.x, yPx: px.y, dataSetIndex: dataSetIndex, axis: set.axisDependency) + } + } + + // - MARK: - Utilities + + /// - Returns: The `ChartHighlight` of the closest value on the x-y cartesian axes + internal func closestSelectionDetailByPixel( + closestValues: [Highlight], + x: CGFloat, + y: CGFloat, + axis: YAxis.AxisDependency?, + minSelectionDistance: CGFloat) -> Highlight? + { + var distance = minSelectionDistance + var closest: Highlight? + + for high in closestValues + { + if axis == nil || high.axis == axis + { + let cDistance = getDistance(x1: x, y1: y, x2: high.xPx, y2: high.yPx) + + if cDistance < distance + { + closest = high + distance = cDistance + } + } + } + + return closest + } + + /// - Returns: The minimum distance from a touch-y-value (in pixels) to the closest y-value (in pixels) that is displayed in the chart. + internal func getMinimumDistance( + closestValues: [Highlight], + y: CGFloat, + axis: YAxis.AxisDependency + ) -> CGFloat { + var distance = CGFloat.greatestFiniteMagnitude + + for high in closestValues where high.axis == axis + { + let tempDistance = abs(getHighlightPos(high: high) - y) + if tempDistance < distance + { + distance = tempDistance + } + } + + return distance + } + + internal func getHighlightPos(high: Highlight) -> CGFloat + { + return high.yPx + } + + internal func getDistance(x1: CGFloat, y1: CGFloat, x2: CGFloat, y2: CGFloat) -> CGFloat + { + return hypot(x1 - x2, y1 - y2) + } + + internal var data: ChartData? + { + return chart?.data + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Highlight/CombinedHighlighter.swift b/Carthage/Checkouts/Charts/Source/Charts/Highlight/CombinedHighlighter.swift new file mode 100644 index 00000000000..7053df09d31 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Highlight/CombinedHighlighter.swift @@ -0,0 +1,70 @@ +// +// CombinedHighlighter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(CombinedChartHighlighter) +open class CombinedHighlighter: ChartHighlighter +{ + /// bar highlighter for supporting stacked highlighting + private var barHighlighter: BarHighlighter? + + @objc public init(chart: CombinedChartDataProvider, barDataProvider: BarChartDataProvider) + { + super.init(chart: chart) + + // if there is BarData, create a BarHighlighter + self.barHighlighter = barDataProvider.barData == nil ? nil : BarHighlighter(chart: barDataProvider) + } + + open override func getHighlights(xValue: Double, x: CGFloat, y: CGFloat) -> [Highlight] + { + var vals = [Highlight]() + + guard + let chart = self.chart as? CombinedChartDataProvider, + let dataObjects = chart.combinedData?.allData + else { return vals } + + for i in 0..= 0 } + + /// Sets the x- and y-position (pixels) where this highlight was last drawn. + @objc open func setDraw(x: CGFloat, y: CGFloat) + { + self.drawX = x + self.drawY = y + } + + /// Sets the x- and y-position (pixels) where this highlight was last drawn. + @objc open func setDraw(pt: CGPoint) + { + self.drawX = pt.x + self.drawY = pt.y + } + + // MARK: NSObject + + open override var description: String + { + return "Highlight, x: \(_x), y: \(_y), dataIndex (combined charts): \(dataIndex), dataSetIndex: \(_dataSetIndex), stackIndex (only stacked barentry): \(_stackIndex)" + } +} + + +// MARK: Equatable +extension Highlight /*: Equatable*/ { + open override func isEqual(_ object: Any?) -> Bool { + guard let object = object as? Highlight else { return false } + + if self === object + { + return true + } + + return _x == object._x + && _y == object._y + && dataIndex == object.dataIndex + && _dataSetIndex == object._dataSetIndex + && _stackIndex == object._stackIndex + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift b/Carthage/Checkouts/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift new file mode 100644 index 00000000000..103d53f9822 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Highlight/HorizontalBarHighlighter.swift @@ -0,0 +1,63 @@ +// +// HorizontalBarHighlighter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(HorizontalBarChartHighlighter) +open class HorizontalBarHighlighter: BarHighlighter +{ + open override func getHighlight(x: CGFloat, y: CGFloat) -> Highlight? + { + guard let barData = self.chart?.data as? BarChartData else { return nil } + + let pos = getValsForTouch(x: y, y: x) + guard let high = getHighlight(xValue: Double(pos.y), x: y, y: x) else { return nil } + + if let set = barData.getDataSetByIndex(high.dataSetIndex) as? IBarChartDataSet, + set.isStacked + { + return getStackedHighlight(high: high, + set: set, + xValue: Double(pos.y), + yValue: Double(pos.x)) + } + + return high + } + + internal override func buildHighlights( + dataSet set: IChartDataSet, + dataSetIndex: Int, + xValue: Double, + rounding: ChartDataSetRounding) -> [Highlight] + { + guard let chart = self.chart as? BarLineScatterCandleBubbleChartDataProvider else { return [] } + + var entries = set.entriesForXValue(xValue) + if entries.count == 0, let closest = set.entryForXValue(xValue, closestToY: .nan, rounding: rounding) + { + // Try to find closest x-value and take all entries for that x-value + entries = set.entriesForXValue(closest.x) + } + + return entries.map { e in + let px = chart.getTransformer(forAxis: set.axisDependency) + .pixelForValues(x: e.y, y: e.x) + return Highlight(x: e.x, y: e.y, xPx: px.x, yPx: px.y, dataSetIndex: dataSetIndex, axis: set.axisDependency) + } + } + + internal override func getDistance(x1: CGFloat, y1: CGFloat, x2: CGFloat, y2: CGFloat) -> CGFloat + { + return abs(y1 - y2) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Highlight/IHighlighter.swift b/Carthage/Checkouts/Charts/Source/Charts/Highlight/IHighlighter.swift new file mode 100644 index 00000000000..21ae298c34d --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Highlight/IHighlighter.swift @@ -0,0 +1,23 @@ +// +// IHighlighter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(IChartHighlighter) +public protocol IHighlighter: class +{ + /// - Parameters: + /// - x: + /// - y: + /// - Returns: A Highlight object corresponding to the given x- and y- touch positions in pixels. + func getHighlight(x: CGFloat, y: CGFloat) -> Highlight? +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Highlight/PieHighlighter.swift b/Carthage/Checkouts/Charts/Source/Charts/Highlight/PieHighlighter.swift new file mode 100644 index 00000000000..54bb3d7b830 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Highlight/PieHighlighter.swift @@ -0,0 +1,27 @@ +// +// PieHighlighter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(PieChartHighlighter) +open class PieHighlighter: PieRadarHighlighter +{ + open override func closestHighlight(index: Int, x: CGFloat, y: CGFloat) -> Highlight? + { + guard + let set = chart?.data?.dataSets[0], + let entry = set.entryForIndex(index) + else { return nil } + + return Highlight(x: Double(index), y: entry.y, xPx: x, yPx: y, dataSetIndex: 0, axis: set.axisDependency) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift b/Carthage/Checkouts/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift new file mode 100644 index 00000000000..c55988ab31d --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Highlight/PieRadarHighlighter.swift @@ -0,0 +1,61 @@ +// +// PieRadarHighlighter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(PieRadarChartHighlighter) +open class PieRadarHighlighter: ChartHighlighter +{ + open override func getHighlight(x: CGFloat, y: CGFloat) -> Highlight? + { + guard let chart = self.chart as? PieRadarChartViewBase else { return nil } + + let touchDistanceToCenter = chart.distanceToCenter(x: x, y: y) + + // check if a slice was touched + guard touchDistanceToCenter <= chart.radius else + { + // if no slice was touched, highlight nothing + return nil + } + + var angle = chart.angleForPoint(x: x ,y: y) + + if chart is PieChartView + { + angle /= CGFloat(chart.chartAnimator.phaseY) + } + + let index = chart.indexForAngle(angle) + + // check if the index could be found + if index < 0 || index >= chart.data?.maxEntryCountSet?.entryCount ?? 0 + { + return nil + } + else + { + return closestHighlight(index: index, x: x, y: y) + } + + } + + /// - Parameters: + /// - index: + /// - x: + /// - y: + /// - Returns: The closest Highlight object of the given objects based on the touch position inside the chart. + @objc open func closestHighlight(index: Int, x: CGFloat, y: CGFloat) -> Highlight? + { + fatalError("closestHighlight(index, x, y) cannot be called on PieRadarChartHighlighter") + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Highlight/RadarHighlighter.swift b/Carthage/Checkouts/Charts/Source/Charts/Highlight/RadarHighlighter.swift new file mode 100644 index 00000000000..cfaf57aec9e --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Highlight/RadarHighlighter.swift @@ -0,0 +1,78 @@ +// +// RadarHighlighter.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(RadarChartHighlighter) +open class RadarHighlighter: PieRadarHighlighter +{ + open override func closestHighlight(index: Int, x: CGFloat, y: CGFloat) -> Highlight? + { + guard let chart = self.chart as? RadarChartView else { return nil } + + let highlights = getHighlights(forIndex: index) + + let distanceToCenter = Double(chart.distanceToCenter(x: x, y: y) / chart.factor) + + var closest: Highlight? + var distance = Double.greatestFiniteMagnitude + + for high in highlights + { + let cdistance = abs(high.y - distanceToCenter) + if cdistance < distance + { + closest = high + distance = cdistance + } + } + + return closest + } + + /// - Parameters: + /// - index: + /// - Returns: An array of Highlight objects for the given index. + /// The Highlight objects give information about the value at the selected index and DataSet it belongs to. + internal func getHighlights(forIndex index: Int) -> [Highlight] + { + var vals = [Highlight]() + + guard + let chart = self.chart as? RadarChartView, + let chartData = chart.data + else { return vals } + + let phaseX = chart.chartAnimator.phaseX + let phaseY = chart.chartAnimator.phaseY + let sliceangle = chart.sliceAngle + let factor = chart.factor + + for i in chartData.dataSets.indices + { + guard + let dataSet = chartData.getDataSetByIndex(i), + let entry = dataSet.entryForIndex(index) + else { continue } + + let y = (entry.y - chart.chartYMin) + + let p = chart.centerOffsets.moving(distance: CGFloat(y) * factor * CGFloat(phaseY), + atAngle: sliceangle * CGFloat(index) * CGFloat(phaseX) + chart.rotationAngle) + + let highlight = Highlight(x: Double(index), y: entry.y, xPx: p.x, yPx: p.y, dataSetIndex: i, axis: dataSet.axisDependency) + vals.append(highlight) + } + + return vals + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Highlight/Range.swift b/Carthage/Checkouts/Charts/Source/Charts/Highlight/Range.swift new file mode 100644 index 00000000000..4b7ead10fb1 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Highlight/Range.swift @@ -0,0 +1,52 @@ +// +// Range.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation + +@objc(ChartRange) +open class Range: NSObject +{ + @objc open var from: Double + @objc open var to: Double + + @objc public init(from: Double, to: Double) + { + self.from = from + self.to = to + + super.init() + } + + /// - Parameters: + /// - value: + /// - Returns: `true` if this range contains (if the value is in between) the given value, `false` ifnot. + @objc open func contains(_ value: Double) -> Bool + { + if value > from && value <= to + { + return true + } + else + { + return false + } + } + + @objc open func isLarger(_ value: Double) -> Bool + { + return value > to + } + + @objc open func isSmaller(_ value: Double) -> Bool + { + return value < from + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift new file mode 100644 index 00000000000..e1d0a8d0b50 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/BarChartDataProvider.swift @@ -0,0 +1,23 @@ +// +// BarChartDataProvider.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol BarChartDataProvider: BarLineScatterCandleBubbleChartDataProvider +{ + var barData: BarChartData? { get } + + var isDrawBarShadowEnabled: Bool { get } + var isDrawValueAboveBarEnabled: Bool { get } + var isHighlightFullBarEnabled: Bool { get } +} \ No newline at end of file diff --git a/Carthage/Checkouts/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift new file mode 100644 index 00000000000..fd5c065292d --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift @@ -0,0 +1,23 @@ +// +// BarLineScatterCandleBubbleChartDataProvider.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol BarLineScatterCandleBubbleChartDataProvider: ChartDataProvider +{ + func getTransformer(forAxis: YAxis.AxisDependency) -> Transformer + func isInverted(axis: YAxis.AxisDependency) -> Bool + + var lowestVisibleX: Double { get } + var highestVisibleX: Double { get } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift new file mode 100644 index 00000000000..d9fc9e81b28 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/BubbleChartDataProvider.swift @@ -0,0 +1,19 @@ +// +// BubbleChartDataProvider.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol BubbleChartDataProvider: BarLineScatterCandleBubbleChartDataProvider +{ + var bubbleData: BubbleChartData? { get } +} \ No newline at end of file diff --git a/Carthage/Checkouts/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift new file mode 100644 index 00000000000..6e729ff1379 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/CandleChartDataProvider.swift @@ -0,0 +1,19 @@ +// +// CandleChartDataProvider.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol CandleChartDataProvider: BarLineScatterCandleBubbleChartDataProvider +{ + var candleData: CandleChartData? { get } +} \ No newline at end of file diff --git a/Carthage/Checkouts/Charts/Source/Charts/Interfaces/ChartDataProvider.swift b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/ChartDataProvider.swift new file mode 100644 index 00000000000..531f04b750f --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/ChartDataProvider.swift @@ -0,0 +1,39 @@ +// +// ChartDataProvider.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol ChartDataProvider +{ + /// The minimum x-value of the chart, regardless of zoom or translation. + var chartXMin: Double { get } + + /// The maximum x-value of the chart, regardless of zoom or translation. + var chartXMax: Double { get } + + /// The minimum y-value of the chart, regardless of zoom or translation. + var chartYMin: Double { get } + + /// The maximum y-value of the chart, regardless of zoom or translation. + var chartYMax: Double { get } + + var maxHighlightDistance: CGFloat { get } + + var xRange: Double { get } + + var centerOffsets: CGPoint { get } + + var data: ChartData? { get } + + var maxVisibleCount: Int { get } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift new file mode 100644 index 00000000000..e360eedd61c --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/CombinedChartDataProvider.swift @@ -0,0 +1,19 @@ +// +// CombinedChartDataProvider.swoft +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol CombinedChartDataProvider: LineChartDataProvider, BarChartDataProvider, BubbleChartDataProvider, CandleChartDataProvider, ScatterChartDataProvider +{ + var combinedData: CombinedChartData? { get } +} \ No newline at end of file diff --git a/Carthage/Checkouts/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift new file mode 100644 index 00000000000..e6354821622 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/LineChartDataProvider.swift @@ -0,0 +1,21 @@ +// +// LineChartDataProvider.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol LineChartDataProvider: BarLineScatterCandleBubbleChartDataProvider +{ + var lineData: LineChartData? { get } + + func getAxis(_ axis: YAxis.AxisDependency) -> YAxis +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift new file mode 100644 index 00000000000..050bde74066 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Interfaces/ScatterChartDataProvider.swift @@ -0,0 +1,19 @@ +// +// ScatterChartDataProvider.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol ScatterChartDataProvider: BarLineScatterCandleBubbleChartDataProvider +{ + var scatterData: ScatterChartData? { get } +} \ No newline at end of file diff --git a/Carthage/Checkouts/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift b/Carthage/Checkouts/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift new file mode 100644 index 00000000000..7a758221610 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Jobs/AnimatedMoveViewJob.swift @@ -0,0 +1,33 @@ +// +// AnimatedMoveViewJob.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class AnimatedMoveViewJob: AnimatedViewPortJob +{ + internal override func animationUpdate() + { + guard + let viewPortHandler = viewPortHandler, + let transformer = transformer, + let view = view + else { return } + + var pt = CGPoint( + x: xOrigin + (CGFloat(xValue) - xOrigin) * phase, + y: yOrigin + (CGFloat(yValue) - yOrigin) * phase + ) + + transformer.pointValueToPixel(&pt) + viewPortHandler.centerViewPort(pt: pt, chart: view) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift b/Carthage/Checkouts/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift new file mode 100644 index 00000000000..7375456664e --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Jobs/AnimatedViewPortJob.swift @@ -0,0 +1,126 @@ +// +// AnimatedViewPortJob.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class AnimatedViewPortJob: ViewPortJob +{ + internal var phase: CGFloat = 1.0 + internal var xOrigin: CGFloat = 0.0 + internal var yOrigin: CGFloat = 0.0 + + private var _startTime: TimeInterval = 0.0 + private var _displayLink: NSUIDisplayLink! + private var _duration: TimeInterval = 0.0 + private var _endTime: TimeInterval = 0.0 + + private var _easing: ChartEasingFunctionBlock? + + @objc public init( + viewPortHandler: ViewPortHandler, + xValue: Double, + yValue: Double, + transformer: Transformer, + view: ChartViewBase, + xOrigin: CGFloat, + yOrigin: CGFloat, + duration: TimeInterval, + easing: ChartEasingFunctionBlock?) + { + super.init(viewPortHandler: viewPortHandler, + xValue: xValue, + yValue: yValue, + transformer: transformer, + view: view) + + self.xOrigin = xOrigin + self.yOrigin = yOrigin + self._duration = duration + self._easing = easing + } + + deinit + { + stop(finish: false) + } + + open override func doJob() + { + start() + } + + @objc open func start() + { + _startTime = CACurrentMediaTime() + _endTime = _startTime + _duration + _endTime = _endTime > _endTime ? _endTime : _endTime + + updateAnimationPhase(_startTime) + + _displayLink = NSUIDisplayLink(target: self, selector: #selector(animationLoop)) + _displayLink.add(to: .main, forMode: RunLoop.Mode.common) + } + + @objc open func stop(finish: Bool) + { + guard _displayLink != nil else { return } + + _displayLink.remove(from: .main, forMode: RunLoop.Mode.common) + _displayLink = nil + + if finish + { + if phase != 1.0 + { + phase = 1.0 + animationUpdate() + } + + animationEnd() + } + } + + private func updateAnimationPhase(_ currentTime: TimeInterval) + { + let elapsedTime = currentTime - _startTime + let duration = _duration + var elapsed = elapsedTime + + elapsed = min(elapsed, duration) + + phase = CGFloat(_easing?(elapsed, duration) ?? elapsed / duration) + } + + @objc private func animationLoop() + { + let currentTime: TimeInterval = CACurrentMediaTime() + + updateAnimationPhase(currentTime) + + animationUpdate() + + if currentTime >= _endTime + { + stop(finish: true) + } + } + + internal func animationUpdate() + { + // Override this + } + + internal func animationEnd() + { + // Override this + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift b/Carthage/Checkouts/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift new file mode 100644 index 00000000000..4e9d5fd981b --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Jobs/AnimatedZoomViewJob.swift @@ -0,0 +1,96 @@ +// +// AnimatedZoomViewJob.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class AnimatedZoomViewJob: AnimatedViewPortJob +{ + internal var yAxis: YAxis? + internal var xAxisRange: Double = 0.0 + internal var scaleX: CGFloat = 0.0 + internal var scaleY: CGFloat = 0.0 + internal var zoomOriginX: CGFloat = 0.0 + internal var zoomOriginY: CGFloat = 0.0 + internal var zoomCenterX: CGFloat = 0.0 + internal var zoomCenterY: CGFloat = 0.0 + + @objc public init( + viewPortHandler: ViewPortHandler, + transformer: Transformer, + view: ChartViewBase, + yAxis: YAxis, + xAxisRange: Double, + scaleX: CGFloat, + scaleY: CGFloat, + xOrigin: CGFloat, + yOrigin: CGFloat, + zoomCenterX: CGFloat, + zoomCenterY: CGFloat, + zoomOriginX: CGFloat, + zoomOriginY: CGFloat, + duration: TimeInterval, + easing: ChartEasingFunctionBlock?) + { + super.init(viewPortHandler: viewPortHandler, + xValue: 0.0, + yValue: 0.0, + transformer: transformer, + view: view, + xOrigin: xOrigin, + yOrigin: yOrigin, + duration: duration, + easing: easing) + + self.yAxis = yAxis + self.xAxisRange = xAxisRange + self.scaleX = scaleX + self.scaleY = scaleY + self.zoomCenterX = zoomCenterX + self.zoomCenterY = zoomCenterY + self.zoomOriginX = zoomOriginX + self.zoomOriginY = zoomOriginY + } + + internal override func animationUpdate() + { + guard + let viewPortHandler = viewPortHandler, + let transformer = transformer, + let view = view + else { return } + + let scaleX = xOrigin + (self.scaleX - xOrigin) * phase + let scaleY = yOrigin + (self.scaleY - yOrigin) * phase + + var matrix = viewPortHandler.setZoom(scaleX: scaleX, scaleY: scaleY) + viewPortHandler.refresh(newMatrix: matrix, chart: view, invalidate: false) + + let valsInView = CGFloat(yAxis?.axisRange ?? 0.0) / viewPortHandler.scaleY + let xsInView = CGFloat(xAxisRange) / viewPortHandler.scaleX + + var pt = CGPoint( + x: zoomOriginX + ((zoomCenterX - xsInView / 2.0) - zoomOriginX) * phase, + y: zoomOriginY + ((zoomCenterY + valsInView / 2.0) - zoomOriginY) * phase + ) + + transformer.pointValueToPixel(&pt) + + matrix = viewPortHandler.translate(pt: pt) + viewPortHandler.refresh(newMatrix: matrix, chart: view, invalidate: true) + } + + internal override func animationEnd() + { + (view as? BarLineChartViewBase)?.calculateOffsets() + view?.setNeedsDisplay() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Jobs/MoveViewJob.swift b/Carthage/Checkouts/Charts/Source/Charts/Jobs/MoveViewJob.swift new file mode 100644 index 00000000000..0b6ca320e5e --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Jobs/MoveViewJob.swift @@ -0,0 +1,34 @@ +// +// MoveViewJob.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(MoveChartViewJob) +open class MoveViewJob: ViewPortJob +{ + open override func doJob() + { + guard + let viewPortHandler = viewPortHandler, + let transformer = transformer, + let view = view + else { return } + + var pt = CGPoint( + x: xValue, + y: yValue + ) + + transformer.pointValueToPixel(&pt) + viewPortHandler.centerViewPort(pt: pt, chart: view) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Jobs/ViewPortJob.swift b/Carthage/Checkouts/Charts/Source/Charts/Jobs/ViewPortJob.swift new file mode 100644 index 00000000000..c52562ed538 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Jobs/ViewPortJob.swift @@ -0,0 +1,46 @@ +// +// ViewPortJob.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +// This defines a viewport modification job, used for delaying or animating viewport changes +@objc(ChartViewPortJob) +open class ViewPortJob: NSObject +{ + internal var point: CGPoint = CGPoint() + internal weak var viewPortHandler: ViewPortHandler? + internal var xValue: Double = 0.0 + internal var yValue: Double = 0.0 + internal weak var transformer: Transformer? + internal weak var view: ChartViewBase? + + @objc public init( + viewPortHandler: ViewPortHandler, + xValue: Double, + yValue: Double, + transformer: Transformer, + view: ChartViewBase) + { + super.init() + + self.viewPortHandler = viewPortHandler + self.xValue = xValue + self.yValue = yValue + self.transformer = transformer + self.view = view + } + + @objc open func doJob() + { + fatalError("`doJob()` must be overridden by subclasses") + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Jobs/ZoomViewJob.swift b/Carthage/Checkouts/Charts/Source/Charts/Jobs/ZoomViewJob.swift new file mode 100644 index 00000000000..a6a79394da4 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Jobs/ZoomViewJob.swift @@ -0,0 +1,71 @@ +// +// ZoomViewJob.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ZoomChartViewJob) +open class ZoomViewJob: ViewPortJob +{ + internal var scaleX: CGFloat = 0.0 + internal var scaleY: CGFloat = 0.0 + internal var axisDependency: YAxis.AxisDependency = .left + + @objc public init( + viewPortHandler: ViewPortHandler, + scaleX: CGFloat, + scaleY: CGFloat, + xValue: Double, + yValue: Double, + transformer: Transformer, + axis: YAxis.AxisDependency, + view: ChartViewBase) + { + super.init( + viewPortHandler: viewPortHandler, + xValue: xValue, + yValue: yValue, + transformer: transformer, + view: view) + + self.scaleX = scaleX + self.scaleY = scaleY + self.axisDependency = axis + } + + open override func doJob() + { + guard + let viewPortHandler = viewPortHandler, + let transformer = transformer, + let view = view + else { return } + + var matrix = viewPortHandler.setZoom(scaleX: scaleX, scaleY: scaleY) + viewPortHandler.refresh(newMatrix: matrix, chart: view, invalidate: false) + + let yValsInView = (view as! BarLineChartViewBase).getAxis(axisDependency).axisRange / Double(viewPortHandler.scaleY) + let xValsInView = (view as! BarLineChartViewBase).xAxis.axisRange / Double(viewPortHandler.scaleX) + + var pt = CGPoint( + x: CGFloat(xValue - xValsInView / 2.0), + y: CGFloat(yValue + yValsInView / 2.0) + ) + + transformer.pointValueToPixel(&pt) + + matrix = viewPortHandler.translate(pt: pt) + viewPortHandler.refresh(newMatrix: matrix, chart: view, invalidate: false) + + (view as! BarLineChartViewBase).calculateOffsets() + view.setNeedsDisplay() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/AxisRendererBase.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/AxisRendererBase.swift new file mode 100644 index 00000000000..302bdf5312f --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/AxisRendererBase.swift @@ -0,0 +1,218 @@ +// +// AxisRendererBase.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartAxisRendererBase) +open class AxisRendererBase: Renderer +{ + /// base axis this axis renderer works with + @objc open var axis: AxisBase? + + /// transformer to transform values to screen pixels and return + @objc open var transformer: Transformer? + + @objc public init(viewPortHandler: ViewPortHandler, transformer: Transformer?, axis: AxisBase?) + { + super.init(viewPortHandler: viewPortHandler) + + self.transformer = transformer + self.axis = axis + } + + /// Draws the axis labels on the specified context + @objc open func renderAxisLabels(context: CGContext) + { + fatalError("renderAxisLabels() cannot be called on AxisRendererBase") + } + + /// Draws the grid lines belonging to the axis. + @objc open func renderGridLines(context: CGContext) + { + fatalError("renderGridLines() cannot be called on AxisRendererBase") + } + + /// Draws the line that goes alongside the axis. + @objc open func renderAxisLine(context: CGContext) + { + fatalError("renderAxisLine() cannot be called on AxisRendererBase") + } + + /// Draws the LimitLines associated with this axis to the screen. + @objc open func renderLimitLines(context: CGContext) + { + fatalError("renderLimitLines() cannot be called on AxisRendererBase") + } + + /// Computes the axis values. + /// + /// - Parameters: + /// - min: the minimum value in the data object for this axis + /// - max: the maximum value in the data object for this axis + @objc open func computeAxis(min: Double, max: Double, inverted: Bool) + { + var min = min, max = max + + if let transformer = self.transformer + { + // calculate the starting and entry point of the y-labels (depending on zoom / contentrect bounds) + if viewPortHandler.contentWidth > 10.0 && !viewPortHandler.isFullyZoomedOutY + { + let p1 = transformer.valueForTouchPoint(CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentTop)) + let p2 = transformer.valueForTouchPoint(CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentBottom)) + + if !inverted + { + min = Double(p2.y) + max = Double(p1.y) + } + else + { + min = Double(p1.y) + max = Double(p2.y) + } + } + } + + computeAxisValues(min: min, max: max) + } + + /// Sets up the axis values. Computes the desired number of labels between the two given extremes. + @objc open func computeAxisValues(min: Double, max: Double) + { + guard let axis = self.axis else { return } + + let yMin = min + let yMax = max + + let labelCount = axis.labelCount + let range = abs(yMax - yMin) + + if labelCount == 0 || range <= 0 || range.isInfinite + { + axis.entries = [Double]() + axis.centeredEntries = [Double]() + return + } + + // Find out how much spacing (in y value space) between axis values + let rawInterval = range / Double(labelCount) + var interval = rawInterval.roundedToNextSignficant() + + // If granularity is enabled, then do not allow the interval to go below specified granularity. + // This is used to avoid repeated values when rounding values for display. + if axis.granularityEnabled + { + interval = interval < axis.granularity ? axis.granularity : interval + } + + // Normalize interval + let intervalMagnitude = pow(10.0, Double(Int(log10(interval)))).roundedToNextSignficant() + let intervalSigDigit = Int(interval / intervalMagnitude) + if intervalSigDigit > 5 + { + // Use one order of magnitude higher, to avoid intervals like 0.9 or 90 + // if it's 0.0 after floor(), we use the old value + interval = floor(10.0 * intervalMagnitude) == 0.0 ? interval : floor(10.0 * intervalMagnitude) + } + + var n = axis.centerAxisLabelsEnabled ? 1 : 0 + + // force label count + if axis.isForceLabelsEnabled + { + interval = Double(range) / Double(labelCount - 1) + + // Ensure stops contains at least n elements. + axis.entries.removeAll(keepingCapacity: true) + axis.entries.reserveCapacity(labelCount) + + var v = yMin + + for _ in 0 ..< labelCount + { + axis.entries.append(v) + v += interval + } + + n = labelCount + } + else + { + // no forced count + + var first = interval == 0.0 ? 0.0 : ceil(yMin / interval) * interval + + if axis.centerAxisLabelsEnabled + { + first -= interval + } + + let last = interval == 0.0 ? 0.0 : (floor(yMax / interval) * interval).nextUp + + if interval != 0.0 && last != first + { + for _ in stride(from: first, through: last, by: interval) + { + n += 1 + } + } + else if last == first && n == 0 + { + n = 1 + } + + // Ensure stops contains at least n elements. + axis.entries.removeAll(keepingCapacity: true) + axis.entries.reserveCapacity(labelCount) + + var f = first + var i = 0 + while i < n + { + if f == 0.0 + { + // Fix for IEEE negative zero case (Where value == -0.0, and 0.0 == -0.0) + f = 0.0 + } + + axis.entries.append(Double(f)) + + f += interval + i += 1 + } + } + + // set decimals + if interval < 1 + { + axis.decimals = Int(ceil(-log10(interval))) + } + else + { + axis.decimals = 0 + } + + if axis.centerAxisLabelsEnabled + { + axis.centeredEntries.reserveCapacity(n) + axis.centeredEntries.removeAll() + + let offset: Double = interval / 2.0 + + for i in 0 ..< n + { + axis.centeredEntries.append(axis.entries[i] + offset) + } + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/BarChartRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/BarChartRenderer.swift new file mode 100644 index 00000000000..6b192051bb7 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/BarChartRenderer.swift @@ -0,0 +1,893 @@ +// +// BarChartRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class BarChartRenderer: BarLineScatterCandleBubbleRenderer +{ + /// A nested array of elements ordered logically (i.e not in visual/drawing order) for use with VoiceOver + /// + /// Its use is apparent when there are multiple data sets, since we want to read bars in left to right order, + /// irrespective of dataset. However, drawing is done per dataset, so using this array and then flattening it prevents us from needing to + /// re-render for the sake of accessibility. + /// + /// In practise, its structure is: + /// + /// ```` + /// [ + /// [dataset1 element1, dataset2 element1], + /// [dataset1 element2, dataset2 element2], + /// [dataset1 element3, dataset2 element3] + /// ... + /// ] + /// ```` + /// This is done to provide numerical inference across datasets to a screenreader user, in the same way that a sighted individual + /// uses a multi-dataset bar chart. + /// + /// The ````internal```` specifier is to allow subclasses (HorizontalBar) to populate the same array + internal lazy var accessibilityOrderedElements: [[NSUIAccessibilityElement]] = accessibilityCreateEmptyOrderedElements() + + private class Buffer + { + var rects = [CGRect]() + } + + @objc open weak var dataProvider: BarChartDataProvider? + + @objc public init(dataProvider: BarChartDataProvider, animator: Animator, viewPortHandler: ViewPortHandler) + { + super.init(animator: animator, viewPortHandler: viewPortHandler) + + self.dataProvider = dataProvider + } + + // [CGRect] per dataset + private var _buffers = [Buffer]() + + open override func initBuffers() + { + if let barData = dataProvider?.barData + { + // Matche buffers count to dataset count + if _buffers.count != barData.dataSetCount + { + while _buffers.count < barData.dataSetCount + { + _buffers.append(Buffer()) + } + while _buffers.count > barData.dataSetCount + { + _buffers.removeLast() + } + } + + for i in stride(from: 0, to: barData.dataSetCount, by: 1) + { + let set = barData.dataSets[i] as! IBarChartDataSet + let size = set.entryCount * (set.isStacked ? set.stackSize : 1) + if _buffers[i].rects.count != size + { + _buffers[i].rects = [CGRect](repeating: CGRect(), count: size) + } + } + } + else + { + _buffers.removeAll() + } + } + + private func prepareBuffer(dataSet: IBarChartDataSet, index: Int) + { + guard + let dataProvider = dataProvider, + let barData = dataProvider.barData + else { return } + + let barWidthHalf = barData.barWidth / 2.0 + + let buffer = _buffers[index] + var bufferIndex = 0 + let containsStacks = dataSet.isStacked + + let isInverted = dataProvider.isInverted(axis: dataSet.axisDependency) + let phaseY = animator.phaseY + var barRect = CGRect() + var x: Double + var y: Double + + + for i in stride(from: 0, to: min(Int(ceil(Double(dataSet.entryCount) * animator.phaseX)), dataSet.entryCount), by: 1) + { + guard let e = dataSet.entryForIndex(i) as? BarChartDataEntry else { continue } + + let vals = e.yValues + + x = e.x + y = e.y + + if !containsStacks || vals == nil + { + let left = CGFloat(x - barWidthHalf) + let right = CGFloat(x + barWidthHalf) + var top = isInverted + ? (y <= 0.0 ? CGFloat(y) : 0) + : (y >= 0.0 ? CGFloat(y) : 0) + var bottom = isInverted + ? (y >= 0.0 ? CGFloat(y) : 0) + : (y <= 0.0 ? CGFloat(y) : 0) + + /* When drawing each bar, the renderer actually draws each bar from 0 to the required value. + * This drawn bar is then clipped to the visible chart rect in BarLineChartViewBase's draw(rect:) using clipDataToContent. + * While this works fine when calculating the bar rects for drawing, it causes the accessibilityFrames to be oversized in some cases. + * This offset attempts to undo that unnecessary drawing when calculating barRects + * + * +---------------------------------------------------------------+---------------------------------------------------------------+ + * | Situation 1: (!inverted && y >= 0) | Situation 3: (inverted && y >= 0) | + * | | | + * | y -> +--+ <- top | 0 -> ---+--+---+--+------ <- top | + * | |//| } topOffset = y - max | | | |//| } topOffset = min | + * | max -> +---------+--+----+ <- top - topOffset | min -> +--+--+---+--+----+ <- top + topOffset | + * | | +--+ |//| | | | | | |//| | | + * | | | | |//| | | | +--+ |//| | | + * | | | | |//| | | | |//| | | + * | min -> +--+--+---+--+----+ <- bottom + bottomOffset | max -> +---------+--+----+ <- bottom - bottomOffset | + * | | | |//| } bottomOffset = min | |//| } bottomOffset = y - max | + * | 0 -> ---+--+---+--+----- <- bottom | y -> +--+ <- bottom | + * | | | + * +---------------------------------------------------------------+---------------------------------------------------------------+ + * | Situation 2: (!inverted && y < 0) | Situation 4: (inverted && y < 0) | + * | | | + * | 0 -> ---+--+---+--+----- <- top | y -> +--+ <- top | + * | | | |//| } topOffset = -max | |//| } topOffset = min - y | + * | max -> +--+--+---+--+----+ <- top - topOffset | min -> +---------+--+----+ <- top + topOffset | + * | | | | |//| | | | +--+ |//| | | + * | | +--+ |//| | | | | | |//| | | + * | | |//| | | | | | |//| | | + * | min -> +---------+--+----+ <- bottom + bottomOffset | max -> +--+--+---+--+----+ <- bottom - bottomOffset | + * | |//| } bottomOffset = min - y | | | |//| } bottomOffset = -max | + * | y -> +--+ <- bottom | 0 -> ---+--+---+--+------- <- bottom | + * | | | + * +---------------------------------------------------------------+---------------------------------------------------------------+ + */ + var topOffset: CGFloat = 0.0 + var bottomOffset: CGFloat = 0.0 + if let offsetView = dataProvider as? BarChartView + { + let offsetAxis = offsetView.getAxis(dataSet.axisDependency) + if y >= 0 + { + // situation 1 + if offsetAxis.axisMaximum < y + { + topOffset = CGFloat(y - offsetAxis.axisMaximum) + } + if offsetAxis.axisMinimum > 0 + { + bottomOffset = CGFloat(offsetAxis.axisMinimum) + } + } + else // y < 0 + { + //situation 2 + if offsetAxis.axisMaximum < 0 + { + topOffset = CGFloat(offsetAxis.axisMaximum * -1) + } + if offsetAxis.axisMinimum > y + { + bottomOffset = CGFloat(offsetAxis.axisMinimum - y) + } + } + if isInverted + { + // situation 3 and 4 + // exchange topOffset/bottomOffset based on 1 and 2 + // see diagram above + (topOffset, bottomOffset) = (bottomOffset, topOffset) + } + } + //apply offset + top = isInverted ? top + topOffset : top - topOffset + bottom = isInverted ? bottom - bottomOffset : bottom + bottomOffset + + // multiply the height of the rect with the phase + // explicitly add 0 + topOffset to indicate this is changed after adding accessibility support (#3650, #3520) + if top > 0 + topOffset + { + top *= CGFloat(phaseY) + } + else + { + bottom *= CGFloat(phaseY) + } + + barRect.origin.x = left + barRect.origin.y = top + barRect.size.width = right - left + barRect.size.height = bottom - top + buffer.rects[bufferIndex] = barRect + bufferIndex += 1 + } + else + { + var posY = 0.0 + var negY = -e.negativeSum + var yStart = 0.0 + + // fill the stack + for k in 0 ..< vals!.count + { + let value = vals![k] + + if value == 0.0 && (posY == 0.0 || negY == 0.0) + { + // Take care of the situation of a 0.0 value, which overlaps a non-zero bar + y = value + yStart = y + } + else if value >= 0.0 + { + y = posY + yStart = posY + value + posY = yStart + } + else + { + y = negY + yStart = negY + abs(value) + negY += abs(value) + } + + let left = CGFloat(x - barWidthHalf) + let right = CGFloat(x + barWidthHalf) + var top = isInverted + ? (y <= yStart ? CGFloat(y) : CGFloat(yStart)) + : (y >= yStart ? CGFloat(y) : CGFloat(yStart)) + var bottom = isInverted + ? (y >= yStart ? CGFloat(y) : CGFloat(yStart)) + : (y <= yStart ? CGFloat(y) : CGFloat(yStart)) + + // multiply the height of the rect with the phase + top *= CGFloat(phaseY) + bottom *= CGFloat(phaseY) + + barRect.origin.x = left + barRect.size.width = right - left + barRect.origin.y = top + barRect.size.height = bottom - top + + buffer.rects[bufferIndex] = barRect + bufferIndex += 1 + } + } + } + } + + open override func drawData(context: CGContext) + { + guard + let dataProvider = dataProvider, + let barData = dataProvider.barData + else { return } + + // If we redraw the data, remove and repopulate accessible elements to update label values and frames + accessibleChartElements.removeAll() + accessibilityOrderedElements = accessibilityCreateEmptyOrderedElements() + + // Make the chart header the first element in the accessible elements array + if let chart = dataProvider as? BarChartView { + let element = createAccessibleHeader(usingChart: chart, + andData: barData, + withDefaultDescription: "Bar Chart") + accessibleChartElements.append(element) + } + + // Populate logically ordered nested elements into accessibilityOrderedElements in drawDataSet() + for i in 0 ..< barData.dataSetCount + { + guard let set = barData.getDataSetByIndex(i) else { continue } + + if set.isVisible + { + if !(set is IBarChartDataSet) + { + fatalError("Datasets for BarChartRenderer must conform to IBarChartDataset") + } + + drawDataSet(context: context, dataSet: set as! IBarChartDataSet, index: i) + } + } + + // Merge nested ordered arrays into the single accessibleChartElements. + accessibleChartElements.append(contentsOf: accessibilityOrderedElements.flatMap { $0 } ) + accessibilityPostLayoutChangedNotification() + } + + private var _barShadowRectBuffer: CGRect = CGRect() + + @objc open func drawDataSet(context: CGContext, dataSet: IBarChartDataSet, index: Int) + { + guard let dataProvider = dataProvider else { return } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + + prepareBuffer(dataSet: dataSet, index: index) + trans.rectValuesToPixel(&_buffers[index].rects) + + let borderWidth = dataSet.barBorderWidth + let borderColor = dataSet.barBorderColor + let drawBorder = borderWidth > 0.0 + + context.saveGState() + + // draw the bar shadow before the values + if dataProvider.isDrawBarShadowEnabled + { + guard let barData = dataProvider.barData else { return } + + let barWidth = barData.barWidth + let barWidthHalf = barWidth / 2.0 + var x: Double = 0.0 + + for i in stride(from: 0, to: min(Int(ceil(Double(dataSet.entryCount) * animator.phaseX)), dataSet.entryCount), by: 1) + { + guard let e = dataSet.entryForIndex(i) as? BarChartDataEntry else { continue } + + x = e.x + + _barShadowRectBuffer.origin.x = CGFloat(x - barWidthHalf) + _barShadowRectBuffer.size.width = CGFloat(barWidth) + + trans.rectValueToPixel(&_barShadowRectBuffer) + + if !viewPortHandler.isInBoundsLeft(_barShadowRectBuffer.origin.x + _barShadowRectBuffer.size.width) + { + continue + } + + if !viewPortHandler.isInBoundsRight(_barShadowRectBuffer.origin.x) + { + break + } + + _barShadowRectBuffer.origin.y = viewPortHandler.contentTop + _barShadowRectBuffer.size.height = viewPortHandler.contentHeight + + context.setFillColor(dataSet.barShadowColor.cgColor) + context.fill(_barShadowRectBuffer) + } + } + + let buffer = _buffers[index] + + // draw the bar shadow before the values + if dataProvider.isDrawBarShadowEnabled + { + for j in stride(from: 0, to: buffer.rects.count, by: 1) + { + let barRect = buffer.rects[j] + + if (!viewPortHandler.isInBoundsLeft(barRect.origin.x + barRect.size.width)) + { + continue + } + + if (!viewPortHandler.isInBoundsRight(barRect.origin.x)) + { + break + } + + context.setFillColor(dataSet.barShadowColor.cgColor) + context.fill(barRect) + } + } + + let isSingleColor = dataSet.colors.count == 1 + + if isSingleColor + { + context.setFillColor(dataSet.color(atIndex: 0).cgColor) + } + + // In case the chart is stacked, we need to accomodate individual bars within accessibilityOrdereredElements + let isStacked = dataSet.isStacked + let stackSize = isStacked ? dataSet.stackSize : 1 + + for j in stride(from: 0, to: buffer.rects.count, by: 1) + { + let barRect = buffer.rects[j] + + if (!viewPortHandler.isInBoundsLeft(barRect.origin.x + barRect.size.width)) + { + continue + } + + if (!viewPortHandler.isInBoundsRight(barRect.origin.x)) + { + break + } + + if !isSingleColor + { + // Set the color for the currently drawn value. If the index is out of bounds, reuse colors. + context.setFillColor(dataSet.color(atIndex: j).cgColor) + } + + context.fill(barRect) + + if drawBorder + { + context.setStrokeColor(borderColor.cgColor) + context.setLineWidth(borderWidth) + context.stroke(barRect) + } + + // Create and append the corresponding accessibility element to accessibilityOrderedElements + if let chart = dataProvider as? BarChartView + { + let element = createAccessibleElement(withIndex: j, + container: chart, + dataSet: dataSet, + dataSetIndex: index, + stackSize: stackSize) + { (element) in + element.accessibilityFrame = barRect + } + + accessibilityOrderedElements[j/stackSize].append(element) + } + } + + context.restoreGState() + } + + open func prepareBarHighlight( + x: Double, + y1: Double, + y2: Double, + barWidthHalf: Double, + trans: Transformer, + rect: inout CGRect) + { + let left = x - barWidthHalf + let right = x + barWidthHalf + let top = y1 + let bottom = y2 + + rect.origin.x = CGFloat(left) + rect.origin.y = CGFloat(top) + rect.size.width = CGFloat(right - left) + rect.size.height = CGFloat(bottom - top) + + trans.rectValueToPixel(&rect, phaseY: animator.phaseY ) + } + + open override func drawValues(context: CGContext) + { + // if values are drawn + if isDrawingValuesAllowed(dataProvider: dataProvider) + { + guard + let dataProvider = dataProvider, + let barData = dataProvider.barData + else { return } + + var dataSets = barData.dataSets + + let valueOffsetPlus: CGFloat = 4.5 + var posOffset: CGFloat + var negOffset: CGFloat + let drawValueAboveBar = dataProvider.isDrawValueAboveBarEnabled + + for dataSetIndex in 0 ..< barData.dataSetCount + { + guard let + dataSet = dataSets[dataSetIndex] as? IBarChartDataSet, + shouldDrawValues(forDataSet: dataSet) + else { continue } + + let isInverted = dataProvider.isInverted(axis: dataSet.axisDependency) + + // calculate the correct offset depending on the draw position of the value + let valueFont = dataSet.valueFont + let valueTextHeight = valueFont.lineHeight + posOffset = (drawValueAboveBar ? -(valueTextHeight + valueOffsetPlus) : valueOffsetPlus) + negOffset = (drawValueAboveBar ? valueOffsetPlus : -(valueTextHeight + valueOffsetPlus)) + + if isInverted + { + posOffset = -posOffset - valueTextHeight + negOffset = -negOffset - valueTextHeight + } + + let buffer = _buffers[dataSetIndex] + + guard let formatter = dataSet.valueFormatter else { continue } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + + let phaseY = animator.phaseY + + let iconsOffset = dataSet.iconsOffset + + // if only single values are drawn (sum) + if !dataSet.isStacked + { + for j in 0 ..< Int(ceil(Double(dataSet.entryCount) * animator.phaseX)) + { + guard let e = dataSet.entryForIndex(j) as? BarChartDataEntry else { continue } + + let rect = buffer.rects[j] + + let x = rect.origin.x + rect.size.width / 2.0 + + if !viewPortHandler.isInBoundsRight(x) + { + break + } + + if !viewPortHandler.isInBoundsY(rect.origin.y) + || !viewPortHandler.isInBoundsLeft(x) + { + continue + } + + let val = e.y + + if dataSet.isDrawValuesEnabled + { + drawValue( + context: context, + value: formatter.stringForValue( + val, + entry: e, + dataSetIndex: dataSetIndex, + viewPortHandler: viewPortHandler), + xPos: x, + yPos: val >= 0.0 + ? (rect.origin.y + posOffset) + : (rect.origin.y + rect.size.height + negOffset), + font: valueFont, + align: .center, + color: dataSet.valueTextColorAt(j)) + } + + if let icon = e.icon, dataSet.isDrawIconsEnabled + { + var px = x + var py = val >= 0.0 + ? (rect.origin.y + posOffset) + : (rect.origin.y + rect.size.height + negOffset) + + px += iconsOffset.x + py += iconsOffset.y + + ChartUtils.drawImage( + context: context, + image: icon, + x: px, + y: py, + size: icon.size) + } + } + } + else + { + // if we have stacks + + var bufferIndex = 0 + + for index in 0 ..< Int(ceil(Double(dataSet.entryCount) * animator.phaseX)) + { + guard let e = dataSet.entryForIndex(index) as? BarChartDataEntry else { continue } + + let vals = e.yValues + + let rect = buffer.rects[bufferIndex] + + let x = rect.origin.x + rect.size.width / 2.0 + + // we still draw stacked bars, but there is one non-stacked in between + if vals == nil + { + if !viewPortHandler.isInBoundsRight(x) + { + break + } + + if !viewPortHandler.isInBoundsY(rect.origin.y) + || !viewPortHandler.isInBoundsLeft(x) + { + continue + } + + if dataSet.isDrawValuesEnabled + { + drawValue( + context: context, + value: formatter.stringForValue( + e.y, + entry: e, + dataSetIndex: dataSetIndex, + viewPortHandler: viewPortHandler), + xPos: x, + yPos: rect.origin.y + + (e.y >= 0 ? posOffset : negOffset), + font: valueFont, + align: .center, + color: dataSet.valueTextColorAt(index)) + } + + if let icon = e.icon, dataSet.isDrawIconsEnabled + { + var px = x + var py = rect.origin.y + + (e.y >= 0 ? posOffset : negOffset) + + px += iconsOffset.x + py += iconsOffset.y + + ChartUtils.drawImage( + context: context, + image: icon, + x: px, + y: py, + size: icon.size) + } + } + else + { + // draw stack values + + let vals = vals! + var transformed = [CGPoint]() + + var posY = 0.0 + var negY = -e.negativeSum + + for k in 0 ..< vals.count + { + let value = vals[k] + var y: Double + + if value == 0.0 && (posY == 0.0 || negY == 0.0) + { + // Take care of the situation of a 0.0 value, which overlaps a non-zero bar + y = value + } + else if value >= 0.0 + { + posY += value + y = posY + } + else + { + y = negY + negY -= value + } + + transformed.append(CGPoint(x: 0.0, y: CGFloat(y * phaseY))) + } + + trans.pointValuesToPixel(&transformed) + + for k in 0 ..< transformed.count + { + let val = vals[k] + let drawBelow = (val == 0.0 && negY == 0.0 && posY > 0.0) || val < 0.0 + let y = transformed[k].y + (drawBelow ? negOffset : posOffset) + + if !viewPortHandler.isInBoundsRight(x) + { + break + } + + if !viewPortHandler.isInBoundsY(y) || !viewPortHandler.isInBoundsLeft(x) + { + continue + } + + if dataSet.isDrawValuesEnabled + { + drawValue( + context: context, + value: formatter.stringForValue( + vals[k], + entry: e, + dataSetIndex: dataSetIndex, + viewPortHandler: viewPortHandler), + xPos: x, + yPos: y, + font: valueFont, + align: .center, + color: dataSet.valueTextColorAt(index)) + } + + if let icon = e.icon, dataSet.isDrawIconsEnabled + { + ChartUtils.drawImage( + context: context, + image: icon, + x: x + iconsOffset.x, + y: y + iconsOffset.y, + size: icon.size) + } + } + } + + bufferIndex = vals == nil ? (bufferIndex + 1) : (bufferIndex + vals!.count) + } + } + } + } + } + + /// Draws a value at the specified x and y position. + @objc open func drawValue(context: CGContext, value: String, xPos: CGFloat, yPos: CGFloat, font: NSUIFont, align: NSTextAlignment, color: NSUIColor) + { + ChartUtils.drawText(context: context, text: value, point: CGPoint(x: xPos, y: yPos), align: align, attributes: [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: color]) + } + + open override func drawExtras(context: CGContext) + { + + } + + open override func drawHighlighted(context: CGContext, indices: [Highlight]) + { + guard + let dataProvider = dataProvider, + let barData = dataProvider.barData + else { return } + + context.saveGState() + + var barRect = CGRect() + + for high in indices + { + guard + let set = barData.getDataSetByIndex(high.dataSetIndex) as? IBarChartDataSet, + set.isHighlightEnabled + else { continue } + + if let e = set.entryForXValue(high.x, closestToY: high.y) as? BarChartDataEntry + { + if !isInBoundsX(entry: e, dataSet: set) + { + continue + } + + let trans = dataProvider.getTransformer(forAxis: set.axisDependency) + + context.setFillColor(set.highlightColor.cgColor) + context.setAlpha(set.highlightAlpha) + + let isStack = high.stackIndex >= 0 && e.isStacked + + let y1: Double + let y2: Double + + if isStack + { + if dataProvider.isHighlightFullBarEnabled + { + y1 = e.positiveSum + y2 = -e.negativeSum + } + else + { + let range = e.ranges?[high.stackIndex] + + y1 = range?.from ?? 0.0 + y2 = range?.to ?? 0.0 + } + } + else + { + y1 = e.y + y2 = 0.0 + } + + prepareBarHighlight(x: e.x, y1: y1, y2: y2, barWidthHalf: barData.barWidth / 2.0, trans: trans, rect: &barRect) + + setHighlightDrawPos(highlight: high, barRect: barRect) + + context.fill(barRect) + } + } + + context.restoreGState() + } + + /// Sets the drawing position of the highlight object based on the given bar-rect. + internal func setHighlightDrawPos(highlight high: Highlight, barRect: CGRect) + { + high.setDraw(x: barRect.midX, y: barRect.origin.y) + } + + /// Creates a nested array of empty subarrays each of which will be populated with NSUIAccessibilityElements. + /// This is marked internal to support HorizontalBarChartRenderer as well. + internal func accessibilityCreateEmptyOrderedElements() -> [[NSUIAccessibilityElement]] + { + guard let chart = dataProvider as? BarChartView else { return [] } + + // Unlike Bubble & Line charts, here we use the maximum entry count to account for stacked bars + let maxEntryCount = chart.data?.maxEntryCountSet?.entryCount ?? 0 + + return Array(repeating: [NSUIAccessibilityElement](), + count: maxEntryCount) + } + + /// Creates an NSUIAccessibleElement representing the smallest meaningful bar of the chart + /// i.e. in case of a stacked chart, this returns each stack, not the combined bar. + /// Note that it is marked internal to support subclass modification in the HorizontalBarChart. + internal func createAccessibleElement(withIndex idx: Int, + container: BarChartView, + dataSet: IBarChartDataSet, + dataSetIndex: Int, + stackSize: Int, + modifier: (NSUIAccessibilityElement) -> ()) -> NSUIAccessibilityElement + { + let element = NSUIAccessibilityElement(accessibilityContainer: container) + let xAxis = container.xAxis + + guard let e = dataSet.entryForIndex(idx/stackSize) as? BarChartDataEntry else { return element } + guard let dataProvider = dataProvider else { return element } + + // NOTE: The formatter can cause issues when the x-axis labels are consecutive ints. + // i.e. due to the Double conversion, if there are more than one data set that are grouped, + // there is the possibility of some labels being rounded up. A floor() might fix this, but seems to be a brute force solution. + let label = xAxis.valueFormatter?.stringForValue(e.x, axis: xAxis) ?? "\(e.x)" + + var elementValueText = dataSet.valueFormatter?.stringForValue( + e.y, + entry: e, + dataSetIndex: dataSetIndex, + viewPortHandler: viewPortHandler) ?? "\(e.y)" + + if dataSet.isStacked, let vals = e.yValues + { + let labelCount = min(dataSet.colors.count, stackSize) + + let stackLabel: String? + if (dataSet.stackLabels.count > 0 && labelCount > 0) { + let labelIndex = idx % labelCount + stackLabel = dataSet.stackLabels.indices.contains(labelIndex) ? dataSet.stackLabels[labelIndex] : nil + } else { + stackLabel = nil + } + + elementValueText = dataSet.valueFormatter?.stringForValue( + vals[idx % stackSize], + entry: e, + dataSetIndex: dataSetIndex, + viewPortHandler: viewPortHandler) ?? "\(e.y)" + + if let stackLabel = stackLabel { + elementValueText = stackLabel + " \(elementValueText)" + } else { + elementValueText = "\(elementValueText)" + } + } + + let dataSetCount = dataProvider.barData?.dataSetCount ?? -1 + let doesContainMultipleDataSets = dataSetCount > 1 + + element.accessibilityLabel = "\(doesContainMultipleDataSets ? (dataSet.label ?? "") + ", " : "") \(label): \(elementValueText)" + + modifier(element) + + return element + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift new file mode 100644 index 00000000000..7c258b1f416 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/BarLineScatterCandleBubbleRenderer.swift @@ -0,0 +1,119 @@ +// +// BarLineScatterCandleBubbleRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(BarLineScatterCandleBubbleChartRenderer) +open class BarLineScatterCandleBubbleRenderer: DataRenderer +{ + internal var _xBounds = XBounds() // Reusable XBounds object + + public override init(animator: Animator, viewPortHandler: ViewPortHandler) + { + super.init(animator: animator, viewPortHandler: viewPortHandler) + } + + /// Checks if the provided entry object is in bounds for drawing considering the current animation phase. + internal func isInBoundsX(entry e: ChartDataEntry, dataSet: IBarLineScatterCandleBubbleChartDataSet) -> Bool + { + let entryIndex = dataSet.entryIndex(entry: e) + return Double(entryIndex) < Double(dataSet.entryCount) * animator.phaseX + } + + /// Calculates and returns the x-bounds for the given DataSet in terms of index in their values array. + /// This includes minimum and maximum visible x, as well as range. + internal func xBounds(chart: BarLineScatterCandleBubbleChartDataProvider, + dataSet: IBarLineScatterCandleBubbleChartDataSet, + animator: Animator?) -> XBounds + { + return XBounds(chart: chart, dataSet: dataSet, animator: animator) + } + + /// - Returns: `true` if the DataSet values should be drawn, `false` if not. + internal func shouldDrawValues(forDataSet set: IChartDataSet) -> Bool + { + return set.isVisible && (set.isDrawValuesEnabled || set.isDrawIconsEnabled) + } + + /// Class representing the bounds of the current viewport in terms of indices in the values array of a DataSet. + open class XBounds + { + /// minimum visible entry index + open var min: Int = 0 + + /// maximum visible entry index + open var max: Int = 0 + + /// range of visible entry indices + open var range: Int = 0 + + public init() + { + + } + + public init(chart: BarLineScatterCandleBubbleChartDataProvider, + dataSet: IBarLineScatterCandleBubbleChartDataSet, + animator: Animator?) + { + self.set(chart: chart, dataSet: dataSet, animator: animator) + } + + /// Calculates the minimum and maximum x values as well as the range between them. + open func set(chart: BarLineScatterCandleBubbleChartDataProvider, + dataSet: IBarLineScatterCandleBubbleChartDataSet, + animator: Animator?) + { + let phaseX = Swift.max(0.0, Swift.min(1.0, animator?.phaseX ?? 1.0)) + + let low = chart.lowestVisibleX + let high = chart.highestVisibleX + + let entryFrom = dataSet.entryForXValue(low, closestToY: .nan, rounding: .down) + let entryTo = dataSet.entryForXValue(high, closestToY: .nan, rounding: .up) + + self.min = entryFrom == nil ? 0 : dataSet.entryIndex(entry: entryFrom!) + self.max = entryTo == nil ? 0 : dataSet.entryIndex(entry: entryTo!) + range = Int(Double(self.max - self.min) * phaseX) + } + } +} + +extension BarLineScatterCandleBubbleRenderer.XBounds: RangeExpression { + public func relative(to collection: C) -> Swift.Range + where C : Collection, Bound == C.Index + { + return Swift.Range(min...min + range) + } + + public func contains(_ element: Int) -> Bool { + return (min...min + range).contains(element) + } +} + +extension BarLineScatterCandleBubbleRenderer.XBounds: Sequence { + public struct Iterator: IteratorProtocol { + private var iterator: IndexingIterator> + + fileprivate init(min: Int, max: Int) { + self.iterator = (min...max).makeIterator() + } + + public mutating func next() -> Int? { + return self.iterator.next() + } + } + + public func makeIterator() -> Iterator { + return Iterator(min: self.min, max: self.max) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift new file mode 100644 index 00000000000..1a089e9f3ea --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/BubbleChartRenderer.swift @@ -0,0 +1,359 @@ +// +// BubbleChartRenderer.swift +// Charts +// +// Bubble chart implementation: +// Copyright 2015 Pierre-Marc Airoldi +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class BubbleChartRenderer: BarLineScatterCandleBubbleRenderer +{ + /// A nested array of elements ordered logically (i.e not in visual/drawing order) for use with VoiceOver. + private lazy var accessibilityOrderedElements: [[NSUIAccessibilityElement]] = accessibilityCreateEmptyOrderedElements() + + @objc open weak var dataProvider: BubbleChartDataProvider? + + @objc public init(dataProvider: BubbleChartDataProvider, animator: Animator, viewPortHandler: ViewPortHandler) + { + super.init(animator: animator, viewPortHandler: viewPortHandler) + + self.dataProvider = dataProvider + } + + open override func drawData(context: CGContext) + { + guard + let dataProvider = dataProvider, + let bubbleData = dataProvider.bubbleData + else { return } + + // If we redraw the data, remove and repopulate accessible elements to update label values and frames + accessibleChartElements.removeAll() + accessibilityOrderedElements = accessibilityCreateEmptyOrderedElements() + + // Make the chart header the first element in the accessible elements array + if let chart = dataProvider as? BubbleChartView { + let element = createAccessibleHeader(usingChart: chart, + andData: bubbleData, + withDefaultDescription: "Bubble Chart") + accessibleChartElements.append(element) + } + + for (i, set) in (bubbleData.dataSets as! [IBubbleChartDataSet]).enumerated() where set.isVisible + { + drawDataSet(context: context, dataSet: set, dataSetIndex: i) + } + + // Merge nested ordered arrays into the single accessibleChartElements. + accessibleChartElements.append(contentsOf: accessibilityOrderedElements.flatMap { $0 } ) + accessibilityPostLayoutChangedNotification() + } + + private func getShapeSize( + entrySize: CGFloat, + maxSize: CGFloat, + reference: CGFloat, + normalizeSize: Bool) -> CGFloat + { + let factor: CGFloat = normalizeSize + ? ((maxSize == 0.0) ? 1.0 : sqrt(entrySize / maxSize)) + : entrySize + let shapeSize: CGFloat = reference * factor + return shapeSize + } + + private var _pointBuffer = CGPoint() + private var _sizeBuffer = [CGPoint](repeating: CGPoint(), count: 2) + + @objc open func drawDataSet(context: CGContext, dataSet: IBubbleChartDataSet, dataSetIndex: Int) + { + guard let dataProvider = dataProvider else { return } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + + let phaseY = animator.phaseY + + _xBounds.set(chart: dataProvider, dataSet: dataSet, animator: animator) + + let valueToPixelMatrix = trans.valueToPixelMatrix + + _sizeBuffer[0].x = 0.0 + _sizeBuffer[0].y = 0.0 + _sizeBuffer[1].x = 1.0 + _sizeBuffer[1].y = 0.0 + + trans.pointValuesToPixel(&_sizeBuffer) + + context.saveGState() + defer { context.restoreGState() } + + let normalizeSize = dataSet.isNormalizeSizeEnabled + + // calcualte the full width of 1 step on the x-axis + let maxBubbleWidth: CGFloat = abs(_sizeBuffer[1].x - _sizeBuffer[0].x) + let maxBubbleHeight: CGFloat = abs(viewPortHandler.contentBottom - viewPortHandler.contentTop) + let referenceSize: CGFloat = min(maxBubbleHeight, maxBubbleWidth) + + for j in _xBounds + { + guard let entry = dataSet.entryForIndex(j) as? BubbleChartDataEntry else { continue } + + _pointBuffer.x = CGFloat(entry.x) + _pointBuffer.y = CGFloat(entry.y * phaseY) + _pointBuffer = _pointBuffer.applying(valueToPixelMatrix) + + let shapeSize = getShapeSize(entrySize: entry.size, maxSize: dataSet.maxSize, reference: referenceSize, normalizeSize: normalizeSize) + let shapeHalf = shapeSize / 2.0 + + guard + viewPortHandler.isInBoundsTop(_pointBuffer.y + shapeHalf), + viewPortHandler.isInBoundsBottom(_pointBuffer.y - shapeHalf), + viewPortHandler.isInBoundsLeft(_pointBuffer.x + shapeHalf) + else { continue } + + guard viewPortHandler.isInBoundsRight(_pointBuffer.x - shapeHalf) else { break } + + let color = dataSet.color(atIndex: j) + + let rect = CGRect( + x: _pointBuffer.x - shapeHalf, + y: _pointBuffer.y - shapeHalf, + width: shapeSize, + height: shapeSize + ) + + context.setFillColor(color.cgColor) + context.fillEllipse(in: rect) + + // Create and append the corresponding accessibility element to accessibilityOrderedElements + if let chart = dataProvider as? BubbleChartView + { + let element = createAccessibleElement(withIndex: j, + container: chart, + dataSet: dataSet, + dataSetIndex: dataSetIndex, + shapeSize: shapeSize) + { (element) in + element.accessibilityFrame = rect + } + + accessibilityOrderedElements[dataSetIndex].append(element) + } + } + } + + open override func drawValues(context: CGContext) + { + guard let + dataProvider = dataProvider, + let bubbleData = dataProvider.bubbleData, + isDrawingValuesAllowed(dataProvider: dataProvider), + let dataSets = bubbleData.dataSets as? [IBubbleChartDataSet] + else { return } + + let phaseX = max(0.0, min(1.0, animator.phaseX)) + let phaseY = animator.phaseY + + var pt = CGPoint() + + for i in 0.. [[NSUIAccessibilityElement]] + { + guard let chart = dataProvider as? BubbleChartView else { return [] } + + let dataSetCount = chart.bubbleData?.dataSetCount ?? 0 + + return Array(repeating: [NSUIAccessibilityElement](), + count: dataSetCount) + } + + /// Creates an NSUIAccessibleElement representing individual bubbles location and relative size. + private func createAccessibleElement(withIndex idx: Int, + container: BubbleChartView, + dataSet: IBubbleChartDataSet, + dataSetIndex: Int, + shapeSize: CGFloat, + modifier: (NSUIAccessibilityElement) -> ()) -> NSUIAccessibilityElement + { + let element = NSUIAccessibilityElement(accessibilityContainer: container) + let xAxis = container.xAxis + + guard let e = dataSet.entryForIndex(idx) else { return element } + guard let dataProvider = dataProvider else { return element } + + // NOTE: The formatter can cause issues when the x-axis labels are consecutive ints. + // i.e. due to the Double conversion, if there are more than one data set that are grouped, + // there is the possibility of some labels being rounded up. A floor() might fix this, but seems to be a brute force solution. + let label = xAxis.valueFormatter?.stringForValue(e.x, axis: xAxis) ?? "\(e.x)" + + let elementValueText = dataSet.valueFormatter?.stringForValue(e.y, + entry: e, + dataSetIndex: dataSetIndex, + viewPortHandler: viewPortHandler) ?? "\(e.y)" + + let dataSetCount = dataProvider.bubbleData?.dataSetCount ?? -1 + let doesContainMultipleDataSets = dataSetCount > 1 + + element.accessibilityLabel = "\(doesContainMultipleDataSets ? (dataSet.label ?? "") + ", " : "") \(label): \(elementValueText), bubble size: \(String(format: "%.2f", (shapeSize/dataSet.maxSize) * 100)) %" + + modifier(element) + + return element + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift new file mode 100644 index 00000000000..2e8cda32574 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/CandleStickChartRenderer.swift @@ -0,0 +1,420 @@ +// +// CandleStickChartRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class CandleStickChartRenderer: LineScatterCandleRadarRenderer +{ + @objc open weak var dataProvider: CandleChartDataProvider? + + @objc public init(dataProvider: CandleChartDataProvider, animator: Animator, viewPortHandler: ViewPortHandler) + { + super.init(animator: animator, viewPortHandler: viewPortHandler) + + self.dataProvider = dataProvider + } + + open override func drawData(context: CGContext) + { + guard let dataProvider = dataProvider, let candleData = dataProvider.candleData else { return } + + // If we redraw the data, remove and repopulate accessible elements to update label values and frames + accessibleChartElements.removeAll() + + // Make the chart header the first element in the accessible elements array + if let chart = dataProvider as? CandleStickChartView { + let element = createAccessibleHeader(usingChart: chart, + andData: candleData, + withDefaultDescription: "CandleStick Chart") + accessibleChartElements.append(element) + } + + for set in candleData.dataSets as! [ICandleChartDataSet] where set.isVisible + { + drawDataSet(context: context, dataSet: set) + } + } + + private var _shadowPoints = [CGPoint](repeating: CGPoint(), count: 4) + private var _rangePoints = [CGPoint](repeating: CGPoint(), count: 2) + private var _openPoints = [CGPoint](repeating: CGPoint(), count: 2) + private var _closePoints = [CGPoint](repeating: CGPoint(), count: 2) + private var _bodyRect = CGRect() + private var _lineSegments = [CGPoint](repeating: CGPoint(), count: 2) + + @objc open func drawDataSet(context: CGContext, dataSet: ICandleChartDataSet) + { + guard + let dataProvider = dataProvider + else { return } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + + let phaseY = animator.phaseY + let barSpace = dataSet.barSpace + let showCandleBar = dataSet.showCandleBar + + _xBounds.set(chart: dataProvider, dataSet: dataSet, animator: animator) + + context.saveGState() + + context.setLineWidth(dataSet.shadowWidth) + + for j in _xBounds + { + // get the entry + guard let e = dataSet.entryForIndex(j) as? CandleChartDataEntry else { continue } + + let xPos = e.x + + let open = e.open + let close = e.close + let high = e.high + let low = e.low + + let doesContainMultipleDataSets = (dataProvider.candleData?.dataSets.count ?? 1) > 1 + var accessibilityMovementDescription = "neutral" + var accessibilityRect = CGRect(x: CGFloat(xPos) + 0.5 - barSpace, + y: CGFloat(low * phaseY), + width: (2 * barSpace) - 1.0, + height: (CGFloat(abs(high - low) * phaseY))) + trans.rectValueToPixel(&accessibilityRect) + + if showCandleBar + { + // calculate the shadow + + _shadowPoints[0].x = CGFloat(xPos) + _shadowPoints[1].x = CGFloat(xPos) + _shadowPoints[2].x = CGFloat(xPos) + _shadowPoints[3].x = CGFloat(xPos) + + if open > close + { + _shadowPoints[0].y = CGFloat(high * phaseY) + _shadowPoints[1].y = CGFloat(open * phaseY) + _shadowPoints[2].y = CGFloat(low * phaseY) + _shadowPoints[3].y = CGFloat(close * phaseY) + } + else if open < close + { + _shadowPoints[0].y = CGFloat(high * phaseY) + _shadowPoints[1].y = CGFloat(close * phaseY) + _shadowPoints[2].y = CGFloat(low * phaseY) + _shadowPoints[3].y = CGFloat(open * phaseY) + } + else + { + _shadowPoints[0].y = CGFloat(high * phaseY) + _shadowPoints[1].y = CGFloat(open * phaseY) + _shadowPoints[2].y = CGFloat(low * phaseY) + _shadowPoints[3].y = _shadowPoints[1].y + } + + trans.pointValuesToPixel(&_shadowPoints) + + // draw the shadows + + var shadowColor: NSUIColor! = nil + if dataSet.shadowColorSameAsCandle + { + if open > close + { + shadowColor = dataSet.decreasingColor ?? dataSet.color(atIndex: j) + } + else if open < close + { + shadowColor = dataSet.increasingColor ?? dataSet.color(atIndex: j) + } + else + { + shadowColor = dataSet.neutralColor ?? dataSet.color(atIndex: j) + } + } + + if shadowColor === nil + { + shadowColor = dataSet.shadowColor ?? dataSet.color(atIndex: j) + } + + context.setStrokeColor(shadowColor.cgColor) + context.strokeLineSegments(between: _shadowPoints) + + // calculate the body + + _bodyRect.origin.x = CGFloat(xPos) - 0.5 + barSpace + _bodyRect.origin.y = CGFloat(close * phaseY) + _bodyRect.size.width = (CGFloat(xPos) + 0.5 - barSpace) - _bodyRect.origin.x + _bodyRect.size.height = CGFloat(open * phaseY) - _bodyRect.origin.y + + trans.rectValueToPixel(&_bodyRect) + + // draw body differently for increasing and decreasing entry + + if open > close + { + accessibilityMovementDescription = "decreasing" + + let color = dataSet.decreasingColor ?? dataSet.color(atIndex: j) + + if dataSet.isDecreasingFilled + { + context.setFillColor(color.cgColor) + context.fill(_bodyRect) + } + else + { + context.setStrokeColor(color.cgColor) + context.stroke(_bodyRect) + } + } + else if open < close + { + accessibilityMovementDescription = "increasing" + + let color = dataSet.increasingColor ?? dataSet.color(atIndex: j) + + if dataSet.isIncreasingFilled + { + context.setFillColor(color.cgColor) + context.fill(_bodyRect) + } + else + { + context.setStrokeColor(color.cgColor) + context.stroke(_bodyRect) + } + } + else + { + let color = dataSet.neutralColor ?? dataSet.color(atIndex: j) + + context.setStrokeColor(color.cgColor) + context.stroke(_bodyRect) + } + } + else + { + _rangePoints[0].x = CGFloat(xPos) + _rangePoints[0].y = CGFloat(high * phaseY) + _rangePoints[1].x = CGFloat(xPos) + _rangePoints[1].y = CGFloat(low * phaseY) + + _openPoints[0].x = CGFloat(xPos) - 0.5 + barSpace + _openPoints[0].y = CGFloat(open * phaseY) + _openPoints[1].x = CGFloat(xPos) + _openPoints[1].y = CGFloat(open * phaseY) + + _closePoints[0].x = CGFloat(xPos) + 0.5 - barSpace + _closePoints[0].y = CGFloat(close * phaseY) + _closePoints[1].x = CGFloat(xPos) + _closePoints[1].y = CGFloat(close * phaseY) + + trans.pointValuesToPixel(&_rangePoints) + trans.pointValuesToPixel(&_openPoints) + trans.pointValuesToPixel(&_closePoints) + + // draw the ranges + var barColor: NSUIColor! = nil + + if open > close + { + accessibilityMovementDescription = "decreasing" + barColor = dataSet.decreasingColor ?? dataSet.color(atIndex: j) + } + else if open < close + { + accessibilityMovementDescription = "increasing" + barColor = dataSet.increasingColor ?? dataSet.color(atIndex: j) + } + else + { + barColor = dataSet.neutralColor ?? dataSet.color(atIndex: j) + } + + context.setStrokeColor(barColor.cgColor) + context.strokeLineSegments(between: _rangePoints) + context.strokeLineSegments(between: _openPoints) + context.strokeLineSegments(between: _closePoints) + } + + let axElement = createAccessibleElement(withIndex: j, + container: dataProvider, + dataSet: dataSet) + { (element) in + element.accessibilityLabel = "\(doesContainMultipleDataSets ? "\(dataSet.label ?? "Dataset")" : "") " + "\(xPos) - \(accessibilityMovementDescription). low: \(low), high: \(high), opening: \(open), closing: \(close)" + element.accessibilityFrame = accessibilityRect + } + + accessibleChartElements.append(axElement) + + } + + // Post this notification to let VoiceOver account for the redrawn frames + accessibilityPostLayoutChangedNotification() + + context.restoreGState() + } + + open override func drawValues(context: CGContext) + { + guard + let dataProvider = dataProvider, + let candleData = dataProvider.candleData + else { return } + + // if values are drawn + if isDrawingValuesAllowed(dataProvider: dataProvider) + { + var dataSets = candleData.dataSets + + let phaseY = animator.phaseY + + var pt = CGPoint() + + for i in 0 ..< dataSets.count + { + guard let + dataSet = dataSets[i] as? IBarLineScatterCandleBubbleChartDataSet, + shouldDrawValues(forDataSet: dataSet) + else { continue } + + let valueFont = dataSet.valueFont + + guard let formatter = dataSet.valueFormatter else { continue } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + let valueToPixelMatrix = trans.valueToPixelMatrix + + let iconsOffset = dataSet.iconsOffset + + _xBounds.set(chart: dataProvider, dataSet: dataSet, animator: animator) + + let lineHeight = valueFont.lineHeight + let yOffset: CGFloat = lineHeight + 5.0 + + for j in _xBounds + { + guard let e = dataSet.entryForIndex(j) as? CandleChartDataEntry else { break } + + pt.x = CGFloat(e.x) + pt.y = CGFloat(e.high * phaseY) + pt = pt.applying(valueToPixelMatrix) + + if (!viewPortHandler.isInBoundsRight(pt.x)) + { + break + } + + if (!viewPortHandler.isInBoundsLeft(pt.x) || !viewPortHandler.isInBoundsY(pt.y)) + { + continue + } + + if dataSet.isDrawValuesEnabled + { + ChartUtils.drawText( + context: context, + text: formatter.stringForValue( + e.high, + entry: e, + dataSetIndex: i, + viewPortHandler: viewPortHandler), + point: CGPoint( + x: pt.x, + y: pt.y - yOffset), + align: .center, + attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: dataSet.valueTextColorAt(j)]) + } + + if let icon = e.icon, dataSet.isDrawIconsEnabled + { + ChartUtils.drawImage(context: context, + image: icon, + x: pt.x + iconsOffset.x, + y: pt.y + iconsOffset.y, + size: icon.size) + } + } + } + } + } + + open override func drawExtras(context: CGContext) + { + } + + open override func drawHighlighted(context: CGContext, indices: [Highlight]) + { + guard + let dataProvider = dataProvider, + let candleData = dataProvider.candleData + else { return } + + context.saveGState() + + for high in indices + { + guard + let set = candleData.getDataSetByIndex(high.dataSetIndex) as? ICandleChartDataSet, + set.isHighlightEnabled + else { continue } + + guard let e = set.entryForXValue(high.x, closestToY: high.y) as? CandleChartDataEntry else { continue } + + if !isInBoundsX(entry: e, dataSet: set) + { + continue + } + + let trans = dataProvider.getTransformer(forAxis: set.axisDependency) + + context.setStrokeColor(set.highlightColor.cgColor) + context.setLineWidth(set.highlightLineWidth) + + if set.highlightLineDashLengths != nil + { + context.setLineDash(phase: set.highlightLineDashPhase, lengths: set.highlightLineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + let lowValue = e.low * Double(animator.phaseY) + let highValue = e.high * Double(animator.phaseY) + let y = (lowValue + highValue) / 2.0 + + let pt = trans.pixelForValues(x: e.x, y: y) + + high.setDraw(pt: pt) + + // draw the lines + drawHighlightLines(context: context, point: pt, set: set) + } + + context.restoreGState() + } + + private func createAccessibleElement(withIndex idx: Int, + container: CandleChartDataProvider, + dataSet: ICandleChartDataSet, + modifier: (NSUIAccessibilityElement) -> ()) -> NSUIAccessibilityElement { + + let element = NSUIAccessibilityElement(accessibilityContainer: container) + + // The modifier allows changing of traits and frame depending on highlight, rotation, etc + modifier(element) + + return element + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift new file mode 100644 index 00000000000..68905ff50ae --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/ChartDataRendererBase.swift @@ -0,0 +1,94 @@ +// +// DataRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartDataRendererBase) +open class DataRenderer: Renderer +{ + /// An array of accessibility elements that are presented to the ChartViewBase accessibility methods. + /// + /// Note that the order of elements in this array determines the order in which they are presented and navigated by + /// Accessibility clients such as VoiceOver. + /// + /// Renderers should ensure that the order of elements makes sense to a client presenting an audio-only interface to a user. + /// Subclasses should populate this array in drawData() or drawDataSet() to make the chart accessible. + @objc final var accessibleChartElements: [NSUIAccessibilityElement] = [] + + @objc public let animator: Animator + + @objc public init(animator: Animator, viewPortHandler: ViewPortHandler) + { + self.animator = animator + + super.init(viewPortHandler: viewPortHandler) + } + + @objc open func drawData(context: CGContext) + { + fatalError("drawData() cannot be called on DataRenderer") + } + + @objc open func drawValues(context: CGContext) + { + fatalError("drawValues() cannot be called on DataRenderer") + } + + @objc open func drawExtras(context: CGContext) + { + fatalError("drawExtras() cannot be called on DataRenderer") + } + + /// Draws all highlight indicators for the values that are currently highlighted. + /// + /// - Parameters: + /// - indices: the highlighted values + @objc open func drawHighlighted(context: CGContext, indices: [Highlight]) + { + fatalError("drawHighlighted() cannot be called on DataRenderer") + } + + /// An opportunity for initializing internal buffers used for rendering with a new size. + /// Since this might do memory allocations, it should only be called if necessary. + @objc open func initBuffers() { } + + @objc open func isDrawingValuesAllowed(dataProvider: ChartDataProvider?) -> Bool + { + guard let data = dataProvider?.data else { return false } + return data.entryCount < Int(CGFloat(dataProvider?.maxVisibleCount ?? 0) * viewPortHandler.scaleX) + } + + /// Creates an ```NSUIAccessibilityElement``` that acts as the first and primary header describing a chart view. + /// + /// - Parameters: + /// - chart: The chartView object being described + /// - data: A non optional data source about the chart + /// - defaultDescription: A simple string describing the type/design of Chart. + /// - Returns: A header ```NSUIAccessibilityElement``` that can be added to accessibleChartElements. + @objc internal func createAccessibleHeader(usingChart chart: ChartViewBase, + andData data: ChartData, + withDefaultDescription defaultDescription: String = "Chart") -> NSUIAccessibilityElement + { + let chartDescriptionText = chart.chartDescription?.text ?? defaultDescription + let dataSetDescriptions = data.dataSets.map { $0.label ?? "" } + let dataSetDescriptionText = dataSetDescriptions.joined(separator: ", ") + let dataSetCount = data.dataSets.count + + let + element = NSUIAccessibilityElement(accessibilityContainer: chart) + element.accessibilityLabel = chartDescriptionText + ". \(dataSetCount) dataset\(dataSetCount == 1 ? "" : "s"). \(dataSetDescriptionText)" + element.accessibilityFrame = chart.bounds + element.isHeader = true + + return element + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift new file mode 100644 index 00000000000..8446c9b637f --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/CombinedChartRenderer.swift @@ -0,0 +1,209 @@ +// +// CombinedChartRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class CombinedChartRenderer: DataRenderer +{ + @objc open weak var chart: CombinedChartView? + + /// if set to true, all values are drawn above their bars, instead of below their top + @objc open var drawValueAboveBarEnabled = true + + /// if set to true, a grey area is drawn behind each bar that indicates the maximum value + @objc open var drawBarShadowEnabled = false + + internal var _renderers = [DataRenderer]() + + internal var _drawOrder: [CombinedChartView.DrawOrder] = [.bar, .bubble, .line, .candle, .scatter] + + @objc public init(chart: CombinedChartView, animator: Animator, viewPortHandler: ViewPortHandler) + { + super.init(animator: animator, viewPortHandler: viewPortHandler) + + self.chart = chart + + createRenderers() + } + + /// Creates the renderers needed for this combined-renderer in the required order. Also takes the DrawOrder into consideration. + internal func createRenderers() + { + _renderers = [DataRenderer]() + + guard let chart = chart else { return } + + for order in drawOrder + { + switch (order) + { + case .bar: + if chart.barData !== nil + { + _renderers.append(BarChartRenderer(dataProvider: chart, animator: animator, viewPortHandler: viewPortHandler)) + } + break + + case .line: + if chart.lineData !== nil + { + _renderers.append(LineChartRenderer(dataProvider: chart, animator: animator, viewPortHandler: viewPortHandler)) + } + break + + case .candle: + if chart.candleData !== nil + { + _renderers.append(CandleStickChartRenderer(dataProvider: chart, animator: animator, viewPortHandler: viewPortHandler)) + } + break + + case .scatter: + if chart.scatterData !== nil + { + _renderers.append(ScatterChartRenderer(dataProvider: chart, animator: animator, viewPortHandler: viewPortHandler)) + } + break + + case .bubble: + if chart.bubbleData !== nil + { + _renderers.append(BubbleChartRenderer(dataProvider: chart, animator: animator, viewPortHandler: viewPortHandler)) + } + break + } + } + + } + + open override func initBuffers() + { + _renderers.forEach { $0.initBuffers() } + } + + open override func drawData(context: CGContext) + { + // If we redraw the data, remove and repopulate accessible elements to update label values and frames + accessibleChartElements.removeAll() + + if + let combinedChart = chart, + let data = combinedChart.data { + // Make the chart header the first element in the accessible elements array + let element = createAccessibleHeader(usingChart: combinedChart, + andData: data, + withDefaultDescription: "Combined Chart") + accessibleChartElements.append(element) + } + + // TODO: Due to the potential complexity of data presented in Combined charts, a more usable way + // for VO accessibility would be to use axis based traversal rather than by dataset. + // Hence, accessibleChartElements is not populated below. (Individual renderers guard against dataSource being their respective views) + _renderers.forEach { $0.drawData(context: context) } + } + + open override func drawValues(context: CGContext) + { + _renderers.forEach { $0.drawValues(context: context) } + } + + open override func drawExtras(context: CGContext) + { + _renderers.forEach { $0.drawExtras(context: context) } + } + + open override func drawHighlighted(context: CGContext, indices: [Highlight]) + { + for renderer in _renderers + { + var data: ChartData? + + if renderer is BarChartRenderer + { + data = (renderer as! BarChartRenderer).dataProvider?.barData + } + else if renderer is LineChartRenderer + { + data = (renderer as! LineChartRenderer).dataProvider?.lineData + } + else if renderer is CandleStickChartRenderer + { + data = (renderer as! CandleStickChartRenderer).dataProvider?.candleData + } + else if renderer is ScatterChartRenderer + { + data = (renderer as! ScatterChartRenderer).dataProvider?.scatterData + } + else if renderer is BubbleChartRenderer + { + data = (renderer as! BubbleChartRenderer).dataProvider?.bubbleData + } + + let dataIndex: Int? = { + guard let data = data else { return nil } + return (chart?.data as? CombinedChartData)? + .allData + .firstIndex(of: data) + }() + + let dataIndices = indices.filter{ $0.dataIndex == dataIndex || $0.dataIndex == -1 } + + renderer.drawHighlighted(context: context, indices: dataIndices) + } + } + + /// - Returns: The sub-renderer object at the specified index. + @objc open func getSubRenderer(index: Int) -> DataRenderer? + { + if index >= _renderers.count || index < 0 + { + return nil + } + else + { + return _renderers[index] + } + } + + /// All sub-renderers. + @objc open var subRenderers: [DataRenderer] + { + get { return _renderers } + set { _renderers = newValue } + } + + // MARK: Accessors + + /// `true` if drawing values above bars is enabled, `false` ifnot + @objc open var isDrawValueAboveBarEnabled: Bool { return drawValueAboveBarEnabled } + + /// `true` if drawing shadows (maxvalue) for each bar is enabled, `false` ifnot + @objc open var isDrawBarShadowEnabled: Bool { return drawBarShadowEnabled } + + /// the order in which the provided data objects should be drawn. + /// The earlier you place them in the provided array, the further they will be in the background. + /// e.g. if you provide [DrawOrder.Bar, DrawOrder.Line], the bars will be drawn behind the lines. + open var drawOrder: [CombinedChartView.DrawOrder] + { + get + { + return _drawOrder + } + set + { + if newValue.count > 0 + { + _drawOrder = newValue + } + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift new file mode 100644 index 00000000000..309de7cf963 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/HorizontalBarChartRenderer.swift @@ -0,0 +1,624 @@ +// +// HorizontalBarChartRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class HorizontalBarChartRenderer: BarChartRenderer +{ + private class Buffer + { + var rects = [CGRect]() + } + + public override init(dataProvider: BarChartDataProvider, animator: Animator, viewPortHandler: ViewPortHandler) + { + super.init(dataProvider: dataProvider, animator: animator, viewPortHandler: viewPortHandler) + } + + // [CGRect] per dataset + private var _buffers = [Buffer]() + + open override func initBuffers() + { + if let barData = dataProvider?.barData + { + // Matche buffers count to dataset count + if _buffers.count != barData.dataSetCount + { + while _buffers.count < barData.dataSetCount + { + _buffers.append(Buffer()) + } + while _buffers.count > barData.dataSetCount + { + _buffers.removeLast() + } + } + + for i in stride(from: 0, to: barData.dataSetCount, by: 1) + { + let set = barData.dataSets[i] as! IBarChartDataSet + let size = set.entryCount * (set.isStacked ? set.stackSize : 1) + if _buffers[i].rects.count != size + { + _buffers[i].rects = [CGRect](repeating: CGRect(), count: size) + } + } + } + else + { + _buffers.removeAll() + } + } + + private func prepareBuffer(dataSet: IBarChartDataSet, index: Int) + { + guard let + dataProvider = dataProvider, + let barData = dataProvider.barData + else { return } + + let barWidthHalf = barData.barWidth / 2.0 + + let buffer = _buffers[index] + var bufferIndex = 0 + let containsStacks = dataSet.isStacked + + let isInverted = dataProvider.isInverted(axis: dataSet.axisDependency) + let phaseY = animator.phaseY + var barRect = CGRect() + var x: Double + var y: Double + + for i in stride(from: 0, to: min(Int(ceil(Double(dataSet.entryCount) * animator.phaseX)), dataSet.entryCount), by: 1) + { + guard let e = dataSet.entryForIndex(i) as? BarChartDataEntry else { continue } + + let vals = e.yValues + + x = e.x + y = e.y + + if !containsStacks || vals == nil + { + let bottom = CGFloat(x - barWidthHalf) + let top = CGFloat(x + barWidthHalf) + var right = isInverted + ? (y <= 0.0 ? CGFloat(y) : 0) + : (y >= 0.0 ? CGFloat(y) : 0) + var left = isInverted + ? (y >= 0.0 ? CGFloat(y) : 0) + : (y <= 0.0 ? CGFloat(y) : 0) + + // multiply the height of the rect with the phase + if right > 0 + { + right *= CGFloat(phaseY) + } + else + { + left *= CGFloat(phaseY) + } + + barRect.origin.x = left + barRect.size.width = right - left + barRect.origin.y = top + barRect.size.height = bottom - top + + buffer.rects[bufferIndex] = barRect + bufferIndex += 1 + } + else + { + var posY = 0.0 + var negY = -e.negativeSum + var yStart = 0.0 + + // fill the stack + for k in 0 ..< vals!.count + { + let value = vals![k] + + if value == 0.0 && (posY == 0.0 || negY == 0.0) + { + // Take care of the situation of a 0.0 value, which overlaps a non-zero bar + y = value + yStart = y + } + else if value >= 0.0 + { + y = posY + yStart = posY + value + posY = yStart + } + else + { + y = negY + yStart = negY + abs(value) + negY += abs(value) + } + + let bottom = CGFloat(x - barWidthHalf) + let top = CGFloat(x + barWidthHalf) + var right = isInverted + ? (y <= yStart ? CGFloat(y) : CGFloat(yStart)) + : (y >= yStart ? CGFloat(y) : CGFloat(yStart)) + var left = isInverted + ? (y >= yStart ? CGFloat(y) : CGFloat(yStart)) + : (y <= yStart ? CGFloat(y) : CGFloat(yStart)) + + // multiply the height of the rect with the phase + right *= CGFloat(phaseY) + left *= CGFloat(phaseY) + + barRect.origin.x = left + barRect.size.width = right - left + barRect.origin.y = top + barRect.size.height = bottom - top + + buffer.rects[bufferIndex] = barRect + bufferIndex += 1 + } + } + } + } + + private var _barShadowRectBuffer: CGRect = CGRect() + + open override func drawDataSet(context: CGContext, dataSet: IBarChartDataSet, index: Int) + { + guard let dataProvider = dataProvider else { return } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + + prepareBuffer(dataSet: dataSet, index: index) + trans.rectValuesToPixel(&_buffers[index].rects) + + let borderWidth = dataSet.barBorderWidth + let borderColor = dataSet.barBorderColor + let drawBorder = borderWidth > 0.0 + + context.saveGState() + + // draw the bar shadow before the values + if dataProvider.isDrawBarShadowEnabled + { + guard let barData = dataProvider.barData else { return } + + let barWidth = barData.barWidth + let barWidthHalf = barWidth / 2.0 + var x: Double = 0.0 + + for i in stride(from: 0, to: min(Int(ceil(Double(dataSet.entryCount) * animator.phaseX)), dataSet.entryCount), by: 1) + { + guard let e = dataSet.entryForIndex(i) as? BarChartDataEntry else { continue } + + x = e.x + + _barShadowRectBuffer.origin.y = CGFloat(x - barWidthHalf) + _barShadowRectBuffer.size.height = CGFloat(barWidth) + + trans.rectValueToPixel(&_barShadowRectBuffer) + + if !viewPortHandler.isInBoundsTop(_barShadowRectBuffer.origin.y + _barShadowRectBuffer.size.height) + { + break + } + + if !viewPortHandler.isInBoundsBottom(_barShadowRectBuffer.origin.y) + { + continue + } + + _barShadowRectBuffer.origin.x = viewPortHandler.contentLeft + _barShadowRectBuffer.size.width = viewPortHandler.contentWidth + + context.setFillColor(dataSet.barShadowColor.cgColor) + context.fill(_barShadowRectBuffer) + } + } + + let buffer = _buffers[index] + + let isSingleColor = dataSet.colors.count == 1 + + if isSingleColor + { + context.setFillColor(dataSet.color(atIndex: 0).cgColor) + } + + // In case the chart is stacked, we need to accomodate individual bars within accessibilityOrdereredElements + let isStacked = dataSet.isStacked + let stackSize = isStacked ? dataSet.stackSize : 1 + + for j in stride(from: 0, to: buffer.rects.count, by: 1) + { + let barRect = buffer.rects[j] + + if (!viewPortHandler.isInBoundsTop(barRect.origin.y + barRect.size.height)) + { + break + } + + if (!viewPortHandler.isInBoundsBottom(barRect.origin.y)) + { + continue + } + + if !isSingleColor + { + // Set the color for the currently drawn value. If the index is out of bounds, reuse colors. + context.setFillColor(dataSet.color(atIndex: j).cgColor) + } + + context.fill(barRect) + + if drawBorder + { + context.setStrokeColor(borderColor.cgColor) + context.setLineWidth(borderWidth) + context.stroke(barRect) + } + + // Create and append the corresponding accessibility element to accessibilityOrderedElements (see BarChartRenderer) + if let chart = dataProvider as? BarChartView + { + let element = createAccessibleElement(withIndex: j, + container: chart, + dataSet: dataSet, + dataSetIndex: index, + stackSize: stackSize) + { (element) in + element.accessibilityFrame = barRect + } + + accessibilityOrderedElements[j/stackSize].append(element) + } + } + + context.restoreGState() + } + + open override func prepareBarHighlight( + x: Double, + y1: Double, + y2: Double, + barWidthHalf: Double, + trans: Transformer, + rect: inout CGRect) + { + let top = x - barWidthHalf + let bottom = x + barWidthHalf + let left = y1 + let right = y2 + + rect.origin.x = CGFloat(left) + rect.origin.y = CGFloat(top) + rect.size.width = CGFloat(right - left) + rect.size.height = CGFloat(bottom - top) + + trans.rectValueToPixelHorizontal(&rect, phaseY: animator.phaseY) + } + + open override func drawValues(context: CGContext) + { + // if values are drawn + if isDrawingValuesAllowed(dataProvider: dataProvider) + { + guard + let dataProvider = dataProvider, + let barData = dataProvider.barData + else { return } + + var dataSets = barData.dataSets + + let textAlign = NSTextAlignment.left + + let valueOffsetPlus: CGFloat = 5.0 + var posOffset: CGFloat + var negOffset: CGFloat + let drawValueAboveBar = dataProvider.isDrawValueAboveBarEnabled + + for dataSetIndex in 0 ..< barData.dataSetCount + { + guard let + dataSet = dataSets[dataSetIndex] as? IBarChartDataSet, + shouldDrawValues(forDataSet: dataSet) + else { continue } + + let isInverted = dataProvider.isInverted(axis: dataSet.axisDependency) + + let valueFont = dataSet.valueFont + let yOffset = -valueFont.lineHeight / 2.0 + + guard let formatter = dataSet.valueFormatter else { continue } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + + let phaseY = animator.phaseY + + let iconsOffset = dataSet.iconsOffset + + let buffer = _buffers[dataSetIndex] + + // if only single values are drawn (sum) + if !dataSet.isStacked + { + for j in 0 ..< Int(ceil(Double(dataSet.entryCount) * animator.phaseX)) + { + guard let e = dataSet.entryForIndex(j) as? BarChartDataEntry else { continue } + + let rect = buffer.rects[j] + + let y = rect.origin.y + rect.size.height / 2.0 + + if !viewPortHandler.isInBoundsTop(rect.origin.y) + { + break + } + + if !viewPortHandler.isInBoundsX(rect.origin.x) + { + continue + } + + if !viewPortHandler.isInBoundsBottom(rect.origin.y) + { + continue + } + + let val = e.y + let valueText = formatter.stringForValue( + val, + entry: e, + dataSetIndex: dataSetIndex, + viewPortHandler: viewPortHandler) + + // calculate the correct offset depending on the draw position of the value + let valueTextWidth = valueText.size(withAttributes: [NSAttributedString.Key.font: valueFont]).width + posOffset = (drawValueAboveBar ? valueOffsetPlus : -(valueTextWidth + valueOffsetPlus)) + negOffset = (drawValueAboveBar ? -(valueTextWidth + valueOffsetPlus) : valueOffsetPlus) - rect.size.width + + if isInverted + { + posOffset = -posOffset - valueTextWidth + negOffset = -negOffset - valueTextWidth + } + + if dataSet.isDrawValuesEnabled + { + drawValue( + context: context, + value: valueText, + xPos: (rect.origin.x + rect.size.width) + + (val >= 0.0 ? posOffset : negOffset), + yPos: y + yOffset, + font: valueFont, + align: textAlign, + color: dataSet.valueTextColorAt(j)) + } + + if let icon = e.icon, dataSet.isDrawIconsEnabled + { + var px = (rect.origin.x + rect.size.width) + + (val >= 0.0 ? posOffset : negOffset) + var py = y + + px += iconsOffset.x + py += iconsOffset.y + + ChartUtils.drawImage( + context: context, + image: icon, + x: px, + y: py, + size: icon.size) + } + } + } + else + { + // if each value of a potential stack should be drawn + + var bufferIndex = 0 + + for index in 0 ..< Int(ceil(Double(dataSet.entryCount) * animator.phaseX)) + { + guard let e = dataSet.entryForIndex(index) as? BarChartDataEntry else { continue } + + let rect = buffer.rects[bufferIndex] + + let vals = e.yValues + + // we still draw stacked bars, but there is one non-stacked in between + if vals == nil + { + if !viewPortHandler.isInBoundsTop(rect.origin.y) + { + break + } + + if !viewPortHandler.isInBoundsX(rect.origin.x) + { + continue + } + + if !viewPortHandler.isInBoundsBottom(rect.origin.y) + { + continue + } + + let val = e.y + let valueText = formatter.stringForValue( + val, + entry: e, + dataSetIndex: dataSetIndex, + viewPortHandler: viewPortHandler) + + // calculate the correct offset depending on the draw position of the value + let valueTextWidth = valueText.size(withAttributes: [NSAttributedString.Key.font: valueFont]).width + posOffset = (drawValueAboveBar ? valueOffsetPlus : -(valueTextWidth + valueOffsetPlus)) + negOffset = (drawValueAboveBar ? -(valueTextWidth + valueOffsetPlus) : valueOffsetPlus) + + if isInverted + { + posOffset = -posOffset - valueTextWidth + negOffset = -negOffset - valueTextWidth + } + + if dataSet.isDrawValuesEnabled + { + drawValue( + context: context, + value: valueText, + xPos: (rect.origin.x + rect.size.width) + + (val >= 0.0 ? posOffset : negOffset), + yPos: rect.origin.y + yOffset, + font: valueFont, + align: textAlign, + color: dataSet.valueTextColorAt(index)) + } + + if let icon = e.icon, dataSet.isDrawIconsEnabled + { + var px = (rect.origin.x + rect.size.width) + + (val >= 0.0 ? posOffset : negOffset) + var py = rect.origin.y + + px += iconsOffset.x + py += iconsOffset.y + + ChartUtils.drawImage( + context: context, + image: icon, + x: px, + y: py, + size: icon.size) + } + } + else + { + let vals = vals! + var transformed = [CGPoint]() + + var posY = 0.0 + var negY = -e.negativeSum + + for k in 0 ..< vals.count + { + let value = vals[k] + var y: Double + + if value == 0.0 && (posY == 0.0 || negY == 0.0) + { + // Take care of the situation of a 0.0 value, which overlaps a non-zero bar + y = value + } + else if value >= 0.0 + { + posY += value + y = posY + } + else + { + y = negY + negY -= value + } + + transformed.append(CGPoint(x: CGFloat(y * phaseY), y: 0.0)) + } + + trans.pointValuesToPixel(&transformed) + + for k in 0 ..< transformed.count + { + let val = vals[k] + let valueText = formatter.stringForValue( + val, + entry: e, + dataSetIndex: dataSetIndex, + viewPortHandler: viewPortHandler) + + // calculate the correct offset depending on the draw position of the value + let valueTextWidth = valueText.size(withAttributes: [NSAttributedString.Key.font: valueFont]).width + posOffset = (drawValueAboveBar ? valueOffsetPlus : -(valueTextWidth + valueOffsetPlus)) + negOffset = (drawValueAboveBar ? -(valueTextWidth + valueOffsetPlus) : valueOffsetPlus) + + if isInverted + { + posOffset = -posOffset - valueTextWidth + negOffset = -negOffset - valueTextWidth + } + + let drawBelow = (val == 0.0 && negY == 0.0 && posY > 0.0) || val < 0.0 + + let x = transformed[k].x + (drawBelow ? negOffset : posOffset) + let y = rect.origin.y + rect.size.height / 2.0 + + if (!viewPortHandler.isInBoundsTop(y)) + { + break + } + + if (!viewPortHandler.isInBoundsX(x)) + { + continue + } + + if (!viewPortHandler.isInBoundsBottom(y)) + { + continue + } + + if dataSet.isDrawValuesEnabled + { + drawValue(context: context, + value: valueText, + xPos: x, + yPos: y + yOffset, + font: valueFont, + align: textAlign, + color: dataSet.valueTextColorAt(index)) + } + + if let icon = e.icon, dataSet.isDrawIconsEnabled + { + ChartUtils.drawImage( + context: context, + image: icon, + x: x + iconsOffset.x, + y: y + iconsOffset.y, + size: icon.size) + } + } + } + + bufferIndex = vals == nil ? (bufferIndex + 1) : (bufferIndex + vals!.count) + } + } + } + } + } + + open override func isDrawingValuesAllowed(dataProvider: ChartDataProvider?) -> Bool + { + guard let data = dataProvider?.data + else { return false } + return data.entryCount < Int(CGFloat(dataProvider?.maxVisibleCount ?? 0) * self.viewPortHandler.scaleY) + } + + /// Sets the drawing position of the highlight object based on the riven bar-rect. + internal override func setHighlightDrawPos(highlight high: Highlight, barRect: CGRect) + { + high.setDraw(x: barRect.midY, y: barRect.origin.x + barRect.size.width) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/LegendRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/LegendRenderer.swift new file mode 100755 index 00000000000..f0b01d093a6 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/LegendRenderer.swift @@ -0,0 +1,575 @@ +// +// LegendRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartLegendRenderer) +open class LegendRenderer: Renderer +{ + /// the legend object this renderer renders + @objc open var legend: Legend? + + @objc public init(viewPortHandler: ViewPortHandler, legend: Legend?) + { + super.init(viewPortHandler: viewPortHandler) + + self.legend = legend + } + + /// Prepares the legend and calculates all needed forms, labels and colors. + @objc open func computeLegend(data: ChartData) + { + guard let legend = legend else { return } + + if !legend.isLegendCustom + { + var entries: [LegendEntry] = [] + + // loop for building up the colors and labels used in the legend + for i in 0.. 0 && minEntries > 0) { + let labelIndex = j % minEntries + label = sLabels.indices.contains(labelIndex) ? sLabels[labelIndex] : nil + } else { + label = nil + } + + entries.append( + LegendEntry( + label: label, + form: dataSet.form, + formSize: dataSet.formSize, + formLineWidth: dataSet.formLineWidth, + formLineDashPhase: dataSet.formLineDashPhase, + formLineDashLengths: dataSet.formLineDashLengths, + formColor: clrs[j] + ) + ) + } + + if dataSet.label != nil + { + // add the legend description label + + entries.append( + LegendEntry( + label: dataSet.label, + form: .none, + formSize: CGFloat.nan, + formLineWidth: CGFloat.nan, + formLineDashPhase: 0.0, + formLineDashLengths: nil, + formColor: nil + ) + ) + } + } + else if dataSet is IPieChartDataSet + { + let pds = dataSet as! IPieChartDataSet + + for j in 0.. 0 + { + context.setLineDash(phase: formLineDashPhase, lengths: formLineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + context.setStrokeColor(formColor.cgColor) + + _formLineSegmentsBuffer[0].x = x + _formLineSegmentsBuffer[0].y = y + _formLineSegmentsBuffer[1].x = x + formSize + _formLineSegmentsBuffer[1].y = y + context.strokeLineSegments(between: _formLineSegmentsBuffer) + } + } + + /// Draws the provided label at the given position. + @objc open func drawLabel(context: CGContext, x: CGFloat, y: CGFloat, label: String, font: NSUIFont, textColor: NSUIColor) + { + ChartUtils.drawText(context: context, text: label, point: CGPoint(x: x, y: y), align: .left, attributes: [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: textColor]) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/LineChartRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/LineChartRenderer.swift new file mode 100644 index 00000000000..eedd92de918 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/LineChartRenderer.swift @@ -0,0 +1,781 @@ +// +// LineChartRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class LineChartRenderer: LineRadarRenderer +{ + // TODO: Currently, this nesting isn't necessary for LineCharts. However, it will make it much easier to add a custom rotor + // that navigates between datasets. + // NOTE: Unlike the other renderers, LineChartRenderer populates accessibleChartElements in drawCircles due to the nature of its drawing options. + /// A nested array of elements ordered logically (i.e not in visual/drawing order) for use with VoiceOver. + private lazy var accessibilityOrderedElements: [[NSUIAccessibilityElement]] = accessibilityCreateEmptyOrderedElements() + + @objc open weak var dataProvider: LineChartDataProvider? + + @objc public init(dataProvider: LineChartDataProvider, animator: Animator, viewPortHandler: ViewPortHandler) + { + super.init(animator: animator, viewPortHandler: viewPortHandler) + + self.dataProvider = dataProvider + } + + open override func drawData(context: CGContext) + { + guard let lineData = dataProvider?.lineData else { return } + + for i in 0 ..< lineData.dataSetCount + { + guard let set = lineData.getDataSetByIndex(i) else { continue } + + if set.isVisible + { + if !(set is ILineChartDataSet) + { + fatalError("Datasets for LineChartRenderer must conform to ILineChartDataSet") + } + + drawDataSet(context: context, dataSet: set as! ILineChartDataSet) + } + } + } + + @objc open func drawDataSet(context: CGContext, dataSet: ILineChartDataSet) + { + if dataSet.entryCount < 1 + { + return + } + + context.saveGState() + + context.setLineWidth(dataSet.lineWidth) + if dataSet.lineDashLengths != nil + { + context.setLineDash(phase: dataSet.lineDashPhase, lengths: dataSet.lineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + context.setLineCap(dataSet.lineCapType) + + // if drawing cubic lines is enabled + switch dataSet.mode + { + case .linear: fallthrough + case .stepped: + drawLinear(context: context, dataSet: dataSet) + + case .cubicBezier: + drawCubicBezier(context: context, dataSet: dataSet) + + case .horizontalBezier: + drawHorizontalBezier(context: context, dataSet: dataSet) + } + + context.restoreGState() + } + + @objc open func drawCubicBezier(context: CGContext, dataSet: ILineChartDataSet) + { + guard let dataProvider = dataProvider else { return } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + + let phaseY = animator.phaseY + + _xBounds.set(chart: dataProvider, dataSet: dataSet, animator: animator) + + // get the color that is specified for this position from the DataSet + let drawingColor = dataSet.colors.first! + + let intensity = dataSet.cubicIntensity + + // the path for the cubic-spline + let cubicPath = CGMutablePath() + + let valueToPixelMatrix = trans.valueToPixelMatrix + + if _xBounds.range >= 1 + { + var prevDx: CGFloat = 0.0 + var prevDy: CGFloat = 0.0 + var curDx: CGFloat = 0.0 + var curDy: CGFloat = 0.0 + + // Take an extra point from the left, and an extra from the right. + // That's because we need 4 points for a cubic bezier (cubic=4), otherwise we get lines moving and doing weird stuff on the edges of the chart. + // So in the starting `prev` and `cur`, go -2, -1 + // And in the `lastIndex`, add +1 + + let firstIndex = _xBounds.min + 1 + let lastIndex = _xBounds.min + _xBounds.range + + var prevPrev: ChartDataEntry! = nil + var prev: ChartDataEntry! = dataSet.entryForIndex(max(firstIndex - 2, 0)) + var cur: ChartDataEntry! = dataSet.entryForIndex(max(firstIndex - 1, 0)) + var next: ChartDataEntry! = cur + var nextIndex: Int = -1 + + if cur == nil { return } + + // let the spline start + cubicPath.move(to: CGPoint(x: CGFloat(cur.x), y: CGFloat(cur.y * phaseY)), transform: valueToPixelMatrix) + + for j in stride(from: firstIndex, through: lastIndex, by: 1) + { + prevPrev = prev + prev = cur + cur = nextIndex == j ? next : dataSet.entryForIndex(j) + + nextIndex = j + 1 < dataSet.entryCount ? j + 1 : j + next = dataSet.entryForIndex(nextIndex) + + if next == nil { break } + + prevDx = CGFloat(cur.x - prevPrev.x) * intensity + prevDy = CGFloat(cur.y - prevPrev.y) * intensity + curDx = CGFloat(next.x - prev.x) * intensity + curDy = CGFloat(next.y - prev.y) * intensity + + cubicPath.addCurve( + to: CGPoint( + x: CGFloat(cur.x), + y: CGFloat(cur.y) * CGFloat(phaseY)), + control1: CGPoint( + x: CGFloat(prev.x) + prevDx, + y: (CGFloat(prev.y) + prevDy) * CGFloat(phaseY)), + control2: CGPoint( + x: CGFloat(cur.x) - curDx, + y: (CGFloat(cur.y) - curDy) * CGFloat(phaseY)), + transform: valueToPixelMatrix) + } + } + + context.saveGState() + + if dataSet.isDrawFilledEnabled + { + // Copy this path because we make changes to it + let fillPath = cubicPath.mutableCopy() + + drawCubicFill(context: context, dataSet: dataSet, spline: fillPath!, matrix: valueToPixelMatrix, bounds: _xBounds) + } + + context.beginPath() + context.addPath(cubicPath) + context.setStrokeColor(drawingColor.cgColor) + context.strokePath() + + context.restoreGState() + } + + @objc open func drawHorizontalBezier(context: CGContext, dataSet: ILineChartDataSet) + { + guard let dataProvider = dataProvider else { return } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + + let phaseY = animator.phaseY + + _xBounds.set(chart: dataProvider, dataSet: dataSet, animator: animator) + + // get the color that is specified for this position from the DataSet + let drawingColor = dataSet.colors.first! + + // the path for the cubic-spline + let cubicPath = CGMutablePath() + + let valueToPixelMatrix = trans.valueToPixelMatrix + + if _xBounds.range >= 1 + { + var prev: ChartDataEntry! = dataSet.entryForIndex(_xBounds.min) + var cur: ChartDataEntry! = prev + + if cur == nil { return } + + // let the spline start + cubicPath.move(to: CGPoint(x: CGFloat(cur.x), y: CGFloat(cur.y * phaseY)), transform: valueToPixelMatrix) + + for j in _xBounds.dropFirst() + { + prev = cur + cur = dataSet.entryForIndex(j) + + let cpx = CGFloat(prev.x + (cur.x - prev.x) / 2.0) + + cubicPath.addCurve( + to: CGPoint( + x: CGFloat(cur.x), + y: CGFloat(cur.y * phaseY)), + control1: CGPoint( + x: cpx, + y: CGFloat(prev.y * phaseY)), + control2: CGPoint( + x: cpx, + y: CGFloat(cur.y * phaseY)), + transform: valueToPixelMatrix) + } + } + + context.saveGState() + + if dataSet.isDrawFilledEnabled + { + // Copy this path because we make changes to it + let fillPath = cubicPath.mutableCopy() + + drawCubicFill(context: context, dataSet: dataSet, spline: fillPath!, matrix: valueToPixelMatrix, bounds: _xBounds) + } + + context.beginPath() + context.addPath(cubicPath) + context.setStrokeColor(drawingColor.cgColor) + context.strokePath() + + context.restoreGState() + } + + open func drawCubicFill( + context: CGContext, + dataSet: ILineChartDataSet, + spline: CGMutablePath, + matrix: CGAffineTransform, + bounds: XBounds) + { + guard + let dataProvider = dataProvider + else { return } + + if bounds.range <= 0 + { + return + } + + let fillMin = dataSet.fillFormatter?.getFillLinePosition(dataSet: dataSet, dataProvider: dataProvider) ?? 0.0 + + var pt1 = CGPoint(x: CGFloat(dataSet.entryForIndex(bounds.min + bounds.range)?.x ?? 0.0), y: fillMin) + var pt2 = CGPoint(x: CGFloat(dataSet.entryForIndex(bounds.min)?.x ?? 0.0), y: fillMin) + pt1 = pt1.applying(matrix) + pt2 = pt2.applying(matrix) + + spline.addLine(to: pt1) + spline.addLine(to: pt2) + spline.closeSubpath() + + if dataSet.fill != nil + { + drawFilledPath(context: context, path: spline, fill: dataSet.fill!, fillAlpha: dataSet.fillAlpha) + } + else + { + drawFilledPath(context: context, path: spline, fillColor: dataSet.fillColor, fillAlpha: dataSet.fillAlpha) + } + } + + private var _lineSegments = [CGPoint](repeating: CGPoint(), count: 2) + + @objc open func drawLinear(context: CGContext, dataSet: ILineChartDataSet) + { + guard let dataProvider = dataProvider else { return } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + + let valueToPixelMatrix = trans.valueToPixelMatrix + + let entryCount = dataSet.entryCount + let isDrawSteppedEnabled = dataSet.mode == .stepped + let pointsPerEntryPair = isDrawSteppedEnabled ? 4 : 2 + + let phaseY = animator.phaseY + + _xBounds.set(chart: dataProvider, dataSet: dataSet, animator: animator) + + // if drawing filled is enabled + if dataSet.isDrawFilledEnabled && entryCount > 0 + { + drawLinearFill(context: context, dataSet: dataSet, trans: trans, bounds: _xBounds) + } + + context.saveGState() + + if _lineSegments.count != pointsPerEntryPair + { + // Allocate once in correct size + _lineSegments = [CGPoint](repeating: CGPoint(), count: pointsPerEntryPair) + } + + for j in stride(from: _xBounds.min, through: _xBounds.range + _xBounds.min, by: 1) + { + var e: ChartDataEntry! = dataSet.entryForIndex(j) + + if e == nil { continue } + + _lineSegments[0].x = CGFloat(e.x) + _lineSegments[0].y = CGFloat(e.y * phaseY) + + if j < _xBounds.max + { + e = dataSet.entryForIndex(j + 1) + + if e == nil { break } + + if isDrawSteppedEnabled + { + _lineSegments[1] = CGPoint(x: CGFloat(e.x), y: _lineSegments[0].y) + _lineSegments[2] = _lineSegments[1] + _lineSegments[3] = CGPoint(x: CGFloat(e.x), y: CGFloat(e.y * phaseY)) + } + else + { + _lineSegments[1] = CGPoint(x: CGFloat(e.x), y: CGFloat(e.y * phaseY)) + } + } + else + { + _lineSegments[1] = _lineSegments[0] + } + + for i in 0..<_lineSegments.count + { + _lineSegments[i] = _lineSegments[i].applying(valueToPixelMatrix) + } + + if (!viewPortHandler.isInBoundsRight(_lineSegments[0].x)) + { + break + } + + // make sure the lines don't do shitty things outside bounds + if !viewPortHandler.isInBoundsLeft(_lineSegments[1].x) + || (!viewPortHandler.isInBoundsTop(_lineSegments[0].y) && !viewPortHandler.isInBoundsBottom(_lineSegments[1].y)) + { + continue + } + + // get the color that is set for this line-segment + context.setStrokeColor(dataSet.color(atIndex: j).cgColor) + context.strokeLineSegments(between: _lineSegments) + } + + context.restoreGState() + } + + open func drawLinearFill(context: CGContext, dataSet: ILineChartDataSet, trans: Transformer, bounds: XBounds) + { + guard let dataProvider = dataProvider else { return } + + let filled = generateFilledPath( + dataSet: dataSet, + fillMin: dataSet.fillFormatter?.getFillLinePosition(dataSet: dataSet, dataProvider: dataProvider) ?? 0.0, + bounds: bounds, + matrix: trans.valueToPixelMatrix) + + if dataSet.fill != nil + { + drawFilledPath(context: context, path: filled, fill: dataSet.fill!, fillAlpha: dataSet.fillAlpha) + } + else + { + drawFilledPath(context: context, path: filled, fillColor: dataSet.fillColor, fillAlpha: dataSet.fillAlpha) + } + } + + /// Generates the path that is used for filled drawing. + private func generateFilledPath(dataSet: ILineChartDataSet, fillMin: CGFloat, bounds: XBounds, matrix: CGAffineTransform) -> CGPath + { + let phaseY = animator.phaseY + let isDrawSteppedEnabled = dataSet.mode == .stepped + let matrix = matrix + + var e: ChartDataEntry! + + let filled = CGMutablePath() + + e = dataSet.entryForIndex(bounds.min) + if e != nil + { + filled.move(to: CGPoint(x: CGFloat(e.x), y: fillMin), transform: matrix) + filled.addLine(to: CGPoint(x: CGFloat(e.x), y: CGFloat(e.y * phaseY)), transform: matrix) + } + + // create a new path + for x in stride(from: (bounds.min + 1), through: bounds.range + bounds.min, by: 1) + { + guard let e = dataSet.entryForIndex(x) else { continue } + + if isDrawSteppedEnabled + { + guard let ePrev = dataSet.entryForIndex(x-1) else { continue } + filled.addLine(to: CGPoint(x: CGFloat(e.x), y: CGFloat(ePrev.y * phaseY)), transform: matrix) + } + + filled.addLine(to: CGPoint(x: CGFloat(e.x), y: CGFloat(e.y * phaseY)), transform: matrix) + } + + // close up + e = dataSet.entryForIndex(bounds.range + bounds.min) + if e != nil + { + filled.addLine(to: CGPoint(x: CGFloat(e.x), y: fillMin), transform: matrix) + } + filled.closeSubpath() + + return filled + } + + open override func drawValues(context: CGContext) + { + guard + let dataProvider = dataProvider, + let lineData = dataProvider.lineData + else { return } + + if isDrawingValuesAllowed(dataProvider: dataProvider) + { + var dataSets = lineData.dataSets + + let phaseY = animator.phaseY + + var pt = CGPoint() + + for i in 0 ..< dataSets.count + { + guard let + dataSet = dataSets[i] as? ILineChartDataSet, + shouldDrawValues(forDataSet: dataSet) + else { continue } + + let valueFont = dataSet.valueFont + + guard let formatter = dataSet.valueFormatter else { continue } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + let valueToPixelMatrix = trans.valueToPixelMatrix + + let iconsOffset = dataSet.iconsOffset + + // make sure the values do not interfear with the circles + var valOffset = Int(dataSet.circleRadius * 1.75) + + if !dataSet.isDrawCirclesEnabled + { + valOffset = valOffset / 2 + } + + _xBounds.set(chart: dataProvider, dataSet: dataSet, animator: animator) + + for j in _xBounds + { + guard let e = dataSet.entryForIndex(j) else { break } + + pt.x = CGFloat(e.x) + pt.y = CGFloat(e.y * phaseY) + pt = pt.applying(valueToPixelMatrix) + + if (!viewPortHandler.isInBoundsRight(pt.x)) + { + break + } + + if (!viewPortHandler.isInBoundsLeft(pt.x) || !viewPortHandler.isInBoundsY(pt.y)) + { + continue + } + + if dataSet.isDrawValuesEnabled { + ChartUtils.drawText( + context: context, + text: formatter.stringForValue( + e.y, + entry: e, + dataSetIndex: i, + viewPortHandler: viewPortHandler), + point: CGPoint( + x: pt.x, + y: pt.y - CGFloat(valOffset) - valueFont.lineHeight), + align: .center, + attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: dataSet.valueTextColorAt(j)]) + } + + if let icon = e.icon, dataSet.isDrawIconsEnabled + { + ChartUtils.drawImage(context: context, + image: icon, + x: pt.x + iconsOffset.x, + y: pt.y + iconsOffset.y, + size: icon.size) + } + } + } + } + } + + open override func drawExtras(context: CGContext) + { + drawCircles(context: context) + } + + private func drawCircles(context: CGContext) + { + guard + let dataProvider = dataProvider, + let lineData = dataProvider.lineData + else { return } + + let phaseY = animator.phaseY + + let dataSets = lineData.dataSets + + var pt = CGPoint() + var rect = CGRect() + + // If we redraw the data, remove and repopulate accessible elements to update label values and frames + accessibleChartElements.removeAll() + accessibilityOrderedElements = accessibilityCreateEmptyOrderedElements() + + // Make the chart header the first element in the accessible elements array + if let chart = dataProvider as? LineChartView { + let element = createAccessibleHeader(usingChart: chart, + andData: lineData, + withDefaultDescription: "Line Chart") + accessibleChartElements.append(element) + } + + context.saveGState() + + for i in 0 ..< dataSets.count + { + guard let dataSet = lineData.getDataSetByIndex(i) as? ILineChartDataSet else { continue } + + if !dataSet.isVisible || dataSet.entryCount == 0 + { + continue + } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + let valueToPixelMatrix = trans.valueToPixelMatrix + + _xBounds.set(chart: dataProvider, dataSet: dataSet, animator: animator) + + let circleRadius = dataSet.circleRadius + let circleDiameter = circleRadius * 2.0 + let circleHoleRadius = dataSet.circleHoleRadius + let circleHoleDiameter = circleHoleRadius * 2.0 + + let drawCircleHole = dataSet.isDrawCircleHoleEnabled && + circleHoleRadius < circleRadius && + circleHoleRadius > 0.0 + let drawTransparentCircleHole = drawCircleHole && + (dataSet.circleHoleColor == nil || + dataSet.circleHoleColor == NSUIColor.clear) + + for j in _xBounds + { + guard let e = dataSet.entryForIndex(j) else { break } + + pt.x = CGFloat(e.x) + pt.y = CGFloat(e.y * phaseY) + pt = pt.applying(valueToPixelMatrix) + + if (!viewPortHandler.isInBoundsRight(pt.x)) + { + break + } + + // make sure the circles don't do shitty things outside bounds + if (!viewPortHandler.isInBoundsLeft(pt.x) || !viewPortHandler.isInBoundsY(pt.y)) + { + continue + } + + // Accessibility element geometry + let scaleFactor: CGFloat = 3 + let accessibilityRect = CGRect(x: pt.x - (scaleFactor * circleRadius), + y: pt.y - (scaleFactor * circleRadius), + width: scaleFactor * circleDiameter, + height: scaleFactor * circleDiameter) + // Create and append the corresponding accessibility element to accessibilityOrderedElements + if let chart = dataProvider as? LineChartView + { + let element = createAccessibleElement(withIndex: j, + container: chart, + dataSet: dataSet, + dataSetIndex: i) + { (element) in + element.accessibilityFrame = accessibilityRect + } + + accessibilityOrderedElements[i].append(element) + } + + if !dataSet.isDrawCirclesEnabled + { + continue + } + + context.setFillColor(dataSet.getCircleColor(atIndex: j)!.cgColor) + + rect.origin.x = pt.x - circleRadius + rect.origin.y = pt.y - circleRadius + rect.size.width = circleDiameter + rect.size.height = circleDiameter + + if drawTransparentCircleHole + { + // Begin path for circle with hole + context.beginPath() + context.addEllipse(in: rect) + + // Cut hole in path + rect.origin.x = pt.x - circleHoleRadius + rect.origin.y = pt.y - circleHoleRadius + rect.size.width = circleHoleDiameter + rect.size.height = circleHoleDiameter + context.addEllipse(in: rect) + + // Fill in-between + context.fillPath(using: .evenOdd) + } + else + { + context.fillEllipse(in: rect) + + if drawCircleHole + { + context.setFillColor(dataSet.circleHoleColor!.cgColor) + + // The hole rect + rect.origin.x = pt.x - circleHoleRadius + rect.origin.y = pt.y - circleHoleRadius + rect.size.width = circleHoleDiameter + rect.size.height = circleHoleDiameter + + context.fillEllipse(in: rect) + } + } + } + } + + context.restoreGState() + + // Merge nested ordered arrays into the single accessibleChartElements. + accessibleChartElements.append(contentsOf: accessibilityOrderedElements.flatMap { $0 } ) + accessibilityPostLayoutChangedNotification() + } + + open override func drawHighlighted(context: CGContext, indices: [Highlight]) + { + guard + let dataProvider = dataProvider, + let lineData = dataProvider.lineData + else { return } + + let chartXMax = dataProvider.chartXMax + + context.saveGState() + + for high in indices + { + guard let set = lineData.getDataSetByIndex(high.dataSetIndex) as? ILineChartDataSet + , set.isHighlightEnabled + else { continue } + + guard let e = set.entryForXValue(high.x, closestToY: high.y) else { continue } + + if !isInBoundsX(entry: e, dataSet: set) + { + continue + } + + context.setStrokeColor(set.highlightColor.cgColor) + context.setLineWidth(set.highlightLineWidth) + if set.highlightLineDashLengths != nil + { + context.setLineDash(phase: set.highlightLineDashPhase, lengths: set.highlightLineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + let x = high.x // get the x-position + let y = high.y * Double(animator.phaseY) + + if x > chartXMax * animator.phaseX + { + continue + } + + let trans = dataProvider.getTransformer(forAxis: set.axisDependency) + + let pt = trans.pixelForValues(x: x, y: y) + + high.setDraw(pt: pt) + + // draw the lines + drawHighlightLines(context: context, point: pt, set: set) + } + + context.restoreGState() + } + + /// Creates a nested array of empty subarrays each of which will be populated with NSUIAccessibilityElements. + /// This is marked internal to support HorizontalBarChartRenderer as well. + private func accessibilityCreateEmptyOrderedElements() -> [[NSUIAccessibilityElement]] + { + guard let chart = dataProvider as? LineChartView else { return [] } + + let dataSetCount = chart.lineData?.dataSetCount ?? 0 + + return Array(repeating: [NSUIAccessibilityElement](), + count: dataSetCount) + } + + /// Creates an NSUIAccessibleElement representing the smallest meaningful bar of the chart + /// i.e. in case of a stacked chart, this returns each stack, not the combined bar. + /// Note that it is marked internal to support subclass modification in the HorizontalBarChart. + private func createAccessibleElement(withIndex idx: Int, + container: LineChartView, + dataSet: ILineChartDataSet, + dataSetIndex: Int, + modifier: (NSUIAccessibilityElement) -> ()) -> NSUIAccessibilityElement + { + let element = NSUIAccessibilityElement(accessibilityContainer: container) + let xAxis = container.xAxis + + guard let e = dataSet.entryForIndex(idx) else { return element } + guard let dataProvider = dataProvider else { return element } + + // NOTE: The formatter can cause issues when the x-axis labels are consecutive ints. + // i.e. due to the Double conversion, if there are more than one data set that are grouped, + // there is the possibility of some labels being rounded up. A floor() might fix this, but seems to be a brute force solution. + let label = xAxis.valueFormatter?.stringForValue(e.x, axis: xAxis) ?? "\(e.x)" + + let elementValueText = dataSet.valueFormatter?.stringForValue(e.y, + entry: e, + dataSetIndex: dataSetIndex, + viewPortHandler: viewPortHandler) ?? "\(e.y)" + + let dataSetCount = dataProvider.lineData?.dataSetCount ?? -1 + let doesContainMultipleDataSets = dataSetCount > 1 + + element.accessibilityLabel = "\(doesContainMultipleDataSets ? (dataSet.label ?? "") + ", " : "") \(label): \(elementValueText)" + + modifier(element) + + return element + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/LineRadarRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/LineRadarRenderer.swift new file mode 100644 index 00000000000..6b028250533 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/LineRadarRenderer.swift @@ -0,0 +1,54 @@ +// +// LineRadarRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(LineRadarChartRenderer) +open class LineRadarRenderer: LineScatterCandleRadarRenderer +{ + public override init(animator: Animator, viewPortHandler: ViewPortHandler) + { + super.init(animator: animator, viewPortHandler: viewPortHandler) + } + + /// Draws the provided path in filled mode with the provided drawable. + @objc open func drawFilledPath(context: CGContext, path: CGPath, fill: Fill, fillAlpha: CGFloat) + { + + context.saveGState() + context.beginPath() + context.addPath(path) + + // filled is usually drawn with less alpha + context.setAlpha(fillAlpha) + + fill.fillPath(context: context, rect: viewPortHandler.contentRect) + + context.restoreGState() + } + + /// Draws the provided path in filled mode with the provided color and alpha. + @objc open func drawFilledPath(context: CGContext, path: CGPath, fillColor: NSUIColor, fillAlpha: CGFloat) + { + context.saveGState() + context.beginPath() + context.addPath(path) + + // filled is usually drawn with less alpha + context.setAlpha(fillAlpha) + + context.setFillColor(fillColor.cgColor) + context.fillPath() + + context.restoreGState() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift new file mode 100644 index 00000000000..05203caf9c3 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/LineScatterCandleRadarRenderer.swift @@ -0,0 +1,49 @@ +// +// LineScatterCandleRadarRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(LineScatterCandleRadarChartRenderer) +open class LineScatterCandleRadarRenderer: BarLineScatterCandleBubbleRenderer +{ + public override init(animator: Animator, viewPortHandler: ViewPortHandler) + { + super.init(animator: animator, viewPortHandler: viewPortHandler) + } + + /// Draws vertical & horizontal highlight-lines if enabled. + /// :param: context + /// :param: points + /// :param: horizontal + /// :param: vertical + @objc open func drawHighlightLines(context: CGContext, point: CGPoint, set: ILineScatterCandleRadarChartDataSet) + { + + // draw vertical highlight lines + if set.isVerticalHighlightIndicatorEnabled + { + context.beginPath() + context.move(to: CGPoint(x: point.x, y: viewPortHandler.contentTop)) + context.addLine(to: CGPoint(x: point.x, y: viewPortHandler.contentBottom)) + context.strokePath() + } + + // draw horizontal highlight lines + if set.isHorizontalHighlightIndicatorEnabled + { + context.beginPath() + context.move(to: CGPoint(x: viewPortHandler.contentLeft, y: point.y)) + context.addLine(to: CGPoint(x: viewPortHandler.contentRight, y: point.y)) + context.strokePath() + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/PieChartRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/PieChartRenderer.swift new file mode 100644 index 00000000000..c9716111dc6 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/PieChartRenderer.swift @@ -0,0 +1,929 @@ +// +// PieChartRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class PieChartRenderer: DataRenderer +{ + @objc open weak var chart: PieChartView? + + @objc public init(chart: PieChartView, animator: Animator, viewPortHandler: ViewPortHandler) + { + super.init(animator: animator, viewPortHandler: viewPortHandler) + + self.chart = chart + } + + open override func drawData(context: CGContext) + { + guard let chart = chart else { return } + + let pieData = chart.data + + if pieData != nil + { + // If we redraw the data, remove and repopulate accessible elements to update label values and frames + accessibleChartElements.removeAll() + + for set in pieData!.dataSets as! [IPieChartDataSet] + where set.isVisible && set.entryCount > 0 + { + drawDataSet(context: context, dataSet: set) + } + } + } + + @objc open func calculateMinimumRadiusForSpacedSlice( + center: CGPoint, + radius: CGFloat, + angle: CGFloat, + arcStartPointX: CGFloat, + arcStartPointY: CGFloat, + startAngle: CGFloat, + sweepAngle: CGFloat) -> CGFloat + { + let angleMiddle = startAngle + sweepAngle / 2.0 + + // Other point of the arc + let arcEndPointX = center.x + radius * cos((startAngle + sweepAngle).DEG2RAD) + let arcEndPointY = center.y + radius * sin((startAngle + sweepAngle).DEG2RAD) + + // Middle point on the arc + let arcMidPointX = center.x + radius * cos(angleMiddle.DEG2RAD) + let arcMidPointY = center.y + radius * sin(angleMiddle.DEG2RAD) + + // This is the base of the contained triangle + let basePointsDistance = sqrt( + pow(arcEndPointX - arcStartPointX, 2) + + pow(arcEndPointY - arcStartPointY, 2)) + + // After reducing space from both sides of the "slice", + // the angle of the contained triangle should stay the same. + // So let's find out the height of that triangle. + let containedTriangleHeight = (basePointsDistance / 2.0 * + tan((180.0 - angle).DEG2RAD / 2.0)) + + // Now we subtract that from the radius + var spacedRadius = radius - containedTriangleHeight + + // And now subtract the height of the arc that's between the triangle and the outer circle + spacedRadius -= sqrt( + pow(arcMidPointX - (arcEndPointX + arcStartPointX) / 2.0, 2) + + pow(arcMidPointY - (arcEndPointY + arcStartPointY) / 2.0, 2)) + + return spacedRadius + } + + /// Calculates the sliceSpace to use based on visible values and their size compared to the set sliceSpace. + @objc open func getSliceSpace(dataSet: IPieChartDataSet) -> CGFloat + { + guard + dataSet.automaticallyDisableSliceSpacing, + let data = chart?.data as? PieChartData + else { return dataSet.sliceSpace } + + let spaceSizeRatio = dataSet.sliceSpace / min(viewPortHandler.contentWidth, viewPortHandler.contentHeight) + let minValueRatio = dataSet.yMin / data.yValueSum * 2.0 + + let sliceSpace = spaceSizeRatio > CGFloat(minValueRatio) + ? 0.0 + : dataSet.sliceSpace + + return sliceSpace + } + + @objc open func drawDataSet(context: CGContext, dataSet: IPieChartDataSet) + { + guard let chart = chart else {return } + + var angle: CGFloat = 0.0 + let rotationAngle = chart.rotationAngle + + let phaseX = animator.phaseX + let phaseY = animator.phaseY + + let entryCount = dataSet.entryCount + var drawAngles = chart.drawAngles + let center = chart.centerCircleBox + let radius = chart.radius + let drawInnerArc = chart.drawHoleEnabled && !chart.drawSlicesUnderHoleEnabled + let userInnerRadius = drawInnerArc ? radius * chart.holeRadiusPercent : 0.0 + + var visibleAngleCount = 0 + for j in 0 ..< entryCount + { + guard let e = dataSet.entryForIndex(j) else { continue } + if ((abs(e.y) > Double.ulpOfOne)) + { + visibleAngleCount += 1 + } + } + + let sliceSpace = visibleAngleCount <= 1 ? 0.0 : getSliceSpace(dataSet: dataSet) + + context.saveGState() + + // Make the chart header the first element in the accessible elements array + // We can do this in drawDataSet, since we know PieChartView can have only 1 dataSet + // Also since there's only 1 dataset, we don't use the typical createAccessibleHeader() here. + // NOTE: - Since we want to summarize the total count of slices/portions/elements, use a default string here + // This is unlike when we are naming individual slices, wherein it's alright to not use a prefix as descriptor. + // i.e. We want to VO to say "3 Elements" even if the developer didn't specify an accessibility prefix + // If prefix is unspecified it is safe to assume they did not want to use "Element 1", so that uses a default empty string + let prefix: String = chart.data?.accessibilityEntryLabelPrefix ?? "Element" + let description = chart.chartDescription?.text ?? dataSet.label ?? chart.centerText ?? "Pie Chart" + + let + element = NSUIAccessibilityElement(accessibilityContainer: chart) + element.accessibilityLabel = description + ". \(entryCount) \(prefix + (entryCount == 1 ? "" : "s"))" + element.accessibilityFrame = chart.bounds + element.isHeader = true + accessibleChartElements.append(element) + + for j in 0 ..< entryCount + { + let sliceAngle = drawAngles[j] + var innerRadius = userInnerRadius + + guard let e = dataSet.entryForIndex(j) else { continue } + + // draw only if the value is greater than zero + if (abs(e.y) > Double.ulpOfOne) + { + if !chart.needsHighlight(index: j) + { + let accountForSliceSpacing = sliceSpace > 0.0 && sliceAngle <= 180.0 + + context.setFillColor(dataSet.color(atIndex: j).cgColor) + + let sliceSpaceAngleOuter = visibleAngleCount == 1 ? + 0.0 : + sliceSpace / radius.DEG2RAD + let startAngleOuter = rotationAngle + (angle + sliceSpaceAngleOuter / 2.0) * CGFloat(phaseY) + var sweepAngleOuter = (sliceAngle - sliceSpaceAngleOuter) * CGFloat(phaseY) + if sweepAngleOuter < 0.0 + { + sweepAngleOuter = 0.0 + } + + let arcStartPointX = center.x + radius * cos(startAngleOuter.DEG2RAD) + let arcStartPointY = center.y + radius * sin(startAngleOuter.DEG2RAD) + + let path = CGMutablePath() + + path.move(to: CGPoint(x: arcStartPointX, + y: arcStartPointY)) + + path.addRelativeArc(center: center, radius: radius, startAngle: startAngleOuter.DEG2RAD, delta: sweepAngleOuter.DEG2RAD) + + if drawInnerArc && + (innerRadius > 0.0 || accountForSliceSpacing) + { + if accountForSliceSpacing + { + var minSpacedRadius = calculateMinimumRadiusForSpacedSlice( + center: center, + radius: radius, + angle: sliceAngle * CGFloat(phaseY), + arcStartPointX: arcStartPointX, + arcStartPointY: arcStartPointY, + startAngle: startAngleOuter, + sweepAngle: sweepAngleOuter) + if minSpacedRadius < 0.0 + { + minSpacedRadius = -minSpacedRadius + } + innerRadius = min(max(innerRadius, minSpacedRadius), radius) + } + + let sliceSpaceAngleInner = visibleAngleCount == 1 || innerRadius == 0.0 ? + 0.0 : + sliceSpace / innerRadius.DEG2RAD + let startAngleInner = rotationAngle + (angle + sliceSpaceAngleInner / 2.0) * CGFloat(phaseY) + var sweepAngleInner = (sliceAngle - sliceSpaceAngleInner) * CGFloat(phaseY) + if sweepAngleInner < 0.0 + { + sweepAngleInner = 0.0 + } + let endAngleInner = startAngleInner + sweepAngleInner + + path.addLine( + to: CGPoint( + x: center.x + innerRadius * cos(endAngleInner.DEG2RAD), + y: center.y + innerRadius * sin(endAngleInner.DEG2RAD))) + + path.addRelativeArc(center: center, radius: innerRadius, startAngle: endAngleInner.DEG2RAD, delta: -sweepAngleInner.DEG2RAD) + } + else + { + if accountForSliceSpacing + { + let angleMiddle = startAngleOuter + sweepAngleOuter / 2.0 + + let sliceSpaceOffset = + calculateMinimumRadiusForSpacedSlice( + center: center, + radius: radius, + angle: sliceAngle * CGFloat(phaseY), + arcStartPointX: arcStartPointX, + arcStartPointY: arcStartPointY, + startAngle: startAngleOuter, + sweepAngle: sweepAngleOuter) + + let arcEndPointX = center.x + sliceSpaceOffset * cos(angleMiddle.DEG2RAD) + let arcEndPointY = center.y + sliceSpaceOffset * sin(angleMiddle.DEG2RAD) + + path.addLine( + to: CGPoint( + x: arcEndPointX, + y: arcEndPointY)) + } + else + { + path.addLine(to: center) + } + } + + path.closeSubpath() + + context.beginPath() + context.addPath(path) + context.fillPath(using: .evenOdd) + + let axElement = createAccessibleElement(withIndex: j, + container: chart, + dataSet: dataSet) + { (element) in + element.accessibilityFrame = path.boundingBoxOfPath + } + + accessibleChartElements.append(axElement) + } + } + + angle += sliceAngle * CGFloat(phaseX) + } + + // Post this notification to let VoiceOver account for the redrawn frames + accessibilityPostLayoutChangedNotification() + + context.restoreGState() + } + + open override func drawValues(context: CGContext) + { + guard + let chart = chart, + let data = chart.data + else { return } + + let center = chart.centerCircleBox + + // get whole the radius + let radius = chart.radius + let rotationAngle = chart.rotationAngle + var drawAngles = chart.drawAngles + var absoluteAngles = chart.absoluteAngles + + let phaseX = animator.phaseX + let phaseY = animator.phaseY + + var labelRadiusOffset = radius / 10.0 * 3.0 + + if chart.drawHoleEnabled + { + labelRadiusOffset = (radius - (radius * chart.holeRadiusPercent)) / 2.0 + } + + let labelRadius = radius - labelRadiusOffset + + var dataSets = data.dataSets + + let yValueSum = (data as! PieChartData).yValueSum + + let drawEntryLabels = chart.isDrawEntryLabelsEnabled + let usePercentValuesEnabled = chart.usePercentValuesEnabled + let entryLabelColor = chart.entryLabelColor + let entryLabelFont = chart.entryLabelFont + + var angle: CGFloat = 0.0 + var xIndex = 0 + + context.saveGState() + defer { context.restoreGState() } + + for i in 0 ..< dataSets.count + { + guard let dataSet = dataSets[i] as? IPieChartDataSet else { continue } + + let drawValues = dataSet.isDrawValuesEnabled + + if !drawValues && !drawEntryLabels && !dataSet.isDrawIconsEnabled + { + continue + } + + let iconsOffset = dataSet.iconsOffset + + let xValuePosition = dataSet.xValuePosition + let yValuePosition = dataSet.yValuePosition + + let valueFont = dataSet.valueFont + let entryLabelFont = dataSet.entryLabelFont + let lineHeight = valueFont.lineHeight + + guard let formatter = dataSet.valueFormatter else { continue } + + for j in 0 ..< dataSet.entryCount + { + guard let e = dataSet.entryForIndex(j) else { continue } + let pe = e as? PieChartDataEntry + + if xIndex == 0 + { + angle = 0.0 + } + else + { + angle = absoluteAngles[xIndex - 1] * CGFloat(phaseX) + } + + let sliceAngle = drawAngles[xIndex] + let sliceSpace = getSliceSpace(dataSet: dataSet) + let sliceSpaceMiddleAngle = sliceSpace / labelRadius.DEG2RAD + + // offset needed to center the drawn text in the slice + let angleOffset = (sliceAngle - sliceSpaceMiddleAngle / 2.0) / 2.0 + + angle = angle + angleOffset + + let transformedAngle = rotationAngle + angle * CGFloat(phaseY) + + let value = usePercentValuesEnabled ? e.y / yValueSum * 100.0 : e.y + let valueText = formatter.stringForValue( + value, + entry: e, + dataSetIndex: i, + viewPortHandler: viewPortHandler) + + let sliceXBase = cos(transformedAngle.DEG2RAD) + let sliceYBase = sin(transformedAngle.DEG2RAD) + + let drawXOutside = drawEntryLabels && xValuePosition == .outsideSlice + let drawYOutside = drawValues && yValuePosition == .outsideSlice + let drawXInside = drawEntryLabels && xValuePosition == .insideSlice + let drawYInside = drawValues && yValuePosition == .insideSlice + + let valueTextColor = dataSet.valueTextColorAt(j) + let entryLabelColor = dataSet.entryLabelColor + + if drawXOutside || drawYOutside + { + let valueLineLength1 = dataSet.valueLinePart1Length + let valueLineLength2 = dataSet.valueLinePart2Length + let valueLinePart1OffsetPercentage = dataSet.valueLinePart1OffsetPercentage + + var pt2: CGPoint + var labelPoint: CGPoint + var align: NSTextAlignment + + var line1Radius: CGFloat + + if chart.drawHoleEnabled + { + line1Radius = (radius - (radius * chart.holeRadiusPercent)) * valueLinePart1OffsetPercentage + (radius * chart.holeRadiusPercent) + } + else + { + line1Radius = radius * valueLinePart1OffsetPercentage + } + + let polyline2Length = dataSet.valueLineVariableLength + ? labelRadius * valueLineLength2 * abs(sin(transformedAngle.DEG2RAD)) + : labelRadius * valueLineLength2 + + let pt0 = CGPoint( + x: line1Radius * sliceXBase + center.x, + y: line1Radius * sliceYBase + center.y) + + let pt1 = CGPoint( + x: labelRadius * (1 + valueLineLength1) * sliceXBase + center.x, + y: labelRadius * (1 + valueLineLength1) * sliceYBase + center.y) + + if transformedAngle.truncatingRemainder(dividingBy: 360.0) >= 90.0 && transformedAngle.truncatingRemainder(dividingBy: 360.0) <= 270.0 + { + pt2 = CGPoint(x: pt1.x - polyline2Length, y: pt1.y) + align = .right + labelPoint = CGPoint(x: pt2.x - 5, y: pt2.y - lineHeight) + } + else + { + pt2 = CGPoint(x: pt1.x + polyline2Length, y: pt1.y) + align = .left + labelPoint = CGPoint(x: pt2.x + 5, y: pt2.y - lineHeight) + } + + DrawLine: do + { + if dataSet.useValueColorForLine + { + context.setStrokeColor(dataSet.color(atIndex: j).cgColor) + } + else if let valueLineColor = dataSet.valueLineColor + { + context.setStrokeColor(valueLineColor.cgColor) + } + else + { + return + } + context.setLineWidth(dataSet.valueLineWidth) + + context.move(to: CGPoint(x: pt0.x, y: pt0.y)) + context.addLine(to: CGPoint(x: pt1.x, y: pt1.y)) + context.addLine(to: CGPoint(x: pt2.x, y: pt2.y)) + + context.drawPath(using: CGPathDrawingMode.stroke) + } + + if drawXOutside && drawYOutside + { + ChartUtils.drawText( + context: context, + text: valueText, + point: labelPoint, + align: align, + attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: valueTextColor] + ) + + if j < data.entryCount && pe?.label != nil + { + ChartUtils.drawText( + context: context, + text: pe!.label!, + point: CGPoint(x: labelPoint.x, y: labelPoint.y + lineHeight), + align: align, + attributes: [ + NSAttributedString.Key.font: entryLabelFont ?? valueFont, + NSAttributedString.Key.foregroundColor: entryLabelColor ?? valueTextColor] + ) + } + } + else if drawXOutside + { + if j < data.entryCount && pe?.label != nil + { + ChartUtils.drawText( + context: context, + text: pe!.label!, + point: CGPoint(x: labelPoint.x, y: labelPoint.y + lineHeight / 2.0), + align: align, + attributes: [ + NSAttributedString.Key.font: entryLabelFont ?? valueFont, + NSAttributedString.Key.foregroundColor: entryLabelColor ?? valueTextColor] + ) + } + } + else if drawYOutside + { + ChartUtils.drawText( + context: context, + text: valueText, + point: CGPoint(x: labelPoint.x, y: labelPoint.y + lineHeight / 2.0), + align: align, + attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: valueTextColor] + ) + } + } + + if drawXInside || drawYInside + { + // calculate the text position + let x = labelRadius * sliceXBase + center.x + let y = labelRadius * sliceYBase + center.y - lineHeight + + if drawXInside && drawYInside + { + ChartUtils.drawText( + context: context, + text: valueText, + point: CGPoint(x: x, y: y), + align: .center, + attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: valueTextColor] + ) + + if j < data.entryCount && pe?.label != nil + { + ChartUtils.drawText( + context: context, + text: pe!.label!, + point: CGPoint(x: x, y: y + lineHeight), + align: .center, + attributes: [ + NSAttributedString.Key.font: entryLabelFont ?? valueFont, + NSAttributedString.Key.foregroundColor: entryLabelColor ?? valueTextColor] + ) + } + } + else if drawXInside + { + if j < data.entryCount && pe?.label != nil + { + ChartUtils.drawText( + context: context, + text: pe!.label!, + point: CGPoint(x: x, y: y + lineHeight / 2.0), + align: .center, + attributes: [ + NSAttributedString.Key.font: entryLabelFont ?? valueFont, + NSAttributedString.Key.foregroundColor: entryLabelColor ?? valueTextColor] + ) + } + } + else if drawYInside + { + ChartUtils.drawText( + context: context, + text: valueText, + point: CGPoint(x: x, y: y + lineHeight / 2.0), + align: .center, + attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: valueTextColor] + ) + } + } + + if let icon = e.icon, dataSet.isDrawIconsEnabled + { + // calculate the icon's position + + let x = (labelRadius + iconsOffset.y) * sliceXBase + center.x + var y = (labelRadius + iconsOffset.y) * sliceYBase + center.y + y += iconsOffset.x + + ChartUtils.drawImage(context: context, + image: icon, + x: x, + y: y, + size: icon.size) + } + + xIndex += 1 + } + } + } + + open override func drawExtras(context: CGContext) + { + drawHole(context: context) + drawCenterText(context: context) + } + + /// draws the hole in the center of the chart and the transparent circle / hole + private func drawHole(context: CGContext) + { + guard let chart = chart else { return } + + if chart.drawHoleEnabled + { + context.saveGState() + + let radius = chart.radius + let holeRadius = radius * chart.holeRadiusPercent + let center = chart.centerCircleBox + + if let holeColor = chart.holeColor + { + if holeColor != NSUIColor.clear + { + // draw the hole-circle + context.setFillColor(chart.holeColor!.cgColor) + context.fillEllipse(in: CGRect(x: center.x - holeRadius, y: center.y - holeRadius, width: holeRadius * 2.0, height: holeRadius * 2.0)) + } + } + + // only draw the circle if it can be seen (not covered by the hole) + if let transparentCircleColor = chart.transparentCircleColor + { + if transparentCircleColor != NSUIColor.clear && + chart.transparentCircleRadiusPercent > chart.holeRadiusPercent + { + let alpha = animator.phaseX * animator.phaseY + let secondHoleRadius = radius * chart.transparentCircleRadiusPercent + + // make transparent + context.setAlpha(CGFloat(alpha)) + context.setFillColor(transparentCircleColor.cgColor) + + // draw the transparent-circle + context.beginPath() + context.addEllipse(in: CGRect( + x: center.x - secondHoleRadius, + y: center.y - secondHoleRadius, + width: secondHoleRadius * 2.0, + height: secondHoleRadius * 2.0)) + context.addEllipse(in: CGRect( + x: center.x - holeRadius, + y: center.y - holeRadius, + width: holeRadius * 2.0, + height: holeRadius * 2.0)) + context.fillPath(using: .evenOdd) + } + } + + context.restoreGState() + } + } + + /// draws the description text in the center of the pie chart makes most sense when center-hole is enabled + private func drawCenterText(context: CGContext) + { + guard + let chart = chart, + let centerAttributedText = chart.centerAttributedText + else { return } + + if chart.drawCenterTextEnabled && centerAttributedText.length > 0 + { + let center = chart.centerCircleBox + let offset = chart.centerTextOffset + let innerRadius = chart.drawHoleEnabled && !chart.drawSlicesUnderHoleEnabled ? chart.radius * chart.holeRadiusPercent : chart.radius + + let x = center.x + offset.x + let y = center.y + offset.y + + let holeRect = CGRect( + x: x - innerRadius, + y: y - innerRadius, + width: innerRadius * 2.0, + height: innerRadius * 2.0) + var boundingRect = holeRect + + if chart.centerTextRadiusPercent > 0.0 + { + boundingRect = boundingRect.insetBy(dx: (boundingRect.width - boundingRect.width * chart.centerTextRadiusPercent) / 2.0, dy: (boundingRect.height - boundingRect.height * chart.centerTextRadiusPercent) / 2.0) + } + + let textBounds = centerAttributedText.boundingRect(with: boundingRect.size, options: [.usesLineFragmentOrigin, .usesFontLeading, .truncatesLastVisibleLine], context: nil) + + var drawingRect = boundingRect + drawingRect.origin.x += (boundingRect.size.width - textBounds.size.width) / 2.0 + drawingRect.origin.y += (boundingRect.size.height - textBounds.size.height) / 2.0 + drawingRect.size = textBounds.size + + context.saveGState() + + let clippingPath = CGPath(ellipseIn: holeRect, transform: nil) + context.beginPath() + context.addPath(clippingPath) + context.clip() + + centerAttributedText.draw(with: drawingRect, options: [.usesLineFragmentOrigin, .usesFontLeading, .truncatesLastVisibleLine], context: nil) + + context.restoreGState() + } + } + + open override func drawHighlighted(context: CGContext, indices: [Highlight]) + { + guard + let chart = chart, + let data = chart.data + else { return } + + context.saveGState() + + let phaseX = animator.phaseX + let phaseY = animator.phaseY + + var angle: CGFloat = 0.0 + let rotationAngle = chart.rotationAngle + + var drawAngles = chart.drawAngles + var absoluteAngles = chart.absoluteAngles + let center = chart.centerCircleBox + let radius = chart.radius + let drawInnerArc = chart.drawHoleEnabled && !chart.drawSlicesUnderHoleEnabled + let userInnerRadius = drawInnerArc ? radius * chart.holeRadiusPercent : 0.0 + + // Append highlighted accessibility slices into this array, so we can prioritize them over unselected slices + var highlightedAccessibleElements: [NSUIAccessibilityElement] = [] + + for i in 0 ..< indices.count + { + // get the index to highlight + let index = Int(indices[i].x) + if index >= drawAngles.count + { + continue + } + + guard let set = data.getDataSetByIndex(indices[i].dataSetIndex) as? IPieChartDataSet else { continue } + + if !set.isHighlightEnabled + { + continue + } + + let entryCount = set.entryCount + var visibleAngleCount = 0 + for j in 0 ..< entryCount + { + guard let e = set.entryForIndex(j) else { continue } + if ((abs(e.y) > Double.ulpOfOne)) + { + visibleAngleCount += 1 + } + } + + if index == 0 + { + angle = 0.0 + } + else + { + angle = absoluteAngles[index - 1] * CGFloat(phaseX) + } + + let sliceSpace = visibleAngleCount <= 1 ? 0.0 : set.sliceSpace + + let sliceAngle = drawAngles[index] + var innerRadius = userInnerRadius + + let shift = set.selectionShift + let highlightedRadius = radius + shift + + let accountForSliceSpacing = sliceSpace > 0.0 && sliceAngle <= 180.0 + + context.setFillColor(set.highlightColor?.cgColor ?? set.color(atIndex: index).cgColor) + + let sliceSpaceAngleOuter = visibleAngleCount == 1 ? + 0.0 : + sliceSpace / radius.DEG2RAD + + let sliceSpaceAngleShifted = visibleAngleCount == 1 ? + 0.0 : + sliceSpace / highlightedRadius.DEG2RAD + + let startAngleOuter = rotationAngle + (angle + sliceSpaceAngleOuter / 2.0) * CGFloat(phaseY) + var sweepAngleOuter = (sliceAngle - sliceSpaceAngleOuter) * CGFloat(phaseY) + if sweepAngleOuter < 0.0 + { + sweepAngleOuter = 0.0 + } + + let startAngleShifted = rotationAngle + (angle + sliceSpaceAngleShifted / 2.0) * CGFloat(phaseY) + var sweepAngleShifted = (sliceAngle - sliceSpaceAngleShifted) * CGFloat(phaseY) + if sweepAngleShifted < 0.0 + { + sweepAngleShifted = 0.0 + } + + let path = CGMutablePath() + + path.move(to: CGPoint(x: center.x + highlightedRadius * cos(startAngleShifted.DEG2RAD), + y: center.y + highlightedRadius * sin(startAngleShifted.DEG2RAD))) + + path.addRelativeArc(center: center, radius: highlightedRadius, startAngle: startAngleShifted.DEG2RAD, + delta: sweepAngleShifted.DEG2RAD) + + var sliceSpaceRadius: CGFloat = 0.0 + if accountForSliceSpacing + { + sliceSpaceRadius = calculateMinimumRadiusForSpacedSlice( + center: center, + radius: radius, + angle: sliceAngle * CGFloat(phaseY), + arcStartPointX: center.x + radius * cos(startAngleOuter.DEG2RAD), + arcStartPointY: center.y + radius * sin(startAngleOuter.DEG2RAD), + startAngle: startAngleOuter, + sweepAngle: sweepAngleOuter) + } + + if drawInnerArc && + (innerRadius > 0.0 || accountForSliceSpacing) + { + if accountForSliceSpacing + { + var minSpacedRadius = sliceSpaceRadius + if minSpacedRadius < 0.0 + { + minSpacedRadius = -minSpacedRadius + } + innerRadius = min(max(innerRadius, minSpacedRadius), radius) + } + + let sliceSpaceAngleInner = visibleAngleCount == 1 || innerRadius == 0.0 ? + 0.0 : + sliceSpace / innerRadius.DEG2RAD + let startAngleInner = rotationAngle + (angle + sliceSpaceAngleInner / 2.0) * CGFloat(phaseY) + var sweepAngleInner = (sliceAngle - sliceSpaceAngleInner) * CGFloat(phaseY) + if sweepAngleInner < 0.0 + { + sweepAngleInner = 0.0 + } + let endAngleInner = startAngleInner + sweepAngleInner + + path.addLine( + to: CGPoint( + x: center.x + innerRadius * cos(endAngleInner.DEG2RAD), + y: center.y + innerRadius * sin(endAngleInner.DEG2RAD))) + + path.addRelativeArc(center: center, radius: innerRadius, + startAngle: endAngleInner.DEG2RAD, + delta: -sweepAngleInner.DEG2RAD) + } + else + { + if accountForSliceSpacing + { + let angleMiddle = startAngleOuter + sweepAngleOuter / 2.0 + + let arcEndPointX = center.x + sliceSpaceRadius * cos(angleMiddle.DEG2RAD) + let arcEndPointY = center.y + sliceSpaceRadius * sin(angleMiddle.DEG2RAD) + + path.addLine( + to: CGPoint( + x: arcEndPointX, + y: arcEndPointY)) + } + else + { + path.addLine(to: center) + } + } + + path.closeSubpath() + + context.beginPath() + context.addPath(path) + context.fillPath(using: .evenOdd) + + let axElement = createAccessibleElement(withIndex: index, + container: chart, + dataSet: set) + { (element) in + element.accessibilityFrame = path.boundingBoxOfPath + element.isSelected = true + } + + highlightedAccessibleElements.append(axElement) + } + + // Prepend selected slices before the already rendered unselected ones. + // NOTE: - This relies on drawDataSet() being called before drawHighlighted in PieChartView. + accessibleChartElements.insert(contentsOf: highlightedAccessibleElements, at: 1) + + context.restoreGState() + } + + /// Creates an NSUIAccessibilityElement representing a slice of the PieChart. + /// The element only has it's container and label set based on the chart and dataSet. Use the modifier to alter traits and frame. + private func createAccessibleElement(withIndex idx: Int, + container: PieChartView, + dataSet: IPieChartDataSet, + modifier: (NSUIAccessibilityElement) -> ()) -> NSUIAccessibilityElement { + + let element = NSUIAccessibilityElement(accessibilityContainer: container) + + guard let e = dataSet.entryForIndex(idx) else { return element } + guard let formatter = dataSet.valueFormatter else { return element } + guard let data = container.data as? PieChartData else { return element } + + var elementValueText = formatter.stringForValue( + e.y, + entry: e, + dataSetIndex: idx, + viewPortHandler: viewPortHandler) + + if container.usePercentValuesEnabled { + let value = e.y / data.yValueSum * 100.0 + let valueText = formatter.stringForValue( + value, + entry: e, + dataSetIndex: idx, + viewPortHandler: viewPortHandler) + + elementValueText = valueText + } + + let pieChartDataEntry = (dataSet.entryForIndex(idx) as? PieChartDataEntry) + let isCount = data.accessibilityEntryLabelSuffixIsCount + let prefix = data.accessibilityEntryLabelPrefix?.appending("\(idx + 1)") ?? pieChartDataEntry?.label ?? "" + let suffix = data.accessibilityEntryLabelSuffix ?? "" + element.accessibilityLabel = "\(prefix) : \(elementValueText) \(suffix + (isCount ? (e.y == 1.0 ? "" : "s") : "") )" + + // The modifier allows changing of traits and frame depending on highlight, rotation, etc + modifier(element) + + return element + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/RadarChartRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/RadarChartRenderer.swift new file mode 100644 index 00000000000..c2ab79fcc22 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/RadarChartRenderer.swift @@ -0,0 +1,475 @@ +// +// RadarChartRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class RadarChartRenderer: LineRadarRenderer +{ + private lazy var accessibilityXLabels: [String] = { + guard let chart = chart else { return [] } + guard let formatter = chart.xAxis.valueFormatter else { return [] } + + let maxEntryCount = chart.data?.maxEntryCountSet?.entryCount ?? 0 + return stride(from: 0, to: maxEntryCount, by: 1).map { + formatter.stringForValue(Double($0), axis: chart.xAxis) + } + }() + + @objc open weak var chart: RadarChartView? + + @objc public init(chart: RadarChartView, animator: Animator, viewPortHandler: ViewPortHandler) + { + super.init(animator: animator, viewPortHandler: viewPortHandler) + + self.chart = chart + } + + open override func drawData(context: CGContext) + { + guard let chart = chart else { return } + + let radarData = chart.data + + if radarData != nil + { + let mostEntries = radarData?.maxEntryCountSet?.entryCount ?? 0 + + // If we redraw the data, remove and repopulate accessible elements to update label values and frames + self.accessibleChartElements.removeAll() + + // Make the chart header the first element in the accessible elements array + if let accessibilityHeaderData = radarData as? RadarChartData { + let element = createAccessibleHeader(usingChart: chart, + andData: accessibilityHeaderData, + withDefaultDescription: "Radar Chart") + self.accessibleChartElements.append(element) + } + + for set in radarData!.dataSets as! [IRadarChartDataSet] where set.isVisible + { + drawDataSet(context: context, dataSet: set, mostEntries: mostEntries) + } + } + } + + /// Draws the RadarDataSet + /// + /// - Parameters: + /// - context: + /// - dataSet: + /// - mostEntries: the entry count of the dataset with the most entries + internal func drawDataSet(context: CGContext, dataSet: IRadarChartDataSet, mostEntries: Int) + { + guard let chart = chart else { return } + + context.saveGState() + + let phaseX = animator.phaseX + let phaseY = animator.phaseY + + let sliceangle = chart.sliceAngle + + // calculate the factor that is needed for transforming the value to pixels + let factor = chart.factor + + let center = chart.centerOffsets + let entryCount = dataSet.entryCount + let path = CGMutablePath() + var hasMovedToPoint = false + + let prefix: String = chart.data?.accessibilityEntryLabelPrefix ?? "Item" + let description = dataSet.label ?? "" + + // Make a tuple of (xLabels, value, originalIndex) then sort it + // This is done, so that the labels are narrated in decreasing order of their corresponding value + // Otherwise, there is no non-visual logic to the data presented + let accessibilityEntryValues = Array(0 ..< entryCount).map { (dataSet.entryForIndex($0)?.y ?? 0, $0) } + let accessibilityAxisLabelValueTuples = zip(accessibilityXLabels, accessibilityEntryValues).map { ($0, $1.0, $1.1) }.sorted { $0.1 > $1.1 } + let accessibilityDataSetDescription: String = description + ". \(entryCount) \(prefix + (entryCount == 1 ? "" : "s")). " + let accessibilityFrameWidth: CGFloat = 22.0 // To allow a tap target of 44x44 + + var accessibilityEntryElements: [NSUIAccessibilityElement] = [] + + for j in 0 ..< entryCount + { + guard let e = dataSet.entryForIndex(j) else { continue } + + let p = center.moving(distance: CGFloat((e.y - chart.chartYMin) * Double(factor) * phaseY), + atAngle: sliceangle * CGFloat(j) * CGFloat(phaseX) + chart.rotationAngle) + + if p.x.isNaN + { + continue + } + + if !hasMovedToPoint + { + path.move(to: p) + hasMovedToPoint = true + } + else + { + path.addLine(to: p) + } + + let accessibilityLabel = accessibilityAxisLabelValueTuples[j].0 + let accessibilityValue = accessibilityAxisLabelValueTuples[j].1 + let accessibilityValueIndex = accessibilityAxisLabelValueTuples[j].2 + + let axp = center.moving(distance: CGFloat((accessibilityValue - chart.chartYMin) * Double(factor) * phaseY), + atAngle: sliceangle * CGFloat(accessibilityValueIndex) * CGFloat(phaseX) + chart.rotationAngle) + + let axDescription = description + " - " + accessibilityLabel + ": \(accessibilityValue) \(chart.data?.accessibilityEntryLabelSuffix ?? "")" + let axElement = createAccessibleElement(withDescription: axDescription, + container: chart, + dataSet: dataSet) + { (element) in + element.accessibilityFrame = CGRect(x: axp.x - accessibilityFrameWidth, + y: axp.y - accessibilityFrameWidth, + width: 2 * accessibilityFrameWidth, + height: 2 * accessibilityFrameWidth) + } + + accessibilityEntryElements.append(axElement) + } + + // if this is the largest set, close it + if dataSet.entryCount < mostEntries + { + // if this is not the largest set, draw a line to the center before closing + path.addLine(to: center) + } + + path.closeSubpath() + + // draw filled + if dataSet.isDrawFilledEnabled + { + if dataSet.fill != nil + { + drawFilledPath(context: context, path: path, fill: dataSet.fill!, fillAlpha: dataSet.fillAlpha) + } + else + { + drawFilledPath(context: context, path: path, fillColor: dataSet.fillColor, fillAlpha: dataSet.fillAlpha) + } + } + + // draw the line (only if filled is disabled or alpha is below 255) + if !dataSet.isDrawFilledEnabled || dataSet.fillAlpha < 1.0 + { + context.setStrokeColor(dataSet.color(atIndex: 0).cgColor) + context.setLineWidth(dataSet.lineWidth) + context.setAlpha(1.0) + + context.beginPath() + context.addPath(path) + context.strokePath() + + let axElement = createAccessibleElement(withDescription: accessibilityDataSetDescription, + container: chart, + dataSet: dataSet) + { (element) in + element.isHeader = true + element.accessibilityFrame = path.boundingBoxOfPath + } + + accessibleChartElements.append(axElement) + accessibleChartElements.append(contentsOf: accessibilityEntryElements) + } + + accessibilityPostLayoutChangedNotification() + + context.restoreGState() + } + + open override func drawValues(context: CGContext) + { + guard + let chart = chart, + let data = chart.data + else { return } + + let phaseX = animator.phaseX + let phaseY = animator.phaseY + + let sliceangle = chart.sliceAngle + + // calculate the factor that is needed for transforming the value to pixels + let factor = chart.factor + + let center = chart.centerOffsets + + let yoffset = CGFloat(5.0) + + for i in 0 ..< data.dataSetCount + { + guard let + dataSet = data.getDataSetByIndex(i) as? IRadarChartDataSet, + shouldDrawValues(forDataSet: dataSet) + else { continue } + + let entryCount = dataSet.entryCount + + let iconsOffset = dataSet.iconsOffset + + for j in 0 ..< entryCount + { + guard let e = dataSet.entryForIndex(j) else { continue } + + let p = center.moving(distance: CGFloat(e.y - chart.chartYMin) * factor * CGFloat(phaseY), + atAngle: sliceangle * CGFloat(j) * CGFloat(phaseX) + chart.rotationAngle) + + let valueFont = dataSet.valueFont + + guard let formatter = dataSet.valueFormatter else { continue } + + if dataSet.isDrawValuesEnabled + { + ChartUtils.drawText( + context: context, + text: formatter.stringForValue( + e.y, + entry: e, + dataSetIndex: i, + viewPortHandler: viewPortHandler), + point: CGPoint(x: p.x, y: p.y - yoffset - valueFont.lineHeight), + align: .center, + attributes: [NSAttributedString.Key.font: valueFont, + NSAttributedString.Key.foregroundColor: dataSet.valueTextColorAt(j)] + ) + } + + if let icon = e.icon, dataSet.isDrawIconsEnabled + { + var pIcon = center.moving(distance: CGFloat(e.y) * factor * CGFloat(phaseY) + iconsOffset.y, + atAngle: sliceangle * CGFloat(j) * CGFloat(phaseX) + chart.rotationAngle) + pIcon.y += iconsOffset.x + + ChartUtils.drawImage(context: context, + image: icon, + x: pIcon.x, + y: pIcon.y, + size: icon.size) + } + } + } + } + + open override func drawExtras(context: CGContext) + { + drawWeb(context: context) + } + + private var _webLineSegmentsBuffer = [CGPoint](repeating: CGPoint(), count: 2) + + @objc open func drawWeb(context: CGContext) + { + guard + let chart = chart, + let data = chart.data + else { return } + + let sliceangle = chart.sliceAngle + + context.saveGState() + + // calculate the factor that is needed for transforming the value to + // pixels + let factor = chart.factor + let rotationangle = chart.rotationAngle + + let center = chart.centerOffsets + + // draw the web lines that come from the center + context.setLineWidth(chart.webLineWidth) + context.setStrokeColor(chart.webColor.cgColor) + context.setAlpha(chart.webAlpha) + + let xIncrements = 1 + chart.skipWebLineCount + let maxEntryCount = chart.data?.maxEntryCountSet?.entryCount ?? 0 + + for i in stride(from: 0, to: maxEntryCount, by: xIncrements) + { + let p = center.moving(distance: CGFloat(chart.yRange) * factor, + atAngle: sliceangle * CGFloat(i) + rotationangle) + + _webLineSegmentsBuffer[0].x = center.x + _webLineSegmentsBuffer[0].y = center.y + _webLineSegmentsBuffer[1].x = p.x + _webLineSegmentsBuffer[1].y = p.y + + context.strokeLineSegments(between: _webLineSegmentsBuffer) + } + + // draw the inner-web + context.setLineWidth(chart.innerWebLineWidth) + context.setStrokeColor(chart.innerWebColor.cgColor) + context.setAlpha(chart.webAlpha) + + let labelCount = chart.yAxis.entryCount + + for j in 0 ..< labelCount + { + for i in 0 ..< data.entryCount + { + let r = CGFloat(chart.yAxis.entries[j] - chart.chartYMin) * factor + + let p1 = center.moving(distance: r, atAngle: sliceangle * CGFloat(i) + rotationangle) + let p2 = center.moving(distance: r, atAngle: sliceangle * CGFloat(i + 1) + rotationangle) + + _webLineSegmentsBuffer[0].x = p1.x + _webLineSegmentsBuffer[0].y = p1.y + _webLineSegmentsBuffer[1].x = p2.x + _webLineSegmentsBuffer[1].y = p2.y + + context.strokeLineSegments(between: _webLineSegmentsBuffer) + } + } + + context.restoreGState() + } + + private var _highlightPointBuffer = CGPoint() + + open override func drawHighlighted(context: CGContext, indices: [Highlight]) + { + guard + let chart = chart, + let radarData = chart.data as? RadarChartData + else { return } + + context.saveGState() + + let sliceangle = chart.sliceAngle + + // calculate the factor that is needed for transforming the value pixels + let factor = chart.factor + + let center = chart.centerOffsets + + for high in indices + { + guard + let set = chart.data?.getDataSetByIndex(high.dataSetIndex) as? IRadarChartDataSet, + set.isHighlightEnabled + else { continue } + + guard let e = set.entryForIndex(Int(high.x)) as? RadarChartDataEntry + else { continue } + + if !isInBoundsX(entry: e, dataSet: set) + { + continue + } + + context.setLineWidth(radarData.highlightLineWidth) + if radarData.highlightLineDashLengths != nil + { + context.setLineDash(phase: radarData.highlightLineDashPhase, lengths: radarData.highlightLineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + context.setStrokeColor(set.highlightColor.cgColor) + + let y = e.y - chart.chartYMin + + _highlightPointBuffer = center.moving(distance: CGFloat(y) * factor * CGFloat(animator.phaseY), + atAngle: sliceangle * CGFloat(high.x) * CGFloat(animator.phaseX) + chart.rotationAngle) + + high.setDraw(pt: _highlightPointBuffer) + + // draw the lines + drawHighlightLines(context: context, point: _highlightPointBuffer, set: set) + + if set.isDrawHighlightCircleEnabled + { + if !_highlightPointBuffer.x.isNaN && !_highlightPointBuffer.y.isNaN + { + var strokeColor = set.highlightCircleStrokeColor + if strokeColor == nil + { + strokeColor = set.color(atIndex: 0) + } + if set.highlightCircleStrokeAlpha < 1.0 + { + strokeColor = strokeColor?.withAlphaComponent(set.highlightCircleStrokeAlpha) + } + + drawHighlightCircle( + context: context, + atPoint: _highlightPointBuffer, + innerRadius: set.highlightCircleInnerRadius, + outerRadius: set.highlightCircleOuterRadius, + fillColor: set.highlightCircleFillColor, + strokeColor: strokeColor, + strokeWidth: set.highlightCircleStrokeWidth) + } + } + } + + context.restoreGState() + } + + internal func drawHighlightCircle( + context: CGContext, + atPoint point: CGPoint, + innerRadius: CGFloat, + outerRadius: CGFloat, + fillColor: NSUIColor?, + strokeColor: NSUIColor?, + strokeWidth: CGFloat) + { + context.saveGState() + + if let fillColor = fillColor + { + context.beginPath() + context.addEllipse(in: CGRect(x: point.x - outerRadius, y: point.y - outerRadius, width: outerRadius * 2.0, height: outerRadius * 2.0)) + if innerRadius > 0.0 + { + context.addEllipse(in: CGRect(x: point.x - innerRadius, y: point.y - innerRadius, width: innerRadius * 2.0, height: innerRadius * 2.0)) + } + + context.setFillColor(fillColor.cgColor) + context.fillPath(using: .evenOdd) + } + + if let strokeColor = strokeColor + { + context.beginPath() + context.addEllipse(in: CGRect(x: point.x - outerRadius, y: point.y - outerRadius, width: outerRadius * 2.0, height: outerRadius * 2.0)) + context.setStrokeColor(strokeColor.cgColor) + context.setLineWidth(strokeWidth) + context.strokePath() + } + + context.restoreGState() + } + + private func createAccessibleElement(withDescription description: String, + container: RadarChartView, + dataSet: IRadarChartDataSet, + modifier: (NSUIAccessibilityElement) -> ()) -> NSUIAccessibilityElement { + + let element = NSUIAccessibilityElement(accessibilityContainer: container) + element.accessibilityLabel = description + + // The modifier allows changing of traits and frame depending on highlight, rotation, etc + modifier(element) + + return element + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/Renderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Renderer.swift new file mode 100644 index 00000000000..e57a9b853fd --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Renderer.swift @@ -0,0 +1,26 @@ +// +// Renderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartRenderer) +open class Renderer: NSObject +{ + /// the component that handles the drawing area of the chart and it's offsets + @objc public let viewPortHandler: ViewPortHandler + + @objc public init(viewPortHandler: ViewPortHandler) + { + self.viewPortHandler = viewPortHandler + super.init() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift new file mode 100644 index 00000000000..2d035bf3579 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/ChevronDownShapeRenderer.swift @@ -0,0 +1,36 @@ +// +// ChevronDownShapeRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// +import Foundation +import CoreGraphics + +open class ChevronDownShapeRenderer : NSObject, IShapeRenderer +{ + open func renderShape( + context: CGContext, + dataSet: IScatterChartDataSet, + viewPortHandler: ViewPortHandler, + point: CGPoint, + color: NSUIColor) + { + let shapeSize = dataSet.scatterShapeSize + let shapeHalf = shapeSize / 2.0 + + context.setLineWidth(1.0) + context.setStrokeColor(color.cgColor) + + context.beginPath() + context.move(to: CGPoint(x: point.x, y: point.y + 2 * shapeHalf)) + context.addLine(to: CGPoint(x: point.x + 2 * shapeHalf, y: point.y)) + context.move(to: CGPoint(x: point.x, y: point.y + 2 * shapeHalf)) + context.addLine(to: CGPoint(x: point.x - 2 * shapeHalf, y: point.y)) + context.strokePath() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift new file mode 100644 index 00000000000..725533e780a --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/ChevronUpShapeRenderer.swift @@ -0,0 +1,36 @@ +// +// ChevronUpShapeRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// +import Foundation +import CoreGraphics + +open class ChevronUpShapeRenderer : NSObject, IShapeRenderer +{ + open func renderShape( + context: CGContext, + dataSet: IScatterChartDataSet, + viewPortHandler: ViewPortHandler, + point: CGPoint, + color: NSUIColor) + { + let shapeSize = dataSet.scatterShapeSize + let shapeHalf = shapeSize / 2.0 + + context.setLineWidth(1.0) + context.setStrokeColor(color.cgColor) + + context.beginPath() + context.move(to: CGPoint(x: point.x, y: point.y - 2 * shapeHalf)) + context.addLine(to: CGPoint(x: point.x + 2 * shapeHalf, y: point.y)) + context.move(to: CGPoint(x: point.x, y: point.y - 2 * shapeHalf)) + context.addLine(to: CGPoint(x: point.x - 2 * shapeHalf, y: point.y)) + context.strokePath() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift new file mode 100644 index 00000000000..b94a51137a5 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/CircleShapeRenderer.swift @@ -0,0 +1,63 @@ +// +// CircleShapeRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// +import Foundation +import CoreGraphics + +open class CircleShapeRenderer : NSObject, IShapeRenderer +{ + open func renderShape( + context: CGContext, + dataSet: IScatterChartDataSet, + viewPortHandler: ViewPortHandler, + point: CGPoint, + color: NSUIColor) + { + let shapeSize = dataSet.scatterShapeSize + let shapeHalf = shapeSize / 2.0 + let shapeHoleSizeHalf = dataSet.scatterShapeHoleRadius + let shapeHoleSize = shapeHoleSizeHalf * 2.0 + let shapeHoleColor = dataSet.scatterShapeHoleColor + let shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.0 + let shapeStrokeSizeHalf = shapeStrokeSize / 2.0 + + if shapeHoleSize > 0.0 + { + context.setStrokeColor(color.cgColor) + context.setLineWidth(shapeStrokeSize) + var rect = CGRect() + rect.origin.x = point.x - shapeHoleSizeHalf - shapeStrokeSizeHalf + rect.origin.y = point.y - shapeHoleSizeHalf - shapeStrokeSizeHalf + rect.size.width = shapeHoleSize + shapeStrokeSize + rect.size.height = shapeHoleSize + shapeStrokeSize + context.strokeEllipse(in: rect) + + if let shapeHoleColor = shapeHoleColor + { + context.setFillColor(shapeHoleColor.cgColor) + rect.origin.x = point.x - shapeHoleSizeHalf + rect.origin.y = point.y - shapeHoleSizeHalf + rect.size.width = shapeHoleSize + rect.size.height = shapeHoleSize + context.fillEllipse(in: rect) + } + } + else + { + context.setFillColor(color.cgColor) + var rect = CGRect() + rect.origin.x = point.x - shapeHalf + rect.origin.y = point.y - shapeHalf + rect.size.width = shapeSize + rect.size.height = shapeSize + context.fillEllipse(in: rect) + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift new file mode 100644 index 00000000000..18785d3dee9 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/CrossShapeRenderer.swift @@ -0,0 +1,36 @@ +// +// CrossShapeRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// +import Foundation +import CoreGraphics + +open class CrossShapeRenderer : NSObject, IShapeRenderer +{ + open func renderShape( + context: CGContext, + dataSet: IScatterChartDataSet, + viewPortHandler: ViewPortHandler, + point: CGPoint, + color: NSUIColor) + { + let shapeSize = dataSet.scatterShapeSize + let shapeHalf = shapeSize / 2.0 + + context.setLineWidth(1.0) + context.setStrokeColor(color.cgColor) + + context.beginPath() + context.move(to: CGPoint(x: point.x - shapeHalf, y: point.y)) + context.addLine(to: CGPoint(x: point.x + shapeHalf, y: point.y)) + context.move(to: CGPoint(x: point.x, y: point.y - shapeHalf)) + context.addLine(to: CGPoint(x: point.x, y: point.y + shapeHalf)) + context.strokePath() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift new file mode 100644 index 00000000000..ff12ee3fb20 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/IShapeRenderer.swift @@ -0,0 +1,32 @@ +// +// IShapeRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc +public protocol IShapeRenderer: class +{ + /// Renders the provided ScatterDataSet with a shape. + /// + /// - Parameters: + /// - context: CGContext for drawing on + /// - dataSet: The DataSet to be drawn + /// - viewPortHandler: Contains information about the current state of the view + /// - point: Position to draw the shape at + /// - color: Color to draw the shape + func renderShape( + context: CGContext, + dataSet: IScatterChartDataSet, + viewPortHandler: ViewPortHandler, + point: CGPoint, + color: NSUIColor) +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift new file mode 100644 index 00000000000..ea692e33fd9 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/SquareShapeRenderer.swift @@ -0,0 +1,63 @@ +// +// SquareShapeRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// +import Foundation +import CoreGraphics + +open class SquareShapeRenderer : NSObject, IShapeRenderer +{ + open func renderShape( + context: CGContext, + dataSet: IScatterChartDataSet, + viewPortHandler: ViewPortHandler, + point: CGPoint, + color: NSUIColor) + { + let shapeSize = dataSet.scatterShapeSize + let shapeHalf = shapeSize / 2.0 + let shapeHoleSizeHalf = dataSet.scatterShapeHoleRadius + let shapeHoleSize = shapeHoleSizeHalf * 2.0 + let shapeHoleColor = dataSet.scatterShapeHoleColor + let shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.0 + let shapeStrokeSizeHalf = shapeStrokeSize / 2.0 + + if shapeHoleSize > 0.0 + { + context.setStrokeColor(color.cgColor) + context.setLineWidth(shapeStrokeSize) + var rect = CGRect() + rect.origin.x = point.x - shapeHoleSizeHalf - shapeStrokeSizeHalf + rect.origin.y = point.y - shapeHoleSizeHalf - shapeStrokeSizeHalf + rect.size.width = shapeHoleSize + shapeStrokeSize + rect.size.height = shapeHoleSize + shapeStrokeSize + context.stroke(rect) + + if let shapeHoleColor = shapeHoleColor + { + context.setFillColor(shapeHoleColor.cgColor) + rect.origin.x = point.x - shapeHoleSizeHalf + rect.origin.y = point.y - shapeHoleSizeHalf + rect.size.width = shapeHoleSize + rect.size.height = shapeHoleSize + context.fill(rect) + } + } + else + { + context.setFillColor(color.cgColor) + var rect = CGRect() + rect.origin.x = point.x - shapeHalf + rect.origin.y = point.y - shapeHalf + rect.size.width = shapeSize + rect.size.height = shapeSize + context.fill(rect) + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift new file mode 100644 index 00000000000..fa313b765b5 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/TriangleShapeRenderer.swift @@ -0,0 +1,66 @@ +// +// TriangleShapeRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// +import Foundation +import CoreGraphics + +open class TriangleShapeRenderer : NSObject, IShapeRenderer +{ + open func renderShape( + context: CGContext, + dataSet: IScatterChartDataSet, + viewPortHandler: ViewPortHandler, + point: CGPoint, + color: NSUIColor) + { + let shapeSize = dataSet.scatterShapeSize + let shapeHalf = shapeSize / 2.0 + let shapeHoleSizeHalf = dataSet.scatterShapeHoleRadius + let shapeHoleSize = shapeHoleSizeHalf * 2.0 + let shapeHoleColor = dataSet.scatterShapeHoleColor + let shapeStrokeSize = (shapeSize - shapeHoleSize) / 2.0 + + context.setFillColor(color.cgColor) + + // create a triangle path + context.beginPath() + context.move(to: CGPoint(x: point.x, y: point.y - shapeHalf)) + context.addLine(to: CGPoint(x: point.x + shapeHalf, y: point.y + shapeHalf)) + context.addLine(to: CGPoint(x: point.x - shapeHalf, y: point.y + shapeHalf)) + + if shapeHoleSize > 0.0 + { + context.addLine(to: CGPoint(x: point.x, y: point.y - shapeHalf)) + + context.move(to: CGPoint(x: point.x - shapeHalf + shapeStrokeSize, y: point.y + shapeHalf - shapeStrokeSize)) + context.addLine(to: CGPoint(x: point.x + shapeHalf - shapeStrokeSize, y: point.y + shapeHalf - shapeStrokeSize)) + context.addLine(to: CGPoint(x: point.x, y: point.y - shapeHalf + shapeStrokeSize)) + context.addLine(to: CGPoint(x: point.x - shapeHalf + shapeStrokeSize, y: point.y + shapeHalf - shapeStrokeSize)) + } + + context.closePath() + + context.fillPath() + + if shapeHoleSize > 0.0 && shapeHoleColor != nil + { + context.setFillColor(shapeHoleColor!.cgColor) + + // create a triangle path + context.beginPath() + context.move(to: CGPoint(x: point.x, y: point.y - shapeHalf + shapeStrokeSize)) + context.addLine(to: CGPoint(x: point.x + shapeHalf - shapeStrokeSize, y: point.y + shapeHalf - shapeStrokeSize)) + context.addLine(to: CGPoint(x: point.x - shapeHalf + shapeStrokeSize, y: point.y + shapeHalf - shapeStrokeSize)) + context.closePath() + + context.fillPath() + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift new file mode 100644 index 00000000000..8a546c5f0bb --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/Scatter/XShapeRenderer.swift @@ -0,0 +1,36 @@ +// +// XShapeRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// +import Foundation +import CoreGraphics + +open class XShapeRenderer : NSObject, IShapeRenderer +{ + open func renderShape( + context: CGContext, + dataSet: IScatterChartDataSet, + viewPortHandler: ViewPortHandler, + point: CGPoint, + color: NSUIColor) + { + let shapeSize = dataSet.scatterShapeSize + let shapeHalf = shapeSize / 2.0 + + context.setLineWidth(1.0) + context.setStrokeColor(color.cgColor) + + context.beginPath() + context.move(to: CGPoint(x: point.x - shapeHalf, y: point.y - shapeHalf)) + context.addLine(to: CGPoint(x: point.x + shapeHalf, y: point.y + shapeHalf)) + context.move(to: CGPoint(x: point.x + shapeHalf, y: point.y - shapeHalf)) + context.addLine(to: CGPoint(x: point.x - shapeHalf, y: point.y + shapeHalf)) + context.strokePath() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift new file mode 100644 index 00000000000..57d348b28b3 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/ScatterChartRenderer.swift @@ -0,0 +1,249 @@ +// +// ScatterChartRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class ScatterChartRenderer: LineScatterCandleRadarRenderer +{ + @objc open weak var dataProvider: ScatterChartDataProvider? + + @objc public init(dataProvider: ScatterChartDataProvider, animator: Animator, viewPortHandler: ViewPortHandler) + { + super.init(animator: animator, viewPortHandler: viewPortHandler) + + self.dataProvider = dataProvider + } + + open override func drawData(context: CGContext) + { + guard let scatterData = dataProvider?.scatterData else { return } + + // If we redraw the data, remove and repopulate accessible elements to update label values and frames + accessibleChartElements.removeAll() + + if let chart = dataProvider as? ScatterChartView { + // Make the chart header the first element in the accessible elements array + let element = createAccessibleHeader(usingChart: chart, + andData: scatterData, + withDefaultDescription: "Scatter Chart") + accessibleChartElements.append(element) + } + + // TODO: Due to the potential complexity of data presented in Scatter charts, a more usable way + // for VO accessibility would be to use axis based traversal rather than by dataset. + // Hence, accessibleChartElements is not populated below. (Individual renderers guard against dataSource being their respective views) + for i in 0 ..< scatterData.dataSetCount + { + guard let set = scatterData.getDataSetByIndex(i) else { continue } + + if set.isVisible + { + if !(set is IScatterChartDataSet) + { + fatalError("Datasets for ScatterChartRenderer must conform to IScatterChartDataSet") + } + + drawDataSet(context: context, dataSet: set as! IScatterChartDataSet) + } + } + } + + private var _lineSegments = [CGPoint](repeating: CGPoint(), count: 2) + + @objc open func drawDataSet(context: CGContext, dataSet: IScatterChartDataSet) + { + guard let dataProvider = dataProvider else { return } + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + + let phaseY = animator.phaseY + + let entryCount = dataSet.entryCount + + var point = CGPoint() + + let valueToPixelMatrix = trans.valueToPixelMatrix + + if let renderer = dataSet.shapeRenderer + { + context.saveGState() + + for j in 0 ..< Int(min(ceil(Double(entryCount) * animator.phaseX), Double(entryCount))) + { + guard let e = dataSet.entryForIndex(j) else { continue } + + point.x = CGFloat(e.x) + point.y = CGFloat(e.y * phaseY) + point = point.applying(valueToPixelMatrix) + + if !viewPortHandler.isInBoundsRight(point.x) + { + break + } + + if !viewPortHandler.isInBoundsLeft(point.x) || + !viewPortHandler.isInBoundsY(point.y) + { + continue + } + + renderer.renderShape(context: context, dataSet: dataSet, viewPortHandler: viewPortHandler, point: point, color: dataSet.color(atIndex: j)) + } + + context.restoreGState() + } + else + { + print("There's no IShapeRenderer specified for ScatterDataSet", terminator: "\n") + } + } + + open override func drawValues(context: CGContext) + { + guard + let dataProvider = dataProvider, + let scatterData = dataProvider.scatterData + else { return } + + // if values are drawn + if isDrawingValuesAllowed(dataProvider: dataProvider) + { + guard let dataSets = scatterData.dataSets as? [IScatterChartDataSet] else { return } + + let phaseY = animator.phaseY + + var pt = CGPoint() + + for i in 0 ..< scatterData.dataSetCount + { + let dataSet = dataSets[i] + guard let + formatter = dataSet.valueFormatter, + shouldDrawValues(forDataSet: dataSet) + else { continue } + + let valueFont = dataSet.valueFont + + let trans = dataProvider.getTransformer(forAxis: dataSet.axisDependency) + let valueToPixelMatrix = trans.valueToPixelMatrix + + let iconsOffset = dataSet.iconsOffset + + let shapeSize = dataSet.scatterShapeSize + let lineHeight = valueFont.lineHeight + + _xBounds.set(chart: dataProvider, dataSet: dataSet, animator: animator) + + for j in _xBounds + { + guard let e = dataSet.entryForIndex(j) else { break } + + pt.x = CGFloat(e.x) + pt.y = CGFloat(e.y * phaseY) + pt = pt.applying(valueToPixelMatrix) + + if (!viewPortHandler.isInBoundsRight(pt.x)) + { + break + } + + // make sure the lines don't do shitty things outside bounds + if (!viewPortHandler.isInBoundsLeft(pt.x) + || !viewPortHandler.isInBoundsY(pt.y)) + { + continue + } + + let text = formatter.stringForValue( + e.y, + entry: e, + dataSetIndex: i, + viewPortHandler: viewPortHandler) + + if dataSet.isDrawValuesEnabled + { + ChartUtils.drawText( + context: context, + text: text, + point: CGPoint( + x: pt.x, + y: pt.y - shapeSize - lineHeight), + align: .center, + attributes: [NSAttributedString.Key.font: valueFont, NSAttributedString.Key.foregroundColor: dataSet.valueTextColorAt(j)] + ) + } + + if let icon = e.icon, dataSet.isDrawIconsEnabled + { + ChartUtils.drawImage(context: context, + image: icon, + x: pt.x + iconsOffset.x, + y: pt.y + iconsOffset.y, + size: icon.size) + } + } + } + } + } + + open override func drawExtras(context: CGContext) + { + + } + + open override func drawHighlighted(context: CGContext, indices: [Highlight]) + { + guard + let dataProvider = dataProvider, + let scatterData = dataProvider.scatterData + else { return } + + context.saveGState() + + for high in indices + { + guard + let set = scatterData.getDataSetByIndex(high.dataSetIndex) as? IScatterChartDataSet, + set.isHighlightEnabled + else { continue } + + guard let entry = set.entryForXValue(high.x, closestToY: high.y) else { continue } + + if !isInBoundsX(entry: entry, dataSet: set) { continue } + + context.setStrokeColor(set.highlightColor.cgColor) + context.setLineWidth(set.highlightLineWidth) + if set.highlightLineDashLengths != nil + { + context.setLineDash(phase: set.highlightLineDashPhase, lengths: set.highlightLineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + let x = entry.x // get the x-position + let y = entry.y * Double(animator.phaseY) + + let trans = dataProvider.getTransformer(forAxis: set.axisDependency) + + let pt = trans.pixelForValues(x: x, y: y) + + high.setDraw(pt: pt) + + // draw the lines + drawHighlightLines(context: context, point: pt, set: set) + } + + context.restoreGState() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/XAxisRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/XAxisRenderer.swift new file mode 100644 index 00000000000..6ea1ba771dc --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/XAxisRenderer.swift @@ -0,0 +1,440 @@ +// +// XAxisRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartXAxisRenderer) +open class XAxisRenderer: AxisRendererBase +{ + @objc public init(viewPortHandler: ViewPortHandler, xAxis: XAxis?, transformer: Transformer?) + { + super.init(viewPortHandler: viewPortHandler, transformer: transformer, axis: xAxis) + } + + open override func computeAxis(min: Double, max: Double, inverted: Bool) + { + var min = min, max = max + + if let transformer = self.transformer + { + // calculate the starting and entry point of the y-labels (depending on + // zoom / contentrect bounds) + if viewPortHandler.contentWidth > 10 && !viewPortHandler.isFullyZoomedOutX + { + let p1 = transformer.valueForTouchPoint(CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentTop)) + let p2 = transformer.valueForTouchPoint(CGPoint(x: viewPortHandler.contentRight, y: viewPortHandler.contentTop)) + + if inverted + { + min = Double(p2.x) + max = Double(p1.x) + } + else + { + min = Double(p1.x) + max = Double(p2.x) + } + } + } + + computeAxisValues(min: min, max: max) + } + + open override func computeAxisValues(min: Double, max: Double) + { + super.computeAxisValues(min: min, max: max) + + computeSize() + } + + @objc open func computeSize() + { + guard let + xAxis = self.axis as? XAxis + else { return } + + let longest = xAxis.getLongestLabel() + + let labelSize = longest.size(withAttributes: [NSAttributedString.Key.font: xAxis.labelFont]) + + let labelWidth = labelSize.width + let labelHeight = labelSize.height + + let labelRotatedSize = labelSize.rotatedBy(degrees: xAxis.labelRotationAngle) + + xAxis.labelWidth = labelWidth + xAxis.labelHeight = labelHeight + xAxis.labelRotatedWidth = labelRotatedSize.width + xAxis.labelRotatedHeight = labelRotatedSize.height + } + + open override func renderAxisLabels(context: CGContext) + { + guard let xAxis = self.axis as? XAxis else { return } + + if !xAxis.isEnabled || !xAxis.isDrawLabelsEnabled + { + return + } + + let yOffset = xAxis.yOffset + + if xAxis.labelPosition == .top + { + drawLabels(context: context, pos: viewPortHandler.contentTop - yOffset, anchor: CGPoint(x: 0.5, y: 1.0)) + } + else if xAxis.labelPosition == .topInside + { + drawLabels(context: context, pos: viewPortHandler.contentTop + yOffset + xAxis.labelRotatedHeight, anchor: CGPoint(x: 0.5, y: 1.0)) + } + else if xAxis.labelPosition == .bottom + { + drawLabels(context: context, pos: viewPortHandler.contentBottom + yOffset, anchor: CGPoint(x: 0.5, y: 0.0)) + } + else if xAxis.labelPosition == .bottomInside + { + drawLabels(context: context, pos: viewPortHandler.contentBottom - yOffset - xAxis.labelRotatedHeight, anchor: CGPoint(x: 0.5, y: 0.0)) + } + else + { // BOTH SIDED + drawLabels(context: context, pos: viewPortHandler.contentTop - yOffset, anchor: CGPoint(x: 0.5, y: 1.0)) + drawLabels(context: context, pos: viewPortHandler.contentBottom + yOffset, anchor: CGPoint(x: 0.5, y: 0.0)) + } + } + + private var _axisLineSegmentsBuffer = [CGPoint](repeating: CGPoint(), count: 2) + + open override func renderAxisLine(context: CGContext) + { + guard let xAxis = self.axis as? XAxis else { return } + + if !xAxis.isEnabled || !xAxis.isDrawAxisLineEnabled + { + return + } + + context.saveGState() + + context.setStrokeColor(xAxis.axisLineColor.cgColor) + context.setLineWidth(xAxis.axisLineWidth) + if xAxis.axisLineDashLengths != nil + { + context.setLineDash(phase: xAxis.axisLineDashPhase, lengths: xAxis.axisLineDashLengths) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + if xAxis.labelPosition == .top + || xAxis.labelPosition == .topInside + || xAxis.labelPosition == .bothSided + { + _axisLineSegmentsBuffer[0].x = viewPortHandler.contentLeft + _axisLineSegmentsBuffer[0].y = viewPortHandler.contentTop + _axisLineSegmentsBuffer[1].x = viewPortHandler.contentRight + _axisLineSegmentsBuffer[1].y = viewPortHandler.contentTop + context.strokeLineSegments(between: _axisLineSegmentsBuffer) + } + + if xAxis.labelPosition == .bottom + || xAxis.labelPosition == .bottomInside + || xAxis.labelPosition == .bothSided + { + _axisLineSegmentsBuffer[0].x = viewPortHandler.contentLeft + _axisLineSegmentsBuffer[0].y = viewPortHandler.contentBottom + _axisLineSegmentsBuffer[1].x = viewPortHandler.contentRight + _axisLineSegmentsBuffer[1].y = viewPortHandler.contentBottom + context.strokeLineSegments(between: _axisLineSegmentsBuffer) + } + + context.restoreGState() + } + + /// draws the x-labels on the specified y-position + @objc open func drawLabels(context: CGContext, pos: CGFloat, anchor: CGPoint) + { + guard + let xAxis = self.axis as? XAxis, + let transformer = self.transformer + else { return } + + let paraStyle = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle + paraStyle.alignment = .center + + let labelAttrs: [NSAttributedString.Key : Any] = [ + .font: xAxis.labelFont, + .foregroundColor: xAxis.labelTextColor, + .paragraphStyle: paraStyle + ] + let labelRotationAngleRadians = xAxis.labelRotationAngle.DEG2RAD + + let centeringEnabled = xAxis.isCenterAxisLabelsEnabled + + let valueToPixelMatrix = transformer.valueToPixelMatrix + + var position = CGPoint(x: 0.0, y: 0.0) + + var labelMaxSize = CGSize() + + if xAxis.isWordWrapEnabled + { + labelMaxSize.width = xAxis.wordWrapWidthPercent * valueToPixelMatrix.a + } + + let entries = xAxis.entries + + for i in stride(from: 0, to: entries.count, by: 1) + { + if centeringEnabled + { + position.x = CGFloat(xAxis.centeredEntries[i]) + } + else + { + position.x = CGFloat(entries[i]) + } + + position.y = 0.0 + position = position.applying(valueToPixelMatrix) + + if viewPortHandler.isInBoundsX(position.x) + { + let label = xAxis.valueFormatter?.stringForValue(xAxis.entries[i], axis: xAxis) ?? "" + + let labelns = label as NSString + + if xAxis.isAvoidFirstLastClippingEnabled + { + // avoid clipping of the last + if i == xAxis.entryCount - 1 && xAxis.entryCount > 1 + { + let width = labelns.boundingRect(with: labelMaxSize, options: .usesLineFragmentOrigin, attributes: labelAttrs, context: nil).size.width + + if width > viewPortHandler.offsetRight * 2.0 + && position.x + width > viewPortHandler.chartWidth + { + position.x -= width / 2.0 + } + } + else if i == 0 + { // avoid clipping of the first + let width = labelns.boundingRect(with: labelMaxSize, options: .usesLineFragmentOrigin, attributes: labelAttrs, context: nil).size.width + position.x += width / 2.0 + } + } + + drawLabel(context: context, + formattedLabel: label, + x: position.x, + y: pos, + attributes: labelAttrs, + constrainedToSize: labelMaxSize, + anchor: anchor, + angleRadians: labelRotationAngleRadians) + } + } + } + + @objc open func drawLabel( + context: CGContext, + formattedLabel: String, + x: CGFloat, + y: CGFloat, + attributes: [NSAttributedString.Key : Any], + constrainedToSize: CGSize, + anchor: CGPoint, + angleRadians: CGFloat) + { + ChartUtils.drawMultilineText( + context: context, + text: formattedLabel, + point: CGPoint(x: x, y: y), + attributes: attributes, + constrainedToSize: constrainedToSize, + anchor: anchor, + angleRadians: angleRadians) + } + + open override func renderGridLines(context: CGContext) + { + guard + let xAxis = self.axis as? XAxis, + let transformer = self.transformer + else { return } + + if !xAxis.isDrawGridLinesEnabled || !xAxis.isEnabled + { + return + } + + context.saveGState() + defer { context.restoreGState() } + context.clip(to: self.gridClippingRect) + + context.setShouldAntialias(xAxis.gridAntialiasEnabled) + context.setStrokeColor(xAxis.gridColor.cgColor) + context.setLineWidth(xAxis.gridLineWidth) + context.setLineCap(xAxis.gridLineCap) + + if xAxis.gridLineDashLengths != nil + { + context.setLineDash(phase: xAxis.gridLineDashPhase, lengths: xAxis.gridLineDashLengths) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + let valueToPixelMatrix = transformer.valueToPixelMatrix + + var position = CGPoint(x: 0.0, y: 0.0) + + let entries = xAxis.entries + + for i in stride(from: 0, to: entries.count, by: 1) + { + position.x = CGFloat(entries[i]) + position.y = position.x + position = position.applying(valueToPixelMatrix) + + drawGridLine(context: context, x: position.x, y: position.y) + } + } + + @objc open var gridClippingRect: CGRect + { + var contentRect = viewPortHandler.contentRect + let dx = self.axis?.gridLineWidth ?? 0.0 + contentRect.origin.x -= dx / 2.0 + contentRect.size.width += dx + return contentRect + } + + @objc open func drawGridLine(context: CGContext, x: CGFloat, y: CGFloat) + { + if x >= viewPortHandler.offsetLeft + && x <= viewPortHandler.chartWidth + { + context.beginPath() + context.move(to: CGPoint(x: x, y: viewPortHandler.contentTop)) + context.addLine(to: CGPoint(x: x, y: viewPortHandler.contentBottom)) + context.strokePath() + } + } + + open override func renderLimitLines(context: CGContext) + { + guard + let xAxis = self.axis as? XAxis, + let transformer = self.transformer, + !xAxis.limitLines.isEmpty + else { return } + + let trans = transformer.valueToPixelMatrix + + var position = CGPoint(x: 0.0, y: 0.0) + + for l in xAxis.limitLines where l.isEnabled + { + context.saveGState() + defer { context.restoreGState() } + + var clippingRect = viewPortHandler.contentRect + clippingRect.origin.x -= l.lineWidth / 2.0 + clippingRect.size.width += l.lineWidth + context.clip(to: clippingRect) + + position.x = CGFloat(l.limit) + position.y = 0.0 + position = position.applying(trans) + + renderLimitLineLine(context: context, limitLine: l, position: position) + renderLimitLineLabel(context: context, limitLine: l, position: position, yOffset: 2.0 + l.yOffset) + } + } + + @objc open func renderLimitLineLine(context: CGContext, limitLine: ChartLimitLine, position: CGPoint) + { + + context.beginPath() + context.move(to: CGPoint(x: position.x, y: viewPortHandler.contentTop)) + context.addLine(to: CGPoint(x: position.x, y: viewPortHandler.contentBottom)) + + context.setStrokeColor(limitLine.lineColor.cgColor) + context.setLineWidth(limitLine.lineWidth) + if limitLine.lineDashLengths != nil + { + context.setLineDash(phase: limitLine.lineDashPhase, lengths: limitLine.lineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + context.strokePath() + } + + @objc open func renderLimitLineLabel(context: CGContext, limitLine: ChartLimitLine, position: CGPoint, yOffset: CGFloat) + { + + let label = limitLine.label + guard limitLine.drawLabelEnabled, !label.isEmpty else { return } + + let labelLineHeight = limitLine.valueFont.lineHeight + + let xOffset: CGFloat = limitLine.lineWidth + limitLine.xOffset + let attributes: [NSAttributedString.Key : Any] = [ + .font : limitLine.valueFont, + .foregroundColor : limitLine.valueTextColor + ] + + let (point, align): (CGPoint, NSTextAlignment) + switch limitLine.labelPosition { + case .topRight: + point = CGPoint( + x: position.x + xOffset, + y: viewPortHandler.contentTop + yOffset + ) + align = .left + + case .bottomRight: + point = CGPoint( + x: position.x + xOffset, + y: viewPortHandler.contentBottom - labelLineHeight - yOffset + ) + align = .left + + case .topLeft: + point = CGPoint( + x: position.x - xOffset, + y: viewPortHandler.contentTop + yOffset + ) + align = .right + + case .bottomLeft: + point = CGPoint( + x: position.x - xOffset, + y: viewPortHandler.contentBottom - labelLineHeight - yOffset + ) + align = .right + } + + ChartUtils.drawText( + context: context, + text: label, + point: point, + align: align, + attributes: attributes + ) + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift new file mode 100644 index 00000000000..ce777746a08 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift @@ -0,0 +1,356 @@ +// +// XAxisRendererHorizontalBarChart.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class XAxisRendererHorizontalBarChart: XAxisRenderer +{ + internal weak var chart: BarChartView? + + @objc public init(viewPortHandler: ViewPortHandler, xAxis: XAxis?, transformer: Transformer?, chart: BarChartView) + { + super.init(viewPortHandler: viewPortHandler, xAxis: xAxis, transformer: transformer) + + self.chart = chart + } + + open override func computeAxis(min: Double, max: Double, inverted: Bool) + { + var min = min, max = max + + if let transformer = self.transformer + { + // calculate the starting and entry point of the y-labels (depending on + // zoom / contentrect bounds) + if viewPortHandler.contentWidth > 10 && !viewPortHandler.isFullyZoomedOutY + { + let p1 = transformer.valueForTouchPoint(CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentBottom)) + let p2 = transformer.valueForTouchPoint(CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentTop)) + + if inverted + { + min = Double(p2.y) + max = Double(p1.y) + } + else + { + min = Double(p1.y) + max = Double(p2.y) + } + } + } + + computeAxisValues(min: min, max: max) + } + + open override func computeSize() + { + guard let + xAxis = self.axis as? XAxis + else { return } + + let longest = xAxis.getLongestLabel() as NSString + + let labelSize = longest.size(withAttributes: [NSAttributedString.Key.font: xAxis.labelFont]) + + let labelWidth = floor(labelSize.width + xAxis.xOffset * 3.5) + let labelHeight = labelSize.height + let labelRotatedSize = CGSize(width: labelSize.width, height: labelHeight).rotatedBy(degrees: xAxis.labelRotationAngle) + + xAxis.labelWidth = labelWidth + xAxis.labelHeight = labelHeight + xAxis.labelRotatedWidth = round(labelRotatedSize.width + xAxis.xOffset * 3.5) + xAxis.labelRotatedHeight = round(labelRotatedSize.height) + } + + open override func renderAxisLabels(context: CGContext) + { + guard + let xAxis = self.axis as? XAxis + else { return } + + if !xAxis.isEnabled || !xAxis.isDrawLabelsEnabled || chart?.data === nil + { + return + } + + let xoffset = xAxis.xOffset + + if xAxis.labelPosition == .top + { + drawLabels(context: context, pos: viewPortHandler.contentRight + xoffset, anchor: CGPoint(x: 0.0, y: 0.5)) + } + else if xAxis.labelPosition == .topInside + { + drawLabels(context: context, pos: viewPortHandler.contentRight - xoffset, anchor: CGPoint(x: 1.0, y: 0.5)) + } + else if xAxis.labelPosition == .bottom + { + drawLabels(context: context, pos: viewPortHandler.contentLeft - xoffset, anchor: CGPoint(x: 1.0, y: 0.5)) + } + else if xAxis.labelPosition == .bottomInside + { + drawLabels(context: context, pos: viewPortHandler.contentLeft + xoffset, anchor: CGPoint(x: 0.0, y: 0.5)) + } + else + { // BOTH SIDED + drawLabels(context: context, pos: viewPortHandler.contentRight + xoffset, anchor: CGPoint(x: 0.0, y: 0.5)) + drawLabels(context: context, pos: viewPortHandler.contentLeft - xoffset, anchor: CGPoint(x: 1.0, y: 0.5)) + } + } + + /// draws the x-labels on the specified y-position + open override func drawLabels(context: CGContext, pos: CGFloat, anchor: CGPoint) + { + guard + let xAxis = self.axis as? XAxis, + let transformer = self.transformer + else { return } + + let labelFont = xAxis.labelFont + let labelTextColor = xAxis.labelTextColor + let labelRotationAngleRadians = xAxis.labelRotationAngle.DEG2RAD + + let centeringEnabled = xAxis.isCenterAxisLabelsEnabled + + // pre allocate to save performance (dont allocate in loop) + var position = CGPoint(x: 0.0, y: 0.0) + + for i in stride(from: 0, to: xAxis.entryCount, by: 1) + { + // only fill x values + + position.x = 0.0 + + if centeringEnabled + { + position.y = CGFloat(xAxis.centeredEntries[i]) + } + else + { + position.y = CGFloat(xAxis.entries[i]) + } + + transformer.pointValueToPixel(&position) + + if viewPortHandler.isInBoundsY(position.y) + { + if let label = xAxis.valueFormatter?.stringForValue(xAxis.entries[i], axis: xAxis) + { + drawLabel( + context: context, + formattedLabel: label, + x: pos, + y: position.y, + attributes: [NSAttributedString.Key.font: labelFont, NSAttributedString.Key.foregroundColor: labelTextColor], + anchor: anchor, + angleRadians: labelRotationAngleRadians) + } + } + } + } + + @objc open func drawLabel( + context: CGContext, + formattedLabel: String, + x: CGFloat, + y: CGFloat, + attributes: [NSAttributedString.Key : Any], + anchor: CGPoint, + angleRadians: CGFloat) + { + ChartUtils.drawText( + context: context, + text: formattedLabel, + point: CGPoint(x: x, y: y), + attributes: attributes, + anchor: anchor, + angleRadians: angleRadians) + } + + open override var gridClippingRect: CGRect + { + var contentRect = viewPortHandler.contentRect + let dy = self.axis?.gridLineWidth ?? 0.0 + contentRect.origin.y -= dy / 2.0 + contentRect.size.height += dy + return contentRect + } + + private var _gridLineSegmentsBuffer = [CGPoint](repeating: CGPoint(), count: 2) + + open override func drawGridLine(context: CGContext, x: CGFloat, y: CGFloat) + { + if viewPortHandler.isInBoundsY(y) + { + context.beginPath() + context.move(to: CGPoint(x: viewPortHandler.contentLeft, y: y)) + context.addLine(to: CGPoint(x: viewPortHandler.contentRight, y: y)) + context.strokePath() + } + } + + open override func renderAxisLine(context: CGContext) + { + guard let xAxis = self.axis as? XAxis else { return } + + if !xAxis.isEnabled || !xAxis.isDrawAxisLineEnabled + { + return + } + + context.saveGState() + + context.setStrokeColor(xAxis.axisLineColor.cgColor) + context.setLineWidth(xAxis.axisLineWidth) + if xAxis.axisLineDashLengths != nil + { + context.setLineDash(phase: xAxis.axisLineDashPhase, lengths: xAxis.axisLineDashLengths) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + if xAxis.labelPosition == .top || + xAxis.labelPosition == .topInside || + xAxis.labelPosition == .bothSided + { + context.beginPath() + context.move(to: CGPoint(x: viewPortHandler.contentRight, y: viewPortHandler.contentTop)) + context.addLine(to: CGPoint(x: viewPortHandler.contentRight, y: viewPortHandler.contentBottom)) + context.strokePath() + } + + if xAxis.labelPosition == .bottom || + xAxis.labelPosition == .bottomInside || + xAxis.labelPosition == .bothSided + { + context.beginPath() + context.move(to: CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentTop)) + context.addLine(to: CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentBottom)) + context.strokePath() + } + + context.restoreGState() + } + + open override func renderLimitLines(context: CGContext) + { + guard + let xAxis = self.axis as? XAxis, + let transformer = self.transformer + else { return } + + var limitLines = xAxis.limitLines + + if limitLines.count == 0 + { + return + } + + let trans = transformer.valueToPixelMatrix + + var position = CGPoint(x: 0.0, y: 0.0) + + for i in 0 ..< limitLines.count + { + let l = limitLines[i] + + if !l.isEnabled + { + continue + } + + context.saveGState() + defer { context.restoreGState() } + + var clippingRect = viewPortHandler.contentRect + clippingRect.origin.y -= l.lineWidth / 2.0 + clippingRect.size.height += l.lineWidth + context.clip(to: clippingRect) + + position.x = 0.0 + position.y = CGFloat(l.limit) + position = position.applying(trans) + + context.beginPath() + context.move(to: CGPoint(x: viewPortHandler.contentLeft, y: position.y)) + context.addLine(to: CGPoint(x: viewPortHandler.contentRight, y: position.y)) + + context.setStrokeColor(l.lineColor.cgColor) + context.setLineWidth(l.lineWidth) + if l.lineDashLengths != nil + { + context.setLineDash(phase: l.lineDashPhase, lengths: l.lineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + context.strokePath() + + let label = l.label + + // if drawing the limit-value label is enabled + if l.drawLabelEnabled && label.count > 0 + { + let labelLineHeight = l.valueFont.lineHeight + + let xOffset: CGFloat = 4.0 + l.xOffset + let yOffset: CGFloat = l.lineWidth + labelLineHeight + l.yOffset + + if l.labelPosition == .topRight + { + ChartUtils.drawText(context: context, + text: label, + point: CGPoint( + x: viewPortHandler.contentRight - xOffset, + y: position.y - yOffset), + align: .right, + attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor]) + } + else if l.labelPosition == .bottomRight + { + ChartUtils.drawText(context: context, + text: label, + point: CGPoint( + x: viewPortHandler.contentRight - xOffset, + y: position.y + yOffset - labelLineHeight), + align: .right, + attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor]) + } + else if l.labelPosition == .topLeft + { + ChartUtils.drawText(context: context, + text: label, + point: CGPoint( + x: viewPortHandler.contentLeft + xOffset, + y: position.y - yOffset), + align: .left, + attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor]) + } + else + { + ChartUtils.drawText(context: context, + text: label, + point: CGPoint( + x: viewPortHandler.contentLeft + xOffset, + y: position.y + yOffset - labelLineHeight), + align: .left, + attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor]) + } + } + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift new file mode 100644 index 00000000000..c5fcedf54c0 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/XAxisRendererRadarChart.swift @@ -0,0 +1,91 @@ +// +// XAxisRendererRadarChart.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class XAxisRendererRadarChart: XAxisRenderer +{ + @objc open weak var chart: RadarChartView? + + @objc public init(viewPortHandler: ViewPortHandler, xAxis: XAxis?, chart: RadarChartView) + { + super.init(viewPortHandler: viewPortHandler, xAxis: xAxis, transformer: nil) + + self.chart = chart + } + + open override func renderAxisLabels(context: CGContext) + { + guard let + xAxis = axis as? XAxis, + let chart = chart + else { return } + + if !xAxis.isEnabled || !xAxis.isDrawLabelsEnabled + { + return + } + + let labelFont = xAxis.labelFont + let labelTextColor = xAxis.labelTextColor + let labelRotationAngleRadians = xAxis.labelRotationAngle.RAD2DEG + let drawLabelAnchor = CGPoint(x: 0.5, y: 0.25) + + let sliceangle = chart.sliceAngle + + // calculate the factor that is needed for transforming the value to pixels + let factor = chart.factor + + let center = chart.centerOffsets + + for i in stride(from: 0, to: chart.data?.maxEntryCountSet?.entryCount ?? 0, by: 1) + { + + let label = xAxis.valueFormatter?.stringForValue(Double(i), axis: xAxis) ?? "" + + let angle = (sliceangle * CGFloat(i) + chart.rotationAngle).truncatingRemainder(dividingBy: 360.0) + + let p = center.moving(distance: CGFloat(chart.yRange) * factor + xAxis.labelRotatedWidth / 2.0, atAngle: angle) + + drawLabel(context: context, + formattedLabel: label, + x: p.x, + y: p.y - xAxis.labelRotatedHeight / 2.0, + attributes: [NSAttributedString.Key.font: labelFont, NSAttributedString.Key.foregroundColor: labelTextColor], + anchor: drawLabelAnchor, + angleRadians: labelRotationAngleRadians) + } + } + + @objc open func drawLabel( + context: CGContext, + formattedLabel: String, + x: CGFloat, + y: CGFloat, + attributes: [NSAttributedString.Key : Any], + anchor: CGPoint, + angleRadians: CGFloat) + { + ChartUtils.drawText( + context: context, + text: formattedLabel, + point: CGPoint(x: x, y: y), + attributes: attributes, + anchor: anchor, + angleRadians: angleRadians) + } + + open override func renderLimitLines(context: CGContext) + { + /// XAxis LimitLines on RadarChart not yet supported. + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/YAxisRenderer.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/YAxisRenderer.swift new file mode 100644 index 00000000000..4fb3dd2ef2c --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/YAxisRenderer.swift @@ -0,0 +1,386 @@ +// +// YAxisRenderer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartYAxisRenderer) +open class YAxisRenderer: AxisRendererBase +{ + @objc public init(viewPortHandler: ViewPortHandler, yAxis: YAxis?, transformer: Transformer?) + { + super.init(viewPortHandler: viewPortHandler, transformer: transformer, axis: yAxis) + } + + /// draws the y-axis labels to the screen + open override func renderAxisLabels(context: CGContext) + { + guard let yAxis = self.axis as? YAxis else { return } + + if !yAxis.isEnabled || !yAxis.isDrawLabelsEnabled + { + return + } + + let xoffset = yAxis.xOffset + let yoffset = yAxis.labelFont.lineHeight / 2.5 + yAxis.yOffset + + let dependency = yAxis.axisDependency + let labelPosition = yAxis.labelPosition + + var xPos = CGFloat(0.0) + + var textAlign: NSTextAlignment + + if dependency == .left + { + if labelPosition == .outsideChart + { + textAlign = .right + xPos = viewPortHandler.offsetLeft - xoffset + } + else + { + textAlign = .left + xPos = viewPortHandler.offsetLeft + xoffset + } + + } + else + { + if labelPosition == .outsideChart + { + textAlign = .left + xPos = viewPortHandler.contentRight + xoffset + } + else + { + textAlign = .right + xPos = viewPortHandler.contentRight - xoffset + } + } + + drawYLabels( + context: context, + fixedPosition: xPos, + positions: transformedPositions(), + offset: yoffset - yAxis.labelFont.lineHeight, + textAlign: textAlign) + } + + open override func renderAxisLine(context: CGContext) + { + guard let yAxis = self.axis as? YAxis else { return } + + if !yAxis.isEnabled || !yAxis.drawAxisLineEnabled + { + return + } + + context.saveGState() + + context.setStrokeColor(yAxis.axisLineColor.cgColor) + context.setLineWidth(yAxis.axisLineWidth) + if yAxis.axisLineDashLengths != nil + { + context.setLineDash(phase: yAxis.axisLineDashPhase, lengths: yAxis.axisLineDashLengths) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + if yAxis.axisDependency == .left + { + context.beginPath() + context.move(to: CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentTop)) + context.addLine(to: CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentBottom)) + context.strokePath() + } + else + { + context.beginPath() + context.move(to: CGPoint(x: viewPortHandler.contentRight, y: viewPortHandler.contentTop)) + context.addLine(to: CGPoint(x: viewPortHandler.contentRight, y: viewPortHandler.contentBottom)) + context.strokePath() + } + + context.restoreGState() + } + + /// draws the y-labels on the specified x-position + internal func drawYLabels( + context: CGContext, + fixedPosition: CGFloat, + positions: [CGPoint], + offset: CGFloat, + textAlign: NSTextAlignment) + { + guard + let yAxis = self.axis as? YAxis + else { return } + + let labelFont = yAxis.labelFont + let labelTextColor = yAxis.labelTextColor + + let from = yAxis.isDrawBottomYLabelEntryEnabled ? 0 : 1 + let to = yAxis.isDrawTopYLabelEntryEnabled ? yAxis.entryCount : (yAxis.entryCount - 1) + + for i in stride(from: from, to: to, by: 1) + { + let text = yAxis.getFormattedLabel(i) + + ChartUtils.drawText( + context: context, + text: text, + point: CGPoint(x: fixedPosition, y: positions[i].y + offset), + align: textAlign, + attributes: [.font: labelFont, .foregroundColor: labelTextColor] + ) + } + } + + open override func renderGridLines(context: CGContext) + { + guard let + yAxis = self.axis as? YAxis + else { return } + + if !yAxis.isEnabled + { + return + } + + if yAxis.drawGridLinesEnabled + { + let positions = transformedPositions() + + context.saveGState() + defer { context.restoreGState() } + context.clip(to: self.gridClippingRect) + + context.setShouldAntialias(yAxis.gridAntialiasEnabled) + context.setStrokeColor(yAxis.gridColor.cgColor) + context.setLineWidth(yAxis.gridLineWidth) + context.setLineCap(yAxis.gridLineCap) + + if yAxis.gridLineDashLengths != nil + { + context.setLineDash(phase: yAxis.gridLineDashPhase, lengths: yAxis.gridLineDashLengths) + + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + // draw the grid + positions.forEach { drawGridLine(context: context, position: $0) } + } + + if yAxis.drawZeroLineEnabled + { + // draw zero line + drawZeroLine(context: context) + } + } + + @objc open var gridClippingRect: CGRect + { + var contentRect = viewPortHandler.contentRect + let dy = self.axis?.gridLineWidth ?? 0.0 + contentRect.origin.y -= dy / 2.0 + contentRect.size.height += dy + return contentRect + } + + @objc open func drawGridLine( + context: CGContext, + position: CGPoint) + { + context.beginPath() + context.move(to: CGPoint(x: viewPortHandler.contentLeft, y: position.y)) + context.addLine(to: CGPoint(x: viewPortHandler.contentRight, y: position.y)) + context.strokePath() + } + + @objc open func transformedPositions() -> [CGPoint] + { + guard + let yAxis = self.axis as? YAxis, + let transformer = self.transformer + else { return [CGPoint]() } + + var positions = [CGPoint]() + positions.reserveCapacity(yAxis.entryCount) + + let entries = yAxis.entries + + for i in stride(from: 0, to: yAxis.entryCount, by: 1) + { + positions.append(CGPoint(x: 0.0, y: entries[i])) + } + + transformer.pointValuesToPixel(&positions) + + return positions + } + + /// Draws the zero line at the specified position. + @objc open func drawZeroLine(context: CGContext) + { + guard + let yAxis = self.axis as? YAxis, + let transformer = self.transformer, + let zeroLineColor = yAxis.zeroLineColor + else { return } + + context.saveGState() + defer { context.restoreGState() } + + var clippingRect = viewPortHandler.contentRect + clippingRect.origin.y -= yAxis.zeroLineWidth / 2.0 + clippingRect.size.height += yAxis.zeroLineWidth + context.clip(to: clippingRect) + + context.setStrokeColor(zeroLineColor.cgColor) + context.setLineWidth(yAxis.zeroLineWidth) + + let pos = transformer.pixelForValues(x: 0.0, y: 0.0) + + if yAxis.zeroLineDashLengths != nil + { + context.setLineDash(phase: yAxis.zeroLineDashPhase, lengths: yAxis.zeroLineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + context.move(to: CGPoint(x: viewPortHandler.contentLeft, y: pos.y)) + context.addLine(to: CGPoint(x: viewPortHandler.contentRight, y: pos.y)) + context.drawPath(using: CGPathDrawingMode.stroke) + } + + open override func renderLimitLines(context: CGContext) + { + guard + let yAxis = self.axis as? YAxis, + let transformer = self.transformer + else { return } + + var limitLines = yAxis.limitLines + + if limitLines.count == 0 + { + return + } + + context.saveGState() + + let trans = transformer.valueToPixelMatrix + + var position = CGPoint(x: 0.0, y: 0.0) + + for i in 0 ..< limitLines.count + { + let l = limitLines[i] + + if !l.isEnabled + { + continue + } + + context.saveGState() + defer { context.restoreGState() } + + var clippingRect = viewPortHandler.contentRect + clippingRect.origin.y -= l.lineWidth / 2.0 + clippingRect.size.height += l.lineWidth + context.clip(to: clippingRect) + + position.x = 0.0 + position.y = CGFloat(l.limit) + position = position.applying(trans) + + context.beginPath() + context.move(to: CGPoint(x: viewPortHandler.contentLeft, y: position.y)) + context.addLine(to: CGPoint(x: viewPortHandler.contentRight, y: position.y)) + + context.setStrokeColor(l.lineColor.cgColor) + context.setLineWidth(l.lineWidth) + if l.lineDashLengths != nil + { + context.setLineDash(phase: l.lineDashPhase, lengths: l.lineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + context.strokePath() + + let label = l.label + + // if drawing the limit-value label is enabled + if l.drawLabelEnabled && label.count > 0 + { + let labelLineHeight = l.valueFont.lineHeight + + let xOffset: CGFloat = 4.0 + l.xOffset + let yOffset: CGFloat = l.lineWidth + labelLineHeight + l.yOffset + + if l.labelPosition == .topRight + { + ChartUtils.drawText(context: context, + text: label, + point: CGPoint( + x: viewPortHandler.contentRight - xOffset, + y: position.y - yOffset), + align: .right, + attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor]) + } + else if l.labelPosition == .bottomRight + { + ChartUtils.drawText(context: context, + text: label, + point: CGPoint( + x: viewPortHandler.contentRight - xOffset, + y: position.y + yOffset - labelLineHeight), + align: .right, + attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor]) + } + else if l.labelPosition == .topLeft + { + ChartUtils.drawText(context: context, + text: label, + point: CGPoint( + x: viewPortHandler.contentLeft + xOffset, + y: position.y - yOffset), + align: .left, + attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor]) + } + else + { + ChartUtils.drawText(context: context, + text: label, + point: CGPoint( + x: viewPortHandler.contentLeft + xOffset, + y: position.y + yOffset - labelLineHeight), + align: .left, + attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor]) + } + } + } + + context.restoreGState() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift new file mode 100644 index 00000000000..e9c1af0e1c1 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift @@ -0,0 +1,363 @@ +// +// YAxisRendererHorizontalBarChart.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class YAxisRendererHorizontalBarChart: YAxisRenderer +{ + public override init(viewPortHandler: ViewPortHandler, yAxis: YAxis?, transformer: Transformer?) + { + super.init(viewPortHandler: viewPortHandler, yAxis: yAxis, transformer: transformer) + } + + /// Computes the axis values. + open override func computeAxis(min: Double, max: Double, inverted: Bool) + { + guard let transformer = self.transformer else { return } + + var min = min, max = max + + // calculate the starting and entry point of the y-labels (depending on zoom / contentrect bounds) + if viewPortHandler.contentHeight > 10.0 && !viewPortHandler.isFullyZoomedOutX + { + let p1 = transformer.valueForTouchPoint(CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentTop)) + let p2 = transformer.valueForTouchPoint(CGPoint(x: viewPortHandler.contentRight, y: viewPortHandler.contentTop)) + + if !inverted + { + min = Double(p1.x) + max = Double(p2.x) + } + else + { + min = Double(p2.x) + max = Double(p1.x) + } + } + + computeAxisValues(min: min, max: max) + } + + /// draws the y-axis labels to the screen + open override func renderAxisLabels(context: CGContext) + { + guard let yAxis = axis as? YAxis else { return } + + if !yAxis.isEnabled || !yAxis.isDrawLabelsEnabled + { + return + } + + let lineHeight = yAxis.labelFont.lineHeight + let baseYOffset: CGFloat = 2.5 + + let dependency = yAxis.axisDependency + let labelPosition = yAxis.labelPosition + + var yPos: CGFloat = 0.0 + + if dependency == .left + { + if labelPosition == .outsideChart + { + yPos = viewPortHandler.contentTop - baseYOffset + } + else + { + yPos = viewPortHandler.contentTop - baseYOffset + } + } + else + { + if labelPosition == .outsideChart + { + yPos = viewPortHandler.contentBottom + lineHeight + baseYOffset + } + else + { + yPos = viewPortHandler.contentBottom + lineHeight + baseYOffset + } + } + + // For compatibility with Android code, we keep above calculation the same, + // And here we pull the line back up + yPos -= lineHeight + + drawYLabels( + context: context, + fixedPosition: yPos, + positions: transformedPositions(), + offset: yAxis.yOffset) + } + + open override func renderAxisLine(context: CGContext) + { + guard let yAxis = axis as? YAxis else { return } + + if !yAxis.isEnabled || !yAxis.drawAxisLineEnabled + { + return + } + + context.saveGState() + + context.setStrokeColor(yAxis.axisLineColor.cgColor) + context.setLineWidth(yAxis.axisLineWidth) + if yAxis.axisLineDashLengths != nil + { + context.setLineDash(phase: yAxis.axisLineDashPhase, lengths: yAxis.axisLineDashLengths) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + if yAxis.axisDependency == .left + { + context.beginPath() + context.move(to: CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentTop)) + context.addLine(to: CGPoint(x: viewPortHandler.contentRight, y: viewPortHandler.contentTop)) + context.strokePath() + } + else + { + context.beginPath() + context.move(to: CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentBottom)) + context.addLine(to: CGPoint(x: viewPortHandler.contentRight, y: viewPortHandler.contentBottom)) + context.strokePath() } + + context.restoreGState() + } + + /// draws the y-labels on the specified x-position + @objc open func drawYLabels( + context: CGContext, + fixedPosition: CGFloat, + positions: [CGPoint], + offset: CGFloat) + { + guard let + yAxis = axis as? YAxis + else { return } + + let labelFont = yAxis.labelFont + let labelTextColor = yAxis.labelTextColor + + let from = yAxis.isDrawBottomYLabelEntryEnabled ? 0 : 1 + let to = yAxis.isDrawTopYLabelEntryEnabled ? yAxis.entryCount : (yAxis.entryCount - 1) + + for i in stride(from: from, to: to, by: 1) + { + let text = yAxis.getFormattedLabel(i) + + ChartUtils.drawText( + context: context, + text: text, + point: CGPoint(x: positions[i].x, y: fixedPosition - offset), + align: .center, + attributes: [NSAttributedString.Key.font: labelFont, NSAttributedString.Key.foregroundColor: labelTextColor]) + } + } + + open override var gridClippingRect: CGRect + { + var contentRect = viewPortHandler.contentRect + let dx = self.axis?.gridLineWidth ?? 0.0 + contentRect.origin.x -= dx / 2.0 + contentRect.size.width += dx + return contentRect + } + + open override func drawGridLine( + context: CGContext, + position: CGPoint) + { + context.beginPath() + context.move(to: CGPoint(x: position.x, y: viewPortHandler.contentTop)) + context.addLine(to: CGPoint(x: position.x, y: viewPortHandler.contentBottom)) + context.strokePath() + } + + open override func transformedPositions() -> [CGPoint] + { + guard + let yAxis = self.axis as? YAxis, + let transformer = self.transformer + else { return [CGPoint]() } + + var positions = [CGPoint]() + positions.reserveCapacity(yAxis.entryCount) + + let entries = yAxis.entries + + for i in stride(from: 0, to: yAxis.entryCount, by: 1) + { + positions.append(CGPoint(x: entries[i], y: 0.0)) + } + + transformer.pointValuesToPixel(&positions) + + return positions + } + + /// Draws the zero line at the specified position. + open override func drawZeroLine(context: CGContext) + { + guard + let yAxis = self.axis as? YAxis, + let transformer = self.transformer, + let zeroLineColor = yAxis.zeroLineColor + else { return } + + context.saveGState() + defer { context.restoreGState() } + + var clippingRect = viewPortHandler.contentRect + clippingRect.origin.x -= yAxis.zeroLineWidth / 2.0 + clippingRect.size.width += yAxis.zeroLineWidth + context.clip(to: clippingRect) + + context.setStrokeColor(zeroLineColor.cgColor) + context.setLineWidth(yAxis.zeroLineWidth) + + let pos = transformer.pixelForValues(x: 0.0, y: 0.0) + + if yAxis.zeroLineDashLengths != nil + { + context.setLineDash(phase: yAxis.zeroLineDashPhase, lengths: yAxis.zeroLineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + context.move(to: CGPoint(x: pos.x - 1.0, y: viewPortHandler.contentTop)) + context.addLine(to: CGPoint(x: pos.x - 1.0, y: viewPortHandler.contentBottom)) + context.drawPath(using: CGPathDrawingMode.stroke) + } + + private var _limitLineSegmentsBuffer = [CGPoint](repeating: CGPoint(), count: 2) + + open override func renderLimitLines(context: CGContext) + { + guard + let yAxis = axis as? YAxis, + let transformer = self.transformer + else { return } + + var limitLines = yAxis.limitLines + + if limitLines.count <= 0 + { + return + } + + context.saveGState() + + let trans = transformer.valueToPixelMatrix + + var position = CGPoint(x: 0.0, y: 0.0) + + for i in 0 ..< limitLines.count + { + let l = limitLines[i] + + if !l.isEnabled + { + continue + } + + context.saveGState() + defer { context.restoreGState() } + + var clippingRect = viewPortHandler.contentRect + clippingRect.origin.x -= l.lineWidth / 2.0 + clippingRect.size.width += l.lineWidth + context.clip(to: clippingRect) + + position.x = CGFloat(l.limit) + position.y = 0.0 + position = position.applying(trans) + + context.beginPath() + context.move(to: CGPoint(x: position.x, y: viewPortHandler.contentTop)) + context.addLine(to: CGPoint(x: position.x, y: viewPortHandler.contentBottom)) + + context.setStrokeColor(l.lineColor.cgColor) + context.setLineWidth(l.lineWidth) + if l.lineDashLengths != nil + { + context.setLineDash(phase: l.lineDashPhase, lengths: l.lineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + context.strokePath() + + let label = l.label + + // if drawing the limit-value label is enabled + if l.drawLabelEnabled && label.count > 0 + { + let labelLineHeight = l.valueFont.lineHeight + + let xOffset: CGFloat = l.lineWidth + l.xOffset + let yOffset: CGFloat = 2.0 + l.yOffset + + if l.labelPosition == .topRight + { + ChartUtils.drawText(context: context, + text: label, + point: CGPoint( + x: position.x + xOffset, + y: viewPortHandler.contentTop + yOffset), + align: .left, + attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor]) + } + else if l.labelPosition == .bottomRight + { + ChartUtils.drawText(context: context, + text: label, + point: CGPoint( + x: position.x + xOffset, + y: viewPortHandler.contentBottom - labelLineHeight - yOffset), + align: .left, + attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor]) + } + else if l.labelPosition == .topLeft + { + ChartUtils.drawText(context: context, + text: label, + point: CGPoint( + x: position.x - xOffset, + y: viewPortHandler.contentTop + yOffset), + align: .right, + attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor]) + } + else + { + ChartUtils.drawText(context: context, + text: label, + point: CGPoint( + x: position.x - xOffset, + y: viewPortHandler.contentBottom - labelLineHeight - yOffset), + align: .right, + attributes: [NSAttributedString.Key.font: l.valueFont, NSAttributedString.Key.foregroundColor: l.valueTextColor]) + } + } + } + + context.restoreGState() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift b/Carthage/Checkouts/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift new file mode 100644 index 00000000000..c98971e9049 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Renderers/YAxisRendererRadarChart.swift @@ -0,0 +1,273 @@ +// +// YAxisRendererRadarChart.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class YAxisRendererRadarChart: YAxisRenderer +{ + private weak var chart: RadarChartView? + + @objc public init(viewPortHandler: ViewPortHandler, yAxis: YAxis?, chart: RadarChartView) + { + super.init(viewPortHandler: viewPortHandler, yAxis: yAxis, transformer: nil) + + self.chart = chart + } + + open override func computeAxisValues(min yMin: Double, max yMax: Double) + { + guard let + axis = axis as? YAxis + else { return } + + let labelCount = axis.labelCount + let range = abs(yMax - yMin) + + if labelCount == 0 || range <= 0 || range.isInfinite + { + axis.entries = [Double]() + axis.centeredEntries = [Double]() + return + } + + // Find out how much spacing (in yValue space) between axis values + let rawInterval = range / Double(labelCount) + var interval = rawInterval.roundedToNextSignficant() + + // If granularity is enabled, then do not allow the interval to go below specified granularity. + // This is used to avoid repeated values when rounding values for display. + if axis.isGranularityEnabled + { + interval = interval < axis.granularity ? axis.granularity : interval + } + + // Normalize interval + let intervalMagnitude = pow(10.0, floor(log10(interval))).roundedToNextSignficant() + let intervalSigDigit = Int(interval / intervalMagnitude) + + if intervalSigDigit > 5 + { + // Use one order of magnitude higher, to avoid intervals like 0.9 or 90 + // if it's 0.0 after floor(), we use the old value + interval = floor(10.0 * intervalMagnitude) == 0.0 ? interval : floor(10.0 * intervalMagnitude) + } + + let centeringEnabled = axis.isCenterAxisLabelsEnabled + var n = centeringEnabled ? 1 : 0 + + // force label count + if axis.isForceLabelsEnabled + { + let step = Double(range) / Double(labelCount - 1) + + // Ensure stops contains at least n elements. + axis.entries.removeAll(keepingCapacity: true) + axis.entries.reserveCapacity(labelCount) + + var v = yMin + + for _ in 0 ..< labelCount + { + axis.entries.append(v) + v += step + } + + n = labelCount + } + else + { + // no forced count + + var first = interval == 0.0 ? 0.0 : ceil(yMin / interval) * interval + + if centeringEnabled + { + first -= interval + } + + let last = interval == 0.0 ? 0.0 : (floor(yMax / interval) * interval).nextUp + + if interval != 0.0 + { + for _ in stride(from: first, through: last, by: interval) + { + n += 1 + } + } + + n += 1 + + // Ensure stops contains at least n elements. + axis.entries.removeAll(keepingCapacity: true) + axis.entries.reserveCapacity(labelCount) + + var f = first + var i = 0 + while i < n + { + if f == 0.0 + { + // Fix for IEEE negative zero case (Where value == -0.0, and 0.0 == -0.0) + f = 0.0 + } + + axis.entries.append(Double(f)) + + f += interval + i += 1 + } + } + + // set decimals + if interval < 1 + { + axis.decimals = Int(ceil(-log10(interval))) + } + else + { + axis.decimals = 0 + } + + if centeringEnabled + { + axis.centeredEntries.reserveCapacity(n) + axis.centeredEntries.removeAll() + + let offset = (axis.entries[1] - axis.entries[0]) / 2.0 + + for i in 0 ..< n + { + axis.centeredEntries.append(axis.entries[i] + offset) + } + } + + axis._axisMinimum = axis.entries[0] + axis._axisMaximum = axis.entries[n-1] + axis.axisRange = abs(axis._axisMaximum - axis._axisMinimum) + } + + open override func renderAxisLabels(context: CGContext) + { + guard let + yAxis = axis as? YAxis, + let chart = chart + else { return } + + if !yAxis.isEnabled || !yAxis.isDrawLabelsEnabled + { + return + } + + let labelFont = yAxis.labelFont + let labelTextColor = yAxis.labelTextColor + + let center = chart.centerOffsets + let factor = chart.factor + + let labelLineHeight = yAxis.labelFont.lineHeight + + let from = yAxis.isDrawBottomYLabelEntryEnabled ? 0 : 1 + let to = yAxis.isDrawTopYLabelEntryEnabled ? yAxis.entryCount : (yAxis.entryCount - 1) + + let alignment: NSTextAlignment = yAxis.labelAlignment + let xOffset: CGFloat = yAxis.labelXOffset + + for j in stride(from: from, to: to, by: 1) + { + let r = CGFloat(yAxis.entries[j] - yAxis._axisMinimum) * factor + + let p = center.moving(distance: r, atAngle: chart.rotationAngle) + + let label = yAxis.getFormattedLabel(j) + + ChartUtils.drawText( + context: context, + text: label, + point: CGPoint(x: p.x + xOffset, y: p.y - labelLineHeight), + align: alignment, + attributes: [ + NSAttributedString.Key.font: labelFont, + NSAttributedString.Key.foregroundColor: labelTextColor + ]) + } + } + + open override func renderLimitLines(context: CGContext) + { + guard + let yAxis = axis as? YAxis, + let chart = chart, + let data = chart.data + else { return } + + var limitLines = yAxis.limitLines + + if limitLines.count == 0 + { + return + } + + context.saveGState() + + let sliceangle = chart.sliceAngle + + // calculate the factor that is needed for transforming the value to pixels + let factor = chart.factor + + let center = chart.centerOffsets + + for i in 0 ..< limitLines.count + { + let l = limitLines[i] + + if !l.isEnabled + { + continue + } + + context.setStrokeColor(l.lineColor.cgColor) + context.setLineWidth(l.lineWidth) + if l.lineDashLengths != nil + { + context.setLineDash(phase: l.lineDashPhase, lengths: l.lineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + let r = CGFloat(l.limit - chart.chartYMin) * factor + + context.beginPath() + + for j in 0 ..< (data.maxEntryCountSet?.entryCount ?? 0) + { + let p = center.moving(distance: r, atAngle: sliceangle * CGFloat(j) + chart.rotationAngle) + + if j == 0 + { + context.move(to: CGPoint(x: p.x, y: p.y)) + } + else + { + context.addLine(to: CGPoint(x: p.x, y: p.y)) + } + } + + context.closePath() + + context.strokePath() + } + + context.restoreGState() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Utils/ChartColorTemplates.swift b/Carthage/Checkouts/Charts/Source/Charts/Utils/ChartColorTemplates.swift new file mode 100644 index 00000000000..534f9cb8805 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Utils/ChartColorTemplates.swift @@ -0,0 +1,198 @@ +// +// ChartColorTemplates.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +open class ChartColorTemplates: NSObject +{ + @objc open class func liberty () -> [NSUIColor] + { + return [ + NSUIColor(red: 207/255.0, green: 248/255.0, blue: 246/255.0, alpha: 1.0), + NSUIColor(red: 148/255.0, green: 212/255.0, blue: 212/255.0, alpha: 1.0), + NSUIColor(red: 136/255.0, green: 180/255.0, blue: 187/255.0, alpha: 1.0), + NSUIColor(red: 118/255.0, green: 174/255.0, blue: 175/255.0, alpha: 1.0), + NSUIColor(red: 42/255.0, green: 109/255.0, blue: 130/255.0, alpha: 1.0) + ] + } + + @objc open class func joyful () -> [NSUIColor] + { + return [ + NSUIColor(red: 217/255.0, green: 80/255.0, blue: 138/255.0, alpha: 1.0), + NSUIColor(red: 254/255.0, green: 149/255.0, blue: 7/255.0, alpha: 1.0), + NSUIColor(red: 254/255.0, green: 247/255.0, blue: 120/255.0, alpha: 1.0), + NSUIColor(red: 106/255.0, green: 167/255.0, blue: 134/255.0, alpha: 1.0), + NSUIColor(red: 53/255.0, green: 194/255.0, blue: 209/255.0, alpha: 1.0) + ] + } + + @objc open class func pastel () -> [NSUIColor] + { + return [ + NSUIColor(red: 64/255.0, green: 89/255.0, blue: 128/255.0, alpha: 1.0), + NSUIColor(red: 149/255.0, green: 165/255.0, blue: 124/255.0, alpha: 1.0), + NSUIColor(red: 217/255.0, green: 184/255.0, blue: 162/255.0, alpha: 1.0), + NSUIColor(red: 191/255.0, green: 134/255.0, blue: 134/255.0, alpha: 1.0), + NSUIColor(red: 179/255.0, green: 48/255.0, blue: 80/255.0, alpha: 1.0) + ] + } + + @objc open class func colorful () -> [NSUIColor] + { + return [ + NSUIColor(red: 193/255.0, green: 37/255.0, blue: 82/255.0, alpha: 1.0), + NSUIColor(red: 255/255.0, green: 102/255.0, blue: 0/255.0, alpha: 1.0), + NSUIColor(red: 245/255.0, green: 199/255.0, blue: 0/255.0, alpha: 1.0), + NSUIColor(red: 106/255.0, green: 150/255.0, blue: 31/255.0, alpha: 1.0), + NSUIColor(red: 179/255.0, green: 100/255.0, blue: 53/255.0, alpha: 1.0) + ] + } + + @objc open class func vordiplom () -> [NSUIColor] + { + return [ + NSUIColor(red: 192/255.0, green: 255/255.0, blue: 140/255.0, alpha: 1.0), + NSUIColor(red: 255/255.0, green: 247/255.0, blue: 140/255.0, alpha: 1.0), + NSUIColor(red: 255/255.0, green: 208/255.0, blue: 140/255.0, alpha: 1.0), + NSUIColor(red: 140/255.0, green: 234/255.0, blue: 255/255.0, alpha: 1.0), + NSUIColor(red: 255/255.0, green: 140/255.0, blue: 157/255.0, alpha: 1.0) + ] + } + + @objc open class func material () -> [NSUIColor] + { + return [ + NSUIColor(red: 46/255.0, green: 204/255.0, blue: 113/255.0, alpha: 1.0), + NSUIColor(red: 241/255.0, green: 196/255.0, blue: 15/255.0, alpha: 1.0), + NSUIColor(red: 231/255.0, green: 76/255.0, blue: 60/255.0, alpha: 1.0), + NSUIColor(red: 52/255.0, green: 152/255.0, blue: 219/255.0, alpha: 1.0) + ] + } + + @objc open class func colorFromString(_ colorString: String) -> NSUIColor + { + let leftParenCharset: CharacterSet = CharacterSet(charactersIn: "( ") + let commaCharset: CharacterSet = CharacterSet(charactersIn: ", ") + + let colorString = colorString.lowercased() + + if colorString.hasPrefix("#") + { + var argb: [UInt] = [255, 0, 0, 0] + let colorString = colorString.unicodeScalars + var length = colorString.count + var index = colorString.startIndex + let endIndex = colorString.endIndex + + index = colorString.index(after: index) + length = length - 1 + + if length == 3 || length == 6 || length == 8 + { + var i = length == 8 ? 0 : 1 + while index < endIndex + { + var c = colorString[index] + index = colorString.index(after: index) + + var val = (c.value >= 0x61 && c.value <= 0x66) ? (c.value - 0x61 + 10) : c.value - 0x30 + argb[i] = UInt(val) * 16 + if length == 3 + { + argb[i] = argb[i] + UInt(val) + } + else + { + c = colorString[index] + index = colorString.index(after: index) + + val = (c.value >= 0x61 && c.value <= 0x66) ? (c.value - 0x61 + 10) : c.value - 0x30 + argb[i] = argb[i] + UInt(val) + } + + i += 1 + } + } + + return NSUIColor(red: CGFloat(argb[1]) / 255.0, green: CGFloat(argb[2]) / 255.0, blue: CGFloat(argb[3]) / 255.0, alpha: CGFloat(argb[0]) / 255.0) + } + else if colorString.hasPrefix("rgba") + { + var a: Float = 1.0 + var r: Int32 = 0 + var g: Int32 = 0 + var b: Int32 = 0 + let scanner: Scanner = Scanner(string: colorString) + scanner.scanString("rgba", into: nil) + scanner.scanCharacters(from: leftParenCharset, into: nil) + scanner.scanInt32(&r) + scanner.scanCharacters(from: commaCharset, into: nil) + scanner.scanInt32(&g) + scanner.scanCharacters(from: commaCharset, into: nil) + scanner.scanInt32(&b) + scanner.scanCharacters(from: commaCharset, into: nil) + scanner.scanFloat(&a) + return NSUIColor( + red: CGFloat(r) / 255.0, + green: CGFloat(g) / 255.0, + blue: CGFloat(b) / 255.0, + alpha: CGFloat(a) + ) + } + else if colorString.hasPrefix("argb") + { + var a: Float = 1.0 + var r: Int32 = 0 + var g: Int32 = 0 + var b: Int32 = 0 + let scanner: Scanner = Scanner(string: colorString) + scanner.scanString("argb", into: nil) + scanner.scanCharacters(from: leftParenCharset, into: nil) + scanner.scanFloat(&a) + scanner.scanCharacters(from: commaCharset, into: nil) + scanner.scanInt32(&r) + scanner.scanCharacters(from: commaCharset, into: nil) + scanner.scanInt32(&g) + scanner.scanCharacters(from: commaCharset, into: nil) + scanner.scanInt32(&b) + return NSUIColor( + red: CGFloat(r) / 255.0, + green: CGFloat(g) / 255.0, + blue: CGFloat(b) / 255.0, + alpha: CGFloat(a) + ) + } + else if colorString.hasPrefix("rgb") + { + var r: Int32 = 0 + var g: Int32 = 0 + var b: Int32 = 0 + let scanner: Scanner = Scanner(string: colorString) + scanner.scanString("rgb", into: nil) + scanner.scanCharacters(from: leftParenCharset, into: nil) + scanner.scanInt32(&r) + scanner.scanCharacters(from: commaCharset, into: nil) + scanner.scanInt32(&g) + scanner.scanCharacters(from: commaCharset, into: nil) + scanner.scanInt32(&b) + return NSUIColor( + red: CGFloat(r) / 255.0, + green: CGFloat(g) / 255.0, + blue: CGFloat(b) / 255.0, + alpha: 1.0 + ) + } + + return NSUIColor.clear + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Utils/ChartUtils.swift b/Carthage/Checkouts/Charts/Source/Charts/Utils/ChartUtils.swift new file mode 100644 index 00000000000..25ccfde3db3 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Utils/ChartUtils.swift @@ -0,0 +1,296 @@ +// +// Utils.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +extension Comparable { + func clamped(to range: ClosedRange) -> Self { + if self > range.upperBound { + return range.upperBound + } else if self < range.lowerBound { + return range.lowerBound + } else { + return self + } + } +} + +extension FloatingPoint +{ + var DEG2RAD: Self + { + return self * .pi / 180 + } + + var RAD2DEG: Self + { + return self * 180 / .pi + } + + /// - Note: Value must be in degrees + /// - Returns: An angle between 0.0 < 360.0 (not less than zero, less than 360) + var normalizedAngle: Self + { + let angle = truncatingRemainder(dividingBy: 360) + return (sign == .minus) ? angle + 360 : angle + } +} + +extension CGSize +{ + func rotatedBy(degrees: CGFloat) -> CGSize + { + let radians = degrees.DEG2RAD + return rotatedBy(radians: radians) + } + + func rotatedBy(radians: CGFloat) -> CGSize + { + return CGSize( + width: abs(width * cos(radians)) + abs(height * sin(radians)), + height: abs(width * sin(radians)) + abs(height * cos(radians)) + ) + } +} + +extension Double +{ + /// Rounds the number to the nearest multiple of it's order of magnitude, rounding away from zero if halfway. + func roundedToNextSignficant() -> Double + { + guard + !isInfinite, + !isNaN, + self != 0 + else { return self } + + let d = ceil(log10(self < 0 ? -self : self)) + let pw = 1 - Int(d) + let magnitude = pow(10.0, Double(pw)) + let shifted = (self * magnitude).rounded() + return shifted / magnitude + } + + var decimalPlaces: Int + { + guard + !isNaN, + !isInfinite, + self != 0.0 + else { return 0 } + + let i = self.roundedToNextSignficant() + + guard + !i.isInfinite, + !i.isNaN + else { return 0 } + + return Int(ceil(-log10(i))) + 2 + } +} + +extension CGPoint +{ + /// Calculates the position around a center point, depending on the distance from the center, and the angle of the position around the center. + func moving(distance: CGFloat, atAngle angle: CGFloat) -> CGPoint + { + return CGPoint(x: x + distance * cos(angle.DEG2RAD), + y: y + distance * sin(angle.DEG2RAD)) + } +} + +open class ChartUtils +{ + private static var _defaultValueFormatter: IValueFormatter = ChartUtils.generateDefaultValueFormatter() + + open class func drawImage( + context: CGContext, + image: NSUIImage, + x: CGFloat, + y: CGFloat, + size: CGSize) + { + var drawOffset = CGPoint() + drawOffset.x = x - (size.width / 2) + drawOffset.y = y - (size.height / 2) + + NSUIGraphicsPushContext(context) + + if image.size.width != size.width && image.size.height != size.height + { + let key = "resized_\(size.width)_\(size.height)" + + // Try to take scaled image from cache of this image + var scaledImage = objc_getAssociatedObject(image, key) as? NSUIImage + if scaledImage == nil + { + // Scale the image + NSUIGraphicsBeginImageContextWithOptions(size, false, 0.0) + + image.draw(in: CGRect(origin: CGPoint(x: 0, y: 0), size: size)) + + scaledImage = NSUIGraphicsGetImageFromCurrentImageContext() + NSUIGraphicsEndImageContext() + + // Put the scaled image in a cache owned by the original image + objc_setAssociatedObject(image, key, scaledImage, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) + } + + scaledImage?.draw(in: CGRect(origin: drawOffset, size: size)) + } + else + { + image.draw(in: CGRect(origin: drawOffset, size: size)) + } + + NSUIGraphicsPopContext() + } + + open class func drawText(context: CGContext, text: String, point: CGPoint, align: NSTextAlignment, attributes: [NSAttributedString.Key : Any]?) + { + var point = point + + if align == .center + { + point.x -= text.size(withAttributes: attributes).width / 2.0 + } + else if align == .right + { + point.x -= text.size(withAttributes: attributes).width + } + + NSUIGraphicsPushContext(context) + + (text as NSString).draw(at: point, withAttributes: attributes) + + NSUIGraphicsPopContext() + } + + open class func drawText(context: CGContext, text: String, point: CGPoint, attributes: [NSAttributedString.Key : Any]?, anchor: CGPoint, angleRadians: CGFloat) + { + var drawOffset = CGPoint() + + NSUIGraphicsPushContext(context) + + if angleRadians != 0.0 + { + let size = text.size(withAttributes: attributes) + + // Move the text drawing rect in a way that it always rotates around its center + drawOffset.x = -size.width * 0.5 + drawOffset.y = -size.height * 0.5 + + var translate = point + + // Move the "outer" rect relative to the anchor, assuming its centered + if anchor.x != 0.5 || anchor.y != 0.5 + { + let rotatedSize = size.rotatedBy(radians: angleRadians) + + translate.x -= rotatedSize.width * (anchor.x - 0.5) + translate.y -= rotatedSize.height * (anchor.y - 0.5) + } + + context.saveGState() + context.translateBy(x: translate.x, y: translate.y) + context.rotate(by: angleRadians) + + (text as NSString).draw(at: drawOffset, withAttributes: attributes) + + context.restoreGState() + } + else + { + if anchor.x != 0.0 || anchor.y != 0.0 + { + let size = text.size(withAttributes: attributes) + + drawOffset.x = -size.width * anchor.x + drawOffset.y = -size.height * anchor.y + } + + drawOffset.x += point.x + drawOffset.y += point.y + + (text as NSString).draw(at: drawOffset, withAttributes: attributes) + } + + NSUIGraphicsPopContext() + } + + internal class func drawMultilineText(context: CGContext, text: String, knownTextSize: CGSize, point: CGPoint, attributes: [NSAttributedString.Key : Any]?, constrainedToSize: CGSize, anchor: CGPoint, angleRadians: CGFloat) + { + var rect = CGRect(origin: CGPoint(), size: knownTextSize) + + NSUIGraphicsPushContext(context) + + if angleRadians != 0.0 + { + // Move the text drawing rect in a way that it always rotates around its center + rect.origin.x = -knownTextSize.width * 0.5 + rect.origin.y = -knownTextSize.height * 0.5 + + var translate = point + + // Move the "outer" rect relative to the anchor, assuming its centered + if anchor.x != 0.5 || anchor.y != 0.5 + { + let rotatedSize = knownTextSize.rotatedBy(radians: angleRadians) + + translate.x -= rotatedSize.width * (anchor.x - 0.5) + translate.y -= rotatedSize.height * (anchor.y - 0.5) + } + + context.saveGState() + context.translateBy(x: translate.x, y: translate.y) + context.rotate(by: angleRadians) + + (text as NSString).draw(with: rect, options: .usesLineFragmentOrigin, attributes: attributes, context: nil) + + context.restoreGState() + } + else + { + if anchor.x != 0.0 || anchor.y != 0.0 + { + rect.origin.x = -knownTextSize.width * anchor.x + rect.origin.y = -knownTextSize.height * anchor.y + } + + rect.origin.x += point.x + rect.origin.y += point.y + + (text as NSString).draw(with: rect, options: .usesLineFragmentOrigin, attributes: attributes, context: nil) + } + + NSUIGraphicsPopContext() + } + + internal class func drawMultilineText(context: CGContext, text: String, point: CGPoint, attributes: [NSAttributedString.Key : Any]?, constrainedToSize: CGSize, anchor: CGPoint, angleRadians: CGFloat) + { + let rect = text.boundingRect(with: constrainedToSize, options: .usesLineFragmentOrigin, attributes: attributes, context: nil) + drawMultilineText(context: context, text: text, knownTextSize: rect.size, point: point, attributes: attributes, constrainedToSize: constrainedToSize, anchor: anchor, angleRadians: angleRadians) + } + + private class func generateDefaultValueFormatter() -> IValueFormatter + { + let formatter = DefaultValueFormatter(decimals: 1) + return formatter + } + + /// - Returns: The default value formatter used for all chart components that needs a default + open class func defaultValueFormatter() -> IValueFormatter + { + return _defaultValueFormatter + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Utils/Fill.swift b/Carthage/Checkouts/Charts/Source/Charts/Utils/Fill.swift new file mode 100644 index 00000000000..1294b3efc0f --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Utils/Fill.swift @@ -0,0 +1,323 @@ +// +// Fill.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartFillType) +public enum FillType: Int +{ + case empty + case color + case linearGradient + case radialGradient + case image + case tiledImage + case layer +} + +@objc(ChartFill) +open class Fill: NSObject +{ + private var _type: FillType = FillType.empty + private var _color: CGColor? + private var _gradient: CGGradient? + private var _gradientAngle: CGFloat = 0.0 + private var _gradientStartOffsetPercent: CGPoint = CGPoint() + private var _gradientStartRadiusPercent: CGFloat = 0.0 + private var _gradientEndOffsetPercent: CGPoint = CGPoint() + private var _gradientEndRadiusPercent: CGFloat = 0.0 + private var _image: CGImage? + private var _layer: CGLayer? + + // MARK: Properties + + @objc open var type: FillType + { + return _type + } + + @objc open var color: CGColor? + { + return _color + } + + @objc open var gradient: CGGradient? + { + return _gradient + } + + @objc open var gradientAngle: CGFloat + { + return _gradientAngle + } + + @objc open var gradientStartOffsetPercent: CGPoint + { + return _gradientStartOffsetPercent + } + + @objc open var gradientStartRadiusPercent: CGFloat + { + return _gradientStartRadiusPercent + } + + @objc open var gradientEndOffsetPercent: CGPoint + { + return _gradientEndOffsetPercent + } + + @objc open var gradientEndRadiusPercent: CGFloat + { + return _gradientEndRadiusPercent + } + + @objc open var image: CGImage? + { + return _image + } + + @objc open var layer: CGLayer? + { + return _layer + } + + // MARK: Constructors + + public override init() + { + } + + @objc public init(CGColor: CGColor) + { + _type = .color + _color = CGColor + } + + @objc public convenience init(color: NSUIColor) + { + self.init(CGColor: color.cgColor) + } + + @objc public init(linearGradient: CGGradient, angle: CGFloat) + { + _type = .linearGradient + _gradient = linearGradient + _gradientAngle = angle + } + + @objc public init( + radialGradient: CGGradient, + startOffsetPercent: CGPoint, + startRadiusPercent: CGFloat, + endOffsetPercent: CGPoint, + endRadiusPercent: CGFloat + ) + { + _type = .radialGradient + _gradient = radialGradient + _gradientStartOffsetPercent = startOffsetPercent + _gradientStartRadiusPercent = startRadiusPercent + _gradientEndOffsetPercent = endOffsetPercent + _gradientEndRadiusPercent = endRadiusPercent + } + + @objc public convenience init(radialGradient: CGGradient) + { + self.init( + radialGradient: radialGradient, + startOffsetPercent: CGPoint(x: 0.0, y: 0.0), + startRadiusPercent: 0.0, + endOffsetPercent: CGPoint(x: 0.0, y: 0.0), + endRadiusPercent: 1.0 + ) + } + + @objc public init(CGImage: CGImage, tiled: Bool) + { + _type = tiled ? .tiledImage : .image + _image = CGImage + } + + @objc public convenience init(image: NSUIImage, tiled: Bool) + { + self.init(CGImage: image.cgImage!, tiled: tiled) + } + + @objc public convenience init(CGImage: CGImage) + { + self.init(CGImage: CGImage, tiled: false) + } + + @objc public convenience init(image: NSUIImage) + { + self.init(image: image, tiled: false) + } + + @objc public init(CGLayer: CGLayer) + { + _type = .layer + _layer = CGLayer + } + + // MARK: Constructors + + @objc open class func fillWithCGColor(_ CGColor: CGColor) -> Fill + { + return Fill(CGColor: CGColor) + } + + @objc open class func fillWithColor(_ color: NSUIColor) -> Fill + { + return Fill(color: color) + } + + @objc open class func fillWithLinearGradient( + _ linearGradient: CGGradient, + angle: CGFloat) -> Fill + { + return Fill(linearGradient: linearGradient, angle: angle) + } + + @objc open class func fillWithRadialGradient( + _ radialGradient: CGGradient, + startOffsetPercent: CGPoint, + startRadiusPercent: CGFloat, + endOffsetPercent: CGPoint, + endRadiusPercent: CGFloat + ) -> Fill + { + return Fill( + radialGradient: radialGradient, + startOffsetPercent: startOffsetPercent, + startRadiusPercent: startRadiusPercent, + endOffsetPercent: endOffsetPercent, + endRadiusPercent: endRadiusPercent + ) + } + + @objc open class func fillWithRadialGradient(_ radialGradient: CGGradient) -> Fill + { + return Fill(radialGradient: radialGradient) + } + + @objc open class func fillWithCGImage(_ CGImage: CGImage, tiled: Bool) -> Fill + { + return Fill(CGImage: CGImage, tiled: tiled) + } + + @objc open class func fillWithImage(_ image: NSUIImage, tiled: Bool) -> Fill + { + return Fill(image: image, tiled: tiled) + } + + @objc open class func fillWithCGImage(_ CGImage: CGImage) -> Fill + { + return Fill(CGImage: CGImage) + } + + @objc open class func fillWithImage(_ image: NSUIImage) -> Fill + { + return Fill(image: image) + } + + @objc open class func fillWithCGLayer(_ CGLayer: CGLayer) -> Fill + { + return Fill(CGLayer: CGLayer) + } + + // MARK: Drawing code + + /// Draws the provided path in filled mode with the provided area + @objc open func fillPath( + context: CGContext, + rect: CGRect) + { + let fillType = _type + if fillType == .empty + { + return + } + + context.saveGState() + + switch fillType + { + case .color: + + context.setFillColor(_color!) + context.fillPath() + + case .image: + + context.clip() + context.draw(_image!, in: rect) + + case .tiledImage: + + context.clip() + context.draw(_image!, in: rect, byTiling: true) + + case .layer: + + context.clip() + context.draw(_layer!, in: rect) + + case .linearGradient: + + let radians = (360.0 - _gradientAngle).DEG2RAD + let centerPoint = CGPoint(x: rect.midX, y: rect.midY) + let xAngleDelta = cos(radians) * rect.width / 2.0 + let yAngleDelta = sin(radians) * rect.height / 2.0 + let startPoint = CGPoint( + x: centerPoint.x - xAngleDelta, + y: centerPoint.y - yAngleDelta + ) + let endPoint = CGPoint( + x: centerPoint.x + xAngleDelta, + y: centerPoint.y + yAngleDelta + ) + + context.clip() + context.drawLinearGradient(_gradient!, + start: startPoint, + end: endPoint, + options: [.drawsAfterEndLocation, .drawsBeforeStartLocation] + ) + + case .radialGradient: + + let centerPoint = CGPoint(x: rect.midX, y: rect.midY) + let radius = max(rect.width, rect.height) / 2.0 + + context.clip() + context.drawRadialGradient(_gradient!, + startCenter: CGPoint( + x: centerPoint.x + rect.width * _gradientStartOffsetPercent.x, + y: centerPoint.y + rect.height * _gradientStartOffsetPercent.y + ), + startRadius: radius * _gradientStartRadiusPercent, + endCenter: CGPoint( + x: centerPoint.x + rect.width * _gradientEndOffsetPercent.x, + y: centerPoint.y + rect.height * _gradientEndOffsetPercent.y + ), + endRadius: radius * _gradientEndRadiusPercent, + options: [.drawsAfterEndLocation, .drawsBeforeStartLocation] + ) + + case .empty: + break + } + + context.restoreGState() + } + +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Utils/Platform+Accessibility.swift b/Carthage/Checkouts/Charts/Source/Charts/Utils/Platform+Accessibility.swift new file mode 100644 index 00000000000..35f4ee317cc --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Utils/Platform+Accessibility.swift @@ -0,0 +1,197 @@ +import Foundation + +#if os(iOS) || os(tvOS) + +internal func accessibilityPostLayoutChangedNotification(withElement element: Any? = nil) +{ + UIAccessibility.post(notification: UIAccessibility.Notification.layoutChanged, argument: element) +} + +internal func accessibilityPostScreenChangedNotification(withElement element: Any? = nil) +{ + UIAccessibility.post(notification: UIAccessibility.Notification.screenChanged, argument: element) +} + +/// A simple abstraction over UIAccessibilityElement and NSAccessibilityElement. +open class NSUIAccessibilityElement: UIAccessibilityElement +{ + private weak var containerView: UIView? + + final var isHeader: Bool = false + { + didSet + { + accessibilityTraits = isHeader ? UIAccessibilityTraits.header : UIAccessibilityTraits.none + } + } + + final var isSelected: Bool = false + { + didSet + { + accessibilityTraits = isSelected ? UIAccessibilityTraits.selected : UIAccessibilityTraits.none + } + } + + override public init(accessibilityContainer container: Any) + { + // We can force unwrap since all chart views are subclasses of UIView + containerView = (container as! UIView) + super.init(accessibilityContainer: container) + } + + override open var accessibilityFrame: CGRect + { + get + { + return super.accessibilityFrame + } + + set + { + guard let containerView = containerView else { return } + super.accessibilityFrame = containerView.convert(newValue, to: UIScreen.main.coordinateSpace) + } + } +} + +extension NSUIView +{ + /// An array of accessibilityElements that is used to implement UIAccessibilityContainer internally. + /// Subclasses **MUST** override this with an array of such elements. + @objc open func accessibilityChildren() -> [Any]? + { + return nil + } + + public final override var isAccessibilityElement: Bool + { + get { return false } // Return false here, so we can make individual elements accessible + set { } + } + + open override func accessibilityElementCount() -> Int + { + return accessibilityChildren()?.count ?? 0 + } + + open override func accessibilityElement(at index: Int) -> Any? + { + return accessibilityChildren()?[index] + } + + open override func index(ofAccessibilityElement element: Any) -> Int + { + guard let axElement = element as? NSUIAccessibilityElement else { return NSNotFound } + return (accessibilityChildren() as? [NSUIAccessibilityElement])? + .firstIndex(of: axElement) ?? NSNotFound + } +} + +#endif + +#if os(OSX) + +internal func accessibilityPostLayoutChangedNotification(withElement element: Any? = nil) +{ + guard let validElement = element else { return } + NSAccessibility.post(element: validElement, notification: .layoutChanged) +} + +internal func accessibilityPostScreenChangedNotification(withElement element: Any? = nil) +{ + // Placeholder +} + +/// A simple abstraction over UIAccessibilityElement and NSAccessibilityElement. +open class NSUIAccessibilityElement: NSAccessibilityElement +{ + private weak var containerView: NSView? + + final var isHeader: Bool = false + { + didSet + { + setAccessibilityRole(isHeader ? .staticText : .none) + } + } + + final var isSelected: Bool = false + { + didSet + { + setAccessibilitySelected(isSelected) + } + } + + open var accessibilityLabel: String + { + get + { + return accessibilityLabel() ?? "" + } + + set + { + setAccessibilityLabel(newValue) + } + } + + open var accessibilityFrame: NSRect + { + get + { + return accessibilityFrame() + } + + set + { + guard let containerView = containerView else { return } + + let bounds = NSAccessibility.screenRect(fromView: containerView, rect: newValue) + + // This works, but won't auto update if the window is resized or moved. + // setAccessibilityFrame(bounds) + + // using FrameInParentSpace allows for automatic updating of frame when windows are moved and resized. + // However, there seems to be a bug right now where using it causes an offset in the frame. + // This is a slightly hacky workaround that calculates the offset and removes it from frame calculation. + setAccessibilityFrameInParentSpace(bounds) + let axFrame = accessibilityFrame() + let widthOffset = abs(axFrame.origin.x - bounds.origin.x) + let heightOffset = abs(axFrame.origin.y - bounds.origin.y) + let rect = NSRect(x: bounds.origin.x - widthOffset, + y: bounds.origin.y - heightOffset, + width: bounds.width, + height: bounds.height) + setAccessibilityFrameInParentSpace(rect) + } + } + + public init(accessibilityContainer container: Any) + { + // We can force unwrap since all chart views are subclasses of NSView + containerView = (container as! NSView) + + super.init() + + setAccessibilityParent(containerView) + setAccessibilityRole(.row) + } +} + +/// - Note: setAccessibilityRole(.list) is called at init. See Platform.swift. +extension NSUIView: NSAccessibilityGroup +{ + open override func accessibilityLabel() -> String? + { + return "Chart View" + } + + open override func accessibilityRows() -> [Any]? + { + return accessibilityChildren() + } +} + +#endif diff --git a/Carthage/Checkouts/Charts/Source/Charts/Utils/Platform.swift b/Carthage/Checkouts/Charts/Source/Charts/Utils/Platform.swift new file mode 100644 index 00000000000..3c11b32a4a4 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Utils/Platform.swift @@ -0,0 +1,629 @@ +import Foundation + +/** This file provides a thin abstraction layer atop of UIKit (iOS, tvOS) and Cocoa (OS X). The two APIs are very much + alike, and for the chart library's usage of the APIs it is often sufficient to typealias one to the other. The NSUI* + types are aliased to either their UI* implementation (on iOS) or their NS* implementation (on OS X). */ +#if os(iOS) || os(tvOS) +import UIKit + +public typealias NSUIFont = UIFont +public typealias NSUIColor = UIColor +public typealias NSUIEvent = UIEvent +public typealias NSUITouch = UITouch +public typealias NSUIImage = UIImage +public typealias NSUIScrollView = UIScrollView +public typealias NSUIGestureRecognizer = UIGestureRecognizer +public typealias NSUIGestureRecognizerState = UIGestureRecognizer.State +public typealias NSUIGestureRecognizerDelegate = UIGestureRecognizerDelegate +public typealias NSUITapGestureRecognizer = UITapGestureRecognizer +public typealias NSUIPanGestureRecognizer = UIPanGestureRecognizer +#if !os(tvOS) +public typealias NSUIPinchGestureRecognizer = UIPinchGestureRecognizer +public typealias NSUIRotationGestureRecognizer = UIRotationGestureRecognizer +#endif +public typealias NSUIScreen = UIScreen + +public typealias NSUIDisplayLink = CADisplayLink + +extension NSUITapGestureRecognizer +{ + @objc final func nsuiNumberOfTouches() -> Int + { + return numberOfTouches + } + + @objc final var nsuiNumberOfTapsRequired: Int + { + get + { + return self.numberOfTapsRequired + } + set + { + self.numberOfTapsRequired = newValue + } + } +} + +extension NSUIPanGestureRecognizer +{ + @objc final func nsuiNumberOfTouches() -> Int + { + return numberOfTouches + } + + @objc final func nsuiLocationOfTouch(_ touch: Int, inView: UIView?) -> CGPoint + { + return super.location(ofTouch: touch, in: inView) + } +} + +#if !os(tvOS) +extension NSUIRotationGestureRecognizer +{ + @objc final var nsuiRotation: CGFloat + { + get { return rotation } + set { rotation = newValue } + } +} +#endif + +#if !os(tvOS) +extension NSUIPinchGestureRecognizer +{ + @objc final var nsuiScale: CGFloat + { + get + { + return scale + } + set + { + scale = newValue + } + } + + @objc final func nsuiLocationOfTouch(_ touch: Int, inView: UIView?) -> CGPoint + { + return super.location(ofTouch: touch, in: inView) + } +} +#endif + +open class NSUIView: UIView +{ + public final override func touchesBegan(_ touches: Set, with event: NSUIEvent?) + { + self.nsuiTouchesBegan(touches, withEvent: event) + } + + public final override func touchesMoved(_ touches: Set, with event: NSUIEvent?) + { + self.nsuiTouchesMoved(touches, withEvent: event) + } + + public final override func touchesEnded(_ touches: Set, with event: NSUIEvent?) + { + self.nsuiTouchesEnded(touches, withEvent: event) + } + + public final override func touchesCancelled(_ touches: Set, with event: NSUIEvent?) + { + self.nsuiTouchesCancelled(touches, withEvent: event) + } + + @objc open func nsuiTouchesBegan(_ touches: Set, withEvent event: NSUIEvent?) + { + super.touchesBegan(touches, with: event!) + } + + @objc open func nsuiTouchesMoved(_ touches: Set, withEvent event: NSUIEvent?) + { + super.touchesMoved(touches, with: event!) + } + + @objc open func nsuiTouchesEnded(_ touches: Set, withEvent event: NSUIEvent?) + { + super.touchesEnded(touches, with: event!) + } + + @objc open func nsuiTouchesCancelled(_ touches: Set?, withEvent event: NSUIEvent?) + { + super.touchesCancelled(touches!, with: event!) + } + + @objc var nsuiLayer: CALayer? + { + return self.layer + } +} + +extension UIView +{ + @objc final var nsuiGestureRecognizers: [NSUIGestureRecognizer]? + { + return self.gestureRecognizers + } +} + +extension UIScrollView +{ + @objc var nsuiIsScrollEnabled: Bool + { + get { return isScrollEnabled } + set { isScrollEnabled = newValue } + } +} + +extension UIScreen +{ + @objc final var nsuiScale: CGFloat + { + return self.scale + } +} + +func NSUIGraphicsGetCurrentContext() -> CGContext? +{ + return UIGraphicsGetCurrentContext() +} + +func NSUIGraphicsGetImageFromCurrentImageContext() -> NSUIImage! +{ + return UIGraphicsGetImageFromCurrentImageContext() +} + +func NSUIGraphicsPushContext(_ context: CGContext) +{ + UIGraphicsPushContext(context) +} + +func NSUIGraphicsPopContext() +{ + UIGraphicsPopContext() +} + +func NSUIGraphicsEndImageContext() +{ + UIGraphicsEndImageContext() +} + +func NSUIImagePNGRepresentation(_ image: NSUIImage) -> Data? +{ + return image.pngData() +} + +func NSUIImageJPEGRepresentation(_ image: NSUIImage, _ quality: CGFloat = 0.8) -> Data? +{ + return image.jpegData(compressionQuality: quality) +} + +func NSUIMainScreen() -> NSUIScreen? +{ + return NSUIScreen.main +} + +func NSUIGraphicsBeginImageContextWithOptions(_ size: CGSize, _ opaque: Bool, _ scale: CGFloat) +{ + UIGraphicsBeginImageContextWithOptions(size, opaque, scale) +} + +#endif + +#if os(OSX) +import Cocoa +import Quartz + +public typealias NSUIFont = NSFont +public typealias NSUIColor = NSColor +public typealias NSUIEvent = NSEvent +public typealias NSUITouch = NSTouch +public typealias NSUIImage = NSImage +public typealias NSUIScrollView = NSScrollView +public typealias NSUIGestureRecognizer = NSGestureRecognizer +public typealias NSUIGestureRecognizerState = NSGestureRecognizer.State +public typealias NSUIGestureRecognizerDelegate = NSGestureRecognizerDelegate +public typealias NSUITapGestureRecognizer = NSClickGestureRecognizer +public typealias NSUIPanGestureRecognizer = NSPanGestureRecognizer +public typealias NSUIPinchGestureRecognizer = NSMagnificationGestureRecognizer +public typealias NSUIRotationGestureRecognizer = NSRotationGestureRecognizer +public typealias NSUIScreen = NSScreen + +/** On OS X there is no CADisplayLink. Use a 60 fps timer to render the animations. */ +public class NSUIDisplayLink +{ + private var timer: Timer? + private var displayLink: CVDisplayLink? + private var _timestamp: CFTimeInterval = 0.0 + + private weak var _target: AnyObject? + private var _selector: Selector + + public var timestamp: CFTimeInterval + { + return _timestamp + } + + init(target: Any, selector: Selector) + { + _target = target as AnyObject + _selector = selector + + if CVDisplayLinkCreateWithActiveCGDisplays(&displayLink) == kCVReturnSuccess + { + + CVDisplayLinkSetOutputCallback(displayLink!, { (displayLink, inNow, inOutputTime, flagsIn, flagsOut, userData) -> CVReturn in + + let _self = unsafeBitCast(userData, to: NSUIDisplayLink.self) + + _self._timestamp = CFAbsoluteTimeGetCurrent() + _self._target?.performSelector(onMainThread: _self._selector, with: _self, waitUntilDone: false) + + return kCVReturnSuccess + }, Unmanaged.passUnretained(self).toOpaque()) + } + else + { + timer = Timer(timeInterval: 1.0 / 60.0, target: target, selector: selector, userInfo: nil, repeats: true) + } + } + + deinit + { + stop() + } + + open func add(to runloop: RunLoop, forMode mode: RunLoop.Mode) + { + if displayLink != nil + { + CVDisplayLinkStart(displayLink!) + } + else if timer != nil + { + runloop.add(timer!, forMode: mode) + } + } + + open func remove(from: RunLoop, forMode: RunLoop.Mode) + { + stop() + } + + private func stop() + { + if displayLink != nil + { + CVDisplayLinkStop(displayLink!) + } + if timer != nil + { + timer?.invalidate() + } + } +} + +/** The 'tap' gesture is mapped to clicks. */ +extension NSUITapGestureRecognizer +{ + final func nsuiNumberOfTouches() -> Int + { + return 1 + } + + final var nsuiNumberOfTapsRequired: Int + { + get + { + return self.numberOfClicksRequired + } + set + { + self.numberOfClicksRequired = newValue + } + } +} + +extension NSUIPanGestureRecognizer +{ + final func nsuiNumberOfTouches() -> Int + { + return 1 + } + + /// FIXME: Currently there are no more than 1 touch in OSX gestures, and not way to create custom touch gestures. + final func nsuiLocationOfTouch(_ touch: Int, inView: NSView?) -> NSPoint + { + return super.location(in: inView) + } +} + +extension NSUIRotationGestureRecognizer +{ + /// FIXME: Currently there are no velocities in OSX gestures, and not way to create custom touch gestures. + final var velocity: CGFloat + { + return 0.1 + } + + final var nsuiRotation: CGFloat + { + get { return -rotation } + set { rotation = -newValue } + } +} + +extension NSUIPinchGestureRecognizer +{ + final var nsuiScale: CGFloat + { + get + { + return magnification + 1.0 + } + set + { + magnification = newValue - 1.0 + } + } + + /// FIXME: Currently there are no more than 1 touch in OSX gestures, and not way to create custom touch gestures. + final func nsuiLocationOfTouch(_ touch: Int, inView view: NSView?) -> NSPoint + { + return super.location(in: view) + } +} + +extension NSView +{ + final var nsuiGestureRecognizers: [NSGestureRecognizer]? + { + return self.gestureRecognizers + } +} + +extension NSScrollView +{ + var nsuiIsScrollEnabled: Bool + { + get { return scrollEnabled } + set { scrollEnabled = newValue } + } +} + +open class NSUIView: NSView +{ + /// A private constant to set the accessibility role during initialization. + /// It ensures parity with the iOS element ordering as well as numbered counts of chart components. + /// (See Platform+Accessibility for details) + private let role: NSAccessibility.Role = .list + + public override init(frame frameRect: NSRect) + { + super.init(frame: frameRect) + setAccessibilityRole(role) + } + + required public init?(coder decoder: NSCoder) + { + super.init(coder: decoder) + setAccessibilityRole(role) + } + + public final override var isFlipped: Bool + { + return true + } + + func setNeedsDisplay() + { + self.setNeedsDisplay(self.bounds) + } + + public final override func touchesBegan(with event: NSEvent) + { + self.nsuiTouchesBegan(event.touches(matching: .any, in: self), withEvent: event) + } + + public final override func touchesEnded(with event: NSEvent) + { + self.nsuiTouchesEnded(event.touches(matching: .any, in: self), withEvent: event) + } + + public final override func touchesMoved(with event: NSEvent) + { + self.nsuiTouchesMoved(event.touches(matching: .any, in: self), withEvent: event) + } + + open override func touchesCancelled(with event: NSEvent) + { + self.nsuiTouchesCancelled(event.touches(matching: .any, in: self), withEvent: event) + } + + open func nsuiTouchesBegan(_ touches: Set, withEvent event: NSUIEvent?) + { + super.touchesBegan(with: event!) + } + + open func nsuiTouchesMoved(_ touches: Set, withEvent event: NSUIEvent?) + { + super.touchesMoved(with: event!) + } + + open func nsuiTouchesEnded(_ touches: Set, withEvent event: NSUIEvent?) + { + super.touchesEnded(with: event!) + } + + open func nsuiTouchesCancelled(_ touches: Set?, withEvent event: NSUIEvent?) + { + super.touchesCancelled(with: event!) + } + + open var backgroundColor: NSUIColor? + { + get + { + return self.layer?.backgroundColor == nil + ? nil + : NSColor(cgColor: self.layer!.backgroundColor!) + } + set + { + self.wantsLayer = true + self.layer?.backgroundColor = newValue == nil ? nil : newValue!.cgColor + } + } + + final var nsuiLayer: CALayer? + { + return self.layer + } +} + +extension NSFont +{ + var lineHeight: CGFloat + { + // Not sure if this is right, but it looks okay + return self.boundingRectForFont.size.height + } +} + +extension NSScreen +{ + final var nsuiScale: CGFloat + { + return self.backingScaleFactor + } +} + +extension NSImage +{ + var cgImage: CGImage? + { + return self.cgImage(forProposedRect: nil, context: nil, hints: nil) + } +} + +extension NSTouch +{ + /** Touch locations on OS X are relative to the trackpad, whereas on iOS they are actually *on* the view. */ + func locationInView(view: NSView) -> NSPoint + { + let n = self.normalizedPosition + let b = view.bounds + return NSPoint(x: b.origin.x + b.size.width * n.x, y: b.origin.y + b.size.height * n.y) + } +} + +extension NSScrollView +{ + var scrollEnabled: Bool + { + get + { + return true + } + set + { + // FIXME: We can't disable scrolling it on OSX + } + } +} + +func NSUIGraphicsGetCurrentContext() -> CGContext? +{ + return NSGraphicsContext.current?.cgContext +} + +func NSUIGraphicsPushContext(_ context: CGContext) +{ + let cx = NSGraphicsContext(cgContext: context, flipped: true) + NSGraphicsContext.saveGraphicsState() + NSGraphicsContext.current = cx +} + +func NSUIGraphicsPopContext() +{ + NSGraphicsContext.restoreGraphicsState() +} + +func NSUIImagePNGRepresentation(_ image: NSUIImage) -> Data? +{ + image.lockFocus() + let rep = NSBitmapImageRep(focusedViewRect: NSMakeRect(0, 0, image.size.width, image.size.height)) + image.unlockFocus() + return rep?.representation(using: .png, properties: [:]) +} + +func NSUIImageJPEGRepresentation(_ image: NSUIImage, _ quality: CGFloat = 0.9) -> Data? +{ + image.lockFocus() + let rep = NSBitmapImageRep(focusedViewRect: NSMakeRect(0, 0, image.size.width, image.size.height)) + image.unlockFocus() + return rep?.representation(using: .jpeg, properties: [NSBitmapImageRep.PropertyKey.compressionFactor: quality]) +} + +private var imageContextStack: [CGFloat] = [] + +func NSUIGraphicsBeginImageContextWithOptions(_ size: CGSize, _ opaque: Bool, _ scale: CGFloat) +{ + var scale = scale + if scale == 0.0 + { + scale = NSScreen.main?.backingScaleFactor ?? 1.0 + } + + let width = Int(size.width * scale) + let height = Int(size.height * scale) + + if width > 0 && height > 0 + { + imageContextStack.append(scale) + + let colorSpace = CGColorSpaceCreateDeviceRGB() + + guard let ctx = CGContext(data: nil, width: width, height: height, bitsPerComponent: 8, bytesPerRow: 4*width, space: colorSpace, bitmapInfo: (opaque ? CGImageAlphaInfo.noneSkipFirst.rawValue : CGImageAlphaInfo.premultipliedFirst.rawValue)) + else { return } + + ctx.concatenate(CGAffineTransform(a: 1, b: 0, c: 0, d: -1, tx: 0, ty: CGFloat(height))) + ctx.scaleBy(x: scale, y: scale) + NSUIGraphicsPushContext(ctx) + } +} + +func NSUIGraphicsGetImageFromCurrentImageContext() -> NSUIImage? +{ + if !imageContextStack.isEmpty + { + guard let ctx = NSUIGraphicsGetCurrentContext() + else { return nil } + + let scale = imageContextStack.last! + if let theCGImage = ctx.makeImage() + { + let size = CGSize(width: CGFloat(ctx.width) / scale, height: CGFloat(ctx.height) / scale) + let image = NSImage(cgImage: theCGImage, size: size) + return image + } + } + return nil +} + +func NSUIGraphicsEndImageContext() +{ + if imageContextStack.last != nil + { + imageContextStack.removeLast() + NSUIGraphicsPopContext() + } +} + +func NSUIMainScreen() -> NSUIScreen? +{ + return NSUIScreen.main +} + +#endif diff --git a/Carthage/Checkouts/Charts/Source/Charts/Utils/Transformer.swift b/Carthage/Checkouts/Charts/Source/Charts/Utils/Transformer.swift new file mode 100644 index 00000000000..b50ea823c5f --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Utils/Transformer.swift @@ -0,0 +1,170 @@ +// +// Transformer.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// Transformer class that contains all matrices and is responsible for transforming values into pixels on the screen and backwards. +@objc(ChartTransformer) +open class Transformer: NSObject +{ + /// matrix to map the values to the screen pixels + internal var _matrixValueToPx = CGAffineTransform.identity + + /// matrix for handling the different offsets of the chart + internal var _matrixOffset = CGAffineTransform.identity + + internal var _viewPortHandler: ViewPortHandler + + @objc public init(viewPortHandler: ViewPortHandler) + { + _viewPortHandler = viewPortHandler + } + + /// Prepares the matrix that transforms values to pixels. Calculates the scale factors from the charts size and offsets. + @objc open func prepareMatrixValuePx(chartXMin: Double, deltaX: CGFloat, deltaY: CGFloat, chartYMin: Double) + { + var scaleX = (_viewPortHandler.contentWidth / deltaX) + var scaleY = (_viewPortHandler.contentHeight / deltaY) + + if CGFloat.infinity == scaleX + { + scaleX = 0.0 + } + if CGFloat.infinity == scaleY + { + scaleY = 0.0 + } + + // setup all matrices + _matrixValueToPx = CGAffineTransform.identity + _matrixValueToPx = _matrixValueToPx.scaledBy(x: scaleX, y: -scaleY) + _matrixValueToPx = _matrixValueToPx.translatedBy(x: CGFloat(-chartXMin), y: CGFloat(-chartYMin)) + } + + /// Prepares the matrix that contains all offsets. + @objc open func prepareMatrixOffset(inverted: Bool) + { + if !inverted + { + _matrixOffset = CGAffineTransform(translationX: _viewPortHandler.offsetLeft, y: _viewPortHandler.chartHeight - _viewPortHandler.offsetBottom) + } + else + { + _matrixOffset = CGAffineTransform(scaleX: 1.0, y: -1.0) + _matrixOffset = _matrixOffset.translatedBy(x: _viewPortHandler.offsetLeft, y: -_viewPortHandler.offsetTop) + } + } + + /// Transform an array of points with all matrices. + // VERY IMPORTANT: Keep matrix order "value-touch-offset" when transforming. + open func pointValuesToPixel(_ points: inout [CGPoint]) + { + let trans = valueToPixelMatrix + points = points.map { $0.applying(trans) } + } + + open func pointValueToPixel(_ point: inout CGPoint) + { + point = point.applying(valueToPixelMatrix) + } + + @objc open func pixelForValues(x: Double, y: Double) -> CGPoint + { + return CGPoint(x: x, y: y).applying(valueToPixelMatrix) + } + + /// Transform a rectangle with all matrices. + open func rectValueToPixel(_ r: inout CGRect) + { + r = r.applying(valueToPixelMatrix) + } + + /// Transform a rectangle with all matrices with potential animation phases. + open func rectValueToPixel(_ r: inout CGRect, phaseY: Double) + { + // multiply the height of the rect with the phase + var bottom = r.origin.y + r.size.height + bottom *= CGFloat(phaseY) + let top = r.origin.y * CGFloat(phaseY) + r.size.height = bottom - top + r.origin.y = top + + r = r.applying(valueToPixelMatrix) + } + + /// Transform a rectangle with all matrices. + open func rectValueToPixelHorizontal(_ r: inout CGRect) + { + r = r.applying(valueToPixelMatrix) + } + + /// Transform a rectangle with all matrices with potential animation phases. + open func rectValueToPixelHorizontal(_ r: inout CGRect, phaseY: Double) + { + // multiply the height of the rect with the phase + let left = r.origin.x * CGFloat(phaseY) + let right = (r.origin.x + r.size.width) * CGFloat(phaseY) + r.size.width = right - left + r.origin.x = left + + r = r.applying(valueToPixelMatrix) + } + + /// transforms multiple rects with all matrices + open func rectValuesToPixel(_ rects: inout [CGRect]) + { + let trans = valueToPixelMatrix + rects = rects.map { $0.applying(trans) } + } + + /// Transforms the given array of touch points (pixels) into values on the chart. + open func pixelsToValues(_ pixels: inout [CGPoint]) + { + let trans = pixelToValueMatrix + pixels = pixels.map { $0.applying(trans) } + } + + /// Transforms the given touch point (pixels) into a value on the chart. + open func pixelToValues(_ pixel: inout CGPoint) + { + pixel = pixel.applying(pixelToValueMatrix) + } + + /// - Returns: The x and y values in the chart at the given touch point + /// (encapsulated in a CGPoint). This method transforms pixel coordinates to + /// coordinates / values in the chart. + @objc open func valueForTouchPoint(_ point: CGPoint) -> CGPoint + { + return point.applying(pixelToValueMatrix) + } + + /// - Returns: The x and y values in the chart at the given touch point + /// (x/y). This method transforms pixel coordinates to + /// coordinates / values in the chart. + @objc open func valueForTouchPoint(x: CGFloat, y: CGFloat) -> CGPoint + { + return CGPoint(x: x, y: y).applying(pixelToValueMatrix) + } + + @objc open var valueToPixelMatrix: CGAffineTransform + { + return + _matrixValueToPx.concatenating(_viewPortHandler.touchMatrix + ).concatenating(_matrixOffset + ) + } + + @objc open var pixelToValueMatrix: CGAffineTransform + { + return valueToPixelMatrix.inverted() + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift b/Carthage/Checkouts/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift new file mode 100644 index 00000000000..d7e657bd257 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Utils/TransformerHorizontalBarChart.swift @@ -0,0 +1,32 @@ +// +// TransformerHorizontalBarChart.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +@objc(ChartTransformerHorizontalBarChart) +open class TransformerHorizontalBarChart: Transformer +{ + /// Prepares the matrix that contains all offsets. + open override func prepareMatrixOffset(inverted: Bool) + { + if !inverted + { + _matrixOffset = CGAffineTransform(translationX: _viewPortHandler.offsetLeft, y: _viewPortHandler.chartHeight - _viewPortHandler.offsetBottom) + } + else + { + _matrixOffset = CGAffineTransform(scaleX: -1.0, y: 1.0) + _matrixOffset = _matrixOffset.translatedBy(x: -(_viewPortHandler.chartWidth - _viewPortHandler.offsetRight), + y: _viewPortHandler.chartHeight - _viewPortHandler.offsetBottom) + } + } +} diff --git a/Carthage/Checkouts/Charts/Source/Charts/Utils/ViewPortHandler.swift b/Carthage/Checkouts/Charts/Source/Charts/Utils/ViewPortHandler.swift new file mode 100755 index 00000000000..56e034b418b --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Charts/Utils/ViewPortHandler.swift @@ -0,0 +1,553 @@ +// +// ViewPortHandler.swift +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +import Foundation +import CoreGraphics + +/// Class that contains information about the charts current viewport settings, including offsets, scale & translation levels, ... +@objc(ChartViewPortHandler) +open class ViewPortHandler: NSObject +{ + /// matrix used for touch events + private var _touchMatrix = CGAffineTransform.identity + + /// this rectangle defines the area in which graph values can be drawn + private var _contentRect = CGRect() + + private var _chartWidth = CGFloat(0.0) + private var _chartHeight = CGFloat(0.0) + + /// minimum scale value on the y-axis + private var _minScaleY = CGFloat(1.0) + + /// maximum scale value on the y-axis + private var _maxScaleY = CGFloat.greatestFiniteMagnitude + + /// minimum scale value on the x-axis + private var _minScaleX = CGFloat(1.0) + + /// maximum scale value on the x-axis + private var _maxScaleX = CGFloat.greatestFiniteMagnitude + + /// contains the current scale factor of the x-axis + private var _scaleX = CGFloat(1.0) + + /// contains the current scale factor of the y-axis + private var _scaleY = CGFloat(1.0) + + /// current translation (drag distance) on the x-axis + private var _transX = CGFloat(0.0) + + /// current translation (drag distance) on the y-axis + private var _transY = CGFloat(0.0) + + /// offset that allows the chart to be dragged over its bounds on the x-axis + private var _transOffsetX = CGFloat(0.0) + + /// offset that allows the chart to be dragged over its bounds on the x-axis + private var _transOffsetY = CGFloat(0.0) + + /// Constructor - don't forget calling setChartDimens(...) + @objc public init(width: CGFloat, height: CGFloat) + { + super.init() + + setChartDimens(width: width, height: height) + } + + @objc open func setChartDimens(width: CGFloat, height: CGFloat) + { + let offsetLeft = self.offsetLeft + let offsetTop = self.offsetTop + let offsetRight = self.offsetRight + let offsetBottom = self.offsetBottom + + _chartHeight = height + _chartWidth = width + + restrainViewPort(offsetLeft: offsetLeft, offsetTop: offsetTop, offsetRight: offsetRight, offsetBottom: offsetBottom) + } + + @objc open var hasChartDimens: Bool + { + if _chartHeight > 0.0 && _chartWidth > 0.0 + { + return true + } + else + { + return false + } + } + + @objc open func restrainViewPort(offsetLeft: CGFloat, offsetTop: CGFloat, offsetRight: CGFloat, offsetBottom: CGFloat) + { + _contentRect.origin.x = offsetLeft + _contentRect.origin.y = offsetTop + _contentRect.size.width = _chartWidth - offsetLeft - offsetRight + _contentRect.size.height = _chartHeight - offsetBottom - offsetTop + } + + @objc open var offsetLeft: CGFloat + { + return _contentRect.origin.x + } + + @objc open var offsetRight: CGFloat + { + return _chartWidth - _contentRect.size.width - _contentRect.origin.x + } + + @objc open var offsetTop: CGFloat + { + return _contentRect.origin.y + } + + @objc open var offsetBottom: CGFloat + { + return _chartHeight - _contentRect.size.height - _contentRect.origin.y + } + + @objc open var contentTop: CGFloat + { + return _contentRect.origin.y + } + + @objc open var contentLeft: CGFloat + { + return _contentRect.origin.x + } + + @objc open var contentRight: CGFloat + { + return _contentRect.origin.x + _contentRect.size.width + } + + @objc open var contentBottom: CGFloat + { + return _contentRect.origin.y + _contentRect.size.height + } + + @objc open var contentWidth: CGFloat + { + return _contentRect.size.width + } + + @objc open var contentHeight: CGFloat + { + return _contentRect.size.height + } + + @objc open var contentRect: CGRect + { + return _contentRect + } + + @objc open var contentCenter: CGPoint + { + return CGPoint(x: _contentRect.origin.x + _contentRect.size.width / 2.0, y: _contentRect.origin.y + _contentRect.size.height / 2.0) + } + + @objc open var chartHeight: CGFloat + { + return _chartHeight + } + + @objc open var chartWidth: CGFloat + { + return _chartWidth + } + + // MARK: - Scaling/Panning etc. + + /// Zooms by the specified zoom factors. + @objc open func zoom(scaleX: CGFloat, scaleY: CGFloat) -> CGAffineTransform + { + return _touchMatrix.scaledBy(x: scaleX, y: scaleY) + } + + /// Zooms around the specified center + @objc open func zoom(scaleX: CGFloat, scaleY: CGFloat, x: CGFloat, y: CGFloat) -> CGAffineTransform + { + var matrix = _touchMatrix.translatedBy(x: x, y: y) + matrix = matrix.scaledBy(x: scaleX, y: scaleY) + matrix = matrix.translatedBy(x: -x, y: -y) + return matrix + } + + /// Zooms in by 1.4, x and y are the coordinates (in pixels) of the zoom center. + @objc open func zoomIn(x: CGFloat, y: CGFloat) -> CGAffineTransform + { + return zoom(scaleX: 1.4, scaleY: 1.4, x: x, y: y) + } + + /// Zooms out by 0.7, x and y are the coordinates (in pixels) of the zoom center. + @objc open func zoomOut(x: CGFloat, y: CGFloat) -> CGAffineTransform + { + return zoom(scaleX: 0.7, scaleY: 0.7, x: x, y: y) + } + + /// Zooms out to original size. + @objc open func resetZoom() -> CGAffineTransform + { + return zoom(scaleX: 1.0, scaleY: 1.0, x: 0.0, y: 0.0) + } + + /// Sets the scale factor to the specified values. + @objc open func setZoom(scaleX: CGFloat, scaleY: CGFloat) -> CGAffineTransform + { + var matrix = _touchMatrix + matrix.a = scaleX + matrix.d = scaleY + return matrix + } + + /// Sets the scale factor to the specified values. x and y is pivot. + @objc open func setZoom(scaleX: CGFloat, scaleY: CGFloat, x: CGFloat, y: CGFloat) -> CGAffineTransform + { + var matrix = _touchMatrix + matrix.a = 1.0 + matrix.d = 1.0 + matrix = matrix.translatedBy(x: x, y: y) + matrix = matrix.scaledBy(x: scaleX, y: scaleY) + matrix = matrix.translatedBy(x: -x, y: -y) + return matrix + } + + /// Resets all zooming and dragging and makes the chart fit exactly it's bounds. + @objc open func fitScreen() -> CGAffineTransform + { + _minScaleX = 1.0 + _minScaleY = 1.0 + + return CGAffineTransform.identity + } + + /// Translates to the specified point. + @objc open func translate(pt: CGPoint) -> CGAffineTransform + { + let translateX = pt.x - offsetLeft + let translateY = pt.y - offsetTop + + let matrix = _touchMatrix.concatenating(CGAffineTransform(translationX: -translateX, y: -translateY)) + + return matrix + } + + /// Centers the viewport around the specified position (x-index and y-value) in the chart. + /// Centering the viewport outside the bounds of the chart is not possible. + /// Makes most sense in combination with the setScaleMinima(...) method. + @objc open func centerViewPort(pt: CGPoint, chart: ChartViewBase) + { + let translateX = pt.x - offsetLeft + let translateY = pt.y - offsetTop + + let matrix = _touchMatrix.concatenating(CGAffineTransform(translationX: -translateX, y: -translateY)) + refresh(newMatrix: matrix, chart: chart, invalidate: true) + } + + /// call this method to refresh the graph with a given matrix + @objc @discardableResult open func refresh(newMatrix: CGAffineTransform, chart: ChartViewBase, invalidate: Bool) -> CGAffineTransform + { + _touchMatrix = newMatrix + + // make sure scale and translation are within their bounds + limitTransAndScale(matrix: &_touchMatrix, content: _contentRect) + + chart.setNeedsDisplay() + + return _touchMatrix + } + + /// limits the maximum scale and X translation of the given matrix + private func limitTransAndScale(matrix: inout CGAffineTransform, content: CGRect?) + { + // min scale-x is 1 + _scaleX = min(max(_minScaleX, matrix.a), _maxScaleX) + + // min scale-y is 1 + _scaleY = min(max(_minScaleY, matrix.d), _maxScaleY) + + + var width: CGFloat = 0.0 + var height: CGFloat = 0.0 + + if content != nil + { + width = content!.width + height = content!.height + } + + let maxTransX = -width * (_scaleX - 1.0) + _transX = min(max(matrix.tx, maxTransX - _transOffsetX), _transOffsetX) + + let maxTransY = height * (_scaleY - 1.0) + _transY = max(min(matrix.ty, maxTransY + _transOffsetY), -_transOffsetY) + + matrix.tx = _transX + matrix.a = _scaleX + matrix.ty = _transY + matrix.d = _scaleY + } + + /// Sets the minimum scale factor for the x-axis + @objc open func setMinimumScaleX(_ xScale: CGFloat) + { + var newValue = xScale + + if newValue < 1.0 + { + newValue = 1.0 + } + + _minScaleX = newValue + + limitTransAndScale(matrix: &_touchMatrix, content: _contentRect) + } + + /// Sets the maximum scale factor for the x-axis + @objc open func setMaximumScaleX(_ xScale: CGFloat) + { + var newValue = xScale + + if newValue == 0.0 + { + newValue = CGFloat.greatestFiniteMagnitude + } + + _maxScaleX = newValue + + limitTransAndScale(matrix: &_touchMatrix, content: _contentRect) + } + + /// Sets the minimum and maximum scale factors for the x-axis + @objc open func setMinMaxScaleX(minScaleX: CGFloat, maxScaleX: CGFloat) + { + var newMin = minScaleX + var newMax = maxScaleX + + if newMin < 1.0 + { + newMin = 1.0 + } + if newMax == 0.0 + { + newMax = CGFloat.greatestFiniteMagnitude + } + + _minScaleX = newMin + _maxScaleX = maxScaleX + + limitTransAndScale(matrix: &_touchMatrix, content: _contentRect) + } + + /// Sets the minimum scale factor for the y-axis + @objc open func setMinimumScaleY(_ yScale: CGFloat) + { + var newValue = yScale + + if newValue < 1.0 + { + newValue = 1.0 + } + + _minScaleY = newValue + + limitTransAndScale(matrix: &_touchMatrix, content: _contentRect) + } + + /// Sets the maximum scale factor for the y-axis + @objc open func setMaximumScaleY(_ yScale: CGFloat) + { + var newValue = yScale + + if newValue == 0.0 + { + newValue = CGFloat.greatestFiniteMagnitude + } + + _maxScaleY = newValue + + limitTransAndScale(matrix: &_touchMatrix, content: _contentRect) + } + + @objc open func setMinMaxScaleY(minScaleY: CGFloat, maxScaleY: CGFloat) + { + var minScaleY = minScaleY, maxScaleY = maxScaleY + + if minScaleY < 1.0 + { + minScaleY = 1.0 + } + + if maxScaleY == 0.0 + { + maxScaleY = CGFloat.greatestFiniteMagnitude + } + + _minScaleY = minScaleY + _maxScaleY = maxScaleY + + limitTransAndScale(matrix: &_touchMatrix, content: _contentRect) + } + + @objc open var touchMatrix: CGAffineTransform + { + return _touchMatrix + } + + // MARK: - Boundaries Check + + @objc open func isInBoundsX(_ x: CGFloat) -> Bool + { + return isInBoundsLeft(x) && isInBoundsRight(x) + } + + @objc open func isInBoundsY(_ y: CGFloat) -> Bool + { + return isInBoundsTop(y) && isInBoundsBottom(y) + } + + @objc open func isInBounds(x: CGFloat, y: CGFloat) -> Bool + { + return isInBoundsX(x) && isInBoundsY(y) + } + + @objc open func isInBoundsLeft(_ x: CGFloat) -> Bool + { + return _contentRect.origin.x <= x + 1.0 + } + + @objc open func isInBoundsRight(_ x: CGFloat) -> Bool + { + let x = floor(x * 100.0) / 100.0 + return (_contentRect.origin.x + _contentRect.size.width) >= x - 1.0 + } + + @objc open func isInBoundsTop(_ y: CGFloat) -> Bool + { + return _contentRect.origin.y <= y + } + + @objc open func isInBoundsBottom(_ y: CGFloat) -> Bool + { + let normalizedY = floor(y * 100.0) / 100.0 + return (_contentRect.origin.y + _contentRect.size.height) >= normalizedY + } + + /// The current x-scale factor + @objc open var scaleX: CGFloat + { + return _scaleX + } + + /// The current y-scale factor + @objc open var scaleY: CGFloat + { + return _scaleY + } + + /// The minimum x-scale factor + @objc open var minScaleX: CGFloat + { + return _minScaleX + } + + /// The minimum y-scale factor + @objc open var minScaleY: CGFloat + { + return _minScaleY + } + + /// The minimum x-scale factor + @objc open var maxScaleX: CGFloat + { + return _maxScaleX + } + + /// The minimum y-scale factor + @objc open var maxScaleY: CGFloat + { + return _maxScaleY + } + + /// The translation (drag / pan) distance on the x-axis + @objc open var transX: CGFloat + { + return _transX + } + + /// The translation (drag / pan) distance on the y-axis + @objc open var transY: CGFloat + { + return _transY + } + + /// if the chart is fully zoomed out, return true + @objc open var isFullyZoomedOut: Bool + { + return isFullyZoomedOutX && isFullyZoomedOutY + } + + /// `true` if the chart is fully zoomed out on it's y-axis (vertical). + @objc open var isFullyZoomedOutY: Bool + { + return !(_scaleY > _minScaleY || _minScaleY > 1.0) + } + + /// `true` if the chart is fully zoomed out on it's x-axis (horizontal). + @objc open var isFullyZoomedOutX: Bool + { + return !(_scaleX > _minScaleX || _minScaleX > 1.0) + } + + /// Set an offset in pixels that allows the user to drag the chart over it's bounds on the x-axis. + @objc open func setDragOffsetX(_ offset: CGFloat) + { + _transOffsetX = offset + } + + /// Set an offset in pixels that allows the user to drag the chart over it's bounds on the y-axis. + @objc open func setDragOffsetY(_ offset: CGFloat) + { + _transOffsetY = offset + } + + /// `true` if both drag offsets (x and y) are zero or smaller. + @objc open var hasNoDragOffset: Bool + { + return _transOffsetX <= 0.0 && _transOffsetY <= 0.0 + } + + /// `true` if the chart is not yet fully zoomed out on the x-axis + @objc open var canZoomOutMoreX: Bool + { + return _scaleX > _minScaleX + } + + /// `true` if the chart is not yet fully zoomed in on the x-axis + @objc open var canZoomInMoreX: Bool + { + return _scaleX < _maxScaleX + } + + /// `true` if the chart is not yet fully zoomed out on the y-axis + @objc open var canZoomOutMoreY: Bool + { + return _scaleY > _minScaleY + } + + /// `true` if the chart is not yet fully zoomed in on the y-axis + @objc open var canZoomInMoreY: Bool + { + return _scaleY < _maxScaleY + } +} diff --git a/Carthage/Checkouts/Charts/Source/Supporting Files/Charts.h b/Carthage/Checkouts/Charts/Source/Supporting Files/Charts.h new file mode 100755 index 00000000000..2b91eb68fe0 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Supporting Files/Charts.h @@ -0,0 +1,28 @@ +// +// Charts.h +// Charts +// +// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda +// A port of MPAndroidChart for iOS +// Licensed under Apache License 2.0 +// +// https://github.com/danielgindi/Charts +// + +#include + +#if TARGET_OS_IPHONE || TARGET_OS_TV || TARGET_IPHONE_SIMULATOR + #import +#else + #import +#endif + +//! Project version number for Charts. +FOUNDATION_EXPORT double ChartsVersionNumber; + +//! Project version string for Charts. +FOUNDATION_EXPORT const unsigned char ChartsVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/Carthage/Checkouts/Charts/Source/Supporting Files/Info.plist b/Carthage/Checkouts/Charts/Source/Supporting Files/Info.plist new file mode 100644 index 00000000000..cd188568000 --- /dev/null +++ b/Carthage/Checkouts/Charts/Source/Supporting Files/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 3.3.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSPrincipalClass + + + diff --git a/Carthage/Checkouts/Charts/Tests/Charts/BarChartTests.swift b/Carthage/Checkouts/Charts/Tests/Charts/BarChartTests.swift new file mode 100644 index 00000000000..6f323223e2a --- /dev/null +++ b/Carthage/Checkouts/Charts/Tests/Charts/BarChartTests.swift @@ -0,0 +1,406 @@ +import XCTest +import FBSnapshotTestCase +@testable import Charts + +class BarChartTests: FBSnapshotTestCase +{ + override func setUp() + { + super.setUp() + + // Set to `true` to re-capture all snapshots + self.recordMode = false + } + + override func tearDown() + { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + //MARK: Prepare + func setupCustomValuesDataEntries(values: [Double]) -> [ChartDataEntry] + { + var entries: [ChartDataEntry] = Array() + for (i, value) in values.enumerated() + { + entries.append(BarChartDataEntry(x: Double(i), y: value, icon: UIImage(named: "icon", in: Bundle(for: self.classForCoder), compatibleWith: nil))) + } + return entries + } + + func setupDefaultValuesDataEntries() -> [ChartDataEntry] + { + let values: [Double] = [8, 104, -81, 93, 52, -44, 97, 101, -75, 28, + -76, 25, 20, -13, 52, 44, -57, 23, 45, -91, + 99, 14, -84, 48, 40, -71, 106, 41, -45, 61] + return setupCustomValuesDataEntries(values: values) + } + + func setupPositiveValuesDataEntries() -> [ChartDataEntry] + { + let values: [Double] = [8, 104, 81, 93, 52, 44, 97, 101, 75, 28, + 76, 25, 20, 13, 52, 44, 57, 23, 45, 91, + 99, 14, 84, 48, 40, 71, 106, 41, 45, 61] + return setupCustomValuesDataEntries(values: values) + } + + func setupNegativeValuesDataEntries() -> [ChartDataEntry] + { + let values: [Double] = [-8, -104, -81, -93, -52, -44, -97, -101, -75, -28, + -76, -25, -20, -13, -52, -44, -57, -23, -45, -91, + -99, -14, -84, -48, -40, -71, -106, -41, -45, -61] + return setupCustomValuesDataEntries(values: values) + } + + func setupZeroValuesDataEntries() -> [ChartDataEntry] + { + let values = [Double](repeating: 0.0, count: 30) + return setupCustomValuesDataEntries(values: values) + } + + func setupStackedValuesDataEntries() -> [ChartDataEntry] + { + var entries: [ChartDataEntry] = Array() + entries.append(BarChartDataEntry(x: 0, yValues: [28, 50, 60, 30, 42], icon: UIImage(named: "icon"))) + entries.append(BarChartDataEntry(x: 1, yValues: [-20, -36, -52, -40, -15], icon: UIImage(named: "icon"))) + entries.append(BarChartDataEntry(x: 2, yValues: [10, 30, 40, 90, 72], icon: UIImage(named: "icon"))) + entries.append(BarChartDataEntry(x: 3, yValues: [-40, -50, -30, -60, -20], icon: UIImage(named: "icon"))) + entries.append(BarChartDataEntry(x: 4, yValues: [10, 40, 60, 45, 62], icon: UIImage(named: "icon"))) + return entries + } + + func setupDefaultStackedDataSet(chartDataEntries: [ChartDataEntry]) -> BarChartDataSet + { + let dataSet = BarChartDataSet(entries: chartDataEntries, label: "Stacked bar chart unit test data") + dataSet.drawIconsEnabled = false + dataSet.iconsOffset = CGPoint(x: 0, y: -10.0) + dataSet.colors = Array(arrayLiteral:NSUIColor(red: 46/255.0, green: 204/255.0, blue: 113/255.0, alpha: 1.0), + NSUIColor(red: 241/255.0, green: 196/255.0, blue: 15/255.0, alpha: 1.0), + NSUIColor(red: 231/255.0, green: 76/255.0, blue: 60/255.0, alpha: 1.0), + NSUIColor(red: 52/255.0, green: 152/255.0, blue: 219/255.0, alpha: 1.0) + ) + return dataSet + } + + func setupDefaultDataSet(chartDataEntries: [ChartDataEntry]) -> BarChartDataSet + { + let dataSet = BarChartDataSet(entries: chartDataEntries, label: "Bar chart unit test data") + dataSet.drawIconsEnabled = false + dataSet.iconsOffset = CGPoint(x: 0, y: -10.0) + return dataSet + } + + func setupDefaultChart(dataSets: [BarChartDataSet]) -> BarChartView + { + let data = BarChartData(dataSets: dataSets) + data.barWidth = 0.85 + + let chart = BarChartView(frame: CGRect(x: 0, y: 0, width: 480, height: 350)) + chart.backgroundColor = NSUIColor.clear + chart.data = data + return chart + } + + //MARK: Start Test + func testDefaultValues() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testZeroValues() + { + let dataEntries = setupZeroValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testPositiveValues() + { + let dataEntries = setupPositiveValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testPositiveValuesWithCustomAxisMaximum() + { + let dataEntries = setupPositiveValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.axisMaximum = 50 + chart.clipValuesToContentEnabled = true + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testPositiveValuesWithCustomAxisMaximum2() + { + let dataEntries = setupPositiveValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.axisMaximum = -10 + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testPositiveValuesWithCustomAxisMinimum() + { + let dataEntries = setupPositiveValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.axisMinimum = 50 + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testPositiveValuesWithCustomAxisMinimum2() + { + let dataEntries = setupPositiveValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.axisMinimum = 110 + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testPositiveValuesWithCustomAxisMaximumAndCustomAxisMaximum() + { + let dataEntries = setupPositiveValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + //If min is greater than max, then min and max will be exchanged. + chart.leftAxis.axisMaximum = 200 + chart.leftAxis.axisMinimum = -10 + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testNegativeValues() + { + let dataEntries = setupNegativeValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testNegativeValuesWithCustomAxisMaximum() + { + let dataEntries = setupNegativeValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.axisMaximum = 10 + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testNegativeValuesWithCustomAxisMaximum2() + { + let dataEntries = setupNegativeValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.axisMaximum = -150 + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + + func testNegativeValuesWithCustomAxisMinimum() + { + let dataEntries = setupNegativeValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.axisMinimum = -200 + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testNegativeValuesWithCustomAxisMinimum2() + { + let dataEntries = setupNegativeValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.axisMinimum = 10 + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testNegativeValuesWithCustomAxisMaximumAndCustomAxisMaximum() + { + let dataEntries = setupNegativeValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + //If min is greater than max, then min and max will be exchanged. + chart.leftAxis.axisMaximum = 10 + chart.leftAxis.axisMinimum = -200 + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testHidesValues() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + dataSet.drawValuesEnabled = false + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testNotDrawValueAboveBars() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.drawValueAboveBarEnabled = false + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testStackedDrawValues() + { + let dataEntries = setupStackedValuesDataEntries() + let dataSet = setupDefaultStackedDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testStackedNotDrawValues() + { + let dataEntries = setupStackedValuesDataEntries() + let dataSet = setupDefaultStackedDataSet(chartDataEntries: dataEntries) + dataSet.drawValuesEnabled = false + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testStackedNotDrawValuesAboveBars() + { + let dataEntries = setupStackedValuesDataEntries() + let dataSet = setupDefaultStackedDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.drawValueAboveBarEnabled = false + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testHideLeftAxis() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.enabled = false + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testHideRightAxis() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.rightAxis.enabled = false + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testInvertedLeftAxis() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.inverted = true + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testInvertedLeftAxisWithNegativeValues() + { + let dataEntries = setupNegativeValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.inverted = true + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testInvertedLeftAxisWithPositiveValues() + { + let dataEntries = setupPositiveValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.inverted = true + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testInvertedRightAxis() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + dataSet.axisDependency = .right + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.rightAxis.inverted = true + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testInvertedRightAxisWithNegativeValues() + { + let dataEntries = setupNegativeValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + dataSet.axisDependency = .right + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.rightAxis.inverted = true + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testInvertedRightAxisWithPositiveValues() + { + let dataEntries = setupPositiveValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + dataSet.axisDependency = .right + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.rightAxis.inverted = true + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testHideHorizontalGridlines() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.leftAxis.drawGridLinesEnabled = false + chart.rightAxis.drawGridLinesEnabled = false + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testHideVerticalGridlines() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.xAxis.drawGridLinesEnabled = false + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testDrawIcons() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + dataSet.drawIconsEnabled = true + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } +} diff --git a/Carthage/Checkouts/Charts/Tests/Charts/ChartUtilsTests.swift b/Carthage/Checkouts/Charts/Tests/Charts/ChartUtilsTests.swift new file mode 100644 index 00000000000..9e5da3a07ba --- /dev/null +++ b/Carthage/Checkouts/Charts/Tests/Charts/ChartUtilsTests.swift @@ -0,0 +1,75 @@ +import XCTest +@testable import Charts + +class ChartUtilsTests: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testDecimalWithNaN() { + + let number = Double.nan + + let actual = number.decimalPlaces + let expected = 0 + + XCTAssertEqual(expected, actual) + } + + func testDecimalWithInfinite() { + + let number = Double.infinity + + let actual = number.decimalPlaces + let expected = 0 + + XCTAssertEqual(expected, actual) + } + + func testDecimalWithZero() { + + let number = 0.0 + + let actual = number.decimalPlaces + let expected = 0 + + XCTAssertEqual(expected, actual) + } + + func testDecimalWithMaxValue() { + + let number = Double.greatestFiniteMagnitude + + let actual = number.decimalPlaces + let expected = 0 + + XCTAssertEqual(expected, actual) + } + + func testDecimalWithMinValue() { + + let number = Double.leastNormalMagnitude + + let actual = number.decimalPlaces + let expected = 310 // Don't think this is supposed to be this value maybe 0? + + XCTAssertEqual(expected, actual) + } + + func testDecimalWithNormalValue() { + + let number = 13.123123 + + let actual = number.decimalPlaces + let expected = 1 // Don't think this is supposed to be this value maybe 6? + + XCTAssertEqual(expected, actual) + } +} diff --git a/Carthage/Checkouts/Charts/Tests/Charts/CombinedChartTests.swift b/Carthage/Checkouts/Charts/Tests/Charts/CombinedChartTests.swift new file mode 100644 index 00000000000..9c19f4dcd41 --- /dev/null +++ b/Carthage/Checkouts/Charts/Tests/Charts/CombinedChartTests.swift @@ -0,0 +1,104 @@ +// +// CombinedChartTests.swift +// ChartsTests +// +// Created by Xuan Liu on 14/10/2017. +// + +import XCTest +import FBSnapshotTestCase +@testable import Charts + +class CombinedChartTests: FBSnapshotTestCase +{ + var chart: CombinedChartView! + var lineDataSet: LineChartDataSet! + var barDataSet: BarChartDataSet! + + override func setUp() + { + super.setUp() + + // Set to `true` to re-capture all snapshots + self.recordMode = false + + // Sample data + let combinedData = CombinedChartData() + combinedData.barData = generateBarData() + combinedData.lineData = generateLineData() + chart = CombinedChartView(frame: CGRect(x: 0, y: 0, width: 480, height: 350)) + chart.backgroundColor = NSUIColor.clear + chart.leftAxis.axisMinimum = 0.0 + chart.rightAxis.axisMinimum = 0.0 + chart.data = combinedData + } + + func generateBarData() -> BarChartData + { + let values: [Double] = [8, 104, 81, 93, 52, 44, 97, 101, 75, 28, + 76, 25, 20, 13, 52, 44, 57, 23, 45, 91, + 99, 14, 84, 48, 40, 71, 106, 41, 45, 61] + + var entries: [ChartDataEntry] = Array() + + for (i, value) in values.enumerated() + { + entries.append(BarChartDataEntry(x: Double(i), y: value, icon: UIImage(named: "icon", in: Bundle(for: self.classForCoder), compatibleWith: nil))) + } + + barDataSet = BarChartDataSet(entries: entries, label: "Bar chart unit test data") + barDataSet.drawIconsEnabled = false + + let data = BarChartData(dataSet: barDataSet) + data.barWidth = 0.85 + return data + } + + func generateLineData() -> LineChartData + { + let values: [Double] = [0, 254, 81, 93, 52, 44, 97, 101, 75, 28, + 76, 25, 20, 13, 52, 44, 57, 23, 45, 91, + 99, 14, 84, 48, 40, 71, 106, 41, 45, 61] + + var entries: [ChartDataEntry] = Array() + + for (i, value) in values.enumerated() + { + entries.append(ChartDataEntry(x: Double(i), y: value, icon: UIImage(named: "icon", in: Bundle(for: self.classForCoder), compatibleWith: nil))) + } + + lineDataSet = LineChartDataSet(entries: entries, label: "Line chart unit test data") + lineDataSet.drawIconsEnabled = false + return LineChartData(dataSet: lineDataSet) + } + + override func tearDown() + { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testDefaultAxisDependency() + { + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testLeftRightAxisDependency() + { + lineDataSet.axisDependency = .left + barDataSet.axisDependency = .right + chart.data?.notifyDataChanged() + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testAllRightAxisDependency() + { + lineDataSet.axisDependency = .right + barDataSet.axisDependency = .right + chart.data?.notifyDataChanged() + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } +} + diff --git a/Carthage/Checkouts/Charts/Tests/Charts/EquatableTests.swift b/Carthage/Checkouts/Charts/Tests/Charts/EquatableTests.swift new file mode 100644 index 00000000000..26074aa2660 --- /dev/null +++ b/Carthage/Checkouts/Charts/Tests/Charts/EquatableTests.swift @@ -0,0 +1,45 @@ +// +// EquatableTests.swift +// Charts +// +// Created by Jacob Christie on 2017-11-13. +// + +import XCTest +@testable import Charts + +class EquatableTests: XCTestCase { + func testChartDataEntryEquality() { + let image = UIImage() + let data = NSObject() + let entry1 = ChartDataEntry(x: 5, y: 3, icon: image, data: data) + let entry2 = ChartDataEntry(x: 5, y: 3, icon: image, data: data) + + XCTAssertTrue(entry1 == entry2) + } + + func testChartDataEntryInequality() { + let image = UIImage() + let data1 = NSObject() + let data2 = NSObject() + let entry1 = ChartDataEntry(x: 5, y: 3, icon: image, data: data1) + let entry2 = ChartDataEntry(x: 5, y: 9, icon: image, data: data2) + + XCTAssertFalse(entry1 == entry2) + } + + func testHighlightEquality() { + let high1 = Highlight(x: 5, y: 3, xPx: 1, yPx: -1, dataSetIndex: 8, stackIndex: 8, axis: .right) + let high2 = Highlight(x: 5, y: 3, xPx: 1, yPx: -1, dataSetIndex: 8, stackIndex: 8, axis: .right) + + XCTAssertTrue(high1 == high2) + } + + func testHighlightInequality() { + let high1 = Highlight(x: 5, y: 3, xPx: 1, yPx: -1, dataSetIndex: 8, stackIndex: 8, axis: .left) + let high2 = Highlight(x: 5, y: 3, xPx: 1, yPx: -1, dataSetIndex: 8, stackIndex: 9, axis: .left) + + XCTAssertFalse(high1 == high2) + } +} + diff --git a/Carthage/Checkouts/Charts/Tests/Charts/HorizontalBarChartTests.swift b/Carthage/Checkouts/Charts/Tests/Charts/HorizontalBarChartTests.swift new file mode 100644 index 00000000000..1b67a0dd274 --- /dev/null +++ b/Carthage/Checkouts/Charts/Tests/Charts/HorizontalBarChartTests.swift @@ -0,0 +1,147 @@ +// +// HorizontalBarChartTests.swift +// ChartsTests +// +// Created by Xuan Liu on 2019/3/20. +// + +import XCTest +import FBSnapshotTestCase +@testable import Charts + +class HorizontalBarChartTests: FBSnapshotTestCase +{ + + override func setUp() + { + super.setUp() + // Set to `true` to re-capture all snapshots + self.recordMode = false + } + + override func tearDown() + { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + //MARK: Prepare + func setupCustomValuesDataEntries(values: [Double]) -> [ChartDataEntry] + { + var entries: [ChartDataEntry] = Array() + for (i, value) in values.enumerated() + { + entries.append(BarChartDataEntry(x: Double(i), y: value, icon: UIImage(named: "icon", in: Bundle(for: self.classForCoder), compatibleWith: nil))) + } + return entries + } + + func setupStackedvaluesDataEntries() -> [ChartDataEntry] + { + var entries: [ChartDataEntry] = Array() + entries.append(BarChartDataEntry(x: 0, yValues: [28, 50, 60, 30, 42], icon: UIImage(named: "icon"))) + entries.append(BarChartDataEntry(x: 1, yValues: [-20, -36, -52, -40, -15], icon: UIImage(named: "icon"))) + entries.append(BarChartDataEntry(x: 2, yValues: [10, 30, 40, 90, 72], icon: UIImage(named: "icon"))) + entries.append(BarChartDataEntry(x: 3, yValues: [-40, -50, -30, -60, -20], icon: UIImage(named: "icon"))) + entries.append(BarChartDataEntry(x: 4, yValues: [10, 40, 60, 45, 62], icon: UIImage(named: "icon"))) + return entries + } + + func setupDefaultValuesDataEntries() -> [ChartDataEntry] + { + let values: [Double] = [8, 104, -81, 93, 52, -44, 97, 101, -75, 28, + -76, 25, 20, -13, 52, 44, -57, 23, 45, -91, + 99, 14, -84, 48, 40, -71, 106, 41, -45, 61] + return setupCustomValuesDataEntries(values: values) + } + + func setupDefaultDataSet(chartDataEntries: [ChartDataEntry]) -> BarChartDataSet + { + let dataSet = BarChartDataSet(entries: chartDataEntries, label: "Bar chart unit test data") + dataSet.drawIconsEnabled = false + dataSet.iconsOffset = CGPoint(x: 0, y: -10.0) + return dataSet + } + + func setupDefaultStackedDataSet(chartDataEntries: [ChartDataEntry]) -> BarChartDataSet + { + let dataSet = BarChartDataSet(entries: chartDataEntries, label: "Stacked bar chart unit test data") + dataSet.drawIconsEnabled = false + dataSet.iconsOffset = CGPoint(x: 0, y: -10.0) + dataSet.colors = Array(arrayLiteral:NSUIColor(red: 46/255.0, green: 204/255.0, blue: 113/255.0, alpha: 1.0), + NSUIColor(red: 241/255.0, green: 196/255.0, blue: 15/255.0, alpha: 1.0), + NSUIColor(red: 231/255.0, green: 76/255.0, blue: 60/255.0, alpha: 1.0), + NSUIColor(red: 52/255.0, green: 152/255.0, blue: 219/255.0, alpha: 1.0) + ) + return dataSet + } + + func setupDefaultChart(dataSets: [BarChartDataSet]) -> BarChartView + { + let data = BarChartData(dataSets: dataSets) + data.barWidth = 0.85 + + let chart = HorizontalBarChartView(frame: CGRect(x: 0, y: 0, width: 480, height: 350)) + chart.backgroundColor = NSUIColor.clear + chart.data = data + return chart + } + + //MARK: Start Test + func testDefaultValues() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testHidesValues() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + dataSet.drawValuesEnabled = false + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testNotDrawValueAboveBars() + { + let dataEntries = setupDefaultValuesDataEntries() + let dataSet = setupDefaultDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.drawValueAboveBarEnabled = false + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testStackedDrawValues() + { + let dataEntries = setupStackedvaluesDataEntries() + let dataSet = setupDefaultStackedDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testStackedNotDrawValues() + { + let dataEntries = setupStackedvaluesDataEntries() + let dataSet = setupDefaultStackedDataSet(chartDataEntries: dataEntries) + dataSet.drawValuesEnabled = false + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testStackedNotDrawValuesAboveBars() + { + let dataEntries = setupStackedvaluesDataEntries() + let dataSet = setupDefaultStackedDataSet(chartDataEntries: dataEntries) + let chart = setupDefaultChart(dataSets: [dataSet]) + chart.drawValueAboveBarEnabled = false + chart.notifyDataSetChanged() + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } +} diff --git a/Carthage/Checkouts/Charts/Tests/Charts/LineChartTests.swift b/Carthage/Checkouts/Charts/Tests/Charts/LineChartTests.swift new file mode 100755 index 00000000000..98d484a54c7 --- /dev/null +++ b/Carthage/Checkouts/Charts/Tests/Charts/LineChartTests.swift @@ -0,0 +1,81 @@ +import XCTest +import FBSnapshotTestCase +@testable import Charts + +class LineChartTests: FBSnapshotTestCase +{ + + var chart: LineChartView! + var dataSet: LineChartDataSet! + + override func setUp() + { + super.setUp() + + // Set to `true` to re-capture all snapshots + self.recordMode = false + + // Sample data + let values: [Double] = [8, 104, 81, 93, 52, 44, 97, 101, 75, 28, + 76, 25, 20, 13, 52, 44, 57, 23, 45, 91, + 99, 14, 84, 48, 40, 71, 106, 41, 45, 61] + + var entries: [ChartDataEntry] = Array() + + for (i, value) in values.enumerated() + { + entries.append(ChartDataEntry(x: Double(i), y: value, icon: UIImage(named: "icon", in: Bundle(for: self.classForCoder), compatibleWith: nil))) + } + + dataSet = LineChartDataSet(entries: entries, label: "First unit test data") + dataSet.drawIconsEnabled = false + dataSet.iconsOffset = CGPoint(x: 0, y: 20.0) + + chart = LineChartView(frame: CGRect(x: 0, y: 0, width: 480, height: 350)) + chart.backgroundColor = NSUIColor.clear + chart.leftAxis.axisMinimum = 0.0 + chart.rightAxis.axisMinimum = 0.0 + chart.data = LineChartData(dataSet: dataSet) + } + + override func tearDown() + { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testDefaultValues() + { + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testHidesValues() + { + dataSet.drawValuesEnabled = false + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testDoesntDrawCircles() + { + dataSet.drawCirclesEnabled = false + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testIsCubic() + { + dataSet.mode = LineChartDataSet.Mode.cubicBezier + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testDoesntDrawCircleHole() + { + dataSet.drawCircleHoleEnabled = false + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testDrawIcons() + { + dataSet.drawIconsEnabled = true + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } +} diff --git a/Carthage/Checkouts/Charts/Tests/Charts/PieChartTests.swift b/Carthage/Checkouts/Charts/Tests/Charts/PieChartTests.swift new file mode 100644 index 00000000000..1ef8051bf0f --- /dev/null +++ b/Carthage/Checkouts/Charts/Tests/Charts/PieChartTests.swift @@ -0,0 +1,73 @@ +import XCTest +import FBSnapshotTestCase +@testable import Charts + +class PieChartTests: FBSnapshotTestCase +{ + + var chart: PieChartView! + var dataSet: PieChartDataSet! + + override func setUp() + { + super.setUp() + + // Set to `true` to re-capture all snapshots + self.recordMode = false + + // Sample data + let values: [Double] = [11, 33, 81, 52, 97, 101, 75] + + var entries: [PieChartDataEntry] = Array() + + for value in values + { + entries.append(PieChartDataEntry(value: value, icon: UIImage(named: "icon", in: Bundle(for: self.classForCoder), compatibleWith: nil))) + } + + dataSet = PieChartDataSet(entries: entries, label: "First unit test data") + dataSet.drawIconsEnabled = false + dataSet.iconsOffset = CGPoint(x: 0, y: 20.0) + + dataSet.colors = ChartColorTemplates.vordiplom() + + ChartColorTemplates.joyful() + + ChartColorTemplates.colorful() + + ChartColorTemplates.liberty() + + ChartColorTemplates.pastel() + + [UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)] + + chart = PieChartView(frame: CGRect(x: 0, y: 0, width: 480, height: 350)) + chart.backgroundColor = NSUIColor.clear + chart.centerText = "PieChart Unit Test" + chart.data = PieChartData(dataSet: dataSet) + } + + override func tearDown() + { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testDefaultValues() + { + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testHidesValues() + { + dataSet.drawValuesEnabled = false + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testDrawIcons() + { + dataSet.drawIconsEnabled = true + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } + + func testHideCenterLabel() + { + chart.drawCenterTextEnabled = false + ChartsSnapshotVerifyView(chart, identifier: Snapshot.identifier(UIScreen.main.bounds.size), overallTolerance: Snapshot.tolerance) + } +} diff --git a/Carthage/Checkouts/Charts/Tests/Charts/Snapshot.swift b/Carthage/Checkouts/Charts/Tests/Charts/Snapshot.swift new file mode 100644 index 00000000000..bc1c28cf4ed --- /dev/null +++ b/Carthage/Checkouts/Charts/Tests/Charts/Snapshot.swift @@ -0,0 +1,29 @@ +import CoreGraphics +import FBSnapshotTestCase + +public struct Snapshot +{ + public static let tolerance: CGFloat = 0.001 + + public static func identifier(_ size: CGSize) -> String { + #if os(tvOS) + let identifier = "tvOS" + #elseif os(iOS) + let identifier = "iOS" + #elseif os(OSX) + let identifier = "macOS" + #else + let identifier = "" + #endif + + return "\(identifier)_\(size.width)_\(size.height)" + } +} + +public extension FBSnapshotTestCase +{ + func ChartsSnapshotVerifyView(_ view: UIView, identifier: String = "", suffixes: NSOrderedSet = NSOrderedSet(object: "_64"), perPixelTolerance: CGFloat = 0, overallTolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line) + { + FBSnapshotVerifyView(view, identifier: identifier, suffixes: suffixes, perPixelTolerance: perPixelTolerance, overallTolerance: overallTolerance, file: file, line: line) + } +} diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..2d13cec3463 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..f8f6daa292a Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testDrawIcons_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testDrawIcons_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..ae1b9408269 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testDrawIcons_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testDrawIcons_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testDrawIcons_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..c477eeaf786 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testDrawIcons_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..93924be46f5 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..bdc61bd13f8 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..14f670fe740 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..9f681624e00 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..5ae2ca6bf8f Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..e2977a01961 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..8297f68973b Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..9670d546aea Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..44f1769c94b Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..818a4c09902 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxisWithNegativeValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxisWithNegativeValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..989f288e05b Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxisWithNegativeValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxisWithNegativeValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxisWithNegativeValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..bd7bd6e4f11 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxisWithNegativeValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxisWithPositiveValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxisWithPositiveValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..be2ae43dd1a Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxisWithPositiveValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxisWithPositiveValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxisWithPositiveValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..9e4f87071ff Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxisWithPositiveValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxis_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxis_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..7d27de0629c Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxis_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxis_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxis_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..1788c32029a Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedLeftAxis_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxisWithNegativeValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxisWithNegativeValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..a5191421c1c Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxisWithNegativeValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxisWithNegativeValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxisWithNegativeValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..6e4bff4416d Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxisWithNegativeValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxisWithPositiveValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxisWithPositiveValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..4b4d2df1d72 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxisWithPositiveValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxisWithPositiveValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxisWithPositiveValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..f9f6d35fb54 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxisWithPositiveValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxis_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxis_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..4c8b73bfb59 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxis_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxis_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxis_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..ab2974b928d Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testInvertedRightAxis_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximum2_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximum2_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..87604724b55 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximum2_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximum2_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximum2_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..156d0741116 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximum2_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximumAndCustomAxisMaximum_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximumAndCustomAxisMaximum_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..d04863eb767 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximumAndCustomAxisMaximum_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximumAndCustomAxisMaximum_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximumAndCustomAxisMaximum_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..aa604e8d4bc Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximumAndCustomAxisMaximum_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximum_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximum_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..35f31f74a2d Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximum_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximum_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximum_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..cd859530f27 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMaximum_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMinimum2_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMinimum2_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..a45e218ca08 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMinimum2_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMinimum2_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMinimum2_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..f1daca0e9a7 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMinimum2_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMinimum_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMinimum_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..ee9fa885170 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMinimum_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMinimum_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMinimum_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..0790dc3635a Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValuesWithCustomAxisMinimum_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..d2eebf46510 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..75e27ace5a4 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNegativeValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNotDrawValueAboveBars_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNotDrawValueAboveBars_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..d3a2eaf95f2 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNotDrawValueAboveBars_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNotDrawValueAboveBars_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNotDrawValueAboveBars_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..5f129a20250 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testNotDrawValueAboveBars_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximum2_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximum2_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..c6da33bf159 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximum2_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximum2_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximum2_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..17040de2adf Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximum2_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximumAndCustomAxisMaximum_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximumAndCustomAxisMaximum_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..f7e8c2b458e Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximumAndCustomAxisMaximum_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximumAndCustomAxisMaximum_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximumAndCustomAxisMaximum_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..1b7585878cf Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximumAndCustomAxisMaximum_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximum_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximum_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..fb7664f40dc Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximum_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximum_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximum_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..61ae9fc6fae Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMaximum_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMinimum2_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMinimum2_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..b04152cdaad Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMinimum2_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMinimum2_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMinimum2_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..84ae02c122a Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMinimum2_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMinimum_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMinimum_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..df85bd7daeb Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMinimum_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMinimum_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMinimum_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..2cd8e7c2d37 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValuesWithCustomAxisMinimum_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..206a06f1ce4 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..a097f6038de Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testPositiveValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedDrawValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedDrawValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..1393c5c758d Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedDrawValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedDrawValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedDrawValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..1e92a91c670 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedDrawValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedNotDrawValuesAboveBars_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedNotDrawValuesAboveBars_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..f383efb25c0 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedNotDrawValuesAboveBars_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedNotDrawValuesAboveBars_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedNotDrawValuesAboveBars_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..d2f8018308a Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedNotDrawValuesAboveBars_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedNotDrawValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedNotDrawValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..c856db0dec6 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedNotDrawValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedNotDrawValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedNotDrawValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..b2486dc54c7 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testStackedNotDrawValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testZeroValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testZeroValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..fdf921d7786 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testZeroValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testZeroValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testZeroValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..00ea37e041f Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.BarChartTests/testZeroValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testAllRightAxisDependency_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testAllRightAxisDependency_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..2b165ed72c4 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testAllRightAxisDependency_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testAllRightAxisDependency_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testAllRightAxisDependency_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..92d5902097e Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testAllRightAxisDependency_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testDefaultAxisDependency_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testDefaultAxisDependency_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..2b165ed72c4 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testDefaultAxisDependency_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testDefaultAxisDependency_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testDefaultAxisDependency_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..92d5902097e Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testDefaultAxisDependency_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testLeftRightAxisDependency_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testLeftRightAxisDependency_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..c95e14720ca Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testLeftRightAxisDependency_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testLeftRightAxisDependency_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testLeftRightAxisDependency_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..da55ed12a75 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.CombinedChartTests/testLeftRightAxisDependency_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testDefaultValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testDefaultValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..90f3a6c6925 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testDefaultValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testDefaultValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testDefaultValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..843f34edaa2 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testDefaultValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testHidesValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testHidesValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..320cc393944 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testHidesValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testHidesValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testHidesValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..7a4b2bf8e64 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testHidesValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testNotDrawValueAboveBars_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testNotDrawValueAboveBars_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..b95109203a0 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testNotDrawValueAboveBars_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testNotDrawValueAboveBars_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testNotDrawValueAboveBars_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..b14f98468be Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testNotDrawValueAboveBars_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedDrawValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedDrawValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..26a18cd2388 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedDrawValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedDrawValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedDrawValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..9e424a242ed Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedDrawValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedNotDrawValuesAboveBars_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedNotDrawValuesAboveBars_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..7b1b288eb37 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedNotDrawValuesAboveBars_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedNotDrawValuesAboveBars_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedNotDrawValuesAboveBars_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..5426bf3bf88 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedNotDrawValuesAboveBars_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedNotDrawValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedNotDrawValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..ac27e555190 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedNotDrawValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedNotDrawValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedNotDrawValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..d8d1dac7737 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.HorizontalBarChartTests/testStackedNotDrawValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..e3e0623a255 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..5f18666d66f Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..ad68420bfae Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..7cf6e686ee8 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..a1f9a77e97a Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..5300de3bd0f Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDrawIcons_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDrawIcons_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..659b1b62d22 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDrawIcons_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDrawIcons_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDrawIcons_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..b7202ea64c8 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testDrawIcons_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..2bb6f59d7d0 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..2dab9c39d6f Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..1b0a5898cb4 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..2ba856164ca Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testDefaultValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testDefaultValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..26c56bdf143 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testDefaultValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testDefaultValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testDefaultValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..672cdeb5d66 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testDefaultValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testDrawIcons_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testDrawIcons_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..aeaaa7b745e Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testDrawIcons_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testDrawIcons_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testDrawIcons_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..ffa5a1847e8 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testDrawIcons_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testHideCenterLabel_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testHideCenterLabel_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..651ec08a926 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testHideCenterLabel_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testHideCenterLabel_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testHideCenterLabel_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..d97914b7ca3 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testHideCenterLabel_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testHidesValues_iOS_375_0_667_0@2x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testHidesValues_iOS_375_0_667_0@2x.png new file mode 100644 index 00000000000..5d6e0059fc8 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testHidesValues_iOS_375_0_667_0@2x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testHidesValues_tvOS_1920_0_1080_0@1x.png b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testHidesValues_tvOS_1920_0_1080_0@1x.png new file mode 100644 index 00000000000..11d04fb97be Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/ReferenceImages_64/ChartsTests.PieChartTests/testHidesValues_tvOS_1920_0_1080_0@1x.png differ diff --git a/Carthage/Checkouts/Charts/Tests/Supporting Files/Info.plist b/Carthage/Checkouts/Charts/Tests/Supporting Files/Info.plist new file mode 100644 index 00000000000..ba72822e872 --- /dev/null +++ b/Carthage/Checkouts/Charts/Tests/Supporting Files/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/Contents.json b/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/icon.imageset/Contents.json b/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/icon.imageset/Contents.json new file mode 100644 index 00000000000..8c89aaaae3c --- /dev/null +++ b/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "star-2.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "star-1.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "star.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/icon.imageset/star-1.png b/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/icon.imageset/star-1.png new file mode 100644 index 00000000000..c7811ef2b89 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/icon.imageset/star-1.png differ diff --git a/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/icon.imageset/star-2.png b/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/icon.imageset/star-2.png new file mode 100644 index 00000000000..c7811ef2b89 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/icon.imageset/star-2.png differ diff --git a/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/icon.imageset/star.png b/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/icon.imageset/star.png new file mode 100644 index 00000000000..c7811ef2b89 Binary files /dev/null and b/Carthage/Checkouts/Charts/Tests/Supporting Files/Media.xcassets/icon.imageset/star.png differ diff --git a/Carthage/Checkouts/Charts/scripts/build-dependencies.sh b/Carthage/Checkouts/Charts/scripts/build-dependencies.sh new file mode 100755 index 00000000000..8f0eca0b05e --- /dev/null +++ b/Carthage/Checkouts/Charts/scripts/build-dependencies.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +function build_dependencies { + + has_dependencies=$(ls Carthage/Build/**/*.framework 2> /dev/null | wc -l) + + if [ $has_dependencies != 0 ] + then + echo "Depencies have already been built." + else + echo "Building dependencies..." + carthage bootstrap + fi +} + +function alert_to_install_carthage { + echo "error: Carthage was not found! In order to build Charts you need to use Carthage to build its dependencies. Carthage can be downloaded from https://github.com/Carthage/Carthage." + exit 1 +} + +if hash carthage 2>/dev/null +then + build_dependencies +else + alert_to_install_carthage +fi diff --git a/Carthage/Checkouts/Charts/scripts/copy-carthage-frameworks.sh b/Carthage/Checkouts/Charts/scripts/copy-carthage-frameworks.sh new file mode 100755 index 00000000000..435f2c32eab --- /dev/null +++ b/Carthage/Checkouts/Charts/scripts/copy-carthage-frameworks.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +case "$PLATFORM_NAME" in + macosx) plat=Mac;; + iphone*) plat=iOS;; + watch*) plat=watchOS;; + appletv*) plat=tvOS;; + *) echo "error: Unknown PLATFORM_NAME: $PLATFORM_NAME"; exit 1;; +esac + +for (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do + VAR=SCRIPT_INPUT_FILE_$n + framework=$(basename "${!VAR}") + export SCRIPT_INPUT_FILE_$n="$SRCROOT"/Carthage/Build/$plat/"$framework" +done + +/usr/local/bin/carthage copy-frameworks || exit + +for (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do + VAR=SCRIPT_INPUT_FILE_$n + source=${!VAR}.dSYM + dest=${BUILT_PRODUCTS_DIR}/$(basename "$source") + ditto "$source" "$dest" || exit +done \ No newline at end of file diff --git a/Carthage/Checkouts/LaunchAtLogin/.editorconfig b/Carthage/Checkouts/LaunchAtLogin/.editorconfig new file mode 100644 index 00000000000..aaac3258bea --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +indent_style = tab +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/Carthage/Checkouts/LaunchAtLogin/.gitattributes b/Carthage/Checkouts/LaunchAtLogin/.gitattributes new file mode 100644 index 00000000000..6313b56c578 --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/Carthage/Checkouts/LaunchAtLogin/.gitignore b/Carthage/Checkouts/LaunchAtLogin/.gitignore new file mode 100644 index 00000000000..8b53cbff82b --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/.gitignore @@ -0,0 +1,2 @@ +xcuserdata +project.xcworkspace diff --git a/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin.podspec b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin.podspec new file mode 100644 index 00000000000..608be3a5991 --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin.podspec @@ -0,0 +1,14 @@ +Pod::Spec.new do |s| + s.name = 'LaunchAtLogin' + s.version = '2.5.0' + s.summary = 'Add "Launch at Login" functionality to your sandboxed macOS app in seconds' + s.license = 'MIT' + s.homepage = 'https://github.com/sindresorhus/LaunchAtLogin' + s.social_media_url = 'https://twitter.com/sindresorhus' + s.authors = { 'Sindre Sorhus' => 'sindresorhus@gmail.com' } + s.source = { :git => 'https://github.com/sindresorhus/LaunchAtLogin.git', :tag => "v#{s.version}" } + s.source_files = 'LaunchAtLogin', 'LaunchAtLoginHelper' + s.resource = 'LaunchAtLogin/copy-helper.sh' + s.swift_version = '4.2' + s.platform = :macos, '10.12' +end diff --git a/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin.xcodeproj/project.pbxproj b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..2a4d29426a3 --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin.xcodeproj/project.pbxproj @@ -0,0 +1,494 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + E32E9B681EB87D7B000FEEE9 /* LaunchAtLogin.h in Headers */ = {isa = PBXBuildFile; fileRef = E32E9B661EB87D7B000FEEE9 /* LaunchAtLogin.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E32E9B6F1EB87DC5000FEEE9 /* LaunchAtLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = E32E9B6E1EB87DC5000FEEE9 /* LaunchAtLogin.swift */; }; + E32E9B771EB87EA3000FEEE9 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = E32E9B761EB87EA3000FEEE9 /* main.swift */; }; + E32E9B861EB8845E000FEEE9 /* LaunchAtLoginHelper.app in Resources */ = {isa = PBXBuildFile; fileRef = E32E9B741EB87EA3000FEEE9 /* LaunchAtLoginHelper.app */; }; + E32E9B931EB889AE000FEEE9 /* copy-helper.sh in Resources */ = {isa = PBXBuildFile; fileRef = E32E9B921EB889AE000FEEE9 /* copy-helper.sh */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + E32E9B871EB88462000FEEE9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E32E9B5A1EB87D7B000FEEE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = E32E9B731EB87EA3000FEEE9; + remoteInfo = LaunchAtLoginHelper; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + E32E9B631EB87D7B000FEEE9 /* LaunchAtLogin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LaunchAtLogin.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E32E9B661EB87D7B000FEEE9 /* LaunchAtLogin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = LaunchAtLogin.h; sourceTree = ""; usesTabs = 1; }; + E32E9B671EB87D7B000FEEE9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E32E9B6E1EB87DC5000FEEE9 /* LaunchAtLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = LaunchAtLogin.swift; sourceTree = ""; usesTabs = 1; }; + E32E9B741EB87EA3000FEEE9 /* LaunchAtLoginHelper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LaunchAtLoginHelper.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E32E9B761EB87EA3000FEEE9 /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = main.swift; sourceTree = ""; usesTabs = 1; }; + E32E9B7F1EB87EA3000FEEE9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E32E9B921EB889AE000FEEE9 /* copy-helper.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; lineEnding = 0; path = "copy-helper.sh"; sourceTree = ""; usesTabs = 1; }; + E3B8C38A20C0003300272EC0 /* LaunchAtLoginHelper.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = LaunchAtLoginHelper.entitlements; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E32E9B5F1EB87D7B000FEEE9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E32E9B711EB87EA3000FEEE9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E32E9B591EB87D7B000FEEE9 = { + isa = PBXGroup; + children = ( + E32E9B651EB87D7B000FEEE9 /* LaunchAtLogin */, + E32E9B751EB87EA3000FEEE9 /* LaunchAtLoginHelper */, + E32E9B641EB87D7B000FEEE9 /* Products */, + ); + sourceTree = ""; + usesTabs = 1; + }; + E32E9B641EB87D7B000FEEE9 /* Products */ = { + isa = PBXGroup; + children = ( + E32E9B631EB87D7B000FEEE9 /* LaunchAtLogin.framework */, + E32E9B741EB87EA3000FEEE9 /* LaunchAtLoginHelper.app */, + ); + name = Products; + sourceTree = ""; + }; + E32E9B651EB87D7B000FEEE9 /* LaunchAtLogin */ = { + isa = PBXGroup; + children = ( + E32E9B6E1EB87DC5000FEEE9 /* LaunchAtLogin.swift */, + E32E9B661EB87D7B000FEEE9 /* LaunchAtLogin.h */, + E32E9B921EB889AE000FEEE9 /* copy-helper.sh */, + E32E9B671EB87D7B000FEEE9 /* Info.plist */, + ); + path = LaunchAtLogin; + sourceTree = ""; + }; + E32E9B751EB87EA3000FEEE9 /* LaunchAtLoginHelper */ = { + isa = PBXGroup; + children = ( + E32E9B761EB87EA3000FEEE9 /* main.swift */, + E32E9B7F1EB87EA3000FEEE9 /* Info.plist */, + E3B8C38A20C0003300272EC0 /* LaunchAtLoginHelper.entitlements */, + ); + path = LaunchAtLoginHelper; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + E32E9B601EB87D7B000FEEE9 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + E32E9B681EB87D7B000FEEE9 /* LaunchAtLogin.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + E32E9B621EB87D7B000FEEE9 /* LaunchAtLogin */ = { + isa = PBXNativeTarget; + buildConfigurationList = E32E9B6B1EB87D7B000FEEE9 /* Build configuration list for PBXNativeTarget "LaunchAtLogin" */; + buildPhases = ( + E32E9B5E1EB87D7B000FEEE9 /* Sources */, + E32E9B5F1EB87D7B000FEEE9 /* Frameworks */, + E32E9B601EB87D7B000FEEE9 /* Headers */, + E32E9B611EB87D7B000FEEE9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + E32E9B881EB88462000FEEE9 /* PBXTargetDependency */, + ); + name = LaunchAtLogin; + productName = LaunchAtLogin; + productReference = E32E9B631EB87D7B000FEEE9 /* LaunchAtLogin.framework */; + productType = "com.apple.product-type.framework"; + }; + E32E9B731EB87EA3000FEEE9 /* LaunchAtLoginHelper */ = { + isa = PBXNativeTarget; + buildConfigurationList = E32E9B801EB87EA3000FEEE9 /* Build configuration list for PBXNativeTarget "LaunchAtLoginHelper" */; + buildPhases = ( + E32E9B701EB87EA3000FEEE9 /* Sources */, + E32E9B711EB87EA3000FEEE9 /* Frameworks */, + E32E9B721EB87EA3000FEEE9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = LaunchAtLoginHelper; + productName = LaunchAtLoginHelper; + productReference = E32E9B741EB87EA3000FEEE9 /* LaunchAtLoginHelper.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E32E9B5A1EB87D7B000FEEE9 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0830; + LastUpgradeCheck = 0940; + ORGANIZATIONNAME = "Sindre Sorhus"; + TargetAttributes = { + E32E9B621EB87D7B000FEEE9 = { + CreatedOnToolsVersion = 8.3.2; + LastSwiftMigration = ""; + }; + E32E9B731EB87EA3000FEEE9 = { + CreatedOnToolsVersion = 8.3.2; + LastSwiftMigration = ""; + SystemCapabilities = { + com.apple.HardenedRuntime = { + enabled = 1; + }; + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + }; + }; + buildConfigurationList = E32E9B5D1EB87D7B000FEEE9 /* Build configuration list for PBXProject "LaunchAtLogin" */; + compatibilityVersion = "Xcode 10.0"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = E32E9B591EB87D7B000FEEE9; + productRefGroup = E32E9B641EB87D7B000FEEE9 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E32E9B621EB87D7B000FEEE9 /* LaunchAtLogin */, + E32E9B731EB87EA3000FEEE9 /* LaunchAtLoginHelper */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E32E9B611EB87D7B000FEEE9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E32E9B861EB8845E000FEEE9 /* LaunchAtLoginHelper.app in Resources */, + E32E9B931EB889AE000FEEE9 /* copy-helper.sh in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E32E9B721EB87EA3000FEEE9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E32E9B5E1EB87D7B000FEEE9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E32E9B6F1EB87DC5000FEEE9 /* LaunchAtLogin.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E32E9B701EB87EA3000FEEE9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E32E9B771EB87EA3000FEEE9 /* main.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + E32E9B881EB88462000FEEE9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = E32E9B731EB87EA3000FEEE9 /* LaunchAtLoginHelper */; + targetProxy = E32E9B871EB88462000FEEE9 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + E32E9B691EB87D7B000FEEE9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = ""; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VALID_ARCHS = x86_64; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + E32E9B6A1EB87D7B000FEEE9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = ""; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALID_ARCHS = x86_64; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + E32E9B6C1EB87D7B000FEEE9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = YG56YK5RN5; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = LaunchAtLogin/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.LaunchAtLogin; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_COMPILATION_MODE = singlefile; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; + }; + name = Debug; + }; + E32E9B6D1EB87D7B000FEEE9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = YG56YK5RN5; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = LaunchAtLogin/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.LaunchAtLogin; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.2; + }; + name = Release; + }; + E32E9B811EB87EA3000FEEE9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = LaunchAtLoginHelper/LaunchAtLoginHelper.entitlements; + CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = YG56YK5RN5; + ENABLE_HARDENED_RUNTIME = YES; + INFOPLIST_FILE = LaunchAtLoginHelper/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.LaunchAtLoginHelper; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.2; + }; + name = Debug; + }; + E32E9B821EB87EA3000FEEE9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = LaunchAtLoginHelper/LaunchAtLoginHelper.entitlements; + CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = YG56YK5RN5; + ENABLE_HARDENED_RUNTIME = YES; + INFOPLIST_FILE = LaunchAtLoginHelper/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.LaunchAtLoginHelper; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.2; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E32E9B5D1EB87D7B000FEEE9 /* Build configuration list for PBXProject "LaunchAtLogin" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E32E9B691EB87D7B000FEEE9 /* Debug */, + E32E9B6A1EB87D7B000FEEE9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E32E9B6B1EB87D7B000FEEE9 /* Build configuration list for PBXNativeTarget "LaunchAtLogin" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E32E9B6C1EB87D7B000FEEE9 /* Debug */, + E32E9B6D1EB87D7B000FEEE9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E32E9B801EB87EA3000FEEE9 /* Build configuration list for PBXNativeTarget "LaunchAtLoginHelper" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E32E9B811EB87EA3000FEEE9 /* Debug */, + E32E9B821EB87EA3000FEEE9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = E32E9B5A1EB87D7B000FEEE9 /* Project object */; +} diff --git a/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin.xcodeproj/xcshareddata/xcschemes/LaunchAtLogin.xcscheme b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin.xcodeproj/xcshareddata/xcschemes/LaunchAtLogin.xcscheme new file mode 100644 index 00000000000..81af23c726f --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin.xcodeproj/xcshareddata/xcschemes/LaunchAtLogin.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin.xcodeproj/xcshareddata/xcschemes/LaunchAtLoginHelper.xcscheme b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin.xcodeproj/xcshareddata/xcschemes/LaunchAtLoginHelper.xcscheme new file mode 100644 index 00000000000..a3a317258a2 --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin.xcodeproj/xcshareddata/xcschemes/LaunchAtLoginHelper.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin/Info.plist b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin/Info.plist new file mode 100644 index 00000000000..ceae955641b --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 2.5.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSHumanReadableCopyright + MIT © Sindre Sorhus + + diff --git a/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin/LaunchAtLogin.h b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin/LaunchAtLogin.h new file mode 100644 index 00000000000..f80117880ff --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin/LaunchAtLogin.h @@ -0,0 +1,4 @@ +#import + +FOUNDATION_EXPORT double LaunchAtLoginVersionNumber; +FOUNDATION_EXPORT const unsigned char LaunchAtLoginVersionString[]; diff --git a/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin/LaunchAtLogin.swift b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin/LaunchAtLogin.swift new file mode 100644 index 00000000000..c0050c9f174 --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin/LaunchAtLogin.swift @@ -0,0 +1,19 @@ +import Foundation +import ServiceManagement + +public struct LaunchAtLogin { + private static let id = "\(Bundle.main.bundleIdentifier!)-LaunchAtLoginHelper" + + public static var isEnabled: Bool { + get { + guard let jobs = (SMCopyAllJobDictionaries(kSMDomainUserLaunchd).takeRetainedValue() as? [[String: AnyObject]]) else { + return false + } + let job = jobs.first { $0["Label"] as! String == id } + return job?["OnDemand"] as? Bool ?? false + } + set { + SMLoginItemSetEnabled(id as CFString, newValue) + } + } +} diff --git a/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin/copy-helper.sh b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin/copy-helper.sh new file mode 100755 index 00000000000..52af101738d --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLogin/copy-helper.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +origin_helper_path="$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/LaunchAtLogin.framework/Resources/LaunchAtLoginHelper.app" +helper_dir="$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Library/LoginItems" +helper_path="$helper_dir/LaunchAtLoginHelper.app" + +rm -rf "$helper_path" +mkdir -p "$helper_dir" +cp -rf "$origin_helper_path" "$helper_dir/" + +defaults write "$helper_path/Contents/Info" CFBundleIdentifier -string "$PRODUCT_BUNDLE_IDENTIFIER-LaunchAtLoginHelper" + +if [[ -n $CODE_SIGN_ENTITLEMENTS ]]; then + codesign --force --entitlements="$CODE_SIGN_ENTITLEMENTS" --options=runtime --sign="$EXPANDED_CODE_SIGN_IDENTITY_NAME" "$helper_path" +else + codesign --force --options=runtime --sign="$EXPANDED_CODE_SIGN_IDENTITY_NAME" "$helper_path" +fi + +if [[ $CONFIGURATION == "Release" ]]; then + rm -rf "$origin_helper_path" + rm "$(dirname "$origin_helper_path")/copy-helper.sh" +fi diff --git a/Carthage/Checkouts/LaunchAtLogin/LaunchAtLoginHelper/Info.plist b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLoginHelper/Info.plist new file mode 100644 index 00000000000..a0756774633 --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLoginHelper/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + MIT © Sindre Sorhus + LSBackgroundOnly + + NSPrincipalClass + NSApplication + + diff --git a/StatsLauncher/StatsLauncher.entitlements b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLoginHelper/LaunchAtLoginHelper.entitlements similarity index 64% rename from StatsLauncher/StatsLauncher.entitlements rename to Carthage/Checkouts/LaunchAtLogin/LaunchAtLoginHelper/LaunchAtLoginHelper.entitlements index e51d8032372..852fa1a4728 100644 --- a/StatsLauncher/StatsLauncher.entitlements +++ b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLoginHelper/LaunchAtLoginHelper.entitlements @@ -4,9 +4,5 @@ com.apple.security.app-sandbox - com.apple.security.application-groups - - com.apple.security.files.user-selected.read-only - diff --git a/Carthage/Checkouts/LaunchAtLogin/LaunchAtLoginHelper/main.swift b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLoginHelper/main.swift new file mode 100644 index 00000000000..ad7fd4f2a1c --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/LaunchAtLoginHelper/main.swift @@ -0,0 +1,25 @@ +import Cocoa + +final class AppDelegate: NSObject, NSApplicationDelegate { + func applicationDidFinishLaunching(_ notification: Notification) { + let bundleId = Bundle.main.bundleIdentifier! + // TODO: Make this more strict by only replacing at the end + let mainBundleId = bundleId.replacingOccurrences(of: "-LaunchAtLoginHelper", with: "") + + // Ensure the app is not already running + guard NSRunningApplication.runningApplications(withBundleIdentifier: mainBundleId).isEmpty else { + NSApp.terminate(nil) + return + } + + let pathComponents = (Bundle.main.bundlePath as NSString).pathComponents + let mainPath = NSString.path(withComponents: Array(pathComponents[0...(pathComponents.count - 5)])) + NSWorkspace.shared.launchApplication(mainPath) + NSApp.terminate(nil) + } +} + +private let app = NSApplication.shared +private let delegate = AppDelegate() +app.delegate = delegate +app.run() diff --git a/Carthage/Checkouts/LaunchAtLogin/before-after.md b/Carthage/Checkouts/LaunchAtLogin/before-after.md new file mode 100644 index 00000000000..91cbe7059bb --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/before-after.md @@ -0,0 +1,21 @@ +# Before and after + +With `LaunchAtLogin`, you only have to do 2 steps instead of 13! + +```diff +- 1. Create a new target that will be the helper app that launches your app +- 2. Set `LSBackgroundOnly` to true in the `Info.plist` file +- 3. Set `Skip Install` to `YES` in the build settings for the helper app +- 4. Enable sandboxing for the helper app +- 5. Add a new `Copy Files` build phase to the main app +- 6. Select `Wrapper` as destination +- 7. Enter `Contents/Library/LoginItems` as subpath +- 8. Add the helper build product to the build phase +- 9. Copy-paste some boilerplate code into the helper app +- 10. Remember to replace `bundleid.of.main.app` and `MainExectuableName` with your own values +- 11. Copy-paste some code to register the helper app into your main app +- 12. Make sure the main app and helper app use the same code signing certificate +- 13. Manually verify that you did everything correctly ++ 1. Install this package ++ 2. Add a new "Run Script Phase" +``` diff --git a/Carthage/Checkouts/LaunchAtLogin/license b/Carthage/Checkouts/LaunchAtLogin/license new file mode 100644 index 00000000000..e7af2f77107 --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Carthage/Checkouts/LaunchAtLogin/readme.md b/Carthage/Checkouts/LaunchAtLogin/readme.md new file mode 100644 index 00000000000..5cc5a311cc2 --- /dev/null +++ b/Carthage/Checkouts/LaunchAtLogin/readme.md @@ -0,0 +1,86 @@ +# LaunchAtLogin + +> Add "Launch at Login" functionality to your macOS app in seconds + +It's usually quite a [convoluted and error-prone process](before-after.md) to add this. **No more!** + +This package works with both sandboxed and non-sandboxed apps and it's App Store compatible and used in my [Lungo](https://blog.sindresorhus.com/lungo-b364a6c2745f) and [Battery Indicator](https://sindresorhus.com/battery-indicator) apps. + +*You might also find my [`create-dmg`](https://github.com/sindresorhus/create-dmg) project useful if you're publishing your app outside the App Store.* + + +## Requirements + +- macOS 10.12+ +- Xcode 10+ +- Swift 4.2+ + + +## Install + +#### Carthage + +``` +github "sindresorhus/LaunchAtLogin" +``` + +#### CocoaPods + +```ruby +pod 'LaunchAtLogin' +``` + + + + + + +## Usage + +Add a new ["Run Script Phase"](http://stackoverflow.com/a/39633955/64949) below "Embed Frameworks" in "Build Phases" with the following: + +Carthage: + +```sh +"${PROJECT_DIR}/Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh" +``` + +CocoaPods: + +```sh +"${PROJECT_DIR}/Pods/LaunchAtLogin/LaunchAtLogin/copy-helper.sh" +``` + +Use it in your app: + +```swift +import LaunchAtLogin + +print(LaunchAtLogin.isEnabled) +//=> false + +LaunchAtLogin.isEnabled = true + +print(LaunchAtLogin.isEnabled) +//=> true +``` + +*Note that the [Mac App Store guidelines](https://developer.apple.com/app-store/review/guidelines/) requires "launch at login" functionality to be enabled in response to a user action. This is usually solved by making it a preference that is disabled by default.* + + +## How does it work? + +The framework bundles the helper app needed to launch your app and copies it into your app at build time. + + +## Related + +- [Defaults](https://github.com/sindresorhus/Defaults) - Swifty and modern UserDefaults +- [Preferences](https://github.com/sindresorhus/Preferences) - Add a preferences window to your macOS app in minutes +- [DockProgress](https://github.com/sindresorhus/DockProgress) - Show progress in your app's Dock icon +- [More…](https://github.com/search?q=user%3Asindresorhus+language%3Aswift) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/Makefile b/Makefile index 56d0804fcff..60630477ad2 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ APP_PATH = "$(BUILD_PATH)/$(APP).app" ZIP_PATH = "$(BUILD_PATH)/$(APP).zip" DMG_PATH = $(PWD)/$(APP).dmg -all: clean archive notarize sign build clean +all: clean archive notarize sign build clean: rm -rf $(BUILD_PATH) @@ -70,6 +70,7 @@ build: sign $(APP_PATH) rm -rf ./create-dmg + rm -rf $(BUILD_PATH) open $(PWD) check: diff --git a/Stats.xcodeproj/project.pbxproj b/Stats.xcodeproj/project.pbxproj old mode 100755 new mode 100644 index 6821e78249a..c2684b47763 --- a/Stats.xcodeproj/project.pbxproj +++ b/Stats.xcodeproj/project.pbxproj @@ -9,17 +9,25 @@ /* Begin PBXBuildFile section */ 9A09C89E22B3A7C90018426F /* Battery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A09C89D22B3A7C90018426F /* Battery.swift */; }; 9A09C8A022B3A7E20018426F /* BatteryReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A09C89F22B3A7E20018426F /* BatteryReader.swift */; }; - 9A09C8A222B3D94D0018426F /* BatteryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A09C8A122B3D94D0018426F /* BatteryView.swift */; }; + 9A09C8A222B3D94D0018426F /* BatteryWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A09C8A122B3D94D0018426F /* BatteryWidget.swift */; }; 9A1410F9229E721100D29793 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1410F8229E721100D29793 /* AppDelegate.swift */; }; 9A141100229E721200D29793 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A1410FE229E721200D29793 /* Main.storyboard */; }; - 9A426DB822C2B5EE00C064C4 /* macAppUpdater.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A426DB722C2B5EE00C064C4 /* macAppUpdater.swift */; }; + 9A426DB822C2B5EE00C064C4 /* MacAppUpdater.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A426DB722C2B5EE00C064C4 /* MacAppUpdater.swift */; }; 9A426DBE22C2BE0000C064C4 /* Updates.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A426DBD22C2BE0000C064C4 /* Updates.storyboard */; }; + 9A493CDF23202B620064570C /* MemoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A493CDE23202B620064570C /* MemoryView.swift */; }; 9A57A18522A1D26D0033E318 /* MenuBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A57A18422A1D26D0033E318 /* MenuBar.swift */; }; 9A57A19D22A1E3270033E318 /* CPU.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A57A19C22A1E3270033E318 /* CPU.swift */; }; 9A58D1B022C150C800405315 /* Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A58D1AF22C150C800405315 /* Network.swift */; }; 9A58D1B222C150D700405315 /* NetworkReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A58D1B122C150D700405315 /* NetworkReader.swift */; }; + 9A59AE54231ED1AC007989D6 /* CPUView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A59AE53231ED1AC007989D6 /* CPUView.swift */; }; + 9A59AE56231EE02F007989D6 /* ChartMarker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A59AE55231EE02F007989D6 /* ChartMarker.swift */; }; 9A5B1CBF229E78F0008B9D3C /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B1CBE229E78F0008B9D3C /* Observable.swift */; }; 9A5B1CC5229E7B40008B9D3C /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5B1CC4229E7B40008B9D3C /* Extensions.swift */; }; + 9A606B482321025C00642F51 /* BatteryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A606B472321025C00642F51 /* BatteryView.swift */; }; + 9A606B4A2321577400642F51 /* UpdatesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A606B492321577400642F51 /* UpdatesViewController.swift */; }; + 9A606B4C232157BA00642F51 /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A606B4B232157BA00642F51 /* AboutViewController.swift */; }; + 9A6698E62326AB16001D00E1 /* Charts.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9A6698E32326AAE5001D00E1 /* Charts.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 9A6698E92326AB19001D00E1 /* LaunchAtLogin.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9A6698DF2326AAD6001D00E1 /* LaunchAtLogin.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9A6CFC0122A1C9F5001E782D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9A6CFC0022A1C9F5001E782D /* Assets.xcassets */; }; 9A74D59722B44498004FE1FA /* Mini.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A74D59622B44498004FE1FA /* Mini.swift */; }; 9A79B36A22D3BEE600BF1C3A /* Widget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A79B36922D3BEE600BF1C3A /* Widget.swift */; }; @@ -38,21 +46,29 @@ 9AF0F32522DA92C400026AE6 /* NetworkText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AF0F32422DA92C400026AE6 /* NetworkText.swift */; }; 9AF0F32722DA92DD00026AE6 /* NetworkDotsText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AF0F32622DA92DD00026AE6 /* NetworkDotsText.swift */; }; 9AF0F32922DA92E800026AE6 /* NetworkArrowsText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AF0F32822DA92E800026AE6 /* NetworkArrowsText.swift */; }; - 9AFA402522AE49A200FE90BC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9AFA402422AE49A200FE90BC /* Assets.xcassets */; }; - 9AFA402822AE49A200FE90BC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9AFA402622AE49A200FE90BC /* Main.storyboard */; }; - 9AFA402F22AE49AE00FE90BC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AFA402E22AE49AE00FE90BC /* AppDelegate.swift */; }; - 9AFA403022AE49DD00FE90BC /* StatsLauncher.app in Copy Files */ = {isa = PBXBuildFile; fileRef = 9AFA401E22AE49A100FE90BC /* StatsLauncher.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 9AF6F1FE231D732600B8E1E4 /* PopupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AF6F1FD231D732600B8E1E4 /* PopupViewController.swift */; }; 9AFFCB3B22B3FD0500B0E6D8 /* About.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9AFFCB3A22B3FD0500B0E6D8 /* About.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ + 9A6698E72326AB16001D00E1 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 9A6698E92326AB19001D00E1 /* LaunchAtLogin.framework in Embed Frameworks */, + 9A6698E62326AB16001D00E1 /* Charts.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; 9AB54DAE22A19F96006192E0 /* Copy Files */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = Contents/Library/LoginItems; dstSubfolderSpec = 1; files = ( - 9AFA403022AE49DD00FE90BC /* StatsLauncher.app in Copy Files */, ); name = "Copy Files"; runOnlyForDeploymentPostprocessing = 0; @@ -62,20 +78,28 @@ /* Begin PBXFileReference section */ 9A09C89D22B3A7C90018426F /* Battery.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Battery.swift; sourceTree = ""; }; 9A09C89F22B3A7E20018426F /* BatteryReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatteryReader.swift; sourceTree = ""; }; - 9A09C8A122B3D94D0018426F /* BatteryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatteryView.swift; sourceTree = ""; }; + 9A09C8A122B3D94D0018426F /* BatteryWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatteryWidget.swift; sourceTree = ""; }; 9A1410F5229E721100D29793 /* Stats.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Stats.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9A1410F8229E721100D29793 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 9A1410FF229E721200D29793 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 9A141101229E721200D29793 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 9A141102229E721200D29793 /* Stats.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Stats.entitlements; sourceTree = ""; }; - 9A426DB722C2B5EE00C064C4 /* macAppUpdater.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = macAppUpdater.swift; sourceTree = ""; }; + 9A426DB722C2B5EE00C064C4 /* MacAppUpdater.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MacAppUpdater.swift; sourceTree = ""; }; 9A426DBD22C2BE0000C064C4 /* Updates.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Updates.storyboard; sourceTree = ""; }; + 9A493CDE23202B620064570C /* MemoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryView.swift; sourceTree = ""; }; 9A57A18422A1D26D0033E318 /* MenuBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBar.swift; sourceTree = ""; }; 9A57A19C22A1E3270033E318 /* CPU.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CPU.swift; sourceTree = ""; }; 9A58D1AF22C150C800405315 /* Network.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Network.swift; sourceTree = ""; }; 9A58D1B122C150D700405315 /* NetworkReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkReader.swift; sourceTree = ""; }; + 9A59AE53231ED1AC007989D6 /* CPUView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CPUView.swift; sourceTree = ""; }; + 9A59AE55231EE02F007989D6 /* ChartMarker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartMarker.swift; sourceTree = ""; }; 9A5B1CBE229E78F0008B9D3C /* Observable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Observable.swift; sourceTree = ""; }; 9A5B1CC4229E7B40008B9D3C /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; + 9A606B472321025C00642F51 /* BatteryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatteryView.swift; sourceTree = ""; }; + 9A606B492321577400642F51 /* UpdatesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdatesViewController.swift; sourceTree = ""; }; + 9A606B4B232157BA00642F51 /* AboutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = ""; }; + 9A6698DF2326AAD6001D00E1 /* LaunchAtLogin.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LaunchAtLogin.framework; path = Carthage/Build/Mac/LaunchAtLogin.framework; sourceTree = ""; }; + 9A6698E32326AAE5001D00E1 /* Charts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Charts.framework; path = Carthage/Build/Mac/Charts.framework; sourceTree = ""; }; 9A6CFC0022A1C9F5001E782D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 9A74D59622B44498004FE1FA /* Mini.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Mini.swift; sourceTree = ""; }; 9A79B36922D3BEE600BF1C3A /* Widget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Widget.swift; sourceTree = ""; }; @@ -96,12 +120,7 @@ 9AF0F32422DA92C400026AE6 /* NetworkText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkText.swift; sourceTree = ""; }; 9AF0F32622DA92DD00026AE6 /* NetworkDotsText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkDotsText.swift; sourceTree = ""; }; 9AF0F32822DA92E800026AE6 /* NetworkArrowsText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkArrowsText.swift; sourceTree = ""; }; - 9AFA401E22AE49A100FE90BC /* StatsLauncher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StatsLauncher.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 9AFA402422AE49A200FE90BC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 9AFA402722AE49A200FE90BC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 9AFA402922AE49A200FE90BC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9AFA402A22AE49A200FE90BC /* StatsLauncher.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = StatsLauncher.entitlements; sourceTree = ""; }; - 9AFA402E22AE49AE00FE90BC /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 9AF6F1FD231D732600B8E1E4 /* PopupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopupViewController.swift; sourceTree = ""; }; 9AFFCB3A22B3FD0500B0E6D8 /* About.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = About.storyboard; sourceTree = ""; }; /* End PBXFileReference section */ @@ -113,13 +132,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 9AFA401B22AE49A100FE90BC /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -128,6 +140,7 @@ children = ( 9A09C89D22B3A7C90018426F /* Battery.swift */, 9A09C89F22B3A7E20018426F /* BatteryReader.swift */, + 9A606B472321025C00642F51 /* BatteryView.swift */, ); path = Battery; sourceTree = ""; @@ -136,7 +149,6 @@ isa = PBXGroup; children = ( 9A1410F7229E721100D29793 /* Stats */, - 9AFA401F22AE49A100FE90BC /* StatsLauncher */, 9A1410F6229E721100D29793 /* Products */, 9A998CD622A199920087ADE7 /* Frameworks */, ); @@ -146,7 +158,6 @@ isa = PBXGroup; children = ( 9A1410F5229E721100D29793 /* Stats.app */, - 9AFA401E22AE49A100FE90BC /* StatsLauncher.app */, ); name = Products; sourceTree = ""; @@ -154,6 +165,7 @@ 9A1410F7229E721100D29793 /* Stats */ = { isa = PBXGroup; children = ( + 9AF6F1FC231D72EC00B8E1E4 /* Views */, 9A74D59522B440D4004FE1FA /* Widgets */, 9A5B1CB3229E72A7008B9D3C /* Supporting Files */, 9A5B1CBA229E7892008B9D3C /* Modules */, @@ -205,7 +217,8 @@ children = ( 9A5B1CBE229E78F0008B9D3C /* Observable.swift */, 9A5B1CC4229E7B40008B9D3C /* Extensions.swift */, - 9A426DB722C2B5EE00C064C4 /* macAppUpdater.swift */, + 9A426DB722C2B5EE00C064C4 /* MacAppUpdater.swift */, + 9A59AE55231EE02F007989D6 /* ChartMarker.swift */, ); path = libs; sourceTree = ""; @@ -215,7 +228,7 @@ children = ( 9AF0F31922DA923100026AE6 /* Network */, 9AF0F31822DA922800026AE6 /* Charts */, - 9A09C8A122B3D94D0018426F /* BatteryView.swift */, + 9A09C8A122B3D94D0018426F /* BatteryWidget.swift */, 9A74D59622B44498004FE1FA /* Mini.swift */, 9A79B36922D3BEE600BF1C3A /* Widget.swift */, ); @@ -227,6 +240,7 @@ children = ( 9A57A19C22A1E3270033E318 /* CPU.swift */, 9A7B8F5D22A2A57600DEB352 /* CPUReader.swift */, + 9A59AE53231ED1AC007989D6 /* CPUView.swift */, ); path = CPU; sourceTree = ""; @@ -236,6 +250,7 @@ children = ( 9A7B8F6822A2C3A100DEB352 /* Memory.swift */, 9A7B8F6C22A2C3D600DEB352 /* MemoryReader.swift */, + 9A493CDE23202B620064570C /* MemoryView.swift */, ); path = Memory; sourceTree = ""; @@ -252,6 +267,8 @@ 9A998CD622A199920087ADE7 /* Frameworks */ = { isa = PBXGroup; children = ( + 9A6698E32326AAE5001D00E1 /* Charts.framework */, + 9A6698DF2326AAD6001D00E1 /* LaunchAtLogin.framework */, 9A998CD922A199970087ADE7 /* ServiceManagement.framework */, 9A998CD722A199920087ADE7 /* Cocoa.framework */, ); @@ -280,16 +297,14 @@ path = Network; sourceTree = ""; }; - 9AFA401F22AE49A100FE90BC /* StatsLauncher */ = { + 9AF6F1FC231D72EC00B8E1E4 /* Views */ = { isa = PBXGroup; children = ( - 9AFA402E22AE49AE00FE90BC /* AppDelegate.swift */, - 9AFA402422AE49A200FE90BC /* Assets.xcassets */, - 9AFA402622AE49A200FE90BC /* Main.storyboard */, - 9AFA402922AE49A200FE90BC /* Info.plist */, - 9AFA402A22AE49A200FE90BC /* StatsLauncher.entitlements */, + 9AF6F1FD231D732600B8E1E4 /* PopupViewController.swift */, + 9A606B492321577400642F51 /* UpdatesViewController.swift */, + 9A606B4B232157BA00642F51 /* AboutViewController.swift */, ); - path = StatsLauncher; + path = Views; sourceTree = ""; }; /* End PBXGroup section */ @@ -303,6 +318,9 @@ 9A1410F2229E721100D29793 /* Frameworks */, 9A1410F3229E721100D29793 /* Resources */, 9AB54DAE22A19F96006192E0 /* Copy Files */, + 9A6698D82326A903001D00E1 /* ShellScript */, + 9A493CE1232047F00064570C /* ShellScript */, + 9A6698E72326AB16001D00E1 /* Embed Frameworks */, ); buildRules = ( ); @@ -313,23 +331,6 @@ productReference = 9A1410F5229E721100D29793 /* Stats.app */; productType = "com.apple.product-type.application"; }; - 9AFA401D22AE49A100FE90BC /* StatsLauncher */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9AFA402B22AE49A200FE90BC /* Build configuration list for PBXNativeTarget "StatsLauncher" */; - buildPhases = ( - 9AFA401A22AE49A100FE90BC /* Sources */, - 9AFA401B22AE49A100FE90BC /* Frameworks */, - 9AFA401C22AE49A100FE90BC /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = StatsLauncher; - productName = StatsLauncher; - productReference = 9AFA401E22AE49A100FE90BC /* StatsLauncher.app */; - productType = "com.apple.product-type.application"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -348,15 +349,6 @@ enabled = 0; }; com.apple.Sandbox = { - enabled = 1; - }; - }; - }; - 9AFA401D22AE49A100FE90BC = { - CreatedOnToolsVersion = 10.2.1; - LastSwiftMigration = 1030; - SystemCapabilities = { - com.apple.ApplicationGroups.Mac = { enabled = 0; }; }; @@ -377,7 +369,6 @@ projectRoot = ""; targets = ( 9A1410F4229E721100D29793 /* Stats */, - 9AFA401D22AE49A100FE90BC /* StatsLauncher */, ); }; /* End PBXProject section */ @@ -394,35 +385,69 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 9AFA401C22AE49A100FE90BC /* Resources */ = { - isa = PBXResourcesBuildPhase; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 9A493CE1232047F00064570C /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( - 9AFA402522AE49A200FE90BC /* Assets.xcassets in Resources */, - 9AFA402822AE49A200FE90BC /* Main.storyboard in Resources */, + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PROJECT_DIR}/Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh\"\n"; }; -/* End PBXResourcesBuildPhase section */ + 9A6698D82326A903001D00E1 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 8; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(SRCROOT)/Carthage/Build/Mac/LaunchAtLogin.framework", + "$(SRCROOT)/Carthage/Build/Mac/Charts.framework", + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 1; + shellPath = /bin/sh; + shellScript = "/usr/local/bin/carthage copy-frameworks\n"; + }; +/* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 9A1410F1229E721100D29793 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9A09C8A222B3D94D0018426F /* BatteryView.swift in Sources */, - 9A426DB822C2B5EE00C064C4 /* macAppUpdater.swift in Sources */, + 9A09C8A222B3D94D0018426F /* BatteryWidget.swift in Sources */, + 9A426DB822C2B5EE00C064C4 /* MacAppUpdater.swift in Sources */, 9A79B36E22D3BEF900BF1C3A /* Reader.swift in Sources */, + 9A606B4C232157BA00642F51 /* AboutViewController.swift in Sources */, + 9A59AE54231ED1AC007989D6 /* CPUView.swift in Sources */, 9A7B8F6F22A2C57000DEB352 /* DiskReader.swift in Sources */, 9A7B8F6922A2C3A100DEB352 /* Memory.swift in Sources */, 9AF0F32522DA92C400026AE6 /* NetworkText.swift in Sources */, 9A7B8F5E22A2A57600DEB352 /* CPUReader.swift in Sources */, 9AF0F32322DA92B900026AE6 /* NetworkArrows.swift in Sources */, + 9A606B4A2321577400642F51 /* UpdatesViewController.swift in Sources */, 9AF0F31D22DA925000026AE6 /* LineChartWithValue.swift in Sources */, 9A09C89E22B3A7C90018426F /* Battery.swift in Sources */, 9A7B8F6D22A2C3D600DEB352 /* MemoryReader.swift in Sources */, 9A79B36C22D3BEF000BF1C3A /* Module.swift in Sources */, 9A57A18522A1D26D0033E318 /* MenuBar.swift in Sources */, + 9AF6F1FE231D732600B8E1E4 /* PopupViewController.swift in Sources */, 9A57A19D22A1E3270033E318 /* CPU.swift in Sources */, 9A58D1B222C150D700405315 /* NetworkReader.swift in Sources */, 9A09C8A022B3A7E20018426F /* BatteryReader.swift in Sources */, @@ -432,20 +457,15 @@ 9A1410F9229E721100D29793 /* AppDelegate.swift in Sources */, 9AF0F32722DA92DD00026AE6 /* NetworkDotsText.swift in Sources */, 9AF0F32922DA92E800026AE6 /* NetworkArrowsText.swift in Sources */, + 9A606B482321025C00642F51 /* BatteryView.swift in Sources */, 9AF0F31F22DA925700026AE6 /* BarChart.swift in Sources */, 9AF0F31B22DA924000026AE6 /* LineChart.swift in Sources */, + 9A59AE56231EE02F007989D6 /* ChartMarker.swift in Sources */, 9A74D59722B44498004FE1FA /* Mini.swift in Sources */, 9A5B1CC5229E7B40008B9D3C /* Extensions.swift in Sources */, 9A79B36A22D3BEE600BF1C3A /* Widget.swift in Sources */, 9AF0F32122DA92AD00026AE6 /* NetworkDots.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9AFA401A22AE49A100FE90BC /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9AFA402F22AE49AE00FE90BC /* AppDelegate.swift in Sources */, + 9A493CDF23202B620064570C /* MemoryView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -460,14 +480,6 @@ name = Main.storyboard; sourceTree = ""; }; - 9AFA402622AE49A200FE90BC /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 9AFA402722AE49A200FE90BC /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -599,6 +611,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)", + "$(PROJECT_DIR)/Carthage/Build/Mac", ); INFOPLIST_FILE = "$(SRCROOT)/Stats/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( @@ -626,6 +639,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)", + "$(PROJECT_DIR)/Carthage/Build/Mac", ); INFOPLIST_FILE = "$(SRCROOT)/Stats/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( @@ -640,50 +654,6 @@ }; name = Release; }; - 9AFA402C22AE49A200FE90BC /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = StatsLauncher/StatsLauncher.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = RP2S87B72W; - ENABLE_HARDENED_RUNTIME = YES; - INFOPLIST_FILE = StatsLauncher/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 10.13; - PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.StatsLauncher; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 9AFA402D22AE49A200FE90BC /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = StatsLauncher/StatsLauncher.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = RP2S87B72W; - ENABLE_HARDENED_RUNTIME = YES; - INFOPLIST_FILE = StatsLauncher/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 10.13; - PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.StatsLauncher; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -705,15 +675,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 9AFA402B22AE49A200FE90BC /* Build configuration list for PBXNativeTarget "StatsLauncher" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9AFA402C22AE49A200FE90BC /* Debug */, - 9AFA402D22AE49A200FE90BC /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = 9A1410ED229E721100D29793 /* Project object */; diff --git a/Stats.xcodeproj/xcshareddata/xcschemes/Stats.xcscheme b/Stats.xcodeproj/xcshareddata/xcschemes/Stats.xcscheme index b0eb1edf853..144292f3f8e 100644 --- a/Stats.xcodeproj/xcshareddata/xcschemes/Stats.xcscheme +++ b/Stats.xcodeproj/xcshareddata/xcschemes/Stats.xcscheme @@ -1,6 +1,6 @@ + + - - + + + + = Observable([CPU(), Memory(), Disk(), Battery(), Network()]) let updater = macAppUpdater(user: "exelban", repo: "stats") - -let appStoreMode: Bool = false +let popover = NSPopover() @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { - let defaults = UserDefaults.standard - var menuBarItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength) + private let defaults = UserDefaults.standard + private var menuBarItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength) func applicationDidFinishLaunching(_ aNotification: Notification) { guard let menuBarButton = self.menuBarItem.button else { @@ -29,33 +25,32 @@ class AppDelegate: NSObject, NSApplicationDelegate { return } - _ = MenuBar(menuBarItem, menuBarButton: menuBarButton) - - let launcherAppId = "eu.exelban.StatsLauncher" - let runningApps = NSWorkspace.shared.runningApplications - let isRunning = !runningApps.filter { $0.bundleIdentifier == launcherAppId }.isEmpty + menuBarButton.action = #selector(toggleMenu) + popover.contentViewController = MainViewController.Init() + popover.behavior = NSPopover.Behavior.transient - if defaults.object(forKey: "runAtLogin") == nil { - SMLoginItemSetEnabled(launcherAppId as CFString, true) - self.defaults.set(true, forKey: "runAtLogin") + _ = MenuBar(menuBarItem, menuBarButton: menuBarButton) + + if self.defaults.object(forKey: "runAtLoginInitialized") == nil { + LaunchAtLogin.isEnabled = true } if defaults.object(forKey: "dockIcon") != nil { let dockIconStatus = defaults.bool(forKey: "dockIcon") ? NSApplication.ActivationPolicy.regular : NSApplication.ActivationPolicy.accessory NSApp.setActivationPolicy(dockIconStatus) } - - if !appStoreMode && defaults.object(forKey: "checkUpdatesOnLogin") == nil || defaults.bool(forKey: "checkUpdatesOnLogin") { + + if defaults.object(forKey: "checkUpdatesOnLogin") == nil || defaults.bool(forKey: "checkUpdatesOnLogin") { updater.check() { result, error in if error != nil && error as! String == "No internet connection" { return } - + guard error == nil, let version: version = result else { print("Error: \(error ?? "check error")") return } - + if version.newest { DispatchQueue.main.async(execute: { let updatesVC: NSWindowController? = NSStoryboard(name: "Updates", bundle: nil).instantiateController(withIdentifier: "UpdatesVC") as? NSWindowController @@ -66,10 +61,6 @@ class AppDelegate: NSObject, NSApplicationDelegate { } } } - - if isRunning { - DistributedNotificationCenter.default().post(name: .killLauncher, object: Bundle.main.bundleIdentifier!) - } } func applicationWillTerminate(_ aNotification: Notification) { @@ -79,96 +70,20 @@ class AppDelegate: NSObject, NSApplicationDelegate { } } } -} - -class AboutVC: NSViewController { - @IBOutlet weak var versionLabel: NSTextField! - - override func viewDidLoad() { - super.viewDidLoad() - self.view.wantsLayer = true - } - - @IBAction func openLink(_ sender: Any) { - NSWorkspace.shared.open(URL(string: "https://github.com/exelban/stats")!) - } - - @IBAction func exit(_ sender: Any) { - self.view.window?.close() - } - - override func awakeFromNib() { - if self.view.layer != nil { - self.view.window?.backgroundColor = .windowBackgroundColor - let versionNumber = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String - versionLabel.stringValue = "Version \(versionNumber)" - } - } -} - -class UpdatesVC: NSViewController { - @IBOutlet weak var mainView: NSStackView! - @IBOutlet weak var spinnerView: NSView! - @IBOutlet weak var noInternetView: NSView! - @IBOutlet weak var mainTextLabel: NSTextFieldCell! - @IBOutlet weak var currentVersionLabel: NSTextField! - @IBOutlet weak var latestVersionLabel: NSTextField! - @IBOutlet weak var downloadButton: NSButton! - @IBOutlet weak var spinner: NSProgressIndicator! - - var url: String? - override func viewDidLoad() { - super.viewDidLoad() - self.view.wantsLayer = true - - self.spinner.startAnimation(self) - - updater.check() { result, error in - if error != nil && error as! String == "No internet connection" { - DispatchQueue.main.async(execute: { - self.spinnerView.isHidden = true - self.noInternetView.isHidden = false - }) - return + @objc func toggleMenu(_ sender: Any?) { + if popover.isShown { + popover.performClose(sender) + } else { + if let button = self.menuBarItem.button { + NSApplication.shared.activate(ignoringOtherApps: true) + popover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY) + popover.becomeFirstResponder() } - - guard error == nil, let version: version = result else { - print("Error: \(error ?? "check error")") - return - } - - DispatchQueue.main.async(execute: { - self.spinner.stopAnimation(self) - self.spinnerView.isHidden = true - self.mainView.isHidden = false - self.currentVersionLabel.stringValue = version.current - self.latestVersionLabel.stringValue = version.latest - self.url = version.url - - if !version.newest { - self.mainTextLabel.stringValue = "No new version available" - self.downloadButton.isEnabled = false - } - }) - } - } - - override func awakeFromNib() { - if self.view.layer != nil { - self.view.window?.backgroundColor = .windowBackgroundColor - } - } - - @IBAction func download(_ sender: Any) { - guard let urlString = self.url, let url = URL(string: urlString) else { - return } - NSWorkspace.shared.open(url) - self.view.window?.close() } - @IBAction func exit(_ sender: Any) { - self.view.window?.close() + func applicationWillResignActive(_ notification: Notification) { + popover.performClose(self) } } diff --git a/Stats/MenuBar.swift b/Stats/MenuBar.swift index c6ed5cdaa9d..dc07c583e9d 100644 --- a/Stats/MenuBar.swift +++ b/Stats/MenuBar.swift @@ -10,9 +10,10 @@ import Cocoa import ServiceManagement class MenuBar { - let defaults = UserDefaults.standard - let menuBarItem: NSStatusItem - lazy var menuBarButton: NSButton = NSButton() + private let defaults = UserDefaults.standard + private let menuBarItem: NSStatusItem + private var menuBarButton: NSButton = NSButton() + private var view: NSView? = nil init(_ menuBarItem: NSStatusItem, menuBarButton: NSButton) { self.menuBarItem = menuBarItem @@ -24,117 +25,29 @@ class MenuBar { } } - func generateMenuBar() { + private func generateMenuBar() { buildModulesView() - menuBarItem.menu = buildMenu() for module in modules.value { module.active.subscribe(observer: self) { (value, _) in self.buildModulesView() self.menuBarItem.menu?.removeAllItems() - self.menuBarItem.menu = self.buildMenu() } module.available.subscribe(observer: self) { (value, _) in self.buildModulesView() self.menuBarItem.menu?.removeAllItems() - self.menuBarItem.menu = self.buildMenu() } } } - func buildMenu() -> NSMenu { - let menu = NSMenu() - - for module in modules.value { - if module.available.value { - menu.addItem(module.menu) - } - } - - menu.addItem(NSMenuItem.separator()) - - let preferences = NSMenuItem(title: "Preferences", action: nil, keyEquivalent: "") - let preferencesMenu = NSMenu() - - let checkForUpdates = NSMenuItem(title: "Check for updates on start", action: #selector(toggleMenu), keyEquivalent: "") - checkForUpdates.state = defaults.bool(forKey: "checkUpdatesOnLogin") || defaults.object(forKey: "checkUpdatesOnLogin") == nil ? NSControl.StateValue.on : NSControl.StateValue.off - checkForUpdates.target = self - preferencesMenu.addItem(checkForUpdates) - - let runAtLogin = NSMenuItem(title: "Start at login", action: #selector(toggleMenu), keyEquivalent: "") - runAtLogin.state = defaults.bool(forKey: "runAtLogin") || defaults.object(forKey: "runAtLogin") == nil ? NSControl.StateValue.on : NSControl.StateValue.off - runAtLogin.target = self - preferencesMenu.addItem(runAtLogin) - - let dockIcon = NSMenuItem(title: "Show icon in dock", action: #selector(toggleMenu), keyEquivalent: "") - dockIcon.state = defaults.bool(forKey: "dockIcon") ? NSControl.StateValue.on : NSControl.StateValue.off - dockIcon.target = self - preferencesMenu.addItem(dockIcon) - - preferences.submenu = preferencesMenu - menu.addItem(preferences) - - menu.addItem(NSMenuItem.separator()) - - let updateMenu = NSMenuItem(title: "Check for updates", action: #selector(checkUpdate), keyEquivalent: "") - updateMenu.target = self - - let aboutMenu = NSMenuItem(title: "About Stats", action: #selector(openAbout), keyEquivalent: "") - aboutMenu.target = self - - if !appStoreMode { - menu.addItem(updateMenu) - } - menu.addItem(aboutMenu) - menu.addItem(NSMenuItem(title: "Quit Stats", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "")) - - return menu - } - - @objc func checkUpdate(_ sender : NSMenuItem) { - let updatesVC: NSWindowController? = NSStoryboard(name: "Updates", bundle: nil).instantiateController(withIdentifier: "UpdatesVC") as? NSWindowController - updatesVC?.window?.center() - updatesVC?.window?.level = .floating - updatesVC!.showWindow(self) - } - - @objc func openAbout(_ sender : NSMenuItem) { - let aboutVC: NSWindowController? = NSStoryboard(name: "About", bundle: nil).instantiateController(withIdentifier: "AboutVC") as? NSWindowController - aboutVC?.window?.center() - aboutVC?.window?.level = .floating - aboutVC!.showWindow(self) - } - - @objc func toggleMenu(_ sender : NSMenuItem) { - let launcherId = "eu.exelban.StatsLauncher" - let status = sender.state != NSControl.StateValue.on - sender.state = sender.state == NSControl.StateValue.on ? NSControl.StateValue.off : NSControl.StateValue.on - - switch sender.title { - case "Start at login": - SMLoginItemSetEnabled(launcherId as CFString, status) - self.defaults.set(status, forKey: "runAtLogin") - case "Check for updates on start": - self.defaults.set(status, forKey: "checkUpdatesOnLogin") - case "Show icon in dock": - self.defaults.set(status, forKey: "dockIcon") - let iconStatus = status ? NSApplication.ActivationPolicy.regular : NSApplication.ActivationPolicy.accessory - NSApp.setActivationPolicy(iconStatus) - return - default: break + private func buildModulesView() { + if self.view == nil { + self.view = NSView(frame: NSMakeRect(0, 0, widgetSize.width, widgetSize.height)) + self.menuBarButton.addSubview(self.view!) } - } - - func buildModulesView() { - for subview in self.menuBarButton.subviews { - subview.removeFromSuperview() - } - - self.menuBarButton.image = NSImage(named:NSImage.Name("tray_icon")) - self.menuBarItem.length = widgetSize.width - var WIDTH = CGFloat(modules.value.count) * widgetSize.width + let view = self.view! - WIDTH = 0 + var WIDTH: CGFloat = 0 for module in modules.value { if module.active.value && module.available.value { module.start() @@ -142,7 +55,10 @@ class MenuBar { } } - let view: NSView = NSView(frame: NSMakeRect(0, 0, WIDTH, widgetSize.height)) + self.menuBarButton.image = nil + for v in view.subviews { + v.removeFromSuperview() + } var x: CGFloat = 0 for module in modules.value { @@ -153,11 +69,12 @@ class MenuBar { } } - if view.subviews.count != 0 { - view.frame.size.width = WIDTH - self.menuBarButton.image = nil + if view.subviews.count == 0 { + self.menuBarButton.image = NSImage(named:NSImage.Name("tray_icon")) + self.menuBarItem.length = widgetSize.width + } else { self.menuBarItem.length = WIDTH - self.menuBarButton.addSubview(view) + view.frame.size.width = WIDTH } } } diff --git a/Stats/Modules/Battery/Battery.swift b/Stats/Modules/Battery/Battery.swift index 51b33a5e6b2..7e1b8478d43 100644 --- a/Stats/Modules/Battery/Battery.swift +++ b/Stats/Modules/Battery/Battery.swift @@ -9,46 +9,50 @@ import Cocoa class Battery: Module { - let name: String = "Battery" - let shortName: String = "" - var view: NSView = NSView() - var menu: NSMenuItem = NSMenuItem() - var submenu: NSMenu = NSMenu() - var active: Observable - var available: Observable - var reader: Reader = BatteryReader() + public let name: String = "Battery" + public let shortName: String = "" + public var view: NSView = NSView() + public var menu: NSMenuItem = NSMenuItem() + public var active: Observable + public var available: Observable + public var reader: Reader = BatteryReader() + public var viewAvailable: Bool = true + public var tabView: NSTabViewItem = NSTabViewItem() - let defaults = UserDefaults.standard - var widgetType: WidgetType = Widgets.Mini - let percentageView: Observable + public var widgetType: WidgetType = Widgets.Mini + public let percentageView: Observable + + private let defaults = UserDefaults.standard + private var submenu: NSMenu = NSMenu() init() { self.available = Observable(self.reader.available) self.active = Observable(defaults.object(forKey: name) != nil ? defaults.bool(forKey: name) : true) self.percentageView = Observable(defaults.object(forKey: "\(self.name)_percentage") != nil ? defaults.bool(forKey: "\(self.name)_percentage") : false) - self.view = BatteryView(frame: NSMakeRect(0, 0, widgetSize.width, widgetSize.height)) + self.view = BatteryWidget(frame: NSMakeRect(0, 0, widgetSize.width, widgetSize.height)) initMenu(active: self.active.value) initWidget() + initTab() } func start() { if !self.reader.value.value.isEmpty { let value = self.reader.value!.value - (self.view as! BatteryView).setCharging(value: value.first! > 0) + (self.view as! BatteryWidget).setCharging(value: value.first! > 0) (self.view as! Widget).setValue(data: [abs(value.first!)]) } self.reader.start() self.reader.value.subscribe(observer: self) { (value, _) in if !value.isEmpty { - (self.view as! BatteryView).setCharging(value: value.first! > 0) + (self.view as! BatteryWidget).setCharging(value: value.first! > 0) (self.view as! Widget).setValue(data: [abs(value.first!)]) } } } func initWidget() { - (self.view as! BatteryView).setPercentage(value: self.percentageView.value) + (self.view as! BatteryWidget).setPercentage(value: self.percentageView.value) } func initMenu(active: Bool) { diff --git a/Stats/Modules/Battery/BatteryReader.swift b/Stats/Modules/Battery/BatteryReader.swift index 8b97b1a01ec..fcc4cd35aec 100644 --- a/Stats/Modules/Battery/BatteryReader.swift +++ b/Stats/Modules/Battery/BatteryReader.swift @@ -9,10 +9,45 @@ import Foundation import IOKit.ps +struct BatteryUsage { + var powerSource: String = "" + var state: String = "" + var isCharged: Bool = false + var capacity: Double = 0 + var cycles: Int = 0 + var health: Int = 0 + + var amperage: Int = 0 + var voltage: Double = 0 + var temperature: Double = 0 + + var ACwatts: Int = 0 + var ACstatus: Bool = false + + var timeToEmpty: Int = 0 + var timeToCharge: Int = 0 +} + class BatteryReader: Reader { - var value: Observable<[Double]>! - var available: Bool = false - var updateTimer: Timer! + public var value: Observable<[Double]>! + public var usage: Observable = Observable(BatteryUsage()) + public var updateTimer: Timer! + + private var service: io_connect_t = 0 + private var internalChecked: Bool = false + private var hasInternalBattery: Bool = false + + public var available: Bool { + get { + if !self.internalChecked { + let snapshot = IOPSCopyPowerSourcesInfo().takeRetainedValue() + let sources = IOPSCopyPowerSourcesList(snapshot).takeRetainedValue() as Array + self.hasInternalBattery = sources.count > 0 + self.internalChecked = true + } + return self.hasInternalBattery + } + } init() { self.value = Observable([]) @@ -20,6 +55,7 @@ class BatteryReader: Reader { } func start() { + self.service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("AppleSmartBattery")) if updateTimer != nil { return } @@ -32,25 +68,101 @@ class BatteryReader: Reader { } updateTimer.invalidate() updateTimer = nil + + IOServiceClose(self.service) + IOObjectRelease(self.service) } @objc func read() { let psInfo = IOPSCopyPowerSourcesInfo().takeRetainedValue() let psList = IOPSCopyPowerSourcesList(psInfo).takeRetainedValue() as [CFTypeRef] - self.available = psList.count != 0 for ps in psList { - if let psDesc = IOPSGetPowerSourceDescription(psInfo, ps).takeUnretainedValue() as? [String: Any] { - let powerSourceState = (psDesc[kIOPSPowerSourceStateKey] as? String) - let isCharged = (psDesc[kIOPSIsChargedKey] as? Bool) - var cap: Float = Float(psDesc[kIOPSCurrentCapacityKey] as! Int) / 100 + if let list = IOPSGetPowerSourceDescription(psInfo, ps).takeUnretainedValue() as? Dictionary { + let powerSource = list[kIOPSPowerSourceStateKey] as? String ?? "AC Power" + let state = list[kIOPSBatteryHealthKey] as! String + let isCharged = list[kIOPSIsChargedKey] as? Bool ?? false + var cap = Float(list[kIOPSCurrentCapacityKey] as! Int) / 100 + + let timeToEmpty = Int(list[kIOPSTimeToEmptyKey] as! Int) + let timeToCharged = Int(list[kIOPSTimeToFullChargeKey] as! Int) + + let cycles = self.getIntValue("CycleCount" as CFString) ?? 0 - if isCharged == nil && powerSourceState! == "Battery Power" { - cap = 0 - cap + let maxCapacity = self.getIntValue("MaxCapacity" as CFString) ?? 1 + let designCapacity = self.getIntValue("DesignCapacity" as CFString) ?? 1 + + let amperage = self.getIntValue("Amperage" as CFString) ?? 0 + let voltage = self.getVoltage() ?? 0 + let temperature = self.getTemperature() ?? 0 + + var ACwatts: Int = 0 + if let ACDetails = IOPSCopyExternalPowerAdapterDetails() { + if let ACList = ACDetails.takeUnretainedValue() as? Dictionary { + ACwatts = Int(ACList[kIOPSPowerAdapterWattsKey] as! Int) + } } + let ACstatus = self.getBoolValue("IsCharging" as CFString) ?? false + self.usage << BatteryUsage( + powerSource: powerSource, + state: state, + isCharged: isCharged, + capacity: Double(cap), + cycles: cycles, + health: (100 * maxCapacity) / designCapacity, + + amperage: amperage, + voltage: voltage, + temperature: temperature, + + ACwatts: ACwatts, + ACstatus: ACstatus, + + timeToEmpty: timeToEmpty, + timeToCharge: timeToCharged + ) + + if powerSource == "Battery Power" { + cap = 0 - cap + } self.value << [Double(cap)] } } } + + func getBoolValue(_ forIdentifier: CFString) -> Bool? { + if let value = IORegistryEntryCreateCFProperty(self.service, forIdentifier, kCFAllocatorDefault, 0) { + return value.takeRetainedValue() as? Bool + } + return nil + } + + func getIntValue(_ identifier: CFString) -> Int? { + if let value = IORegistryEntryCreateCFProperty(self.service, identifier, kCFAllocatorDefault, 0) { + return value.takeRetainedValue() as? Int + } + return nil + } + + func getDoubleValue(_ identifier: CFString) -> Double? { + if let value = IORegistryEntryCreateCFProperty(self.service, identifier, kCFAllocatorDefault, 0) { + return value.takeRetainedValue() as? Double + } + return nil + } + + func getVoltage() -> Double? { + if let value = self.getDoubleValue("Voltage" as CFString) { + return value / 1000.0 + } + return nil + } + + func getTemperature() -> Double? { + if let value = IORegistryEntryCreateCFProperty(self.service, "Temperature" as CFString, kCFAllocatorDefault, 0) { + return value.takeRetainedValue() as! Double / 100.0 + } + return nil + } } diff --git a/Stats/Modules/Battery/BatteryView.swift b/Stats/Modules/Battery/BatteryView.swift new file mode 100644 index 00000000000..7b740ca3c39 --- /dev/null +++ b/Stats/Modules/Battery/BatteryView.swift @@ -0,0 +1,258 @@ +// +// BatteryView.swift +// Stats +// +// Created by Serhiy Mytrovtsiy on 05/09/2019. +// Copyright © 2019 Serhiy Mytrovtsiy. All rights reserved. +// + +import Foundation +import Cocoa + +extension Battery { + + func initTab() { + self.tabView.view?.frame = NSRect(x: 0, y: 0, width: TabWidth, height: 10) + + makeMain() + makeOverview() + makeBattery() + makePowerAdapter() + } + + func makeMain() { + let stackHeight: CGFloat = 22 + let vertical: NSStackView = NSStackView(frame: NSRect(x: 0, y: TabHeight - stackHeight*3 - 4, width: TabWidth, height: stackHeight*3)) + vertical.orientation = .vertical + + let level: NSStackView = NSStackView(frame: NSRect(x: 10, y: stackHeight*2, width: TabWidth - 20, height: stackHeight)) + level.orientation = .horizontal + level.distribution = .equalCentering + let levelLabel = LabelField(string: "Level") + let levelValue = ValueField(string: "0 %") + level.addView(levelLabel, in: .center) + level.addView(levelValue, in: .center) + + let source: NSStackView = NSStackView(frame: NSRect(x: 10, y: stackHeight*1, width: TabWidth - 20, height: stackHeight)) + source.orientation = .horizontal + source.distribution = .equalCentering + let sourceLabel = LabelField(string: "Source") + let sourceValue = ValueField(string: "AC Power") + source.addView(sourceLabel, in: .center) + source.addView(sourceValue, in: .center) + + let time: NSStackView = NSStackView(frame: NSRect(x: 10, y: 0, width: TabWidth - 20, height: stackHeight)) + time.orientation = .horizontal + time.distribution = .equalCentering + let timeLabel = LabelField(string: "Time to charge") + let timeValue = ValueField(string: "Calculating") + time.addView(timeLabel, in: .center) + time.addView(timeValue, in: .center) + + vertical.addSubview(level) + vertical.addSubview(source) + vertical.addSubview(time) + + self.tabView.view?.addSubview(vertical) + + (self.reader as! BatteryReader).usage.subscribe(observer: self) { (value, _) in + levelValue.stringValue = "\(Int(value.capacity * 100)) %" + sourceValue.stringValue = value.powerSource + + if value.powerSource == "Battery Power" { + timeLabel.stringValue = "Time to discharge" + if value.timeToEmpty != -1 && value.timeToEmpty != 0 { + timeValue.stringValue = Double(value.timeToEmpty*60).printSecondsToHoursMinutesSeconds() + } + } else { + timeLabel.stringValue = "Time to charge" + if value.timeToCharge != -1 && value.timeToCharge != 0 { + timeValue.stringValue = Double(value.timeToCharge*60).printSecondsToHoursMinutesSeconds() + } + } + + if value.timeToEmpty == -1 || value.timeToEmpty == -1 { + timeValue.stringValue = "Calculating" + } + + if value.isCharged { + timeValue.stringValue = "Fully charged" + } + } + } + + func makeOverview() { + let overviewLabel: NSView = NSView(frame: NSRect(x: 0, y: TabHeight - 102, width: TabWidth, height: 25)) + + overviewLabel.wantsLayer = true + overviewLabel.layer?.backgroundColor = NSColor(hexString: "#eeeeee", alpha: 0.5).cgColor + + let overviewText: NSTextField = NSTextField(string: "Overview") + overviewText.frame = NSRect(x: 0, y: 0, width: TabWidth, height: overviewLabel.frame.size.height - 4) + overviewText.isEditable = false + overviewText.isSelectable = false + overviewText.isBezeled = false + overviewText.wantsLayer = true + overviewText.textColor = .darkGray + overviewText.canDrawSubviewsIntoLayer = true + overviewText.alignment = .center + overviewText.backgroundColor = NSColor(hexString: "#dddddd", alpha: 0) + overviewText.font = NSFont.systemFont(ofSize: 12, weight: .medium) + + overviewLabel.addSubview(overviewText) + self.tabView.view?.addSubview(overviewLabel) + + let stackHeight: CGFloat = 22 + let vertical: NSStackView = NSStackView(frame: NSRect(x: 0, y: 184, width: TabWidth, height: stackHeight*3)) + vertical.orientation = .vertical + + let cycles: NSStackView = NSStackView(frame: NSRect(x: 10, y: stackHeight*2, width: TabWidth - 20, height: stackHeight)) + cycles.orientation = .horizontal + cycles.distribution = .equalCentering + let cyclesLabel = LabelField(string: "Cycles") + let cyclesValue = ValueField(string: "0") + cycles.addView(cyclesLabel, in: .center) + cycles.addView(cyclesValue, in: .center) + + let health: NSStackView = NSStackView(frame: NSRect(x: 10, y: stackHeight*1, width: TabWidth - 20, height: stackHeight)) + health.orientation = .horizontal + health.distribution = .equalCentering + let healthLabel = LabelField(string: "Health") + let healthValue = ValueField(string: "Calculating") + health.addView(healthLabel, in: .center) + health.addView(healthValue, in: .center) + + let state: NSStackView = NSStackView(frame: NSRect(x: 10, y: 0, width: TabWidth - 20, height: stackHeight)) + state.orientation = .horizontal + state.distribution = .equalCentering + let stateLabel = LabelField(string: "State") + let stateValue = ValueField(string: "Calculating") + state.addView(stateLabel, in: .center) + state.addView(stateValue, in: .center) + + vertical.addSubview(cycles) + vertical.addSubview(health) + vertical.addSubview(state) + + self.tabView.view?.addSubview(vertical) + + (self.reader as! BatteryReader).usage.subscribe(observer: self) { (value, _) in + cyclesValue.stringValue = "\(value.cycles)" + stateValue.stringValue = value.state + healthValue.stringValue = "\(value.health) %" + } + } + + func makeBattery() { + let batteryLabel: NSView = NSView(frame: NSRect(x: 0, y: TabHeight - 202, width: TabWidth, height: 25)) + + batteryLabel.wantsLayer = true + batteryLabel.layer?.backgroundColor = NSColor(hexString: "#eeeeee", alpha: 0.5).cgColor + + let overviewText: NSTextField = NSTextField(string: "Battery") + overviewText.frame = NSRect(x: 0, y: 0, width: TabWidth, height: batteryLabel.frame.size.height - 4) + overviewText.isEditable = false + overviewText.isSelectable = false + overviewText.isBezeled = false + overviewText.wantsLayer = true + overviewText.textColor = .darkGray + overviewText.canDrawSubviewsIntoLayer = true + overviewText.alignment = .center + overviewText.backgroundColor = NSColor(hexString: "#dddddd", alpha: 0) + overviewText.font = NSFont.systemFont(ofSize: 12, weight: .medium) + + batteryLabel.addSubview(overviewText) + self.tabView.view?.addSubview(batteryLabel) + + let stackHeight: CGFloat = 22 + let vertical: NSStackView = NSStackView(frame: NSRect(x: 0, y: TabHeight - 273, width: TabWidth, height: stackHeight*3)) + vertical.orientation = .vertical + + let amperage: NSStackView = NSStackView(frame: NSRect(x: 10, y: stackHeight*2, width: TabWidth - 20, height: stackHeight)) + amperage.orientation = .horizontal + amperage.distribution = .equalCentering + let amperageLabel = LabelField(string: "Amperage") + let amperageValue = ValueField(string: "0 mA") + amperage.addView(amperageLabel, in: .center) + amperage.addView(amperageValue, in: .center) + + let voltage: NSStackView = NSStackView(frame: NSRect(x: 10, y: stackHeight*1, width: TabWidth - 20, height: stackHeight)) + voltage.orientation = .horizontal + voltage.distribution = .equalCentering + let voltageLabel = LabelField(string: "Voltage") + let voltageValue = ValueField(string: "0 V") + voltage.addView(voltageLabel, in: .center) + voltage.addView(voltageValue, in: .center) + + let temperature: NSStackView = NSStackView(frame: NSRect(x: 10, y: 0, width: TabWidth - 20, height: stackHeight)) + temperature.orientation = .horizontal + temperature.distribution = .equalCentering + let temperatureLabel = LabelField(string: "Temperature") + let temperatureValue = ValueField(string: "0 °C") + temperature.addView(temperatureLabel, in: .center) + temperature.addView(temperatureValue, in: .center) + + vertical.addSubview(amperage) + vertical.addSubview(voltage) + vertical.addSubview(temperature) + + self.tabView.view?.addSubview(vertical) + (self.reader as! BatteryReader).usage.subscribe(observer: self) { (value, _) in + amperageValue.stringValue = "\(value.amperage) mA" + voltageValue.stringValue = "\(value.voltage.roundTo(decimalPlaces: 2)) V" + temperatureValue.stringValue = "\(value.temperature) °C" + } + } + + func makePowerAdapter() { + let powerAdapterLabel: NSView = NSView(frame: NSRect(x: 0, y: 52, width: TabWidth, height: 25)) + + powerAdapterLabel.wantsLayer = true + powerAdapterLabel.layer?.backgroundColor = NSColor(hexString: "#eeeeee", alpha: 0.5).cgColor + + let overviewText: NSTextField = NSTextField(string: "Power adapter") + overviewText.frame = NSRect(x: 0, y: 0, width: TabWidth, height: powerAdapterLabel.frame.size.height - 4) + overviewText.isEditable = false + overviewText.isSelectable = false + overviewText.isBezeled = false + overviewText.wantsLayer = true + overviewText.textColor = .darkGray + overviewText.canDrawSubviewsIntoLayer = true + overviewText.alignment = .center + overviewText.backgroundColor = NSColor(hexString: "#dddddd", alpha: 0) + overviewText.font = NSFont.systemFont(ofSize: 12, weight: .medium) + + powerAdapterLabel.addSubview(overviewText) + self.tabView.view?.addSubview(powerAdapterLabel) + + let stackHeight: CGFloat = 22 + let vertical: NSStackView = NSStackView(frame: NSRect(x: 0, y: 4, width: TabWidth, height: stackHeight*2)) + vertical.orientation = .vertical + + let power: NSStackView = NSStackView(frame: NSRect(x: 10, y: stackHeight*1, width: TabWidth - 20, height: stackHeight)) + power.orientation = .horizontal + power.distribution = .equalCentering + let powerLabel = LabelField(string: "Power") + let powerValue = ValueField(string: "0 W") + power.addView(powerLabel, in: .center) + power.addView(powerValue, in: .center) + + let charging: NSStackView = NSStackView(frame: NSRect(x: 10, y: 0, width: TabWidth - 20, height: stackHeight)) + charging.orientation = .horizontal + charging.distribution = .equalCentering + let chargingLabel = LabelField(string: "Is charging") + let chargingValue = ValueField(string: "No") + charging.addView(chargingLabel, in: .center) + charging.addView(chargingValue, in: .center) + + vertical.addSubview(power) + vertical.addSubview(charging) + + self.tabView.view?.addSubview(vertical) + + (self.reader as! BatteryReader).usage.subscribe(observer: self) { (value, _) in + powerValue.stringValue = value.powerSource == "Battery Power" ? "Not connected" : "\(value.ACwatts) W" + chargingValue.stringValue = value.ACstatus ? "Yes" : "No" + } + } +} diff --git a/Stats/Modules/CPU/CPU.swift b/Stats/Modules/CPU/CPU.swift index f2765984db6..f3f35acbf9a 100644 --- a/Stats/Modules/CPU/CPU.swift +++ b/Stats/Modules/CPU/CPU.swift @@ -7,25 +7,29 @@ // import Cocoa +import Charts class CPU: Module { - let name: String = "CPU" - let shortName: String = "CPU" - var view: NSView = NSView() - var menu: NSMenuItem = NSMenuItem() - var submenu: NSMenu = NSMenu() - var active: Observable - var available: Observable - var hyperthreading: Observable - var reader: Reader = CPUReader() + public let name: String = "CPU" + public let shortName: String = "CPU" + public var view: NSView = NSView() + public var menu: NSMenuItem = NSMenuItem() + public var active: Observable + public var available: Observable + public var hyperthreading: Observable + public var reader: Reader = CPUReader() + public var tabView: NSTabViewItem = NSTabViewItem() + public var viewAvailable: Bool = true + public var widgetType: WidgetType + public var chart: LineChartView = LineChartView() - let defaults = UserDefaults.standard - var widgetType: WidgetType + private let defaults = UserDefaults.standard + private var submenu: NSMenu = NSMenu() init() { self.available = Observable(true) self.active = Observable(defaults.object(forKey: name) != nil ? defaults.bool(forKey: name) : true) - self.hyperthreading = Observable(defaults.object(forKey: "\(name)_hyperthreading") != nil ? defaults.bool(forKey: "\(name)_hyperthreading") : true) + self.hyperthreading = Observable(defaults.object(forKey: "\(name)_hyperthreading") != nil ? defaults.bool(forKey: "\(name)_hyperthreading") : false) self.widgetType = defaults.object(forKey: "\(name)_widget") != nil ? defaults.float(forKey: "\(name)_widget") : Widgets.Mini if self.widgetType == Widgets.BarChart { @@ -36,6 +40,7 @@ class CPU: Module { initWidget() initMenu(active: self.active.value) + initTab() } func initMenu(active: Bool) { diff --git a/Stats/Modules/CPU/CPUReader.swift b/Stats/Modules/CPU/CPUReader.swift index ad4e578c432..6a20085100f 100644 --- a/Stats/Modules/CPU/CPUReader.swift +++ b/Stats/Modules/CPU/CPUReader.swift @@ -8,23 +8,47 @@ import Foundation +struct CPUUsage { + var value: Double = 0 + var system: Double = 0 + var user: Double = 0 + var idle: Double = 0 +} + +struct TopProcess { + var pid: Int = 0 + var command: String = "" + var usage: Double = 0 +} + class CPUReader: Reader { - var value: Observable<[Double]>! - var available: Bool = true - var cpuInfo: processor_info_array_t! - var prevCpuInfo: processor_info_array_t? - var numCpuInfo: mach_msg_type_number_t = 0 - var numPrevCpuInfo: mach_msg_type_number_t = 0 - var numCPUs: uint = 0 - var updateTimer: Timer! - let CPUUsageLock: NSLock = NSLock() + public var value: Observable<[Double]>! + public var usage: Observable = Observable(CPUUsage()) + public var processes: Observable<[TopProcess]> = Observable([TopProcess]()) + public var available: Bool = true + public var updateTimer: Timer! + public var perCoreMode: Bool = false + public var hyperthreading: Bool = false - var perCoreMode: Bool = false - var hyperthreading: Bool = true + private var cpuInfo: processor_info_array_t! + private var prevCpuInfo: processor_info_array_t? + private var numCpuInfo: mach_msg_type_number_t = 0 + private var numPrevCpuInfo: mach_msg_type_number_t = 0 + private var numCPUs: uint = 0 + private let CPUUsageLock: NSLock = NSLock() + private var loadPrevious = host_cpu_load_info() + + private var topProcess: Process = Process() + private var pipe: Pipe = Pipe() init() { let mibKeys: [Int32] = [ CTL_HW, HW_NCPU ] self.value = Observable([]) + + self.topProcess.launchPath = "/usr/bin/top" + self.topProcess.arguments = ["-s", "3", "-o", "cpu", "-n", "5", "-stats", "pid,command,cpu"] + self.topProcess.standardOutput = pipe + mibKeys.withUnsafeBufferPointer() { mib in var sizeOfNumCPUs: size_t = MemoryLayout.size let status = sysctl(processor_info_array_t(mutating: mib.baseAddress), 2, &numCPUs, &sizeOfNumCPUs, nil, 0) @@ -40,6 +64,43 @@ class CPUReader: Reader { return } updateTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(read), userInfo: nil, repeats: true) + + if topProcess.isRunning { + return + } + self.pipe.fileHandleForReading.waitForDataInBackgroundAndNotify() + + NotificationCenter.default.addObserver(forName: NSNotification.Name.NSFileHandleDataAvailable, object: self.pipe.fileHandleForReading , queue: nil) { _ -> Void in + defer { + self.pipe.fileHandleForReading.waitForDataInBackgroundAndNotify() + } + + let output = self.pipe.fileHandleForReading.availableData + if output.isEmpty { + return + } + + let outputString = String(data: output, encoding: String.Encoding.utf8) ?? "" + var processes: [TopProcess] = [] + outputString.enumerateLines { (line, stop) -> () in + if line.matches("^\\d+ + .+ +\\d+.\\d *$") { + let arr = line.condenseWhitespace().split(separator: " ") + let pid = Int(arr[0]) ?? 0 + let command = String(arr[1]) + let usage = Double(arr[2]) ?? 0 + let process = TopProcess(pid: pid, command: command, usage: usage) + processes.append(process) + } + } + + self.processes << processes + } + + do { + try topProcess.run() + } catch let error { + print(error) + } } func stop() { @@ -48,11 +109,14 @@ class CPUReader: Reader { } updateTimer.invalidate() updateTimer = nil + NotificationCenter.default.removeObserver(self, name: NSNotification.Name.NSFileHandleDataAvailable, object: nil) } @objc func read() { var numCPUsU: natural_t = 0 let err: kern_return_t = host_processor_info(mach_host_self(), PROCESSOR_CPU_LOAD_INFO, &numCPUsU, &cpuInfo, &numCpuInfo); + let usage = getUsage() + if err == KERN_SUCCESS { CPUUsageLock.lock() @@ -65,7 +129,7 @@ class CPUReader: Reader { incrementNumber = 2 } - for i in stride(from: 0, to: Int32(numCPUs), by: incrementNumber){ + for i in stride(from: 0, to: Int32(numCPUs), by: incrementNumber) { var inUse: Int32 var total: Int32 if let prevCpuInfo = prevCpuInfo { @@ -96,6 +160,9 @@ class CPUReader: Reader { } else { self.value << [(Double(inUseOnAllCores) / Double(totalOnAllCores))] } + if !usage.system.isNaN && !usage.user.isNaN && !usage.idle.isNaN { + self.usage << CPUUsage(value: Double(inUseOnAllCores) / Double(totalOnAllCores), system: usage.system, user: usage.user, idle: usage.idle) + } CPUUsageLock.unlock() @@ -113,4 +180,46 @@ class CPUReader: Reader { print("Error KERN_SUCCESS!") } } + + func hostCPULoadInfo() -> host_cpu_load_info? { + let HOST_CPU_LOAD_INFO_COUNT = MemoryLayout.stride/MemoryLayout.stride + var size = mach_msg_type_number_t(HOST_CPU_LOAD_INFO_COUNT) + var cpuLoadInfo = host_cpu_load_info() + + let result = withUnsafeMutablePointer(to: &cpuLoadInfo) { + $0.withMemoryRebound(to: integer_t.self, capacity: HOST_CPU_LOAD_INFO_COUNT) { + host_statistics(mach_host_self(), HOST_CPU_LOAD_INFO, $0, &size) + } + } + if result != KERN_SUCCESS { + print("Error - \(#file): \(#function) - kern_result_t = \(result)") + return nil + } + return cpuLoadInfo + } + + public func getUsage() -> (system: Double, user: Double, idle : Double) { + let load = hostCPULoadInfo() + + let userDiff = Double(load!.cpu_ticks.0 - loadPrevious.cpu_ticks.0) + let sysDiff = Double(load!.cpu_ticks.1 - loadPrevious.cpu_ticks.1) + let idleDiff = Double(load!.cpu_ticks.2 - loadPrevious.cpu_ticks.2) + let niceDiff = Double(load!.cpu_ticks.3 - loadPrevious.cpu_ticks.3) + + let totalTicks = sysDiff + userDiff + niceDiff + idleDiff + + let sys = sysDiff / totalTicks * 100.0 + let user = userDiff / totalTicks * 100.0 + let idle = idleDiff / totalTicks * 100.0 + + self.loadPrevious = load! + + return (sys, user, idle) + } +} + +extension String { + func matches(_ regex: String) -> Bool { + return self.range(of: regex, options: .regularExpression, range: nil, locale: nil) != nil + } } diff --git a/Stats/Modules/CPU/CPUView.swift b/Stats/Modules/CPU/CPUView.swift new file mode 100644 index 00000000000..b6c03e77eeb --- /dev/null +++ b/Stats/Modules/CPU/CPUView.swift @@ -0,0 +1,230 @@ +// +// CPUView.swift +// Stats +// +// Created by Serhiy Mytrovtsiy on 03/09/2019. +// Copyright © 2019 Serhiy Mytrovtsiy. All rights reserved. +// + +import Cocoa +import Foundation +import Charts + +extension CPU { + + func initTab() { + self.tabView.view?.frame = NSRect(x: 0, y: 0, width: TabWidth, height: TabHeight) + + makeChart() + makeOverview() + makeProcesses() + + (self.reader as! CPUReader).usage.subscribe(observer: self) { (value, _) in + let v: Double = Double((value.value * 100).roundTo(decimalPlaces: 2))! + self.updateChart(value: v) + } + } + + func makeChart() { + let lineColor: NSColor = NSColor(red: (26/255.0), green: (126/255.0), blue: (252/255.0), alpha: 1.0) + let gradientColor: NSColor = NSColor(red: (26/255.0), green: (126/255.0), blue: (252/255.0), alpha: 0.5) + + self.chart = LineChartView(frame: CGRect(x: 0, y: TabHeight - 110, width: TabWidth, height: 102)) + self.chart.animate(xAxisDuration: 2.0, yAxisDuration: 2.0, easingOption: .easeInCubic) + self.chart.backgroundColor = .white + self.chart.noDataText = "No \(self.name) usage data" + self.chart.legend.enabled = false + self.chart.scaleXEnabled = false + self.chart.scaleYEnabled = false + self.chart.pinchZoomEnabled = false + self.chart.doubleTapToZoomEnabled = false + self.chart.drawBordersEnabled = false + + self.chart.rightAxis.enabled = false + + self.chart.leftAxis.axisMinimum = 0 + self.chart.leftAxis.axisMaximum = 100 + self.chart.leftAxis.labelCount = 6 + self.chart.leftAxis.drawGridLinesEnabled = false + self.chart.leftAxis.drawAxisLineEnabled = false + + self.chart.leftAxis.gridColor = NSColor(red:220/255, green:220/255, blue:220/255, alpha:1) + self.chart.leftAxis.gridLineWidth = 0.5 + self.chart.leftAxis.drawGridLinesEnabled = true + self.chart.leftAxis.labelTextColor = NSColor(red:150/255, green:150/255, blue:150/255, alpha:1) + + self.chart.xAxis.drawAxisLineEnabled = false + self.chart.xAxis.drawLimitLinesBehindDataEnabled = false + self.chart.xAxis.gridLineWidth = 0.5 + self.chart.xAxis.drawGridLinesEnabled = false + self.chart.xAxis.drawLabelsEnabled = false + + let marker = ChartMarker() + marker.chartView = self.chart + self.chart.marker = marker + + let lineChartEntry = [ChartDataEntry]() + let chartDataSet = LineChartDataSet(entries: lineChartEntry, label: "\(self.name) Usage") + chartDataSet.drawCirclesEnabled = false + chartDataSet.mode = .cubicBezier + chartDataSet.cubicIntensity = 0.1 + chartDataSet.colors = [lineColor] + chartDataSet.fillColor = gradientColor + chartDataSet.drawFilledEnabled = true + + let data = LineChartData() + data.addDataSet(chartDataSet) + data.setDrawValues(false) + + self.chart.data = LineChartData(dataSet: chartDataSet) + + self.tabView.view?.addSubview(self.chart) + } + + func updateChart(value: Double) { + let index = Double((self.chart.data?.getDataSetByIndex(0)?.entryCount)!) + self.chart.data?.addEntry(ChartDataEntry(x: index, y: value), dataSetIndex: 0) + + if index > 120 { + self.chart.xAxis.axisMinimum = index - 120 + } + self.chart.xAxis.axisMaximum = index + self.chart.notifyDataSetChanged() + self.chart.moveViewToX(index) + } + + func makeOverview() { + let overviewLabel: NSView = NSView(frame: NSRect(x: 0, y: TabHeight - 140, width: TabWidth, height: 25)) + + overviewLabel.wantsLayer = true + overviewLabel.layer?.backgroundColor = NSColor(hexString: "#eeeeee", alpha: 0.5).cgColor + + let overviewText: NSTextField = NSTextField(string: "Overview") + overviewText.frame = NSRect(x: 0, y: 0, width: TabWidth, height: overviewLabel.frame.size.height - 4) + overviewText.isEditable = false + overviewText.isSelectable = false + overviewText.isBezeled = false + overviewText.wantsLayer = true + overviewText.textColor = .darkGray + overviewText.canDrawSubviewsIntoLayer = true + overviewText.alignment = .center + overviewText.backgroundColor = NSColor(hexString: "#dddddd", alpha: 0) + overviewText.font = NSFont.systemFont(ofSize: 12, weight: .medium) + + overviewLabel.addSubview(overviewText) + self.tabView.view?.addSubview(overviewLabel) + + let stackHeight: CGFloat = 22 + let vertical: NSStackView = NSStackView(frame: NSRect(x: 0, y: 147, width: TabWidth, height: stackHeight*3)) + vertical.orientation = .vertical + + let system: NSStackView = NSStackView(frame: NSRect(x: 10, y: stackHeight*2, width: TabWidth - 20, height: stackHeight)) + system.orientation = .horizontal + system.distribution = .equalCentering + let systemLabel = LabelField(string: "System") + let systemValue = ValueField(string: "0 %") + system.addView(systemLabel, in: .center) + system.addView(systemValue, in: .center) + + let user: NSStackView = NSStackView(frame: NSRect(x: 10, y: stackHeight*1, width: TabWidth - 20, height: stackHeight)) + user.orientation = .horizontal + user.distribution = .equalCentering + let userLabel = LabelField(string: "User") + let userValue = ValueField(string: "0 %") + user.addView(userLabel, in: .center) + user.addView(userValue, in: .center) + + let idle: NSStackView = NSStackView(frame: NSRect(x: 10, y: 0, width: TabWidth - 20, height: stackHeight)) + idle.orientation = .horizontal + idle.distribution = .equalCentering + let idleLabel = LabelField(string: "Idle") + let idleValue = ValueField(string: "0 %") + idle.addView(idleLabel, in: .center) + idle.addView(idleValue, in: .center) + + vertical.addSubview(system) + vertical.addSubview(user) + vertical.addSubview(idle) + + self.tabView.view?.addSubview(vertical) + + (self.reader as! CPUReader).usage.subscribe(observer: self) { (value, _) in + systemValue.stringValue = "\(value.system.roundTo(decimalPlaces: 2)) %" + userValue.stringValue = "\(value.user.roundTo(decimalPlaces: 2)) %" + idleValue.stringValue = "\(value.idle.roundTo(decimalPlaces: 2)) %" + } + } + + func makeProcesses() { + let label: NSView = NSView(frame: NSRect(x: 0, y: 0, width: TabWidth, height: 25)) + + label.wantsLayer = true + label.layer?.backgroundColor = NSColor(hexString: "#eeeeee", alpha: 0.5).cgColor + + let text: NSTextField = NSTextField(string: "Top Processes") + text.frame = NSRect(x: 0, y: 0, width: TabWidth, height: label.frame.size.height - 4) + text.isEditable = false + text.isSelectable = false + text.isBezeled = false + text.wantsLayer = true + text.textColor = .darkGray + text.canDrawSubviewsIntoLayer = true + text.alignment = .center + text.backgroundColor = NSColor(hexString: "#dddddd", alpha: 0) + text.font = NSFont.systemFont(ofSize: 12, weight: .medium) + + label.addSubview(text) + self.tabView.view?.addSubview(label) + + let stackHeight: CGFloat = 22 + let vertical: NSStackView = NSStackView(frame: NSRect(x: 0, y: 4, width: TabWidth, height: stackHeight*5)) + vertical.orientation = .vertical + vertical.distribution = .fill + + var processViewList: [NSStackView] = [] + let process_1 = makeProcessView(num: 4, height: stackHeight, label: "", value: "") + let process_2 = makeProcessView(num: 3, height: stackHeight, label: "", value: "") + let process_3 = makeProcessView(num: 2, height: stackHeight, label: "", value: "") + let process_4 = makeProcessView(num: 1, height: stackHeight, label: "", value: "") + let process_5 = makeProcessView(num: 0, height: stackHeight, label: "", value: "") + + processViewList.append(process_1) + processViewList.append(process_2) + processViewList.append(process_3) + processViewList.append(process_4) + processViewList.append(process_5) + + vertical.addSubview(process_1) + vertical.addSubview(process_2) + vertical.addSubview(process_3) + vertical.addSubview(process_4) + vertical.addSubview(process_5) + self.tabView.view?.addSubview(vertical) + + label.frame = NSRect(x: 0, y: vertical.frame.origin.y + vertical.frame.size.height + 2, width: TabWidth, height: 25) + self.tabView.view?.addSubview(label) + + (self.reader as! CPUReader).processes.subscribe(observer: self) { (processes, _) in + for (i, process) in processes.enumerated() { + if i < 5 { + let processView = processViewList[i] + + (processView.subviews[0] as! NSTextField).stringValue = process.command + (processView.subviews[1] as! NSTextField).stringValue = "\(process.usage.roundTo(decimalPlaces: 2)) %" + } + } + } + } + + func makeProcessView(num: Int, height: CGFloat, label: String, value: String) -> NSStackView { + let view: NSStackView = NSStackView(frame: NSRect(x: 10, y: CGFloat(num)*height, width: TabWidth - 20, height: height)) + view.orientation = .horizontal + view.distribution = .equalCentering + let viewLabel = LabelField(string: label) + let viewValue = ValueField(string: value) + view.addView(viewLabel, in: .center) + view.addView(viewValue, in: .center) + + return view + } +} diff --git a/Stats/Modules/Disk/Disk.swift b/Stats/Modules/Disk/Disk.swift index 06bef15eb8d..05e6bb23d10 100644 --- a/Stats/Modules/Disk/Disk.swift +++ b/Stats/Modules/Disk/Disk.swift @@ -9,20 +9,21 @@ import Cocoa class Disk: Module { - let name: String = "Disk" - let shortName: String = "SSD" - var view: NSView = NSView() - var menu: NSMenuItem = NSMenuItem() - var submenu: NSMenu = NSMenu() - let defaults = UserDefaults.standard - var widgetType: WidgetType + public let name: String = "Disk" + public let shortName: String = "SSD" + public var view: NSView = NSView() + public var menu: NSMenuItem = NSMenuItem() + public var widgetType: WidgetType - var active: Observable - var available: Observable + public var active: Observable + public var available: Observable + public var viewAvailable: Bool = false + public var tabView: NSTabViewItem = NSTabViewItem() - var reader: Reader = DiskReader() + public var reader: Reader = DiskReader() - @IBOutlet weak var value: NSTextField! + private var submenu: NSMenu = NSMenu() + private let defaults = UserDefaults.standard init() { self.available = Observable(true) @@ -30,7 +31,12 @@ class Disk: Module { self.widgetType = defaults.object(forKey: "\(name)_widget") != nil ? defaults.float(forKey: "\(name)_widget") : Widgets.Mini self.initWidget() - initMenu(active: self.active.value) + self.initMenu(active: self.active.value) + initTab() + } + + func initTab() { + self.tabView.view?.frame = NSRect(x: 0, y: 0, width: TabWidth, height: TabHeight) } func initMenu(active: Bool) { diff --git a/Stats/Modules/Memory/Memory.swift b/Stats/Modules/Memory/Memory.swift index dd3e6964230..e8657ec074c 100644 --- a/Stats/Modules/Memory/Memory.swift +++ b/Stats/Modules/Memory/Memory.swift @@ -7,27 +7,30 @@ // import Cocoa +import Charts class Memory: Module { - let name: String = "Memory" - let shortName: String = "MEM" - var view: NSView = NSView() - var menu: NSMenuItem = NSMenuItem() - var submenu: NSMenu = NSMenu() - var active: Observable - var available: Observable - var reader: Reader = MemoryReader() - var widgetType: WidgetType + public let name: String = "Memory" + public let shortName: String = "MEM" + public var view: NSView = NSView() + public var menu: NSMenuItem = NSMenuItem() + public var active: Observable + public var available: Observable + public var reader: Reader = MemoryReader() + public var widgetType: WidgetType + public var viewAvailable: Bool = true + public var tabView: NSTabViewItem = NSTabViewItem() + public var chart: LineChartView = LineChartView() - let defaults = UserDefaults.standard - - @IBOutlet weak var value: NSTextField! + private let defaults = UserDefaults.standard + private var submenu: NSMenu = NSMenu() init() { self.available = Observable(true) self.active = Observable(defaults.object(forKey: name) != nil ? defaults.bool(forKey: name) : true) self.widgetType = defaults.object(forKey: "\(name)_widget") != nil ? defaults.float(forKey: "\(name)_widget") : Widgets.Mini initWidget() + initTab() initMenu(active: self.active.value) } diff --git a/Stats/Modules/Memory/MemoryReader.swift b/Stats/Modules/Memory/MemoryReader.swift index 58101500d5b..2f5d010b3e1 100644 --- a/Stats/Modules/Memory/MemoryReader.swift +++ b/Stats/Modules/Memory/MemoryReader.swift @@ -8,17 +8,32 @@ import Foundation +struct MemoryUsage { + var total: Double = 0 + var used: Double = 0 + var free: Double = 0 +} + class MemoryReader: Reader { - var value: Observable<[Double]>! - var available: Bool = true - var updateTimer: Timer! - var totalSize: Float + public var value: Observable<[Double]>! + public var usage: Observable = Observable(MemoryUsage()) + public var processes: Observable<[TopProcess]> = Observable([TopProcess]()) + public var available: Bool = true + public var updateTimer: Timer! + public var totalSize: Float + + private var topProcess: Process = Process() + private var pipe: Pipe = Pipe() init() { self.value = Observable([]) var stats = host_basic_info() var count = UInt32(MemoryLayout.size / MemoryLayout.size) + self.topProcess.launchPath = "/usr/bin/top" + self.topProcess.arguments = ["-s", "3", "-o", "mem", "-n", "5", "-stats", "pid,command,mem"] + self.topProcess.standardOutput = pipe + let kerr: kern_return_t = withUnsafeMutablePointer(to: &stats) { $0.withMemoryRebound(to: integer_t.self, capacity: Int(count)) { host_info(mach_host_self(), HOST_BASIC_INFO, $0, &count) @@ -41,6 +56,45 @@ class MemoryReader: Reader { return } updateTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(read), userInfo: nil, repeats: true) + + if topProcess.isRunning { + return + } + self.pipe.fileHandleForReading.waitForDataInBackgroundAndNotify() + + NotificationCenter.default.addObserver(forName: NSNotification.Name.NSFileHandleDataAvailable, object: self.pipe.fileHandleForReading , queue: nil) { _ -> Void in + defer { + self.pipe.fileHandleForReading.waitForDataInBackgroundAndNotify() + } + + let output = self.pipe.fileHandleForReading.availableData + if output.isEmpty { + return + } + + let outputString = String(data: output, encoding: String.Encoding.utf8) ?? "" + var processes: [TopProcess] = [] + outputString.enumerateLines { (line, stop) -> () in + if line.matches("^\\d+ + .+ +\\d+.\\d[M\\+\\-]+ *$") { + let arr = line.condenseWhitespace().split(separator: " ") + let pid = Int(arr[0]) ?? 0 + let command = String(arr[1]) + guard let usage = Double(arr[2].filter("01234567890.".contains)) else { + return + } + let process = TopProcess(pid: pid, command: command, usage: usage * Double(1024 * 1024)) + processes.append(process) + } + } + + self.processes << processes + } + + do { + try topProcess.run() + } catch let error { + print(error) + } } func stop() { @@ -49,6 +103,7 @@ class MemoryReader: Reader { } updateTimer.invalidate() updateTimer = nil + NotificationCenter.default.removeObserver(self, name: NSNotification.Name.NSFileHandleDataAvailable, object: nil) } @objc func read() { @@ -63,11 +118,14 @@ class MemoryReader: Reader { if kerr == KERN_SUCCESS { let active = Float(stats.active_count) * Float(PAGE_SIZE) - // let inactive = Float(stats.inactive_count) * Float(PAGE_SIZE) +// let inactive = Float(stats.inactive_count) * Float(PAGE_SIZE) let wired = Float(stats.wire_count) * Float(PAGE_SIZE) let compressed = Float(stats.compressor_page_count) * Float(PAGE_SIZE) - let free = totalSize - (active + wired + compressed) + let used = active + wired + compressed + let free = totalSize - used + + self.usage << MemoryUsage(total: Double(totalSize), used: Double(used), free: Double(free)) self.value << [Double((totalSize - free) / totalSize)] } else { diff --git a/Stats/Modules/Memory/MemoryView.swift b/Stats/Modules/Memory/MemoryView.swift new file mode 100644 index 00000000000..69bd659eb04 --- /dev/null +++ b/Stats/Modules/Memory/MemoryView.swift @@ -0,0 +1,230 @@ +// +// MemoryView.swift +// Stats +// +// Created by Serhiy Mytrovtsiy on 04/09/2019. +// Copyright © 2019 Serhiy Mytrovtsiy. All rights reserved. +// + +import Cocoa +import Foundation +import Charts + +extension Memory { + + func initTab() { + self.tabView.view?.frame = NSRect(x: 0, y: 0, width: TabWidth, height: TabHeight) + + makeChart() + makeOverview() + makeProcesses() + + (self.reader as! MemoryReader).usage.subscribe(observer: self) { (value, _) in + self.updateChart(value: Units(bytes: Int64(value.used)).getReadableTuple().0) + } + } + + func makeChart() { + let reader = self.reader as! MemoryReader + let lineColor: NSColor = NSColor(red: (26/255.0), green: (126/255.0), blue: (252/255.0), alpha: 1.0) + let gradientColor: NSColor = NSColor(red: (26/255.0), green: (126/255.0), blue: (252/255.0), alpha: 0.5) + + self.chart = LineChartView(frame: CGRect(x: 0, y: TabHeight - 110, width: TabWidth, height: 102)) + self.chart.animate(xAxisDuration: 2.0, yAxisDuration: 2.0, easingOption: .easeInCubic) + self.chart.backgroundColor = .white + self.chart.noDataText = "No \(self.name) usage data" + self.chart.legend.enabled = false + self.chart.scaleXEnabled = false + self.chart.scaleYEnabled = false + self.chart.pinchZoomEnabled = false + self.chart.doubleTapToZoomEnabled = false + self.chart.drawBordersEnabled = false + + self.chart.rightAxis.enabled = false + + self.chart.leftAxis.axisMinimum = 0 + self.chart.leftAxis.axisMaximum = Units(bytes: Int64(reader.totalSize)).gigabytes + self.chart.leftAxis.labelCount = Units(bytes: Int64(reader.totalSize)).gigabytes > 16 ? 6 : 4 + self.chart.leftAxis.drawGridLinesEnabled = false + self.chart.leftAxis.drawAxisLineEnabled = false + + self.chart.leftAxis.gridColor = NSColor(red:220/255, green:220/255, blue:220/255, alpha:1) + self.chart.leftAxis.gridLineWidth = 0.5 + self.chart.leftAxis.drawGridLinesEnabled = true + self.chart.leftAxis.labelTextColor = NSColor(red:150/255, green:150/255, blue:150/255, alpha:1) + + self.chart.xAxis.drawAxisLineEnabled = false + self.chart.xAxis.drawLimitLinesBehindDataEnabled = false + self.chart.xAxis.gridLineWidth = 0.5 + self.chart.xAxis.drawGridLinesEnabled = false + self.chart.xAxis.drawLabelsEnabled = false + + let marker = ChartMarker() + marker.chartView = self.chart + self.chart.marker = marker + + let lineChartEntry = [ChartDataEntry]() + let chartDataSet = LineChartDataSet(entries: lineChartEntry, label: "\(self.name) Usage") + chartDataSet.drawCirclesEnabled = false + chartDataSet.mode = .cubicBezier + chartDataSet.cubicIntensity = 0.1 + chartDataSet.colors = [lineColor] + chartDataSet.fillColor = gradientColor + chartDataSet.drawFilledEnabled = true + + let data = LineChartData() + data.addDataSet(chartDataSet) + data.setDrawValues(false) + + self.chart.data = LineChartData(dataSet: chartDataSet) + + self.tabView.view?.addSubview(self.chart) + } + + func updateChart(value: Double) { + let index = Double((self.chart.data?.getDataSetByIndex(0)?.entryCount)!) + self.chart.data?.addEntry(ChartDataEntry(x: index, y: value), dataSetIndex: 0) + + if index > 120 { + self.chart.xAxis.axisMinimum = index - 120 + } + self.chart.xAxis.axisMaximum = index + self.chart.notifyDataSetChanged() + self.chart.moveViewToX(index) + } + + func makeOverview() { + let overviewLabel: NSView = NSView(frame: NSRect(x: 0, y: TabHeight - 140, width: TabWidth, height: 25)) + + overviewLabel.wantsLayer = true + overviewLabel.layer?.backgroundColor = NSColor(hexString: "#eeeeee", alpha: 0.5).cgColor + + let overviewText: NSTextField = NSTextField(string: "Overview") + overviewText.frame = NSRect(x: 0, y: 0, width: TabWidth, height: overviewLabel.frame.size.height - 4) + overviewText.isEditable = false + overviewText.isSelectable = false + overviewText.isBezeled = false + overviewText.wantsLayer = true + overviewText.textColor = .darkGray + overviewText.canDrawSubviewsIntoLayer = true + overviewText.alignment = .center + overviewText.backgroundColor = NSColor(hexString: "#dddddd", alpha: 0) + overviewText.font = NSFont.systemFont(ofSize: 12, weight: .medium) + + overviewLabel.addSubview(overviewText) + self.tabView.view?.addSubview(overviewLabel) + + let stackHeight: CGFloat = 22 + let vertical: NSStackView = NSStackView(frame: NSRect(x: 0, y: 147, width: TabWidth, height: stackHeight*3)) + vertical.orientation = .vertical + + let total: NSStackView = NSStackView(frame: NSRect(x: 10, y: stackHeight*2, width: TabWidth - 20, height: stackHeight)) + total.orientation = .horizontal + total.distribution = .equalCentering + let totalLabel = LabelField(string: "Total") + let totalValue = ValueField(string: "0 GB") + total.addView(totalLabel, in: .center) + total.addView(totalValue, in: .center) + + let used: NSStackView = NSStackView(frame: NSRect(x: 10, y: stackHeight*1, width: TabWidth - 20, height: stackHeight)) + used.orientation = .horizontal + used.distribution = .equalCentering + let usedLabel = LabelField(string: "Used") + let usedValue = ValueField(string: "0 GB") + used.addView(usedLabel, in: .center) + used.addView(usedValue, in: .center) + + let free: NSStackView = NSStackView(frame: NSRect(x: 10, y: 0, width: TabWidth - 20, height: stackHeight)) + free.orientation = .horizontal + free.distribution = .equalCentering + let freeLabel = LabelField(string: "Free") + let freeValue = ValueField(string: "0 GB") + free.addView(freeLabel, in: .center) + free.addView(freeValue, in: .center) + + vertical.addSubview(total) + vertical.addSubview(used) + vertical.addSubview(free) + + self.tabView.view?.addSubview(vertical) + + (self.reader as! MemoryReader).usage.subscribe(observer: self) { (value, _) in + totalValue.stringValue = Units(bytes: Int64(value.total)).getReadableUnit() + usedValue.stringValue = Units(bytes: Int64(value.used)).getReadableUnit() + freeValue.stringValue = Units(bytes: Int64(value.free)).getReadableUnit() + } + } + + func makeProcesses() { + let label: NSView = NSView(frame: NSRect(x: 0, y: 0, width: TabWidth, height: 25)) + + label.wantsLayer = true + label.layer?.backgroundColor = NSColor(hexString: "#eeeeee", alpha: 0.5).cgColor + + let text: NSTextField = NSTextField(string: "Top Processes") + text.frame = NSRect(x: 0, y: 0, width: TabWidth, height: label.frame.size.height - 4) + text.isEditable = false + text.isSelectable = false + text.isBezeled = false + text.wantsLayer = true + text.textColor = .darkGray + text.canDrawSubviewsIntoLayer = true + text.alignment = .center + text.backgroundColor = NSColor(hexString: "#dddddd", alpha: 0) + text.font = NSFont.systemFont(ofSize: 12, weight: .medium) + + label.addSubview(text) + self.tabView.view?.addSubview(label) + + let stackHeight: CGFloat = 22 + let vertical: NSStackView = NSStackView(frame: NSRect(x: 0, y: 4, width: TabWidth, height: stackHeight*5)) + vertical.orientation = .vertical + vertical.distribution = .fill + + var processViewList: [NSStackView] = [] + let process_1 = makeProcessView(num: 4, height: stackHeight, label: "", value: "") + let process_2 = makeProcessView(num: 3, height: stackHeight, label: "", value: "") + let process_3 = makeProcessView(num: 2, height: stackHeight, label: "", value: "") + let process_4 = makeProcessView(num: 1, height: stackHeight, label: "", value: "") + let process_5 = makeProcessView(num: 0, height: stackHeight, label: "", value: "") + + processViewList.append(process_1) + processViewList.append(process_2) + processViewList.append(process_3) + processViewList.append(process_4) + processViewList.append(process_5) + + vertical.addSubview(process_1) + vertical.addSubview(process_2) + vertical.addSubview(process_3) + vertical.addSubview(process_4) + vertical.addSubview(process_5) + self.tabView.view?.addSubview(vertical) + + label.frame = NSRect(x: 0, y: vertical.frame.origin.y + vertical.frame.size.height + 2, width: TabWidth, height: 25) + self.tabView.view?.addSubview(label) + + (self.reader as! MemoryReader).processes.subscribe(observer: self) { (processes, _) in + for (i, process) in processes.enumerated() { + if i < 5 { + let processView = processViewList[i] + + (processView.subviews[0] as! NSTextField).stringValue = process.command + (processView.subviews[1] as! NSTextField).stringValue = Units(bytes: Int64(process.usage)).getReadableUnit() + } + } + } + } + + func makeProcessView(num: Int, height: CGFloat, label: String, value: String) -> NSStackView { + let view: NSStackView = NSStackView(frame: NSRect(x: 10, y: CGFloat(num)*height, width: TabWidth - 20, height: height)) + view.orientation = .horizontal + view.distribution = .equalCentering + let viewLabel = LabelField(string: label) + let viewValue = ValueField(string: value) + view.addView(viewLabel, in: .center) + view.addView(viewValue, in: .center) + + return view + } +} diff --git a/Stats/Modules/Module.swift b/Stats/Modules/Module.swift index b13e9ce93f2..11c0bb21774 100644 --- a/Stats/Modules/Module.swift +++ b/Stats/Modules/Module.swift @@ -19,6 +19,9 @@ protocol Module: class { var active: Observable { get } var available: Observable { get } + var viewAvailable: Bool { get } + var tabView: NSTabViewItem { get } + var reader: Reader { get } func start() diff --git a/Stats/Modules/Network/Network.swift b/Stats/Modules/Network/Network.swift index 85827e80fec..9ccd5444938 100644 --- a/Stats/Modules/Network/Network.swift +++ b/Stats/Modules/Network/Network.swift @@ -9,17 +9,19 @@ import Cocoa class Network: Module { - var name: String = "Network" - var shortName: String = "NET" - var view: NSView = NSView() - var menu: NSMenuItem = NSMenuItem() - var submenu: NSMenu = NSMenu() - var active: Observable - var available: Observable - var reader: Reader = NetworkReader() - var widgetType: WidgetType = 2.0 + public var name: String = "Network" + public var shortName: String = "NET" + public var view: NSView = NSView() + public var menu: NSMenuItem = NSMenuItem() + public var active: Observable + public var available: Observable + public var reader: Reader = NetworkReader() + public var widgetType: WidgetType = 2.0 + public var viewAvailable: Bool = false + public var tabView: NSTabViewItem = NSTabViewItem() - let defaults = UserDefaults.standard + private let defaults = UserDefaults.standard + private var submenu: NSMenu = NSMenu() init() { self.available = Observable(self.reader.available) @@ -27,6 +29,25 @@ class Network: Module { self.widgetType = defaults.object(forKey: "\(name)_widget") != nil ? defaults.float(forKey: "\(name)_widget") : Widgets.NetworkDots initMenu(active: self.active.value) initWidget() + initTab() + } + + func initTab() { + self.tabView.view?.frame = NSRect(x: 0, y: 0, width: TabWidth, height: TabHeight) + + let text: NSTextField = NSTextField(string: self.name) + text.isEditable = false + text.isSelectable = false + text.isBezeled = false + text.wantsLayer = true + text.textColor = .labelColor + text.canDrawSubviewsIntoLayer = true + text.alignment = .natural + text.font = NSFont.systemFont(ofSize: 13, weight: .regular) + text.frame.origin.x = ((self.tabView.view?.frame.size.width)! - 50) / 2 + text.frame.origin.y = ((self.tabView.view?.frame.size.height)! - 22) / 2 + + self.tabView.view?.addSubview(text) } func start() { diff --git a/Stats/Supporting Files/Assets.xcassets/icons/Contents.json b/Stats/Supporting Files/Assets.xcassets/icons/Contents.json new file mode 100644 index 00000000000..da4a164c918 --- /dev/null +++ b/Stats/Supporting Files/Assets.xcassets/icons/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Stats/Supporting Files/Assets.xcassets/icons/baseline_build_black_18pt.imageset/Contents.json b/Stats/Supporting Files/Assets.xcassets/icons/baseline_build_black_18pt.imageset/Contents.json new file mode 100644 index 00000000000..f9f14e7cde6 --- /dev/null +++ b/Stats/Supporting Files/Assets.xcassets/icons/baseline_build_black_18pt.imageset/Contents.json @@ -0,0 +1,26 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "baseline_build_black_18pt_1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "baseline_build_black_18pt_2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "baseline_build_black_18pt_3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +} \ No newline at end of file diff --git a/Stats/Supporting Files/Assets.xcassets/icons/baseline_build_black_18pt.imageset/baseline_build_black_18pt_1x.png b/Stats/Supporting Files/Assets.xcassets/icons/baseline_build_black_18pt.imageset/baseline_build_black_18pt_1x.png new file mode 100644 index 00000000000..792a9c06150 Binary files /dev/null and b/Stats/Supporting Files/Assets.xcassets/icons/baseline_build_black_18pt.imageset/baseline_build_black_18pt_1x.png differ diff --git a/Stats/Supporting Files/Assets.xcassets/icons/baseline_build_black_18pt.imageset/baseline_build_black_18pt_2x.png b/Stats/Supporting Files/Assets.xcassets/icons/baseline_build_black_18pt.imageset/baseline_build_black_18pt_2x.png new file mode 100644 index 00000000000..a1e7f71e777 Binary files /dev/null and b/Stats/Supporting Files/Assets.xcassets/icons/baseline_build_black_18pt.imageset/baseline_build_black_18pt_2x.png differ diff --git a/Stats/Supporting Files/Assets.xcassets/icons/baseline_build_black_18pt.imageset/baseline_build_black_18pt_3x.png b/Stats/Supporting Files/Assets.xcassets/icons/baseline_build_black_18pt.imageset/baseline_build_black_18pt_3x.png new file mode 100644 index 00000000000..34e6be7afa8 Binary files /dev/null and b/Stats/Supporting Files/Assets.xcassets/icons/baseline_build_black_18pt.imageset/baseline_build_black_18pt_3x.png differ diff --git a/Stats/Supporting Files/Base.lproj/Main.storyboard b/Stats/Supporting Files/Base.lproj/Main.storyboard index d5df9d6e98c..8c35fef6fec 100755 --- a/Stats/Supporting Files/Base.lproj/Main.storyboard +++ b/Stats/Supporting Files/Base.lproj/Main.storyboard @@ -1,8 +1,9 @@ - + - + + @@ -20,5 +21,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Stats/Supporting Files/Info.plist b/Stats/Supporting Files/Info.plist index 713fbf7b883..589d68b18d4 100755 --- a/Stats/Supporting Files/Info.plist +++ b/Stats/Supporting Files/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.2.13 + 1.3.0 CFBundleVersion 1 LSApplicationCategoryType diff --git a/Stats/Supporting Files/Stats.entitlements b/Stats/Supporting Files/Stats.entitlements index 92624a8a3f1..2eb7e333a6f 100755 --- a/Stats/Supporting Files/Stats.entitlements +++ b/Stats/Supporting Files/Stats.entitlements @@ -2,13 +2,7 @@ - com.apple.security.app-sandbox - com.apple.security.application-groups - com.apple.security.files.user-selected.read-only - - com.apple.security.network.client - diff --git a/Stats/Views/AboutViewController.swift b/Stats/Views/AboutViewController.swift new file mode 100644 index 00000000000..52c1320ae77 --- /dev/null +++ b/Stats/Views/AboutViewController.swift @@ -0,0 +1,35 @@ +// +// AboutViewController.swift +// Stats +// +// Created by Serhiy Mytrovtsiy on 05/09/2019. +// Copyright © 2019 Serhiy Mytrovtsiy. All rights reserved. +// + +import Cocoa +import Foundation + +class AboutVC: NSViewController { + @IBOutlet weak var versionLabel: NSTextField! + + override func viewDidLoad() { + super.viewDidLoad() + self.view.wantsLayer = true + } + + @IBAction func openLink(_ sender: Any) { + NSWorkspace.shared.open(URL(string: "https://github.com/exelban/stats")!) + } + + @IBAction func exit(_ sender: Any) { + self.view.window?.close() + } + + override func awakeFromNib() { + if self.view.layer != nil { + self.view.window?.backgroundColor = .windowBackgroundColor + let versionNumber = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String + versionLabel.stringValue = "Version \(versionNumber)" + } + } +} diff --git a/Stats/Views/PopupViewController.swift b/Stats/Views/PopupViewController.swift new file mode 100644 index 00000000000..c385f409108 --- /dev/null +++ b/Stats/Views/PopupViewController.swift @@ -0,0 +1,196 @@ +// +// MainViewController.swift +// Stats +// +// Created by Serhiy Mytrovtsiy on 02/09/2019. +// Copyright © 2019 Serhiy Mytrovtsiy. All rights reserved. +// + +import Cocoa +import ServiceManagement +import LaunchAtLogin + +public let TabWidth: CGFloat = 300 +public let TabHeight: CGFloat = 356 + +class MainViewController: NSViewController { + let defaults = UserDefaults.standard + + @IBOutlet weak var tabView: NSTabView! + @IBOutlet weak var topStackView: NSStackView! + + var segmentsControl: NSSegmentedControl! + var settingsButton: NSButton! + + static func Init() -> MainViewController { + let storyboard = NSStoryboard.init(name: "Main", bundle: nil) + let identifier = NSStoryboard.SceneIdentifier("MainViewController") + + guard let viewcontroller = storyboard.instantiateController(withIdentifier: identifier) as? MainViewController else { + fatalError("Why cant i find MainViewController? - Check Main.storyboard") + } + + return viewcontroller + } + + override func viewDidLoad() { + super.viewDidLoad() + + makeHeader() + } + + func makeHeader() { + var list: [String] = [] + for module in modules.value { + if module.viewAvailable && module.available.value { + list.append(module.name) + + let tab = module.tabView + tab.label = module.name + tab.identifier = module.name + tab.view?.wantsLayer = true + tab.view?.layer?.backgroundColor = NSColor.white.cgColor + + tabView.addTabViewItem(module.tabView) + } + } + + self.segmentsControl = NSSegmentedControl(labels: list, trackingMode: NSSegmentedControl.SwitchTracking.selectOne, target: self, action: #selector(switchTabs)) + self.segmentsControl.setSelected(true, forSegment: 0) +// self.tabView.selectTabViewItem(at: 2) + self.segmentsControl.segmentDistribution = .fillEqually + + let button = NSButton(frame: NSRect(x: 0, y: 0, width: 26, height: 20)) + button.title = "" + button.image = NSImage(named: NSImage.Name("NSActionTemplate")) + button.imagePosition = .imageOnly + button.bezelStyle = .texturedSquare + button.setButtonType(.momentaryPushIn) + button.action = #selector(showSettings) + + button.widthAnchor.constraint(equalToConstant: 26).isActive = true + button.heightAnchor.constraint(equalToConstant: 21).isActive = true + + self.topStackView.addView(self.segmentsControl, in: NSStackView.Gravity.center) + self.topStackView.addView(button, in: NSStackView.Gravity.center) + } + + @objc func switchTabs(_ sender: NSSegmentedControl) { + if let selectedLabel = self.segmentsControl.label(forSegment: sender.selectedSegment) { + let tabNumber = self.tabView.indexOfTabViewItem(withIdentifier: selectedLabel) + self.tabView.selectTabViewItem(at: tabNumber) + } + } + + @IBAction func showSettings(_ sender: NSButton) { + let settings = buildSettings() + let p = NSPoint(x: NSEvent.mouseLocation.x + 3, y: NSEvent.mouseLocation.y - 3) + settings.popUp(positioning: settings.item(at: 0), at:p , in: nil) + } + + func buildSettings() -> NSMenu { + let menu = NSMenu() + + for module in modules.value { + if module.available.value { + menu.addItem(module.menu) + } + } + + menu.addItem(NSMenuItem.separator()) + + let checkForUpdates = NSMenuItem(title: "Check for updates on start", action: #selector(toggleMenu), keyEquivalent: "") + checkForUpdates.state = defaults.bool(forKey: "checkUpdatesOnLogin") || defaults.object(forKey: "checkUpdatesOnLogin") == nil ? NSControl.StateValue.on : NSControl.StateValue.off + checkForUpdates.target = self + + let runAtLogin = NSMenuItem(title: "Start at login", action: #selector(toggleMenu), keyEquivalent: "") + runAtLogin.state = LaunchAtLogin.isEnabled ? NSControl.StateValue.on : NSControl.StateValue.off + runAtLogin.target = self + + let dockIcon = NSMenuItem(title: "Show icon in dock", action: #selector(toggleMenu), keyEquivalent: "") + dockIcon.state = defaults.bool(forKey: "dockIcon") ? NSControl.StateValue.on : NSControl.StateValue.off + dockIcon.target = self + + menu.addItem(checkForUpdates) + menu.addItem(runAtLogin) + menu.addItem(dockIcon) + + menu.addItem(NSMenuItem.separator()) + + let updateMenu = NSMenuItem(title: "Check for updates", action: #selector(checkUpdate), keyEquivalent: "") + updateMenu.target = self + + let aboutMenu = NSMenuItem(title: "About Stats", action: #selector(openAbout), keyEquivalent: "") + aboutMenu.target = self + + menu.addItem(updateMenu) + menu.addItem(aboutMenu) + menu.addItem(NSMenuItem(title: "Quit Stats", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "")) + + return menu + } + + @objc func checkUpdate(_ sender : NSMenuItem) { + let updatesVC: NSWindowController? = NSStoryboard(name: "Updates", bundle: nil).instantiateController(withIdentifier: "UpdatesVC") as? NSWindowController + updatesVC?.window?.center() + updatesVC?.window?.level = .floating + updatesVC!.showWindow(self) + } + + @objc func openAbout(_ sender : NSMenuItem) { + let aboutVC: NSWindowController? = NSStoryboard(name: "About", bundle: nil).instantiateController(withIdentifier: "AboutVC") as? NSWindowController + aboutVC?.window?.center() + aboutVC?.window?.level = .floating + aboutVC!.showWindow(self) + } + + @objc func toggleMenu(_ sender : NSMenuItem) { + let status = sender.state != NSControl.StateValue.on + sender.state = sender.state == NSControl.StateValue.on ? NSControl.StateValue.off : NSControl.StateValue.on + + switch sender.title { + case "Start at login": + LaunchAtLogin.isEnabled = status + if self.defaults.object(forKey: "runAtLoginInitialized") == nil { + self.defaults.set(true, forKey: "runAtLoginInitialized") + } + case "Check for updates on start": + self.defaults.set(status, forKey: "checkUpdatesOnLogin") + case "Show icon in dock": + self.defaults.set(status, forKey: "dockIcon") + let iconStatus = status ? NSApplication.ActivationPolicy.regular : NSApplication.ActivationPolicy.accessory + NSApp.setActivationPolicy(iconStatus) + return + default: break + } + } +} + + +func LabelField(string: String) -> NSTextField { + let label: NSTextField = NSTextField(string: string) + + label.isEditable = false + label.isSelectable = false + label.isBezeled = false + label.textColor = .darkGray + label.alignment = .center + label.font = NSFont.systemFont(ofSize: 12, weight: .regular) + label.backgroundColor = NSColor(hexString: "#dddddd", alpha: 0) + + return label +} + +func ValueField(string: String) -> NSTextField { + let label: NSTextField = NSTextField(string: string) + + label.isEditable = false + label.isSelectable = false + label.isBezeled = false + label.textColor = .black + label.alignment = .center + label.font = NSFont.systemFont(ofSize: 13, weight: .regular) + label.backgroundColor = NSColor(hexString: "#dddddd", alpha: 0) + + return label +} diff --git a/Stats/Views/UpdatesViewController.swift b/Stats/Views/UpdatesViewController.swift new file mode 100644 index 00000000000..98a5a05680b --- /dev/null +++ b/Stats/Views/UpdatesViewController.swift @@ -0,0 +1,77 @@ +// +// UpdatesViewController.swift +// Stats +// +// Created by Serhiy Mytrovtsiy on 05/09/2019. +// Copyright © 2019 Serhiy Mytrovtsiy. All rights reserved. +// + +import Cocoa +import Foundation + +class UpdatesVC: NSViewController { + @IBOutlet weak var mainView: NSStackView! + @IBOutlet weak var spinnerView: NSView! + @IBOutlet weak var noInternetView: NSView! + @IBOutlet weak var mainTextLabel: NSTextFieldCell! + @IBOutlet weak var currentVersionLabel: NSTextField! + @IBOutlet weak var latestVersionLabel: NSTextField! + @IBOutlet weak var downloadButton: NSButton! + @IBOutlet weak var spinner: NSProgressIndicator! + + var url: String? + + override func viewDidLoad() { + super.viewDidLoad() + self.view.wantsLayer = true + + self.spinner.startAnimation(self) + + updater.check() { result, error in + if error != nil && error as! String == "No internet connection" { + DispatchQueue.main.async(execute: { + self.spinnerView.isHidden = true + self.noInternetView.isHidden = false + }) + return + } + + guard error == nil, let version: version = result else { + print("Error: \(error ?? "check error")") + return + } + + DispatchQueue.main.async(execute: { + self.spinner.stopAnimation(self) + self.spinnerView.isHidden = true + self.mainView.isHidden = false + self.currentVersionLabel.stringValue = version.current + self.latestVersionLabel.stringValue = version.latest + self.url = version.url + + if !version.newest { + self.mainTextLabel.stringValue = "No new version available" + self.downloadButton.isEnabled = false + } + }) + } + } + + override func awakeFromNib() { + if self.view.layer != nil { + self.view.window?.backgroundColor = .windowBackgroundColor + } + } + + @IBAction func download(_ sender: Any) { + guard let urlString = self.url, let url = URL(string: urlString) else { + return + } + NSWorkspace.shared.open(url) + self.view.window?.close() + } + + @IBAction func exit(_ sender: Any) { + self.view.window?.close() + } +} diff --git a/Stats/Widgets/BatteryView.swift b/Stats/Widgets/BatteryWidget.swift similarity index 99% rename from Stats/Widgets/BatteryView.swift rename to Stats/Widgets/BatteryWidget.swift index 124d9e663cf..a1ccf77354f 100644 --- a/Stats/Widgets/BatteryView.swift +++ b/Stats/Widgets/BatteryWidget.swift @@ -8,7 +8,7 @@ import Cocoa -class BatteryView: NSView, Widget { +class BatteryWidget: NSView, Widget { var activeModule: Observable = Observable(false) var size: CGFloat = widgetSize.width var name: String = "" diff --git a/Stats/Widgets/Mini.swift b/Stats/Widgets/Mini.swift index 40408b380a6..56fb21e1b5b 100644 --- a/Stats/Widgets/Mini.swift +++ b/Stats/Widgets/Mini.swift @@ -106,5 +106,6 @@ class Mini: NSView, Widget { sender.state = sender.state == NSControl.StateValue.on ? NSControl.StateValue.off : NSControl.StateValue.on self.defaults.set(sender.state == NSControl.StateValue.on, forKey: "\(name)_color") self.color = sender.state == NSControl.StateValue.on + self.redraw() } } diff --git a/Stats/Widgets/Network/NetworkArrowsText.swift b/Stats/Widgets/Network/NetworkArrowsText.swift index 82426c4f060..d6b9adeb1ea 100644 --- a/Stats/Widgets/Network/NetworkArrowsText.swift +++ b/Stats/Widgets/Network/NetworkArrowsText.swift @@ -94,11 +94,11 @@ class NetworkArrowsTextView: NSView, Widget { if self.download != download { self.download = download - downloadValue.stringValue = Units(bytes: self.download).getReadableUnit() + downloadValue.stringValue = "\(Units(bytes: self.download).getReadableUnit())/s" } if self.upload != upload { self.upload = upload - uploadValue.stringValue = Units(bytes: self.upload).getReadableUnit() + uploadValue.stringValue = "\(Units(bytes: self.upload).getReadableUnit())/s" } } diff --git a/Stats/Widgets/Network/NetworkDotsText.swift b/Stats/Widgets/Network/NetworkDotsText.swift index ab57aa7b369..f37e006cf40 100644 --- a/Stats/Widgets/Network/NetworkDotsText.swift +++ b/Stats/Widgets/Network/NetworkDotsText.swift @@ -80,11 +80,11 @@ class NetworkDotsTextView: NSView, Widget { if self.download != download { self.download = download - downloadValue.stringValue = Units(bytes: self.download).getReadableUnit() + downloadValue.stringValue = "\(Units(bytes: self.download).getReadableUnit())/s" } if self.upload != upload { self.upload = upload - uploadValue.stringValue = Units(bytes: self.upload).getReadableUnit() + uploadValue.stringValue = "\(Units(bytes: self.upload).getReadableUnit())/s" } } diff --git a/Stats/Widgets/Network/NetworkText.swift b/Stats/Widgets/Network/NetworkText.swift index 883c7aba394..8f4bf952443 100644 --- a/Stats/Widgets/Network/NetworkText.swift +++ b/Stats/Widgets/Network/NetworkText.swift @@ -44,8 +44,8 @@ class NetworkTextView: NSView, Widget { let download: Int64 = Int64(data[0]) let upload: Int64 = Int64(data[1]) - downloadValue.stringValue = Units(bytes: download).getReadableUnit() - uploadValue.stringValue = Units(bytes: upload).getReadableUnit() + downloadValue.stringValue = "\(Units(bytes: download).getReadableUnit())/s" + uploadValue.stringValue = "\(Units(bytes: upload).getReadableUnit())/s" } func valueView() { diff --git a/Stats/libs/ChartMarker.swift b/Stats/libs/ChartMarker.swift new file mode 100644 index 00000000000..3070293fd72 --- /dev/null +++ b/Stats/libs/ChartMarker.swift @@ -0,0 +1,41 @@ +// +// ChartMarker.swift +// Stats +// +// Created by Serhiy Mytrovtsiy on 03/09/2019. +// Copyright © 2019 Serhiy Mytrovtsiy. All rights reserved. +// + +import Cocoa +import Foundation +import Charts + +class ChartMarker: MarkerView { + var text = "" + + override func refreshContent(entry: ChartDataEntry, highlight: Highlight) { + super.refreshContent(entry: entry, highlight: highlight) + text = String(entry.y) + } + + override func draw(context: CGContext, point: CGPoint) { + super.draw(context: context, point: point) + + var drawAttributes = [NSAttributedString.Key : Any]() + drawAttributes[.font] = NSFont.systemFont(ofSize: 13) + drawAttributes[.foregroundColor] = NSColor.white + drawAttributes[.backgroundColor] = NSColor.darkGray + + self.bounds.size = (" \(text) " as NSString).size(withAttributes: drawAttributes) + self.offset = CGPoint(x: 0, y: self.bounds.size.height) + + let offset = self.offsetForDrawing(atPoint: point) + drawText(text: " \(text) " as NSString, rect: CGRect(origin: CGPoint(x: point.x + offset.x, y: point.y + offset.y), size: self.bounds.size), withAttributes: drawAttributes) + } + + func drawText(text: NSString, rect: CGRect, withAttributes attributes: [NSAttributedString.Key : Any]? = nil) { + let size = text.size(withAttributes: attributes) + let centeredRect = CGRect(x: rect.origin.x + (rect.size.width - size.width) / 2.0, y: rect.origin.y + (rect.size.height - size.height) / 2.0, width: size.width, height: size.height) + text.draw(in: centeredRect, withAttributes: attributes) + } +} diff --git a/Stats/libs/Extensions.swift b/Stats/libs/Extensions.swift index 3b047c10119..558e864b7f6 100755 --- a/Stats/libs/Extensions.swift +++ b/Stats/libs/Extensions.swift @@ -107,15 +107,48 @@ public struct Units { public func getReadableUnit() -> String { switch bytes { case 0..<1_024: - return "0 KB/s" + return "0 KB" case 1_024..<(1_024 * 1_024): - return String(format: "%.0f KB/s", kilobytes) + return String(format: "%.0f KB", kilobytes) case 1_024..<(1_024 * 1_024 * 1_024): - return String(format: "%.2f MB/s", megabytes) + return String(format: "%.2f MB", megabytes) case (1_024 * 1_024 * 1_024)...Int64.max: - return String(format: "%.2f GB/s", gigabytes) + return String(format: "%.2f GB", gigabytes) default: - return String(format: "%.0f KB/s", kilobytes) + return String(format: "%.0f KB", kilobytes) + } + } +} + +extension Double { + + func secondsToHoursMinutesSeconds () -> (Int?, Int?, Int?) { + let hrs = self / 3600 + let mins = (self.truncatingRemainder(dividingBy: 3600)) / 60 + let seconds = (self.truncatingRemainder(dividingBy:3600)).truncatingRemainder(dividingBy:60) + return (Int(hrs) > 0 ? Int(hrs) : nil , Int(mins) > 0 ? Int(mins) : nil, Int(seconds) > 0 ? Int(seconds) : nil) + } + + func printSecondsToHoursMinutesSeconds () -> String { + let time = self.secondsToHoursMinutesSeconds() + + switch time { + case (nil, let x? , let y?): + return "\(x) min \(y) sec" + case (nil, let x?, nil): + return "\(x) min" + case (let x?, nil, nil): + return "\(x) hr" + case (nil, nil, let x?): + return "\(x) sec" + case (let x?, nil, let z?): + return "\(x) hr \(z) sec" + case (let x?, let y?, nil): + return "\(x) hr \(y) min" + case (let x?, let y?, let z?): + return "\(x) hr \(y) min \(z) sec" + default: + return "n/a" } } } @@ -141,3 +174,34 @@ extension NSBezierPath { self.line(to: arrowLine2) } } + +extension NSColor { + + convenience init(hexString: String, alpha: CGFloat = 1.0) { + let hexString: String = hexString.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) + let scanner = Scanner(string: hexString) + if (hexString.hasPrefix("#")) { + scanner.scanLocation = 1 + } + var color: UInt32 = 0 + scanner.scanHexInt32(&color) + let mask = 0x000000FF + let r = Int(color >> 16) & mask + let g = Int(color >> 8) & mask + let b = Int(color) & mask + let red = CGFloat(r) / 255.0 + let green = CGFloat(g) / 255.0 + let blue = CGFloat(b) / 255.0 + self.init(red:red, green:green, blue:blue, alpha:alpha) + } + + func toHexString() -> String { + var r:CGFloat = 0 + var g:CGFloat = 0 + var b:CGFloat = 0 + var a:CGFloat = 0 + getRed(&r, green: &g, blue: &b, alpha: &a) + let rgb:Int = (Int)(r*255)<<16 | (Int)(g*255)<<8 | (Int)(b*255)<<0 + return String(format:"#%06x", rgb) + } +} diff --git a/Stats/libs/macAppUpdater.swift b/Stats/libs/MacAppUpdater.swift similarity index 100% rename from Stats/libs/macAppUpdater.swift rename to Stats/libs/MacAppUpdater.swift diff --git a/Stats/libs/Observable.swift b/Stats/libs/Observable.swift index 98ccd942edc..aa7f02d2973 100755 --- a/Stats/libs/Observable.swift +++ b/Stats/libs/Observable.swift @@ -13,7 +13,6 @@ protocol ObservableProtocol { var value: T { get set } func subscribe(observer: AnyObject, block: @escaping (_ newValue: T, _ oldValue: T) -> ()) func unsubscribe(observer: AnyObject) - func userDefaults(key: String) } public final class Observable: ObservableProtocol { @@ -34,7 +33,6 @@ public final class Observable: ObservableProtocol { let (_, block) = entry block(value, oldValue) } - updateUserDefaults() } } @@ -51,14 +49,6 @@ public final class Observable: ObservableProtocol { observers = filtered } - - func userDefaults(key: String) { - self.userDefaultsKey = key - } - - func updateUserDefaults() { - self.defaults.set(self.value, forKey: self.userDefaultsKey) - } } func <<(observable: Observable, value: T) { diff --git a/StatsLauncher/AppDelegate.swift b/StatsLauncher/AppDelegate.swift deleted file mode 100644 index 4c7353dd503..00000000000 --- a/StatsLauncher/AppDelegate.swift +++ /dev/null @@ -1,43 +0,0 @@ -// -// AppDelegate.swift -// StatsLauncher -// -// Created by Serhiy Mytrovtsiy on 10/06/2019. -// Copyright © 2019 Serhiy Mytrovtsiy. All rights reserved. -// - -import Cocoa - -extension Notification.Name { - static let killLauncher = Notification.Name("killLauncher") -} - -@NSApplicationMain -class AppDelegate: NSObject, NSApplicationDelegate { - - func applicationDidFinishLaunching(_ aNotification: Notification) { - let mainAppIdentifier = "eu.exelban.Stats" - let runningApps = NSWorkspace.shared.runningApplications - let isRunning = !runningApps.filter { $0.bundleIdentifier == mainAppIdentifier }.isEmpty - - if !isRunning { - DistributedNotificationCenter.default().addObserver(self, - selector: #selector(self.terminate), - name: .killLauncher, - object: mainAppIdentifier) - var path = Bundle.main.bundlePath as NSString - for _ in 1...4 { - path = path.deletingLastPathComponent as NSString - } - NSWorkspace.shared.launchApplication(path as String) - } - else { - self.terminate() - } - } - - @objc func terminate() { - NSApp.terminate(nil) - } -} - diff --git a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/1024.png b/StatsLauncher/Assets.xcassets/AppIcon.appiconset/1024.png deleted file mode 100644 index a8172494173..00000000000 Binary files a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/1024.png and /dev/null differ diff --git a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/128.png b/StatsLauncher/Assets.xcassets/AppIcon.appiconset/128.png deleted file mode 100644 index 4d0f7329b58..00000000000 Binary files a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/128.png and /dev/null differ diff --git a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/16.png b/StatsLauncher/Assets.xcassets/AppIcon.appiconset/16.png deleted file mode 100644 index 628518b46ae..00000000000 Binary files a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/16.png and /dev/null differ diff --git a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/256-1.png b/StatsLauncher/Assets.xcassets/AppIcon.appiconset/256-1.png deleted file mode 100644 index e28ffbe4172..00000000000 Binary files a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/256-1.png and /dev/null differ diff --git a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/256.png b/StatsLauncher/Assets.xcassets/AppIcon.appiconset/256.png deleted file mode 100644 index e28ffbe4172..00000000000 Binary files a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/256.png and /dev/null differ diff --git a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/32-1.png b/StatsLauncher/Assets.xcassets/AppIcon.appiconset/32-1.png deleted file mode 100644 index 71b750a80b7..00000000000 Binary files a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/32-1.png and /dev/null differ diff --git a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/32.png b/StatsLauncher/Assets.xcassets/AppIcon.appiconset/32.png deleted file mode 100644 index 71b750a80b7..00000000000 Binary files a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/32.png and /dev/null differ diff --git a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/512-1.png b/StatsLauncher/Assets.xcassets/AppIcon.appiconset/512-1.png deleted file mode 100644 index 4d15d717550..00000000000 Binary files a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/512-1.png and /dev/null differ diff --git a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/512.png b/StatsLauncher/Assets.xcassets/AppIcon.appiconset/512.png deleted file mode 100644 index 4d15d717550..00000000000 Binary files a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/512.png and /dev/null differ diff --git a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/64.png b/StatsLauncher/Assets.xcassets/AppIcon.appiconset/64.png deleted file mode 100644 index 59d8a6d3791..00000000000 Binary files a/StatsLauncher/Assets.xcassets/AppIcon.appiconset/64.png and /dev/null differ