├── .gitignore ├── .travis.yml ├── Assets ├── feature_graphic.png └── feature_graphic.psd ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Charts.podspec ├── Charts ├── Cartfile.private ├── Cartfile.resolved ├── Charts.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ ├── Charts-OSX.xcscheme │ │ ├── Charts-TV.xcscheme │ │ └── Charts-iOS.xcscheme ├── ChartsTests │ ├── BarChartTests.swift │ ├── Info.plist │ ├── LineChartTests.swift │ └── ReferenceImages_64 │ │ ├── ChartsTests.BarChartTests │ │ ├── testDefaultValues@2x.png │ │ ├── testDefaultValues@3x.png │ │ ├── testHideHorizontalGridlines@2x.png │ │ ├── testHideHorizontalGridlines@3x.png │ │ ├── testHideLeftAxis@2x.png │ │ ├── testHideLeftAxis@3x.png │ │ ├── testHideRightAxis@2x.png │ │ ├── testHideRightAxis@3x.png │ │ ├── testHideVerticalGridlines@2x.png │ │ ├── testHideVerticalGridlines@3x.png │ │ ├── testHidesValues@2x.png │ │ └── testHidesValues@3x.png │ │ └── ChartsTests.LineChartTests │ │ ├── testDefaultValues@2x.png │ │ ├── testDefaultValues@3x.png │ │ ├── testDoesntDrawCircleHole@2x.png │ │ ├── testDoesntDrawCircleHole@3x.png │ │ ├── testDoesntDrawCircles@2x.png │ │ ├── testDoesntDrawCircles@3x.png │ │ ├── testHidesValues@2x.png │ │ ├── testHidesValues@3x.png │ │ ├── testIsCubic@2x.png │ │ └── testIsCubic@3x.png ├── Classes │ ├── Animation │ │ ├── ChartAnimationEasing.swift │ │ └── ChartAnimator.swift │ ├── Charts │ │ ├── BarChartView.swift │ │ ├── BarLineChartViewBase.swift │ │ ├── BubbleChartView.swift │ │ ├── CandleStickChartView.swift │ │ ├── ChartViewBase.swift │ │ ├── CombinedChartView.swift │ │ ├── HorizontalBarChartView.swift │ │ ├── LineChartView.swift │ │ ├── PieChartView.swift │ │ ├── PieRadarChartViewBase.swift │ │ ├── RadarChartView.swift │ │ └── ScatterChartView.swift │ ├── Components │ │ ├── ChartAxisBase.swift │ │ ├── ChartComponentBase.swift │ │ ├── ChartLegend.swift │ │ ├── ChartLimitLine.swift │ │ ├── ChartMarker.swift │ │ ├── ChartXAxis.swift │ │ └── ChartYAxis.swift │ ├── Data │ │ ├── Implementations │ │ │ ├── ChartBaseDataSet.swift │ │ │ └── Standard │ │ │ │ ├── BarChartData.swift │ │ │ │ ├── BarChartDataEntry.swift │ │ │ │ ├── BarChartDataSet.swift │ │ │ │ ├── BarLineScatterCandleBubbleChartData.swift │ │ │ │ ├── BarLineScatterCandleBubbleChartDataSet.swift │ │ │ │ ├── BubbleChartData.swift │ │ │ │ ├── BubbleChartDataEntry.swift │ │ │ │ ├── BubbleChartDataSet.swift │ │ │ │ ├── CandleChartData.swift │ │ │ │ ├── CandleChartDataEntry.swift │ │ │ │ ├── CandleChartDataSet.swift │ │ │ │ ├── ChartData.swift │ │ │ │ ├── ChartDataEntry.swift │ │ │ │ ├── ChartDataSet.swift │ │ │ │ ├── CombinedChartData.swift │ │ │ │ ├── LineChartData.swift │ │ │ │ ├── LineChartDataSet.swift │ │ │ │ ├── LineRadarChartDataSet.swift │ │ │ │ ├── LineScatterCandleRadarChartDataSet.swift │ │ │ │ ├── PieChartData.swift │ │ │ │ ├── PieChartDataSet.swift │ │ │ │ ├── RadarChartData.swift │ │ │ │ ├── RadarChartDataSet.swift │ │ │ │ ├── ScatterChartData.swift │ │ │ │ └── ScatterChartDataSet.swift │ │ └── Interfaces │ │ │ ├── IBarChartDataSet.swift │ │ │ ├── IBarLineScatterCandleBubbleChartDataSet.swift │ │ │ ├── IBubbleChartDataSet.swift │ │ │ ├── ICandleChartDataSet.swift │ │ │ ├── IChartDataSet.swift │ │ │ ├── ILineChartDataSet.swift │ │ │ ├── ILineRadarChartDataSet.swift │ │ │ ├── ILineScatterCandleRadarChartDataSet.swift │ │ │ ├── IPieChartDataSet.swift │ │ │ ├── IRadarChartDataSet.swift │ │ │ └── IScatterChartDataSet.swift │ ├── Filters │ │ ├── ChartDataApproximatorFilter.swift │ │ └── ChartDataBaseFilter.swift │ ├── Formatters │ │ ├── ChartDefaultFillFormatter.swift │ │ ├── ChartDefaultXAxisValueFormatter.swift │ │ ├── ChartFillFormatter.swift │ │ └── ChartXAxisValueFormatter.swift │ ├── Highlight │ │ ├── BarChartHighlighter.swift │ │ ├── ChartHighlight.swift │ │ ├── ChartHighlighter.swift │ │ ├── ChartRange.swift │ │ ├── CombinedHighlighter.swift │ │ └── HorizontalBarChartHighlighter.swift │ ├── Interfaces │ │ ├── BarChartDataProvider.swift │ │ ├── BarLineScatterCandleBubbleChartDataProvider.swift │ │ ├── BubbleChartDataProvider.swift │ │ ├── CandleChartDataProvider.swift │ │ ├── ChartDataProvider.swift │ │ ├── LineChartDataProvider.swift │ │ └── ScatterChartDataProvider.swift │ ├── Jobs │ │ ├── AnimatedMoveViewJob.swift │ │ ├── AnimatedViewPortJob.swift │ │ ├── AnimatedZoomViewJob.swift │ │ ├── ChartViewPortJob.swift │ │ ├── MoveChartViewJob.swift │ │ └── ZoomChartViewJob.swift │ ├── Renderers │ │ ├── BarChartRenderer.swift │ │ ├── BubbleChartRenderer.swift │ │ ├── CandleStickChartRenderer.swift │ │ ├── ChartAxisRendererBase.swift │ │ ├── ChartDataRendererBase.swift │ │ ├── ChartLegendRenderer.swift │ │ ├── ChartRendererBase.swift │ │ ├── ChartXAxisRenderer.swift │ │ ├── ChartXAxisRendererBarChart.swift │ │ ├── ChartXAxisRendererHorizontalBarChart.swift │ │ ├── ChartXAxisRendererRadarChart.swift │ │ ├── ChartYAxisRenderer.swift │ │ ├── ChartYAxisRendererHorizontalBarChart.swift │ │ ├── ChartYAxisRendererRadarChart.swift │ │ ├── CombinedChartRenderer.swift │ │ ├── HorizontalBarChartRenderer.swift │ │ ├── LineChartRenderer.swift │ │ ├── LineRadarChartRenderer.swift │ │ ├── LineScatterCandleRadarChartRenderer.swift │ │ ├── PieChartRenderer.swift │ │ ├── RadarChartRenderer.swift │ │ └── ScatterChartRenderer.swift │ └── Utils │ │ ├── ChartColorTemplates.swift │ │ ├── ChartFill.swift │ │ ├── ChartPlatform.swift │ │ ├── ChartSelectionDetail.swift │ │ ├── ChartTransformer.swift │ │ ├── ChartTransformerHorizontalBarChart.swift │ │ ├── ChartUtils.swift │ │ └── ChartViewPortHandler.swift └── Supporting Files │ ├── Charts.h │ └── Info.plist ├── ChartsDemo-OSX ├── ChartsDemo-OSX.xcodeproj │ └── project.pbxproj └── ChartsDemo-OSX │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ └── Main.storyboard │ ├── Demos │ ├── BarDemoViewController.swift │ ├── LineDemoViewController.swift │ ├── PieDemoViewController.swift │ └── RadarDemoViewController.swift │ └── Info.plist ├── ChartsDemo ├── ChartsDemo.xcodeproj │ └── project.pbxproj ├── Classes │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Components │ │ ├── BalloonMarker.swift │ │ ├── MyCustomXValueFormatter.h │ │ └── MyCustomXValueFormatter.m │ ├── DemoBaseViewController.h │ ├── DemoBaseViewController.m │ ├── DemoListViewController.h │ ├── DemoListViewController.m │ ├── DemoListViewController.xib │ ├── Demos │ │ ├── AnotherBarChartViewController.h │ │ ├── AnotherBarChartViewController.m │ │ ├── AnotherBarChartViewController.xib │ │ ├── BarChartViewController.h │ │ ├── BarChartViewController.m │ │ ├── BarChartViewController.xib │ │ ├── BubbleChartViewController.h │ │ ├── BubbleChartViewController.m │ │ ├── BubbleChartViewController.xib │ │ ├── CandleStickChartViewController.h │ │ ├── CandleStickChartViewController.m │ │ ├── CandleStickChartViewController.xib │ │ ├── ColoredLineChartViewController.h │ │ ├── ColoredLineChartViewController.m │ │ ├── ColoredLineChartViewController.xib │ │ ├── CombinedChartViewController.h │ │ ├── CombinedChartViewController.m │ │ ├── CombinedChartViewController.xib │ │ ├── CubicLineChartViewController.h │ │ ├── CubicLineChartViewController.m │ │ ├── CubicLineChartViewController.xib │ │ ├── HorizontalBarChartViewController.h │ │ ├── HorizontalBarChartViewController.m │ │ ├── HorizontalBarChartViewController.xib │ │ ├── LineChart1ViewController.h │ │ ├── LineChart1ViewController.m │ │ ├── LineChart1ViewController.xib │ │ ├── LineChart2ViewController.h │ │ ├── LineChart2ViewController.m │ │ ├── LineChart2ViewController.xib │ │ ├── MultipleBarChartViewController.h │ │ ├── MultipleBarChartViewController.m │ │ ├── MultipleBarChartViewController.xib │ │ ├── MultipleLinesChartViewController.h │ │ ├── MultipleLinesChartViewController.m │ │ ├── MultipleLinesChartViewController.xib │ │ ├── NegativeStackedBarChartViewController.h │ │ ├── NegativeStackedBarChartViewController.m │ │ ├── NegativeStackedBarChartViewController.xib │ │ ├── PieChartViewController.h │ │ ├── PieChartViewController.m │ │ ├── PieChartViewController.xib │ │ ├── PositiveNegativeBarChartViewController.h │ │ ├── PositiveNegativeBarChartViewController.m │ │ ├── PositiveNegativeBarChartViewController.xib │ │ ├── RadarChartViewController.h │ │ ├── RadarChartViewController.m │ │ ├── RadarChartViewController.xib │ │ ├── ScatterChartViewController.h │ │ ├── ScatterChartViewController.m │ │ ├── ScatterChartViewController.xib │ │ ├── SinusBarChartViewController.h │ │ ├── SinusBarChartViewController.m │ │ ├── SinusBarChartViewController.xib │ │ ├── StackedBarChartViewController.h │ │ ├── StackedBarChartViewController.m │ │ └── StackedBarChartViewController.xib │ ├── RealmBase │ │ ├── RealmDemoBaseViewController.h │ │ ├── RealmDemoBaseViewController.m │ │ ├── RealmDemoData.h │ │ ├── RealmDemoData.m │ │ ├── RealmFloat.h │ │ ├── RealmFloat.m │ │ ├── Score.h │ │ └── Score.m │ ├── RealmDemoListViewController.h │ ├── RealmDemoListViewController.m │ ├── RealmDemoListViewController.xib │ └── RealmDemos │ │ ├── RealmBarChartViewController.h │ │ ├── RealmBarChartViewController.m │ │ ├── RealmBarChartViewController.xib │ │ ├── RealmBubbleChartViewController.h │ │ ├── RealmBubbleChartViewController.m │ │ ├── RealmBubbleChartViewController.xib │ │ ├── RealmCandleChartViewController.h │ │ ├── RealmCandleChartViewController.m │ │ ├── RealmCandleChartViewController.xib │ │ ├── RealmHorizontalBarChartViewController.h │ │ ├── RealmHorizontalBarChartViewController.m │ │ ├── RealmHorizontalBarChartViewController.xib │ │ ├── RealmLineChartViewController.h │ │ ├── RealmLineChartViewController.m │ │ ├── RealmLineChartViewController.xib │ │ ├── RealmPieChartViewController.h │ │ ├── RealmPieChartViewController.m │ │ ├── RealmPieChartViewController.xib │ │ ├── RealmRadarChartViewController.h │ │ ├── RealmRadarChartViewController.m │ │ ├── RealmRadarChartViewController.xib │ │ ├── RealmScatterChartViewController.h │ │ ├── RealmScatterChartViewController.m │ │ ├── RealmScatterChartViewController.xib │ │ ├── RealmWikiExampleChartViewController.h │ │ ├── RealmWikiExampleChartViewController.m │ │ └── RealmWikiExampleChartViewController.xib ├── Resources │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-29@2x.png │ │ │ ├── Icon-29@3x.png │ │ │ ├── Icon-40@2x.png │ │ │ ├── Icon-40@3x.png │ │ │ ├── Icon-60@2x.png │ │ │ └── Icon-60@3x.png │ │ └── LaunchImage.launchimage │ │ │ ├── Contents.json │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default-667h@2x.png │ │ │ ├── Default-736h@3x.png │ │ │ └── Default@2x.png │ ├── app-icon │ │ ├── Icon-29@2x.png │ │ ├── Icon-29@3x.png │ │ ├── Icon-40@2x.png │ │ ├── Icon-40@3x.png │ │ ├── Icon-60@2x.png │ │ ├── Icon-60@3x.png │ │ ├── iTunesArtwork │ │ └── iTunesArtwork@2x │ └── launch-image │ │ ├── Default-568h@2x.png │ │ ├── Default-667h@2x.png │ │ ├── Default-736h@3x.png │ │ └── Default@2x.png └── Supporting Files │ ├── ChartsDemo-Bridging-Header.h │ ├── Info.plist │ └── main.m ├── ChartsRealm ├── ChartsRealm.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ ├── ChartsRealm-TV.xcscheme │ │ └── ChartsRealm-iOS.xcscheme ├── Classes │ ├── Data │ │ ├── RealmBarData.swift │ │ ├── RealmBarDataSet.swift │ │ ├── RealmBarLineScatterCandleBubbleDataSet.swift │ │ ├── RealmBaseDataSet.swift │ │ ├── RealmBubbleData.swift │ │ ├── RealmBubbleDataSet.swift │ │ ├── RealmCandleData.swift │ │ ├── RealmCandleDataSet.swift │ │ ├── RealmLineData.swift │ │ ├── RealmLineDataSet.swift │ │ ├── RealmLineRadarDataSet.swift │ │ ├── RealmLineScatterCandleRadarDataSet.swift │ │ ├── RealmPieData.swift │ │ ├── RealmPieDataSet.swift │ │ ├── RealmRadarData.swift │ │ ├── RealmRadarDataSet.swift │ │ ├── RealmScatterData.swift │ │ └── RealmScatterDataSet.swift │ └── Utils │ │ └── RealmChartUtils.swift ├── Supporting Files │ ├── ChartsRealm.h │ └── Info.plist └── ThirdParty │ └── Realm │ ├── ios │ ├── Realm.framework │ │ ├── 645FADE5-20BA-3B97-969D-64938A025E8E.bcsymbolmap │ │ ├── 8A0D49D9-DD3A-31FD-9A79-BF264744DCC3.bcsymbolmap │ │ ├── CHANGELOG.md │ │ ├── Headers │ │ │ ├── RLMArray.h │ │ │ ├── RLMCollection.h │ │ │ ├── RLMConstants.h │ │ │ ├── RLMDefines.h │ │ │ ├── RLMMigration.h │ │ │ ├── RLMObject.h │ │ │ ├── RLMObjectBase.h │ │ │ ├── RLMObjectBase_Dynamic.h │ │ │ ├── RLMObjectSchema.h │ │ │ ├── RLMPlatform.h │ │ │ ├── RLMProperty.h │ │ │ ├── RLMRealm.h │ │ │ ├── RLMRealmConfiguration.h │ │ │ ├── RLMRealm_Dynamic.h │ │ │ ├── RLMResults.h │ │ │ ├── RLMSchema.h │ │ │ └── Realm.h │ │ ├── Info.plist │ │ ├── LICENSE │ │ ├── Modules │ │ │ └── module.modulemap │ │ ├── PrivateHeaders │ │ │ ├── RLMAccessor.h │ │ │ ├── RLMArray_Private.h │ │ │ ├── RLMListBase.h │ │ │ ├── RLMMigration_Private.h │ │ │ ├── RLMObjectSchema_Private.h │ │ │ ├── RLMObjectStore.h │ │ │ ├── RLMObject_Private.h │ │ │ ├── RLMOptionalBase.h │ │ │ ├── RLMProperty_Private.h │ │ │ ├── RLMRealmConfiguration_Private.h │ │ │ ├── RLMRealmUtil.hpp │ │ │ ├── RLMRealm_Private.h │ │ │ ├── RLMResults_Private.h │ │ │ └── RLMSchema_Private.h │ │ ├── Realm │ │ ├── _CodeSignature │ │ │ └── CodeResources │ │ └── strip-frameworks.sh │ └── RealmSwift.framework │ │ ├── 3575149B-6A97-3EED-8AC5-249F0F69893D.bcsymbolmap │ │ ├── 645FADE5-20BA-3B97-969D-64938A025E8E.bcsymbolmap │ │ ├── 781824F3-7FDF-337C-B733-289907054DB2.bcsymbolmap │ │ ├── 8A0D49D9-DD3A-31FD-9A79-BF264744DCC3.bcsymbolmap │ │ ├── Headers │ │ └── RealmSwift-Swift.h │ │ ├── Info.plist │ │ ├── Modules │ │ ├── RealmSwift.swiftmodule │ │ │ ├── arm.swiftdoc │ │ │ ├── arm.swiftmodule │ │ │ ├── arm64.swiftdoc │ │ │ ├── arm64.swiftmodule │ │ │ ├── i386.swiftdoc │ │ │ ├── i386.swiftmodule │ │ │ ├── x86_64.swiftdoc │ │ │ └── x86_64.swiftmodule │ │ └── module.modulemap │ │ ├── RealmSwift │ │ └── _CodeSignature │ │ └── CodeResources │ └── tvos │ ├── Realm.framework │ ├── A792C1DF-D8FC-3489-9384-E7EB44DC299A.bcsymbolmap │ ├── CHANGELOG.md │ ├── Headers │ │ ├── RLMArray.h │ │ ├── RLMCollection.h │ │ ├── RLMConstants.h │ │ ├── RLMDefines.h │ │ ├── RLMMigration.h │ │ ├── RLMObject.h │ │ ├── RLMObjectBase.h │ │ ├── RLMObjectBase_Dynamic.h │ │ ├── RLMObjectSchema.h │ │ ├── RLMPlatform.h │ │ ├── RLMProperty.h │ │ ├── RLMRealm.h │ │ ├── RLMRealmConfiguration.h │ │ ├── RLMRealm_Dynamic.h │ │ ├── RLMResults.h │ │ ├── RLMSchema.h │ │ └── Realm.h │ ├── Info.plist │ ├── LICENSE │ ├── Modules │ │ └── module.modulemap │ ├── PrivateHeaders │ │ ├── RLMAccessor.h │ │ ├── RLMArray_Private.h │ │ ├── RLMListBase.h │ │ ├── RLMMigration_Private.h │ │ ├── RLMObjectSchema_Private.h │ │ ├── RLMObjectStore.h │ │ ├── RLMObject_Private.h │ │ ├── RLMOptionalBase.h │ │ ├── RLMProperty_Private.h │ │ ├── RLMRealmConfiguration_Private.h │ │ ├── RLMRealmUtil.hpp │ │ ├── RLMRealm_Private.h │ │ ├── RLMResults_Private.h │ │ └── RLMSchema_Private.h │ ├── Realm │ ├── _CodeSignature │ │ └── CodeResources │ └── strip-frameworks.sh │ └── RealmSwift.framework │ ├── 071A9353-A9D3-3243-91A9-BD46CD7EF709.bcsymbolmap │ ├── A792C1DF-D8FC-3489-9384-E7EB44DC299A.bcsymbolmap │ ├── Headers │ └── RealmSwift-Swift.h │ ├── Info.plist │ ├── Modules │ ├── RealmSwift.swiftmodule │ │ ├── arm64.swiftdoc │ │ ├── arm64.swiftmodule │ │ ├── x86_64.swiftdoc │ │ └── x86_64.swiftmodule │ └── module.modulemap │ ├── RealmSwift │ └── _CodeSignature │ └── CodeResources ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── README.md └── Rakefile /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | project.xcworkspace 20 | 21 | # CocoaPods 22 | # 23 | # We recommend against adding the Pods directory to your .gitignore. However 24 | # you should judge for yourself, the pros and cons are mentioned at: 25 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 26 | # 27 | # Pods/ 28 | 29 | Carthage 30 | Charts.framework.zip 31 | ChartsRealm.framework.zip 32 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | osx_image: xcode7.2 2 | language: objective-c 3 | 4 | env: 5 | global: 6 | - LANG=en_US.UTF-8 7 | 8 | cache: 9 | - bundler 10 | 11 | before_install: 12 | - brew update 13 | - cd Charts && carthage bootstrap 14 | 15 | script: 16 | - rake test 17 | 18 | # after_success: 19 | # - bash <(curl -s https://codecov.io/bash) 20 | -------------------------------------------------------------------------------- /Assets/feature_graphic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Assets/feature_graphic.png -------------------------------------------------------------------------------- /Assets/feature_graphic.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Assets/feature_graphic.psd -------------------------------------------------------------------------------- /Charts.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "Charts" 3 | s.version = "2.2.3" 4 | s.summary = "ios-charts is a powerful & easy to use chart library for iOS, tvOS and OSX" 5 | s.homepage = "https://github.com/danielgindi/ios-charts" 6 | s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" } 7 | s.authors = "Daniel Cohen Gindi", "Philipp Jahoda" 8 | s.ios.deployment_target = "8.0" 9 | s.tvos.deployment_target = "9.0" 10 | s.osx.deployment_target = "10.11" 11 | s.source = { :git => "https://github.com/danielgindi/ios-charts.git", :tag => "v#{s.version}" } 12 | s.default_subspec = "Core" 13 | s.prepare_command = "sed -i '' -e 's/import Charts//g' ChartsRealm/Classes/**/*.swift" 14 | 15 | s.subspec "Core" do |ss| 16 | ss.source_files = "Charts/Classes/**/*.swift" 17 | end 18 | 19 | s.subspec "Realm" do |ss| 20 | ss.source_files = "ChartsRealm/Classes/**/*.swift" 21 | ss.dependency "Charts/Core" 22 | ss.dependency "RealmSwift", "~> 0.97" 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /Charts/Cartfile.private: -------------------------------------------------------------------------------- 1 | github "facebook/ios-snapshot-test-case" ~> 2.0 2 | -------------------------------------------------------------------------------- /Charts/Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "facebook/ios-snapshot-test-case" "2.0.7" 2 | -------------------------------------------------------------------------------- /Charts/ChartsTests/BarChartTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import FBSnapshotTestCase 3 | @testable import Charts 4 | 5 | class BarChartTests: FBSnapshotTestCase 6 | { 7 | 8 | var chart: BarChartView! 9 | var dataSet: BarChartDataSet! 10 | 11 | override func setUp() 12 | { 13 | super.setUp() 14 | 15 | // Set to `true` to re-capture all snapshots 16 | self.recordMode = false 17 | 18 | // Sample data 19 | let values: [Double] = [8, 104, 81, 93, 52, 44, 97, 101, 75, 28, 20 | 76, 25, 20, 13, 52, 44, 57, 23, 45, 91, 21 | 99, 14, 84, 48, 40, 71, 106, 41, 45, 61] 22 | 23 | var entries: [ChartDataEntry] = Array() 24 | var xValues: [String] = Array() 25 | 26 | for (i, value) in values.enumerate() 27 | { 28 | entries.append(BarChartDataEntry.init(value: value, xIndex: i)) 29 | xValues.append("\(i)") 30 | } 31 | 32 | dataSet = BarChartDataSet(yVals: entries, label: "Bar chart unit test data") 33 | 34 | chart = BarChartView(frame: CGRectMake(0, 0, 480, 350)) 35 | chart.leftAxis.customAxisMin = 0.0 36 | chart.rightAxis.customAxisMin = 0.0 37 | chart.data = BarChartData(xVals: xValues, dataSet: dataSet) 38 | } 39 | 40 | override func tearDown() 41 | { 42 | // Put teardown code here. This method is called after the invocation of each test method in the class. 43 | super.tearDown() 44 | } 45 | 46 | func testDefaultValues() 47 | { 48 | FBSnapshotVerifyView(chart) 49 | } 50 | 51 | func testHidesValues() 52 | { 53 | dataSet.drawValuesEnabled = false 54 | FBSnapshotVerifyView(chart) 55 | } 56 | 57 | func testHideLeftAxis() 58 | { 59 | chart.leftAxis.enabled = false 60 | FBSnapshotVerifyView(chart) 61 | } 62 | 63 | func testHideRightAxis() 64 | { 65 | chart.rightAxis.enabled = false 66 | FBSnapshotVerifyView(chart) 67 | } 68 | 69 | func testHideHorizontalGridlines() 70 | { 71 | chart.leftAxis.drawGridLinesEnabled = false 72 | chart.rightAxis.drawGridLinesEnabled = false 73 | FBSnapshotVerifyView(chart) 74 | } 75 | 76 | func testHideVerticalGridlines() 77 | { 78 | chart.xAxis.drawGridLinesEnabled = false 79 | FBSnapshotVerifyView(chart) 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Charts/ChartsTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Charts/ChartsTests/LineChartTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import FBSnapshotTestCase 3 | @testable import Charts 4 | 5 | class LineChartTests: FBSnapshotTestCase 6 | { 7 | 8 | var chart: LineChartView! 9 | var dataSet: LineChartDataSet! 10 | 11 | override func setUp() 12 | { 13 | super.setUp() 14 | 15 | // Set to `true` to re-capture all snapshots 16 | self.recordMode = false 17 | 18 | // Sample data 19 | let values: [Double] = [8, 104, 81, 93, 52, 44, 97, 101, 75, 28, 20 | 76, 25, 20, 13, 52, 44, 57, 23, 45, 91, 21 | 99, 14, 84, 48, 40, 71, 106, 41, 45, 61] 22 | 23 | var entries: [ChartDataEntry] = Array() 24 | var xValues: [String] = Array() 25 | 26 | for (i, value) in values.enumerate() 27 | { 28 | entries.append(ChartDataEntry.init(value: value, xIndex: i)) 29 | xValues.append("\(i)") 30 | } 31 | 32 | dataSet = LineChartDataSet(yVals: entries, label: "First unit test data") 33 | 34 | chart = LineChartView(frame: CGRectMake(0, 0, 480, 350)) 35 | chart.leftAxis.customAxisMin = 0.0 36 | chart.rightAxis.customAxisMin = 0.0 37 | chart.data = LineChartData(xVals: xValues, dataSet: dataSet) 38 | } 39 | 40 | override func tearDown() 41 | { 42 | // Put teardown code here. This method is called after the invocation of each test method in the class. 43 | super.tearDown() 44 | } 45 | 46 | func testDefaultValues() 47 | { 48 | FBSnapshotVerifyView(chart) 49 | } 50 | 51 | func testHidesValues() 52 | { 53 | dataSet.drawValuesEnabled = false 54 | FBSnapshotVerifyView(chart) 55 | } 56 | 57 | func testDoesntDrawCircles() 58 | { 59 | dataSet.drawCirclesEnabled = false 60 | FBSnapshotVerifyView(chart) 61 | } 62 | 63 | func testIsCubic() 64 | { 65 | dataSet.drawCubicEnabled = true 66 | FBSnapshotVerifyView(chart) 67 | } 68 | 69 | func testDoesntDrawCircleHole() 70 | { 71 | dataSet.drawCircleHoleEnabled = false 72 | FBSnapshotVerifyView(chart) 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues@2x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues@3x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines@2x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines@3x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis@2x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis@3x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis@2x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis@3x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines@2x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines@3x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues@2x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues@3x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues@2x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues@3x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole@2x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole@3x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles@2x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles@3x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues@2x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues@3x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic@2x.png -------------------------------------------------------------------------------- /Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/Charts/ChartsTests/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic@3x.png -------------------------------------------------------------------------------- /Charts/Classes/Charts/BubbleChartView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BubbleChartView.swift 3 | // Charts 4 | // 5 | // Bubble chart implementation: 6 | // Copyright 2015 Pierre-Marc Airoldi 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/ios-charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | public class BubbleChartView: BarLineChartViewBase, BubbleChartDataProvider 16 | { 17 | public override func initialize() 18 | { 19 | super.initialize() 20 | 21 | renderer = BubbleChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) 22 | } 23 | 24 | public override func calcMinMax() 25 | { 26 | super.calcMinMax() 27 | guard let data = _data else { return } 28 | 29 | if (_deltaX == 0.0 && data.yValCount > 0) 30 | { 31 | _deltaX = 1.0 32 | } 33 | 34 | _chartXMin = -0.5 35 | _chartXMax = Double(data.xVals.count) - 0.5 36 | 37 | if renderer as? BubbleChartRenderer !== nil, 38 | let sets = data.dataSets as? [IBubbleChartDataSet] 39 | { 40 | for set in sets { 41 | 42 | let xmin = set.xMin 43 | let xmax = set.xMax 44 | 45 | if (xmin < _chartXMin) 46 | { 47 | _chartXMin = xmin 48 | } 49 | 50 | if (xmax > _chartXMax) 51 | { 52 | _chartXMax = xmax 53 | } 54 | } 55 | } 56 | 57 | _deltaX = CGFloat(abs(_chartXMax - _chartXMin)) 58 | } 59 | 60 | // MARK: - BubbleChartDataProbider 61 | 62 | public var bubbleData: BubbleChartData? { return _data as? BubbleChartData } 63 | } -------------------------------------------------------------------------------- /Charts/Classes/Charts/CandleStickChartView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CandleStickChartView.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 4/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | /// Financial chart type that draws candle-sticks. 18 | public class CandleStickChartView: BarLineChartViewBase, CandleChartDataProvider 19 | { 20 | internal override func initialize() 21 | { 22 | super.initialize() 23 | 24 | renderer = CandleStickChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) 25 | _chartXMin = -0.5 26 | } 27 | 28 | internal override func calcMinMax() 29 | { 30 | super.calcMinMax() 31 | 32 | _chartXMax += 0.5 33 | _deltaX = CGFloat(abs(_chartXMax - _chartXMin)) 34 | } 35 | 36 | // MARK: - CandleChartDataProvider 37 | 38 | public var candleData: CandleChartData? 39 | { 40 | return _data as? CandleChartData 41 | } 42 | } -------------------------------------------------------------------------------- /Charts/Classes/Charts/LineChartView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineChartView.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 4/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | /// Chart that draws lines, surfaces, circles, ... 18 | public class LineChartView: BarLineChartViewBase, LineChartDataProvider 19 | { 20 | internal override func initialize() 21 | { 22 | super.initialize() 23 | 24 | renderer = LineChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) 25 | } 26 | 27 | internal override func calcMinMax() 28 | { 29 | super.calcMinMax() 30 | guard let data = _data else { return } 31 | 32 | if (_deltaX == 0.0 && data.yValCount > 0) 33 | { 34 | _deltaX = 1.0 35 | } 36 | } 37 | 38 | // MARK: - LineChartDataProvider 39 | 40 | public var lineData: LineChartData? { return _data as? LineChartData } 41 | } -------------------------------------------------------------------------------- /Charts/Classes/Charts/ScatterChartView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScatterChartView.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 4/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | /// The ScatterChart. Draws dots, triangles, squares and custom shapes into the chartview. 18 | public class ScatterChartView: BarLineChartViewBase, ScatterChartDataProvider 19 | { 20 | public override func initialize() 21 | { 22 | super.initialize() 23 | 24 | renderer = ScatterChartRenderer(dataProvider: self, animator: _animator, viewPortHandler: _viewPortHandler) 25 | _chartXMin = -0.5 26 | } 27 | 28 | public override func calcMinMax() 29 | { 30 | super.calcMinMax() 31 | guard let data = _data else { return } 32 | 33 | if (_deltaX == 0.0 && data.yValCount > 0) 34 | { 35 | _deltaX = 1.0 36 | } 37 | 38 | _chartXMax += 0.5 39 | _deltaX = CGFloat(abs(_chartXMax - _chartXMin)) 40 | } 41 | 42 | // MARK: - ScatterChartDataProbider 43 | 44 | public var scatterData: ScatterChartData? { return _data as? ScatterChartData } 45 | } -------------------------------------------------------------------------------- /Charts/Classes/Components/ChartComponentBase.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartComponentBase.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 16/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | 18 | /// This class encapsulates everything both Axis, Legend and LimitLines have in common 19 | public class ChartComponentBase: NSObject 20 | { 21 | /// flag that indicates if this component is enabled or not 22 | public var enabled = true 23 | 24 | /// Sets the used x-axis offset for the labels on this axis. 25 | /// **default**: 5.0 26 | public var xOffset = CGFloat(5.0) 27 | 28 | /// Sets the used y-axis offset for the labels on this axis. 29 | /// **default**: 5.0 (or 0.0 on ChartYAxis) 30 | public var yOffset = CGFloat(5.0) 31 | 32 | public override init() 33 | { 34 | super.init() 35 | } 36 | 37 | public var isEnabled: Bool { return enabled; } 38 | } 39 | -------------------------------------------------------------------------------- /Charts/Classes/Components/ChartLimitLine.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartLimitLine.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | import CoreGraphics 17 | 18 | 19 | /// The limit line is an additional feature for all Line, Bar and ScatterCharts. 20 | /// 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). 21 | public class ChartLimitLine: ChartComponentBase 22 | { 23 | @objc 24 | public enum ChartLimitLabelPosition: Int 25 | { 26 | case LeftTop 27 | case LeftBottom 28 | case RightTop 29 | case RightBottom 30 | } 31 | 32 | /// limit / maximum (the y-value or xIndex) 33 | public var limit = Double(0.0) 34 | 35 | private var _lineWidth = CGFloat(2.0) 36 | public var lineColor = NSUIColor(red: 237.0/255.0, green: 91.0/255.0, blue: 91.0/255.0, alpha: 1.0) 37 | public var lineDashPhase = CGFloat(0.0) 38 | public var lineDashLengths: [CGFloat]? 39 | public var valueTextColor = NSUIColor.blackColor() 40 | public var valueFont = NSUIFont.systemFontOfSize(13.0) 41 | public var label = "" 42 | public var labelPosition = ChartLimitLabelPosition.RightTop 43 | 44 | public override init() 45 | { 46 | super.init() 47 | } 48 | 49 | public init(limit: Double) 50 | { 51 | super.init() 52 | self.limit = limit 53 | } 54 | 55 | public init(limit: Double, label: String) 56 | { 57 | super.init() 58 | self.limit = limit 59 | self.label = label 60 | } 61 | 62 | /// set the line width of the chart (min = 0.2, max = 12); default 2 63 | public var lineWidth: CGFloat 64 | { 65 | get 66 | { 67 | return _lineWidth 68 | } 69 | set 70 | { 71 | if (newValue < 0.2) 72 | { 73 | _lineWidth = 0.2 74 | } 75 | else if (newValue > 12.0) 76 | { 77 | _lineWidth = 12.0 78 | } 79 | else 80 | { 81 | _lineWidth = newValue 82 | } 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /Charts/Classes/Components/ChartMarker.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartMarker.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 3/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | 18 | public class ChartMarker: ChartComponentBase 19 | { 20 | /// The marker image to render 21 | public var image: NSUIImage? 22 | 23 | /// Use this to return the desired offset you wish the MarkerView to have on the x-axis. 24 | public var offset: CGPoint = CGPoint() 25 | 26 | /// The marker's size 27 | public var size: CGSize 28 | { 29 | get 30 | { 31 | return image!.size 32 | } 33 | } 34 | 35 | public override init() 36 | { 37 | super.init() 38 | } 39 | 40 | /// Returns the offset for drawing at the specific `point` 41 | /// 42 | /// - parameter point: This is the point at which the marker wants to be drawn. You can adjust the offset conditionally based on this argument. 43 | /// - By default returns the self.offset property. You can return any other value to override that. 44 | public func offsetForDrawingAtPos(point: CGPoint) -> CGPoint 45 | { 46 | return offset; 47 | } 48 | 49 | /// Draws the ChartMarker on the given position on the given context 50 | public func draw(context context: CGContext, point: CGPoint) 51 | { 52 | let offset = self.offsetForDrawingAtPos(point) 53 | let size = self.size 54 | 55 | let rect = CGRect(x: point.x + offset.x, y: point.y + offset.y, width: size.width, height: size.height) 56 | 57 | NSUIGraphicsPushContext(context) 58 | image!.drawInRect(rect) 59 | NSUIGraphicsPopContext() 60 | } 61 | 62 | /// This method enables a custom ChartMarker to update it's content everytime the MarkerView is redrawn according to the data entry it points to. 63 | /// 64 | /// - parameter 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). 65 | public func refreshContent(entry entry: ChartDataEntry, highlight: ChartHighlight) 66 | { 67 | // Do nothing here... 68 | } 69 | } -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/BarChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarChartData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | public class BarChartData: BarLineScatterCandleBubbleChartData 18 | { 19 | public override init() 20 | { 21 | super.init() 22 | } 23 | 24 | public override init(xVals: [String?]?, dataSets: [IChartDataSet]?) 25 | { 26 | super.init(xVals: xVals, dataSets: dataSets) 27 | } 28 | 29 | public override init(xVals: [NSObject]?, dataSets: [IChartDataSet]?) 30 | { 31 | super.init(xVals: xVals, dataSets: dataSets) 32 | } 33 | 34 | private var _groupSpace = CGFloat(0.8) 35 | 36 | /// The spacing is relative to a full bar width 37 | public var groupSpace: CGFloat 38 | { 39 | get 40 | { 41 | if (_dataSets.count <= 1) 42 | { 43 | return 0.0 44 | } 45 | return _groupSpace 46 | } 47 | set 48 | { 49 | _groupSpace = newValue 50 | } 51 | } 52 | 53 | /// - returns: true if this BarData object contains grouped DataSets (more than 1 DataSet). 54 | public var isGrouped: Bool 55 | { 56 | return _dataSets.count > 1 ? true : false 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/BarLineScatterCandleBubbleChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarLineScatterCandleBubbleChartData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | 16 | public class BarLineScatterCandleBubbleChartData: ChartData 17 | { 18 | public override init() 19 | { 20 | super.init() 21 | } 22 | 23 | public override init(xVals: [String?]?, dataSets: [IChartDataSet]?) 24 | { 25 | super.init(xVals: xVals, dataSets: dataSets) 26 | } 27 | 28 | public override init(xVals: [NSObject]?, dataSets: [IChartDataSet]?) 29 | { 30 | super.init(xVals: xVals, dataSets: dataSets) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/BarLineScatterCandleBubbleChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarLineScatterCandleBubbleChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | 18 | public class BarLineScatterCandleBubbleChartDataSet: ChartDataSet, IBarLineScatterCandleBubbleChartDataSet 19 | { 20 | // MARK: - Data functions and accessors 21 | 22 | // MARK: - Styling functions and accessors 23 | 24 | public var highlightColor = NSUIColor(red: 255.0/255.0, green: 187.0/255.0, blue: 115.0/255.0, alpha: 1.0) 25 | public var highlightLineWidth = CGFloat(0.5) 26 | public var highlightLineDashPhase = CGFloat(0.0) 27 | public var highlightLineDashLengths: [CGFloat]? 28 | 29 | // MARK: - NSCopying 30 | 31 | public override func copyWithZone(zone: NSZone) -> AnyObject 32 | { 33 | let copy = super.copyWithZone(zone) as! BarLineScatterCandleBubbleChartDataSet 34 | copy.highlightColor = highlightColor 35 | copy.highlightLineWidth = highlightLineWidth 36 | copy.highlightLineDashPhase = highlightLineDashPhase 37 | copy.highlightLineDashLengths = highlightLineDashLengths 38 | return copy 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/BubbleChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BubbleChartData.swift 3 | // Charts 4 | // 5 | // Bubble chart implementation: 6 | // Copyright 2015 Pierre-Marc Airoldi 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/ios-charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | public class BubbleChartData: BarLineScatterCandleBubbleChartData 16 | { 17 | public override init() 18 | { 19 | super.init() 20 | } 21 | 22 | public override init(xVals: [String?]?, dataSets: [IChartDataSet]?) 23 | { 24 | super.init(xVals: xVals, dataSets: dataSets) 25 | } 26 | 27 | public override init(xVals: [NSObject]?, dataSets: [IChartDataSet]?) 28 | { 29 | super.init(xVals: xVals, dataSets: dataSets) 30 | } 31 | 32 | /// Sets the width of the circle that surrounds the bubble when highlighted for all DataSet objects this data object contains 33 | public func setHighlightCircleWidth(width: CGFloat) 34 | { 35 | for set in _dataSets as! [IBubbleChartDataSet]! 36 | { 37 | set.highlightCircleWidth = width 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/BubbleChartDataEntry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BubbleDataEntry.swift 3 | // Charts 4 | // 5 | // Bubble chart implementation: 6 | // Copyright 2015 Pierre-Marc Airoldi 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/ios-charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | public class BubbleChartDataEntry: ChartDataEntry 16 | { 17 | /// The size of the bubble. 18 | public var size = CGFloat(0.0) 19 | 20 | public required init() 21 | { 22 | super.init() 23 | } 24 | 25 | /// - parameter xIndex: The index on the x-axis. 26 | /// - parameter val: The value on the y-axis. 27 | /// - parameter size: The size of the bubble. 28 | public init(xIndex: Int, value: Double, size: CGFloat) 29 | { 30 | super.init(value: value, xIndex: xIndex) 31 | 32 | self.size = size 33 | } 34 | 35 | /// - parameter xIndex: The index on the x-axis. 36 | /// - parameter val: The value on the y-axis. 37 | /// - parameter size: The size of the bubble. 38 | /// - parameter data: Spot for additional data this Entry represents. 39 | public init(xIndex: Int, value: Double, size: CGFloat, data: AnyObject?) 40 | { 41 | super.init(value: value, xIndex: xIndex, data: data) 42 | 43 | self.size = size 44 | } 45 | 46 | // MARK: NSCopying 47 | 48 | public override func copyWithZone(zone: NSZone) -> AnyObject 49 | { 50 | let copy = super.copyWithZone(zone) as! BubbleChartDataEntry 51 | copy.size = size 52 | return copy 53 | } 54 | } -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/CandleChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CandleChartData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | 16 | public class CandleChartData: BarLineScatterCandleBubbleChartData 17 | { 18 | public override init() 19 | { 20 | super.init() 21 | } 22 | 23 | public override init(xVals: [String?]?, dataSets: [IChartDataSet]?) 24 | { 25 | super.init(xVals: xVals, dataSets: dataSets) 26 | } 27 | 28 | public override init(xVals: [NSObject]?, dataSets: [IChartDataSet]?) 29 | { 30 | super.init(xVals: xVals, dataSets: dataSets) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/LineChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineChartData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | 16 | /// Data object that encapsulates all data associated with a LineChart. 17 | public class LineChartData: ChartData 18 | { 19 | public override init() 20 | { 21 | super.init() 22 | } 23 | 24 | public override init(xVals: [String?]?, dataSets: [IChartDataSet]?) 25 | { 26 | super.init(xVals: xVals, dataSets: dataSets) 27 | } 28 | 29 | public override init(xVals: [NSObject]?, dataSets: [IChartDataSet]?) 30 | { 31 | super.init(xVals: xVals, dataSets: dataSets) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/LineScatterCandleRadarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineScatterCandleRadarChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 29/7/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | 16 | 17 | public class LineScatterCandleRadarChartDataSet: BarLineScatterCandleBubbleChartDataSet, ILineScatterCandleRadarChartDataSet 18 | { 19 | // MARK: - Data functions and accessors 20 | 21 | // MARK: - Styling functions and accessors 22 | 23 | /// Enables / disables the horizontal highlight-indicator. If disabled, the indicator is not drawn. 24 | public var drawHorizontalHighlightIndicatorEnabled = true 25 | 26 | /// Enables / disables the vertical highlight-indicator. If disabled, the indicator is not drawn. 27 | public var drawVerticalHighlightIndicatorEnabled = true 28 | 29 | /// - returns: true if horizontal highlight indicator lines are enabled (drawn) 30 | public var isHorizontalHighlightIndicatorEnabled: Bool { return drawHorizontalHighlightIndicatorEnabled } 31 | 32 | /// - returns: true if vertical highlight indicator lines are enabled (drawn) 33 | public var isVerticalHighlightIndicatorEnabled: Bool { return drawVerticalHighlightIndicatorEnabled } 34 | 35 | /// Enables / disables both vertical and horizontal highlight-indicators. 36 | /// :param: enabled 37 | public func setDrawHighlightIndicators(enabled: Bool) 38 | { 39 | drawHorizontalHighlightIndicatorEnabled = enabled 40 | drawVerticalHighlightIndicatorEnabled = enabled 41 | } 42 | 43 | // MARK: NSCopying 44 | 45 | public override func copyWithZone(zone: NSZone) -> AnyObject 46 | { 47 | let copy = super.copyWithZone(zone) as! LineScatterCandleRadarChartDataSet 48 | copy.drawHorizontalHighlightIndicatorEnabled = drawHorizontalHighlightIndicatorEnabled 49 | copy.drawVerticalHighlightIndicatorEnabled = drawVerticalHighlightIndicatorEnabled 50 | return copy 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/PieChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PieChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 24/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | import CoreGraphics 17 | 18 | public class PieChartDataSet: ChartDataSet, IPieChartDataSet 19 | { 20 | private func initialize() 21 | { 22 | self.valueTextColor = NSUIColor.whiteColor() 23 | self.valueFont = NSUIFont.systemFontOfSize(13.0) 24 | } 25 | 26 | public required init() 27 | { 28 | super.init() 29 | initialize() 30 | } 31 | 32 | public override init(yVals: [ChartDataEntry]?, label: String?) 33 | { 34 | super.init(yVals: yVals, label: label) 35 | initialize() 36 | } 37 | 38 | // MARK: - Styling functions and accessors 39 | 40 | private var _sliceSpace = CGFloat(0.0) 41 | 42 | /// the space in pixels between the pie-slices 43 | /// **default**: 0 44 | /// **maximum**: 20 45 | public var sliceSpace: CGFloat 46 | { 47 | get 48 | { 49 | return _sliceSpace 50 | } 51 | set 52 | { 53 | var space = newValue 54 | if (space > 20.0) 55 | { 56 | space = 20.0 57 | } 58 | if (space < 0.0) 59 | { 60 | space = 0.0 61 | } 62 | _sliceSpace = space 63 | } 64 | } 65 | 66 | /// indicates the selection distance of a pie slice 67 | public var selectionShift = CGFloat(18.0) 68 | 69 | // MARK: - NSCopying 70 | 71 | public override func copyWithZone(zone: NSZone) -> AnyObject 72 | { 73 | let copy = super.copyWithZone(zone) as! PieChartDataSet 74 | copy._sliceSpace = _sliceSpace 75 | copy.selectionShift = selectionShift 76 | return copy 77 | } 78 | } -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/RadarChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RadarChartData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | 18 | public class RadarChartData: ChartData 19 | { 20 | public var highlightColor = NSUIColor(red: 255.0/255.0, green: 187.0/255.0, blue: 115.0/255.0, alpha: 1.0) 21 | public var highlightLineWidth = CGFloat(1.0) 22 | public var highlightLineDashPhase = CGFloat(0.0) 23 | public var highlightLineDashLengths: [CGFloat]? 24 | 25 | public override init() 26 | { 27 | super.init() 28 | } 29 | 30 | public override init(xVals: [String?]?, dataSets: [IChartDataSet]?) 31 | { 32 | super.init(xVals: xVals, dataSets: dataSets) 33 | } 34 | 35 | public override init(xVals: [NSObject]?, dataSets: [IChartDataSet]?) 36 | { 37 | super.init(xVals: xVals, dataSets: dataSets) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/RadarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RadarChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 24/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | 18 | public class RadarChartDataSet: LineRadarChartDataSet, IRadarChartDataSet 19 | { 20 | private func initialize() 21 | { 22 | self.valueFont = NSUIFont.systemFontOfSize(13.0) 23 | } 24 | 25 | public required init() 26 | { 27 | super.init() 28 | initialize() 29 | } 30 | 31 | public override init(yVals: [ChartDataEntry]?, label: String?) 32 | { 33 | super.init(yVals: yVals, label: label) 34 | initialize() 35 | } 36 | 37 | // MARK: - Data functions and accessors 38 | 39 | // MARK: - Styling functions and accessors 40 | 41 | /// flag indicating whether highlight circle should be drawn or not 42 | /// **default**: false 43 | public var drawHighlightCircleEnabled: Bool = false 44 | 45 | /// - returns: true if highlight circle should be drawn, false if not 46 | public var isDrawHighlightCircleEnabled: Bool { return drawHighlightCircleEnabled } 47 | 48 | public var highlightCircleFillColor: NSUIColor? = NSUIColor.whiteColor() 49 | 50 | /// The stroke color for highlight circle. 51 | /// If `nil`, the color of the dataset is taken. 52 | public var highlightCircleStrokeColor: NSUIColor? 53 | 54 | public var highlightCircleStrokeAlpha: CGFloat = 0.3 55 | 56 | public var highlightCircleInnerRadius: CGFloat = 3.0 57 | 58 | public var highlightCircleOuterRadius: CGFloat = 4.0 59 | 60 | public var highlightCircleStrokeWidth: CGFloat = 2.0 61 | } -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/ScatterChartData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScatterChartData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | public class ScatterChartData: BarLineScatterCandleBubbleChartData 18 | { 19 | public override init() 20 | { 21 | super.init() 22 | } 23 | 24 | public override init(xVals: [String?]?, dataSets: [IChartDataSet]?) 25 | { 26 | super.init(xVals: xVals, dataSets: dataSets) 27 | } 28 | 29 | public override init(xVals: [NSObject]?, dataSets: [IChartDataSet]?) 30 | { 31 | super.init(xVals: xVals, dataSets: dataSets) 32 | } 33 | 34 | /// - returns: the maximum shape-size across all DataSets. 35 | public func getGreatestShapeSize() -> CGFloat 36 | { 37 | var max = CGFloat(0.0) 38 | 39 | for set in _dataSets 40 | { 41 | let scatterDataSet = set as? IScatterChartDataSet 42 | 43 | if (scatterDataSet == nil) 44 | { 45 | print("ScatterChartData: Found a DataSet which is not a ScatterChartDataSet", terminator: "\n") 46 | } 47 | else 48 | { 49 | let size = scatterDataSet!.scatterShapeSize 50 | 51 | if (size > max) 52 | { 53 | max = size 54 | } 55 | } 56 | } 57 | 58 | return max 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Implementations/Standard/ScatterChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScatterChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | public class ScatterChartDataSet: LineScatterCandleRadarChartDataSet, IScatterChartDataSet 18 | { 19 | @objc 20 | public enum ScatterShape: Int 21 | { 22 | case Square 23 | case Circle 24 | case Triangle 25 | case Cross 26 | case X 27 | case Custom 28 | } 29 | 30 | // The size the scatter shape will have 31 | public var scatterShapeSize = CGFloat(10.0) 32 | 33 | // The type of shape that is set to be drawn where the values are at 34 | // **default**: .Square 35 | public var scatterShape = ScatterChartDataSet.ScatterShape.Square 36 | 37 | // The radius of the hole in the shape (applies to Square, Circle and Triangle) 38 | // **default**: 0.0 39 | public var scatterShapeHoleRadius: CGFloat = 0.0 40 | 41 | // Color for the hole in the shape. Setting to `nil` will behave as transparent. 42 | // **default**: nil 43 | public var scatterShapeHoleColor: NSUIColor? = nil 44 | 45 | // Custom path object to draw where the values are at. 46 | // This is used when shape is set to Custom. 47 | public var customScatterShape: CGPath? 48 | 49 | // MARK: NSCopying 50 | 51 | public override func copyWithZone(zone: NSZone) -> AnyObject 52 | { 53 | let copy = super.copyWithZone(zone) as! ScatterChartDataSet 54 | copy.scatterShapeSize = scatterShapeSize 55 | copy.scatterShape = scatterShape 56 | copy.customScatterShape = customScatterShape 57 | return copy 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Interfaces/IBarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IBarChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol IBarChartDataSet: IBarLineScatterCandleBubbleChartDataSet 19 | { 20 | // MARK: - Data functions and accessors 21 | 22 | // MARK: - Styling functions and accessors 23 | 24 | /// space indicator between the bars in percentage of the whole width of one value (0.15 == 15% of bar width) 25 | var barSpace: CGFloat { get set } 26 | 27 | /// - returns: true if this DataSet is stacked (stacksize > 1) or not. 28 | var isStacked: Bool { get } 29 | 30 | /// - returns: the maximum number of bars that can be stacked upon another in this DataSet. 31 | var stackSize: Int { get } 32 | 33 | /// the color used for drawing the bar-shadows. The bar shadows is a surface behind the bar that indicates the maximum value 34 | var barShadowColor: NSUIColor { get set } 35 | 36 | /// the alpha value (transparency) that is used for drawing the highlight indicator bar. min = 0.0 (fully transparent), max = 1.0 (fully opaque) 37 | var highlightAlpha: CGFloat { get set } 38 | 39 | /// array of labels used to describe the different values of the stacked bars 40 | var stackLabels: [String] { get set } 41 | } 42 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Interfaces/IBarLineScatterCandleBubbleChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IBarLineScatterCandleBubbleChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol IBarLineScatterCandleBubbleChartDataSet: IChartDataSet 19 | { 20 | // MARK: - Data functions and accessors 21 | 22 | // MARK: - Styling functions and accessors 23 | 24 | var highlightColor: NSUIColor { get set } 25 | var highlightLineWidth: CGFloat { get set } 26 | var highlightLineDashPhase: CGFloat { get set } 27 | var highlightLineDashLengths: [CGFloat]? { get set } 28 | } 29 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Interfaces/IBubbleChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IBubbleChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol IBubbleChartDataSet: IBarLineScatterCandleBubbleChartDataSet 19 | { 20 | // MARK: - Data functions and accessors 21 | 22 | var xMin: Double { get } 23 | var xMax: Double { get } 24 | var maxSize: CGFloat { get } 25 | 26 | // MARK: - Styling functions and accessors 27 | 28 | /// Sets/gets the width of the circle that surrounds the bubble when highlighted 29 | var highlightCircleWidth: CGFloat { get set } 30 | } 31 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Interfaces/ICandleChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ICandleChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol ICandleChartDataSet: ILineScatterCandleRadarChartDataSet 19 | { 20 | // MARK: - Data functions and accessors 21 | 22 | // MARK: - Styling functions and accessors 23 | 24 | /// the space that is left out on the left and right side of each candle, 25 | /// **default**: 0.1 (10%), max 0.45, min 0.0 26 | var barSpace: CGFloat { get set } 27 | 28 | /// should the candle bars show? 29 | /// when false, only "ticks" will show 30 | /// 31 | /// **default**: true 32 | var showCandleBar: Bool { get set } 33 | 34 | /// the width of the candle-shadow-line in pixels. 35 | /// 36 | /// **default**: 3.0 37 | var shadowWidth: CGFloat { get set } 38 | 39 | /// the color of the shadow line 40 | var shadowColor: NSUIColor? { get set } 41 | 42 | /// use candle color for the shadow 43 | var shadowColorSameAsCandle: Bool { get set } 44 | 45 | /// Is the shadow color same as the candle color? 46 | var isShadowColorSameAsCandle: Bool { get } 47 | 48 | /// color for open == close 49 | var neutralColor: NSUIColor? { get set } 50 | 51 | /// color for open > close 52 | var increasingColor: NSUIColor? { get set } 53 | 54 | /// color for open < close 55 | var decreasingColor: NSUIColor? { get set } 56 | 57 | /// Are increasing values drawn as filled? 58 | var increasingFilled: Bool { get set } 59 | 60 | /// Are increasing values drawn as filled? 61 | var isIncreasingFilled: Bool { get } 62 | 63 | /// Are decreasing values drawn as filled? 64 | var decreasingFilled: Bool { get set } 65 | 66 | /// Are decreasing values drawn as filled? 67 | var isDecreasingFilled: Bool { get } 68 | } 69 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Interfaces/ILineRadarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ILineRadarChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol ILineRadarChartDataSet: ILineScatterCandleRadarChartDataSet 19 | { 20 | // MARK: - Data functions and accessors 21 | 22 | // MARK: - Styling functions and accessors 23 | 24 | /// The color that is used for filling the line surface area. 25 | var fillColor: NSUIColor { get set } 26 | 27 | /// Returns the object that is used for filling the area below the line. 28 | /// **default**: nil 29 | var fill: ChartFill? { get set } 30 | 31 | /// The alpha value that is used for filling the line surface. 32 | /// **default**: 0.33 33 | var fillAlpha: CGFloat { get set } 34 | 35 | /// line width of the chart (min = 0.2, max = 10) 36 | /// 37 | /// **default**: 1 38 | var lineWidth: CGFloat { get set } 39 | 40 | /// Set to true if the DataSet should be drawn filled (surface), and not just as a line. 41 | /// Disabling this will give great performance boost. 42 | /// Please note that this method uses the path clipping for drawing the filled area (with images, gradients and layers). 43 | var drawFilledEnabled: Bool { get set } 44 | 45 | /// Returns true if filled drawing is enabled, false if not 46 | var isDrawFilledEnabled: Bool { get } 47 | } 48 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Interfaces/ILineScatterCandleRadarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ILineScatterCandleRadarChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | 16 | @objc 17 | public protocol ILineScatterCandleRadarChartDataSet: IBarLineScatterCandleBubbleChartDataSet 18 | { 19 | // MARK: - Data functions and accessors 20 | 21 | // MARK: - Styling functions and accessors 22 | 23 | /// Enables / disables the horizontal highlight-indicator. If disabled, the indicator is not drawn. 24 | var drawHorizontalHighlightIndicatorEnabled: Bool { get set } 25 | 26 | /// Enables / disables the vertical highlight-indicator. If disabled, the indicator is not drawn. 27 | var drawVerticalHighlightIndicatorEnabled: Bool { get set } 28 | 29 | /// - returns: true if horizontal highlight indicator lines are enabled (drawn) 30 | var isHorizontalHighlightIndicatorEnabled: Bool { get } 31 | 32 | /// - returns: true if vertical highlight indicator lines are enabled (drawn) 33 | var isVerticalHighlightIndicatorEnabled: Bool { get } 34 | 35 | /// Enables / disables both vertical and horizontal highlight-indicators. 36 | /// :param: enabled 37 | func setDrawHighlightIndicators(enabled: Bool) 38 | } 39 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Interfaces/IPieChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IPieChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | #if !os(OSX) 18 | import UIKit 19 | #endif 20 | 21 | @objc 22 | public protocol IPieChartDataSet: IChartDataSet 23 | { 24 | // MARK: - Styling functions and accessors 25 | 26 | /// the space in pixels between the pie-slices 27 | /// **default**: 0 28 | /// **maximum**: 20 29 | var sliceSpace: CGFloat { get set } 30 | 31 | /// indicates the selection distance of a pie slice 32 | var selectionShift: CGFloat { get set } 33 | } 34 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Interfaces/IRadarChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IRadarChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | 16 | @objc 17 | public protocol IRadarChartDataSet: ILineRadarChartDataSet 18 | { 19 | // MARK: - Data functions and accessors 20 | 21 | // MARK: - Styling functions and accessors 22 | 23 | /// flag indicating whether highlight circle should be drawn or not 24 | var drawHighlightCircleEnabled: Bool { get set } 25 | 26 | var isDrawHighlightCircleEnabled: Bool { get } 27 | 28 | var highlightCircleFillColor: NSUIColor? { get set } 29 | 30 | /// The stroke color for highlight circle. 31 | /// If `nil`, the color of the dataset is taken. 32 | var highlightCircleStrokeColor: NSUIColor? { get set } 33 | 34 | var highlightCircleStrokeAlpha: CGFloat { get set } 35 | 36 | var highlightCircleInnerRadius: CGFloat { get set } 37 | 38 | var highlightCircleOuterRadius: CGFloat { get set } 39 | 40 | var highlightCircleStrokeWidth: CGFloat { get set } 41 | } 42 | -------------------------------------------------------------------------------- /Charts/Classes/Data/Interfaces/IScatterChartDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IScatterChartDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol IScatterChartDataSet: ILineScatterCandleRadarChartDataSet 19 | { 20 | // MARK: - Data functions and accessors 21 | 22 | // MARK: - Styling functions and accessors 23 | 24 | // The size the scatter shape will have 25 | var scatterShapeSize: CGFloat { get set } 26 | 27 | // The type of shape that is set to be drawn where the values are at 28 | // **default**: .Square 29 | var scatterShape: ScatterChartDataSet.ScatterShape { get set } 30 | 31 | // The radius of the hole in the shape (applies to Square, Circle and Triangle) 32 | // Set this to <= 0 to remove holes. 33 | // **default**: 0.0 34 | var scatterShapeHoleRadius: CGFloat { get set } 35 | 36 | // Color for the hole in the shape. Setting to `nil` will behave as transparent. 37 | // **default**: nil 38 | var scatterShapeHoleColor: NSUIColor? { get set } 39 | 40 | // Custom path object to draw where the values are at. 41 | // This is used when shape is set to Custom. 42 | var customScatterShape: CGPath? { get set } 43 | } 44 | -------------------------------------------------------------------------------- /Charts/Classes/Filters/ChartDataBaseFilter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartDataFilter.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | public class ChartDataBaseFilter: NSObject 18 | { 19 | public override init() 20 | { 21 | super.init() 22 | } 23 | 24 | public func filter(points: [ChartDataEntry]) -> [ChartDataEntry] 25 | { 26 | fatalError("filter() cannot be called on ChartDataBaseFilter") 27 | } 28 | } -------------------------------------------------------------------------------- /Charts/Classes/Formatters/ChartDefaultFillFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartDefaultFillFormatter.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 04/02/2016. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | #if !os(OSX) 18 | import UIKit 19 | #endif 20 | 21 | /// Default formatter that calculates the position of the filled line. 22 | public class ChartDefaultFillFormatter: NSObject, ChartFillFormatter 23 | { 24 | public override init() 25 | { 26 | } 27 | 28 | public func getFillLinePosition(dataSet dataSet: ILineChartDataSet, dataProvider: LineChartDataProvider) -> CGFloat 29 | { 30 | var fillMin = CGFloat(0.0) 31 | 32 | if (dataSet.yMax > 0.0 && dataSet.yMin < 0.0) 33 | { 34 | fillMin = 0.0 35 | } 36 | else 37 | { 38 | if let data = dataProvider.data 39 | { 40 | var max: Double, min: Double 41 | 42 | if (data.yMax > 0.0) 43 | { 44 | max = 0.0 45 | } 46 | else 47 | { 48 | max = dataProvider.chartYMax 49 | } 50 | 51 | if (data.yMin < 0.0) 52 | { 53 | min = 0.0 54 | } 55 | else 56 | { 57 | min = dataProvider.chartYMin 58 | } 59 | 60 | fillMin = CGFloat(dataSet.yMin >= 0.0 ? min : max) 61 | } 62 | } 63 | 64 | return fillMin 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Charts/Classes/Formatters/ChartDefaultXAxisValueFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartDefaultXAxisValueFormatter.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 27/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | 16 | /// An interface for providing custom x-axis Strings. 17 | public class ChartDefaultXAxisValueFormatter: NSObject, ChartXAxisValueFormatter 18 | { 19 | 20 | public func stringForXValue(index: Int, original: String, viewPortHandler: ChartViewPortHandler) -> String 21 | { 22 | return original // just return original, no adjustments 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /Charts/Classes/Formatters/ChartFillFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartFillFormatter.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 6/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | /// 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. 18 | @objc 19 | public protocol ChartFillFormatter 20 | { 21 | /// - returns: the vertical (y-axis) position where the filled-line of the LineDataSet should end. 22 | func getFillLinePosition(dataSet dataSet: ILineChartDataSet, dataProvider: LineChartDataProvider) -> CGFloat 23 | } 24 | -------------------------------------------------------------------------------- /Charts/Classes/Formatters/ChartXAxisValueFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartXAxisValueFormatter.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 27/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | 16 | /// An interface for providing custom x-axis Strings. 17 | @objc 18 | public protocol ChartXAxisValueFormatter 19 | { 20 | 21 | /// For performance reasons, avoid excessive calculations and memory allocations inside this method. 22 | /// 23 | /// - returns: the customized label that is drawn on the x-axis. 24 | /// - parameter index: the x-index that is currently being drawn 25 | /// - parameter original: the original x-axis label to be drawn 26 | /// - parameter viewPortHandler: provides information about the current chart state (scale, translation, ...) 27 | /// 28 | func stringForXValue(index: Int, original: String, viewPortHandler: ChartViewPortHandler) -> String 29 | 30 | } -------------------------------------------------------------------------------- /Charts/Classes/Highlight/ChartRange.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartRange.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/7/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | public class ChartRange: NSObject 18 | { 19 | public var from: Double 20 | public var to: Double 21 | 22 | public init(from: Double, to: Double) 23 | { 24 | self.from = from 25 | self.to = to 26 | 27 | super.init() 28 | } 29 | 30 | /// Returns true if this range contains (if the value is in between) the given value, false if not. 31 | /// - parameter value: 32 | public func contains(value: Double) -> Bool 33 | { 34 | if value > from && value <= to 35 | { 36 | return true 37 | } 38 | else 39 | { 40 | return false 41 | } 42 | } 43 | 44 | public func isLarger(value: Double) -> Bool 45 | { 46 | return value > to 47 | } 48 | 49 | public func isSmaller(value: Double) -> Bool 50 | { 51 | return value < from 52 | } 53 | } -------------------------------------------------------------------------------- /Charts/Classes/Highlight/CombinedHighlighter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CombinedHighlighter.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 26/7/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | import CoreGraphics 17 | 18 | public class CombinedHighlighter: ChartHighlighter 19 | { 20 | /// Returns a list of SelectionDetail object corresponding to the given xIndex. 21 | /// - parameter xIndex: 22 | /// - returns: 23 | public override func getSelectionDetailsAtIndex(xIndex: Int) -> [ChartSelectionDetail] 24 | { 25 | var vals = [ChartSelectionDetail]() 26 | 27 | if let data = self.chart?.data as? CombinedChartData 28 | { 29 | // get all chartdata objects 30 | var dataObjects = data.allData 31 | 32 | var pt = CGPoint() 33 | 34 | for var i = 0; i < dataObjects.count; i++ 35 | { 36 | for var j = 0; j < dataObjects[i].dataSetCount; j++ 37 | { 38 | let dataSet = dataObjects[i].getDataSetByIndex(j) 39 | 40 | // dont include datasets that cannot be highlighted 41 | if !dataSet.isHighlightEnabled 42 | { 43 | continue 44 | } 45 | 46 | // extract all y-values from all DataSets at the given x-index 47 | let yVal = dataSet.yValForXIndex(xIndex) 48 | if yVal.isNaN 49 | { 50 | continue 51 | } 52 | 53 | pt.y = CGFloat(yVal) 54 | 55 | self.chart!.getTransformer(dataSet.axisDependency).pointValueToPixel(&pt) 56 | 57 | if !pt.y.isNaN 58 | { 59 | vals.append(ChartSelectionDetail(value: Double(pt.y), dataSetIndex: j, dataSet: dataSet)) 60 | } 61 | } 62 | } 63 | } 64 | 65 | return vals 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Charts/Classes/Interfaces/BarChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarChartDataProvider.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 27/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol BarChartDataProvider: BarLineScatterCandleBubbleChartDataProvider 19 | { 20 | var barData: BarChartData? { get } 21 | 22 | var isDrawBarShadowEnabled: Bool { get } 23 | var isDrawValueAboveBarEnabled: Bool { get } 24 | var isDrawHighlightArrowEnabled: Bool { get } 25 | } -------------------------------------------------------------------------------- /Charts/Classes/Interfaces/BarLineScatterCandleBubbleChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarLineScatterCandleBubbleChartDataProvider.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 27/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol BarLineScatterCandleBubbleChartDataProvider: ChartDataProvider 19 | { 20 | func getTransformer(which: ChartYAxis.AxisDependency) -> ChartTransformer 21 | var maxVisibleValueCount: Int { get } 22 | func isInverted(axis: ChartYAxis.AxisDependency) -> Bool 23 | 24 | var lowestVisibleXIndex: Int { get } 25 | var highestVisibleXIndex: Int { get } 26 | } -------------------------------------------------------------------------------- /Charts/Classes/Interfaces/BubbleChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BubbleChartDataProvider.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 27/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol BubbleChartDataProvider: BarLineScatterCandleBubbleChartDataProvider 19 | { 20 | var bubbleData: BubbleChartData? { get } 21 | } -------------------------------------------------------------------------------- /Charts/Classes/Interfaces/CandleChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CandleChartDataProvider.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 27/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol CandleChartDataProvider: BarLineScatterCandleBubbleChartDataProvider 19 | { 20 | var candleData: CandleChartData? { get } 21 | } -------------------------------------------------------------------------------- /Charts/Classes/Interfaces/ChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartDataProvider.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 27/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol ChartDataProvider 19 | { 20 | /// - returns: the minimum x-value of the chart, regardless of zoom or translation. 21 | var chartXMin: Double { get } 22 | 23 | /// - returns: the maximum x-value of the chart, regardless of zoom or translation. 24 | var chartXMax: Double { get } 25 | 26 | /// - returns: the minimum y-value of the chart, regardless of zoom or translation. 27 | var chartYMin: Double { get } 28 | 29 | /// - returns: the maximum y-value of the chart, regardless of zoom or translation. 30 | var chartYMax: Double { get } 31 | 32 | var xValCount: Int { get } 33 | 34 | var centerOffsets: CGPoint { get } 35 | 36 | var data: ChartData? { get } 37 | } -------------------------------------------------------------------------------- /Charts/Classes/Interfaces/LineChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineChartDataProvider.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 27/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol LineChartDataProvider: BarLineScatterCandleBubbleChartDataProvider 19 | { 20 | var lineData: LineChartData? { get } 21 | 22 | func getAxis(axis: ChartYAxis.AxisDependency) -> ChartYAxis 23 | } -------------------------------------------------------------------------------- /Charts/Classes/Interfaces/ScatterChartDataProvider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScatterChartDataProvider.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 27/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | @objc 18 | public protocol ScatterChartDataProvider: BarLineScatterCandleBubbleChartDataProvider 19 | { 20 | var scatterData: ScatterChartData? { get } 21 | } -------------------------------------------------------------------------------- /Charts/Classes/Jobs/AnimatedMoveViewJob.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnimatedMoveChartViewJob.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/ios-charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | #if !os(OSX) 16 | import UIKit 17 | #endif 18 | 19 | public class AnimatedMoveChartViewJob: AnimatedViewPortJob 20 | { 21 | public override init( 22 | viewPortHandler: ChartViewPortHandler, 23 | xIndex: CGFloat, 24 | yValue: Double, 25 | transformer: ChartTransformer, 26 | view: ChartViewBase, 27 | xOrigin: CGFloat, 28 | yOrigin: CGFloat, 29 | duration: NSTimeInterval, 30 | easing: ChartEasingFunctionBlock?) 31 | { 32 | super.init(viewPortHandler: viewPortHandler, 33 | xIndex: xIndex, 34 | yValue: yValue, 35 | transformer: transformer, 36 | view: view, 37 | xOrigin: xOrigin, 38 | yOrigin: yOrigin, 39 | duration: duration, 40 | easing: easing) 41 | } 42 | 43 | internal override func animationUpdate() 44 | { 45 | guard let 46 | viewPortHandler = viewPortHandler, 47 | transformer = transformer, 48 | view = view 49 | else { return } 50 | 51 | var pt = CGPoint( 52 | x: xOrigin + (xIndex - xOrigin) * phase, 53 | y: yOrigin + (CGFloat(yValue) - yOrigin) * phase 54 | ); 55 | 56 | transformer.pointValueToPixel(&pt) 57 | viewPortHandler.centerViewPort(pt: pt, chart: view) 58 | } 59 | } -------------------------------------------------------------------------------- /Charts/Classes/Jobs/ChartViewPortJob.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartViewPortJob.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/ios-charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | // This defines a viewport modification job, used for delaying or animating viewport changes 16 | public class ChartViewPortJob 17 | { 18 | internal var point: CGPoint = CGPoint() 19 | internal weak var viewPortHandler: ChartViewPortHandler? 20 | internal var xIndex: CGFloat = 0.0 21 | internal var yValue: Double = 0.0 22 | internal weak var transformer: ChartTransformer? 23 | internal weak var view: ChartViewBase? 24 | 25 | public init( 26 | viewPortHandler: ChartViewPortHandler, 27 | xIndex: CGFloat, 28 | yValue: Double, 29 | transformer: ChartTransformer, 30 | view: ChartViewBase) 31 | { 32 | self.viewPortHandler = viewPortHandler 33 | self.xIndex = xIndex 34 | self.yValue = yValue 35 | self.transformer = transformer 36 | self.view = view 37 | } 38 | 39 | public func doJob() 40 | { 41 | // Override this 42 | } 43 | } -------------------------------------------------------------------------------- /Charts/Classes/Jobs/MoveChartViewJob.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MoveChartViewJob.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/ios-charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | #if !os(OSX) 16 | import UIKit 17 | #endif 18 | 19 | public class MoveChartViewJob: ChartViewPortJob 20 | { 21 | public override init( 22 | viewPortHandler: ChartViewPortHandler, 23 | xIndex: CGFloat, 24 | yValue: Double, 25 | transformer: ChartTransformer, 26 | view: ChartViewBase) 27 | { 28 | super.init( 29 | viewPortHandler: viewPortHandler, 30 | xIndex: xIndex, 31 | yValue: yValue, 32 | transformer: transformer, 33 | view: view) 34 | } 35 | 36 | public override func doJob() 37 | { 38 | guard let 39 | viewPortHandler = viewPortHandler, 40 | transformer = transformer, 41 | view = view 42 | else { return } 43 | 44 | var pt = CGPoint( 45 | x: xIndex, 46 | y: CGFloat(yValue) 47 | ); 48 | 49 | transformer.pointValueToPixel(&pt) 50 | viewPortHandler.centerViewPort(pt: pt, chart: view) 51 | } 52 | } -------------------------------------------------------------------------------- /Charts/Classes/Jobs/ZoomChartViewJob.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZoomChartViewJob.swift 3 | // Charts 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/ios-charts 10 | // 11 | 12 | import Foundation 13 | import CoreGraphics 14 | 15 | #if !os(OSX) 16 | import UIKit 17 | #endif 18 | 19 | public class ZoomChartViewJob: ChartViewPortJob 20 | { 21 | internal var scaleX: CGFloat = 0.0 22 | internal var scaleY: CGFloat = 0.0 23 | internal var axisDependency: ChartYAxis.AxisDependency = ChartYAxis.AxisDependency.Left 24 | 25 | public init( 26 | viewPortHandler: ChartViewPortHandler, 27 | scaleX: CGFloat, 28 | scaleY: CGFloat, 29 | xIndex: CGFloat, 30 | yValue: Double, 31 | transformer: ChartTransformer, 32 | axis: ChartYAxis.AxisDependency, 33 | view: ChartViewBase) 34 | { 35 | super.init( 36 | viewPortHandler: viewPortHandler, 37 | xIndex: xIndex, 38 | yValue: yValue, 39 | transformer: transformer, 40 | view: view) 41 | 42 | self.scaleX = scaleX 43 | self.scaleY = scaleY 44 | self.axisDependency = axis 45 | } 46 | 47 | public override func doJob() 48 | { 49 | guard let 50 | viewPortHandler = viewPortHandler, 51 | transformer = transformer, 52 | view = view 53 | else { return } 54 | 55 | var matrix = viewPortHandler.setZoom(scaleX: scaleX, scaleY: scaleY) 56 | viewPortHandler.refresh(newMatrix: matrix, chart: view, invalidate: false) 57 | 58 | let valsInView = (view as! BarLineChartViewBase).getDeltaY(axisDependency) / viewPortHandler.scaleY 59 | let xsInView = CGFloat((view as! BarLineChartViewBase).xAxis.values.count) / viewPortHandler.scaleX 60 | 61 | var pt = CGPoint( 62 | x: xIndex - xsInView / 2.0, 63 | y: CGFloat(yValue) + valsInView / 2.0 64 | ) 65 | 66 | transformer.pointValueToPixel(&pt) 67 | 68 | matrix = viewPortHandler.translate(pt: pt) 69 | viewPortHandler.refresh(newMatrix: matrix, chart: view, invalidate: false) 70 | 71 | (view as! BarLineChartViewBase).calculateOffsets() 72 | view.setNeedsDisplay() 73 | } 74 | } -------------------------------------------------------------------------------- /Charts/Classes/Renderers/ChartAxisRendererBase.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartAxisRendererBase.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 3/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | 18 | public class ChartAxisRendererBase: ChartRendererBase 19 | { 20 | public var transformer: ChartTransformer! 21 | 22 | public override init() 23 | { 24 | super.init() 25 | } 26 | 27 | public init(viewPortHandler: ChartViewPortHandler, transformer: ChartTransformer!) 28 | { 29 | super.init(viewPortHandler: viewPortHandler) 30 | 31 | self.transformer = transformer 32 | } 33 | 34 | /// Draws the axis labels on the specified context 35 | public func renderAxisLabels(context context: CGContext) 36 | { 37 | fatalError("renderAxisLabels() cannot be called on ChartAxisRendererBase") 38 | } 39 | 40 | /// Draws the grid lines belonging to the axis. 41 | public func renderGridLines(context context: CGContext) 42 | { 43 | fatalError("renderGridLines() cannot be called on ChartAxisRendererBase") 44 | } 45 | 46 | /// Draws the line that goes alongside the axis. 47 | public func renderAxisLine(context context: CGContext) 48 | { 49 | fatalError("renderAxisLine() cannot be called on ChartAxisRendererBase") 50 | } 51 | 52 | /// Draws the LimitLines associated with this axis to the screen. 53 | public func renderLimitLines(context context: CGContext) 54 | { 55 | fatalError("renderLimitLines() cannot be called on ChartAxisRendererBase") 56 | } 57 | } -------------------------------------------------------------------------------- /Charts/Classes/Renderers/ChartDataRendererBase.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartDataRendererBase.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 4/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | public class ChartDataRendererBase: ChartRendererBase 18 | { 19 | public var animator: ChartAnimator? 20 | 21 | public init(animator: ChartAnimator?, viewPortHandler: ChartViewPortHandler) 22 | { 23 | super.init(viewPortHandler: viewPortHandler) 24 | 25 | self.animator = animator 26 | } 27 | 28 | public func drawData(context context: CGContext) 29 | { 30 | fatalError("drawData() cannot be called on ChartDataRendererBase") 31 | } 32 | 33 | public func drawValues(context context: CGContext) 34 | { 35 | fatalError("drawValues() cannot be called on ChartDataRendererBase") 36 | } 37 | 38 | public func drawExtras(context context: CGContext) 39 | { 40 | fatalError("drawExtras() cannot be called on ChartDataRendererBase") 41 | } 42 | 43 | /// Draws all highlight indicators for the values that are currently highlighted. 44 | /// 45 | /// - parameter indices: the highlighted values 46 | public func drawHighlighted(context context: CGContext, indices: [ChartHighlight]) 47 | { 48 | fatalError("drawHighlighted() cannot be called on ChartDataRendererBase") 49 | } 50 | } -------------------------------------------------------------------------------- /Charts/Classes/Renderers/ChartRendererBase.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartRendererBase.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 3/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | public class ChartRendererBase: NSObject 18 | { 19 | /// the component that handles the drawing area of the chart and it's offsets 20 | public var viewPortHandler: ChartViewPortHandler! 21 | 22 | /// the minimum value on the x-axis that should be plotted 23 | public var minX: Int = 0 24 | 25 | /// the maximum value on the x-axis that should be plotted 26 | public var maxX: Int = 0 27 | 28 | public override init() 29 | { 30 | super.init() 31 | } 32 | 33 | public init(viewPortHandler: ChartViewPortHandler) 34 | { 35 | super.init() 36 | self.viewPortHandler = viewPortHandler 37 | } 38 | 39 | /// Calculates the minimum and maximum x-value the chart can currently display (with the given zoom level). 40 | public func calcXBounds(chart chart: BarLineChartViewBase, xAxisModulus: Int) 41 | { 42 | let low = chart.lowestVisibleXIndex 43 | let high = chart.highestVisibleXIndex 44 | 45 | let subLow = (low % xAxisModulus == 0) ? xAxisModulus : 0 46 | 47 | minX = max((low / xAxisModulus) * (xAxisModulus) - subLow, 0) 48 | maxX = min((high / xAxisModulus) * (xAxisModulus) + xAxisModulus, Int(chart.chartXMax)) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Charts/Classes/Renderers/LineRadarChartRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineRadarChartRenderer.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 27/01/2016. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | 18 | public class LineRadarChartRenderer: LineScatterCandleRadarChartRenderer 19 | { 20 | public override init(animator: ChartAnimator?, viewPortHandler: ChartViewPortHandler) 21 | { 22 | super.init(animator: animator, viewPortHandler: viewPortHandler) 23 | } 24 | 25 | /// Draws the provided path in filled mode with the provided drawable. 26 | public func drawFilledPath(context context: CGContext, path: CGPath, fill: ChartFill, fillAlpha: CGFloat) 27 | { 28 | CGContextSaveGState(context) 29 | CGContextBeginPath(context) 30 | CGContextAddPath(context, path) 31 | 32 | // filled is usually drawn with less alpha 33 | CGContextSetAlpha(context, fillAlpha) 34 | 35 | fill.fillPath(context: context, rect: viewPortHandler.contentRect) 36 | 37 | CGContextRestoreGState(context) 38 | } 39 | 40 | /// Draws the provided path in filled mode with the provided color and alpha. 41 | public func drawFilledPath(context context: CGContext, path: CGPath, fillColor: NSUIColor, fillAlpha: CGFloat) 42 | { 43 | CGContextSaveGState(context) 44 | CGContextBeginPath(context) 45 | CGContextAddPath(context, path) 46 | 47 | // filled is usually drawn with less alpha 48 | CGContextSetAlpha(context, fillAlpha) 49 | 50 | CGContextSetFillColorWithColor(context, fillColor.CGColor) 51 | CGContextFillPath(context) 52 | 53 | CGContextRestoreGState(context) 54 | } 55 | } -------------------------------------------------------------------------------- /Charts/Classes/Renderers/LineScatterCandleRadarChartRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineScatterCandleRadarChartRenderer.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 29/7/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | 18 | public class LineScatterCandleRadarChartRenderer: ChartDataRendererBase 19 | { 20 | public override init(animator: ChartAnimator?, viewPortHandler: ChartViewPortHandler) 21 | { 22 | super.init(animator: animator, viewPortHandler: viewPortHandler) 23 | } 24 | 25 | /// Draws vertical & horizontal highlight-lines if enabled. 26 | /// :param: context 27 | /// :param: points 28 | /// :param: horizontal 29 | /// :param: vertical 30 | public func drawHighlightLines(context context: CGContext, point: CGPoint, set: ILineScatterCandleRadarChartDataSet) 31 | { 32 | // draw vertical highlight lines 33 | if set.isVerticalHighlightIndicatorEnabled 34 | { 35 | CGContextBeginPath(context) 36 | CGContextMoveToPoint(context, point.x, viewPortHandler.contentTop) 37 | CGContextAddLineToPoint(context, point.x, viewPortHandler.contentBottom) 38 | CGContextStrokePath(context) 39 | } 40 | 41 | // draw horizontal highlight lines 42 | if set.isHorizontalHighlightIndicatorEnabled 43 | { 44 | CGContextBeginPath(context) 45 | CGContextMoveToPoint(context, viewPortHandler.contentLeft, point.y) 46 | CGContextAddLineToPoint(context, viewPortHandler.contentRight, point.y) 47 | CGContextStrokePath(context) 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Charts/Classes/Utils/ChartTransformerHorizontalBarChart.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartTransformerHorizontalBarChart.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 1/4/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import CoreGraphics 16 | 17 | public class ChartTransformerHorizontalBarChart: ChartTransformer 18 | { 19 | /// Prepares the matrix that contains all offsets. 20 | public override func prepareMatrixOffset(inverted: Bool) 21 | { 22 | if (!inverted) 23 | { 24 | _matrixOffset = CGAffineTransformMakeTranslation(_viewPortHandler.offsetLeft, _viewPortHandler.chartHeight - _viewPortHandler.offsetBottom) 25 | } 26 | else 27 | { 28 | _matrixOffset = CGAffineTransformMakeScale(-1.0, 1.0) 29 | _matrixOffset = CGAffineTransformTranslate(_matrixOffset, 30 | -(_viewPortHandler.chartWidth - _viewPortHandler.offsetRight), 31 | _viewPortHandler.chartHeight - _viewPortHandler.offsetBottom) 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Charts/Supporting Files/Charts.h: -------------------------------------------------------------------------------- 1 | // 2 | // Charts.h 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | #include 16 | 17 | #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR 18 | #import 19 | #else 20 | #import 21 | #endif 22 | 23 | //! Project version number for Charts. 24 | FOUNDATION_EXPORT double ChartsVersionNumber; 25 | 26 | //! Project version string for Charts. 27 | FOUNDATION_EXPORT const unsigned char ChartsVersionString[]; 28 | 29 | // In this header, you should import all the public headers of your framework using statements like #import 30 | 31 | 32 | -------------------------------------------------------------------------------- /Charts/Supporting Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 2.2.3 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 19 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ChartsDemo-OSX/ChartsDemo-OSX/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | @NSApplicationMain 4 | class AppDelegate: NSObject, NSApplicationDelegate 5 | { 6 | } 7 | 8 | -------------------------------------------------------------------------------- /ChartsDemo-OSX/ChartsDemo-OSX/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /ChartsDemo-OSX/ChartsDemo-OSX/Demos/BarDemoViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarDemoViewController.swift 3 | // ChartsDemo-OSX 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/ios-charts 10 | 11 | import Foundation 12 | import Cocoa 13 | import Charts 14 | 15 | public class BarDemoViewController: NSViewController 16 | { 17 | @IBOutlet var barChartView: BarChartView! 18 | 19 | override public func viewDidLoad() 20 | { 21 | super.viewDidLoad() 22 | 23 | // Do any additional setup after loading the view. 24 | let xs = Array(1..<10).map { return Double($0) } 25 | let ys1 = xs.map { i in return sin(Double(i / 2.0 / 3.141 * 1.5)) } 26 | let ys2 = xs.map { i in return cos(Double(i / 2.0 / 3.141)) } 27 | 28 | let yse1 = ys1.enumerate().map { idx, i in return BarChartDataEntry(value: i, xIndex: idx) } 29 | let yse2 = ys2.enumerate().map { idx, i in return BarChartDataEntry(value: i, xIndex: idx) } 30 | 31 | let data = BarChartData(xVals: xs) 32 | let ds1 = BarChartDataSet(yVals: yse1, label: "Hello") 33 | ds1.colors = [NSUIColor.redColor()] 34 | data.addDataSet(ds1) 35 | 36 | let ds2 = BarChartDataSet(yVals: yse2, label: "World") 37 | ds2.colors = [NSUIColor.blueColor()] 38 | data.addDataSet(ds2) 39 | self.barChartView.data = data 40 | 41 | self.barChartView.gridBackgroundColor = NSUIColor.whiteColor() 42 | } 43 | 44 | @IBAction func save(sender: AnyObject) 45 | { 46 | let panel = NSSavePanel() 47 | panel.allowedFileTypes = ["png"] 48 | panel.beginSheetModalForWindow(self.view.window!) { (result) -> Void in 49 | if result == NSFileHandlingPanelOKButton 50 | { 51 | if let path = panel.URL?.path 52 | { 53 | self.barChartView.saveToPath(path, format: .PNG, compressionQuality: 1.0) 54 | } 55 | } 56 | } 57 | } 58 | 59 | override public func viewWillAppear() 60 | { 61 | self.barChartView.animate(xAxisDuration: 1.0, yAxisDuration: 1.0) 62 | } 63 | } -------------------------------------------------------------------------------- /ChartsDemo-OSX/ChartsDemo-OSX/Demos/LineDemoViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LineDemoViewController.swift 3 | // ChartsDemo-OSX 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/ios-charts 10 | 11 | import Foundation 12 | import Cocoa 13 | import Charts 14 | 15 | public class LineDemoViewController: NSViewController 16 | { 17 | @IBOutlet var lineChartView: LineChartView! 18 | 19 | override public func viewDidLoad() 20 | { 21 | super.viewDidLoad() 22 | 23 | // Do any additional setup after loading the view. 24 | let xs = Array(1..<10).map { return Double($0) } 25 | let ys1 = xs.map { i in return sin(Double(i / 2.0 / 3.141 * 1.5)) } 26 | let ys2 = xs.map { i in return cos(Double(i / 2.0 / 3.141)) } 27 | 28 | let yse1 = ys1.enumerate().map { idx, i in return ChartDataEntry(value: i, xIndex: idx) } 29 | let yse2 = ys2.enumerate().map { idx, i in return ChartDataEntry(value: i, xIndex: idx) } 30 | 31 | let data = LineChartData(xVals: xs) 32 | let ds1 = LineChartDataSet(yVals: yse1, label: "Hello") 33 | ds1.colors = [NSUIColor.redColor()] 34 | data.addDataSet(ds1) 35 | 36 | let ds2 = LineChartDataSet(yVals: yse2, label: "World") 37 | ds2.colors = [NSUIColor.blueColor()] 38 | data.addDataSet(ds2) 39 | self.lineChartView.data = data 40 | 41 | self.lineChartView.gridBackgroundColor = NSUIColor.whiteColor() 42 | } 43 | 44 | override public func viewWillAppear() 45 | { 46 | self.lineChartView.animate(xAxisDuration: 0.0, yAxisDuration: 1.0) 47 | } 48 | } -------------------------------------------------------------------------------- /ChartsDemo-OSX/ChartsDemo-OSX/Demos/RadarDemoViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RadarDemoViewController.swift 3 | // ChartsDemo-OSX 4 | // 5 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 6 | // A port of MPAndroidChart for iOS 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/ios-charts 10 | 11 | import Foundation 12 | import Cocoa 13 | import Charts 14 | 15 | public class RadarDemoViewController: NSViewController 16 | { 17 | @IBOutlet var radarChartView: RadarChartView! 18 | 19 | override public func viewDidLoad() 20 | { 21 | super.viewDidLoad() 22 | 23 | // Do any additional setup after loading the view. 24 | let xs = Array(1..<10).map { return Double($0) } 25 | let ys1 = xs.map { i in return sin(Double(i / 2.0 / 3.141 * 1.5)) } 26 | let ys2 = xs.map { i in return cos(Double(i / 2.0 / 3.141)) } 27 | 28 | let yse1 = ys1.enumerate().map { idx, i in return ChartDataEntry(value: i, xIndex: idx) } 29 | let yse2 = ys2.enumerate().map { idx, i in return ChartDataEntry(value: i, xIndex: idx) } 30 | 31 | let data = RadarChartData(xVals: xs) 32 | let ds1 = RadarChartDataSet(yVals: yse1, label: "Hello") 33 | ds1.colors = [NSUIColor.redColor()] 34 | data.addDataSet(ds1) 35 | 36 | let ds2 = RadarChartDataSet(yVals: yse2, label: "World") 37 | ds2.colors = [NSUIColor.blueColor()] 38 | data.addDataSet(ds2) 39 | self.radarChartView.data = data 40 | } 41 | 42 | override public func viewWillAppear() 43 | { 44 | self.radarChartView.animate(xAxisDuration: 0.0, yAxisDuration: 1.0) 45 | } 46 | } -------------------------------------------------------------------------------- /ChartsDemo-OSX/ChartsDemo-OSX/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSMainStoryboardFile 28 | Main 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | 16 | @interface AppDelegate : UIResponder 17 | 18 | @property (strong, nonatomic) UIWindow *window; 19 | 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Components/MyCustomXValueFormatter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyCustomXValueFormatter.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 21/9/15. 6 | // Copyright © 2015 dcg. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface MyCustomXValueFormatter : NSObject 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Components/MyCustomXValueFormatter.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyCustomXValueFormatter.m 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 21/9/15. 6 | // Copyright © 2015 dcg. All rights reserved. 7 | // 8 | 9 | #import "MyCustomXValueFormatter.h" 10 | 11 | @implementation MyCustomXValueFormatter 12 | 13 | - (NSString *)stringForXValue:(NSInteger)index 14 | original:(NSString *)original 15 | viewPortHandler:(ChartViewPortHandler *)viewPortHandler 16 | { 17 | // e.g. adjust the x-axis values depending on scale / zoom level 18 | if (viewPortHandler.scaleX > 5.f) 19 | { 20 | return @"4"; 21 | } 22 | else if (viewPortHandler.scaleX > 3.f) 23 | { 24 | return @"3"; 25 | } 26 | else if (viewPortHandler.scaleX > 1.f) 27 | { 28 | return @"2"; 29 | } 30 | else 31 | { 32 | return original; 33 | } 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/DemoBaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DemoBaseViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 13/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "ChartsDemo-Swift.h" 16 | 17 | @interface DemoBaseViewController : UIViewController 18 | { 19 | @protected 20 | NSArray *months; 21 | NSArray *parties; 22 | } 23 | 24 | @property (nonatomic, strong) IBOutlet UIButton *optionsButton; 25 | @property (nonatomic, strong) IBOutlet NSArray *options; 26 | 27 | @property (nonatomic, assign) BOOL shouldHideData; 28 | 29 | - (void)handleOption:(NSString *)key forChartView:(ChartViewBase *)chartView; 30 | 31 | - (void)updateChartData; 32 | 33 | - (void)setupPieChartView:(PieChartView *)chartView; 34 | - (void)setupRadarChartView:(RadarChartView *)chartView; 35 | - (void)setupBarLineChartView:(BarLineChartViewBase *)chartView; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/DemoListViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DemoListViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | 16 | @interface DemoListViewController : UIViewController 17 | 18 | 19 | @end 20 | 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/AnotherBarChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AnotherBarChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface AnotherBarChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/BarChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BarChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface BarChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/BubbleChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BubbleChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Bubble chart implementation: 6 | // Copyright 2015 Pierre-Marc Airoldi 7 | // Licensed under Apache License 2.0 8 | // 9 | // https://github.com/danielgindi/ios-charts 10 | // 11 | 12 | #import 13 | #import "DemoBaseViewController.h" 14 | #import 15 | 16 | @interface BubbleChartViewController : DemoBaseViewController 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/CandleStickChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CandleStickChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface CandleStickChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/ColoredLineChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ColoredLineChartViewController.m 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface ColoredLineChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/CombinedChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CombinedChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface CombinedChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/CubicLineChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CubicLineChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface CubicLineChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/HorizontalBarChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HorizontalBarChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface HorizontalBarChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/LineChart1ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LineChart1ViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface LineChart1ViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/LineChart2ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LineChart2ViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface LineChart2ViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/MultipleBarChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MultipleBarChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface MultipleBarChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/MultipleLinesChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MultipleLinesChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface MultipleLinesChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/NegativeStackedBarChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NegativeStackedBarChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface NegativeStackedBarChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/PieChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PieChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface PieChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/PositiveNegativeBarChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PositiveNegativeBarChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 08/02/2016. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface PositiveNegativeBarChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/RadarChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RadarChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface RadarChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/ScatterChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ScatterChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface ScatterChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/SinusBarChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SinusBarChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface SinusBarChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/Demos/StackedBarChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // StackedBarChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | #import 17 | 18 | @interface StackedBarChartViewController : DemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmBase/RealmDemoBaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmDemoBaseViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 13/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "DemoBaseViewController.h" 16 | 17 | @interface RealmDemoBaseViewController : DemoBaseViewController 18 | 19 | - (void)writeRandomDataToDbWithObjectCount:(NSInteger)objectCount; 20 | - (void)writeRandomStackedDataToDbWithObjectCount:(NSInteger)objectCount; 21 | - (void)writeRandomCandleDataToDbWithObjectCount:(NSInteger)objectCount; 22 | - (void)writeRandomBubbleDataToDbWithObjectCount:(NSInteger)objectCount; 23 | - (void)writeRandomPieDataToDb; 24 | 25 | - (void)styleData:(ChartData *)data; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmBase/RealmDemoData.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmDemoData.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/11/2015. 6 | // Copyright © 2015 dcg. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "RealmFloat.h" 11 | 12 | @interface RealmDemoData : RLMObject 13 | 14 | - (id)initWithValue:(float)value 15 | xIndex:(int)xIndex 16 | xValue:(NSString *)xValue; 17 | 18 | - (id)initWithStackValues:(NSArray *)stackValues 19 | xIndex:(int)xIndex 20 | xValue:(NSString *)xValue; 21 | 22 | - (id)initWithHigh:(float)high 23 | low:(float)low 24 | open:(float)open 25 | close:(float)close 26 | xIndex:(int)xIndex xValue:(NSString *)xValue; 27 | 28 | - (id)initWithValue:(float)value 29 | xIndex:(int)xIndex 30 | bubbleSize:(float)bubbleSize 31 | xValue:(NSString *)xValue; 32 | 33 | @property (nonatomic, assign) float value; 34 | 35 | @property (nonatomic, assign) float open; 36 | @property (nonatomic, assign) float close; 37 | @property (nonatomic, assign) float high; 38 | @property (nonatomic, assign) float low; 39 | 40 | @property (nonatomic, assign) float bubbleSize; 41 | 42 | @property (nonatomic, strong) RLMArray *stackValues; 43 | @property (nonatomic, assign) int xIndex; 44 | 45 | @property (nonatomic, strong) NSString *xValue; 46 | 47 | @property (nonatomic, strong) NSString *someStringField; 48 | 49 | @end -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmBase/RealmDemoData.m: -------------------------------------------------------------------------------- 1 | // 2 | // RealmDemoData.m 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/11/2015. 6 | // Copyright © 2015 dcg. All rights reserved. 7 | // 8 | 9 | #import "RealmDemoData.h" 10 | 11 | @implementation RealmDemoData 12 | 13 | - (id)initWithValue:(float)value 14 | xIndex:(int)xIndex 15 | xValue:(NSString *)xValue 16 | { 17 | self = [super init]; 18 | 19 | if (self) 20 | { 21 | self.value = value; 22 | self.xIndex = xIndex; 23 | self.xValue = xValue; 24 | } 25 | 26 | return self; 27 | } 28 | 29 | - (id)initWithHigh:(float)high 30 | low:(float)low 31 | open:(float)open 32 | close:(float)close 33 | xIndex:(int)xIndex xValue:(NSString *)xValue 34 | { 35 | self = [super init]; 36 | 37 | if (self) 38 | { 39 | self.value = (high + low) / 2.f; 40 | self.high = high; 41 | self.low = low; 42 | self.open = open; 43 | self.close = close; 44 | self.xIndex = xIndex; 45 | self.xValue = xValue; 46 | } 47 | 48 | return self; 49 | } 50 | 51 | - (id)initWithStackValues:(NSArray *)stackValues 52 | xIndex:(int)xIndex 53 | xValue:(NSString *)xValue 54 | { 55 | self = [super init]; 56 | 57 | if (self) 58 | { 59 | self.xIndex = xIndex; 60 | self.xValue = xValue; 61 | self.stackValues = [[RLMArray alloc] initWithObjectClassName:@"RealmFloat"]; 62 | 63 | for (NSNumber *value in stackValues) 64 | { 65 | [self.stackValues addObject:[[RealmFloat alloc] initWithFloatValue:value.floatValue]]; 66 | } 67 | } 68 | 69 | return self; 70 | } 71 | 72 | - (id)initWithValue:(float)value 73 | xIndex:(int)xIndex 74 | bubbleSize:(float)bubbleSize 75 | xValue:(NSString *)xValue; 76 | { 77 | self = [super init]; 78 | 79 | if (self) 80 | { 81 | self.value = value; 82 | self.xIndex = xIndex; 83 | self.bubbleSize = bubbleSize; 84 | self.xValue = xValue; 85 | } 86 | 87 | return self; 88 | } 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmBase/RealmFloat.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmFloat.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/11/2015. 6 | // Copyright © 2015 dcg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RealmFloat : RLMObject 12 | 13 | @property (nonatomic, assign) float floatValue; 14 | 15 | - (id)initWithFloatValue:(float)value; 16 | 17 | @end 18 | 19 | RLM_ARRAY_TYPE(RealmFloat) -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmBase/RealmFloat.m: -------------------------------------------------------------------------------- 1 | // 2 | // RealmFloat.m 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/11/2015. 6 | // Copyright © 2015 dcg. All rights reserved. 7 | // 8 | 9 | #import "RealmFloat.h" 10 | 11 | @implementation RealmFloat 12 | 13 | - (id)initWithFloatValue:(float)value 14 | { 15 | self = [super init]; 16 | 17 | if (self) 18 | { 19 | self.floatValue = value; 20 | } 21 | 22 | return self; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmBase/Score.h: -------------------------------------------------------------------------------- 1 | // 2 | // Score.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/01/2015. 6 | // Copyright © 2015 dcg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Score : RLMObject 12 | 13 | @property (nonatomic, assign) float totalScore; 14 | @property (nonatomic, assign) NSInteger scoreNr; 15 | @property (nonatomic, strong) NSString *playerName; 16 | 17 | - (id)initWithTotalScore:(float)totalScore 18 | scoreNr:(NSInteger)scoreNr 19 | playerName:(NSString *)playerName; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmBase/Score.m: -------------------------------------------------------------------------------- 1 | // 2 | // Score.m 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/01/2015. 6 | // Copyright © 2015 dcg. All rights reserved. 7 | // 8 | 9 | #import "Score.h" 10 | 11 | @implementation Score 12 | 13 | - (id)initWithTotalScore:(float)totalScore 14 | scoreNr:(NSInteger)scoreNr 15 | playerName:(NSString *)playerName 16 | { 17 | self = [super init]; 18 | 19 | if (self) 20 | { 21 | self.totalScore = totalScore; 22 | self.scoreNr = scoreNr; 23 | self.playerName = playerName; 24 | } 25 | 26 | return self; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmDemoListViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmDemoListViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | 16 | @interface RealmDemoListViewController : UIViewController 17 | 18 | 19 | @end 20 | 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmDemos/RealmBarChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmBarChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "RealmDemoBaseViewController.h" 16 | #import 17 | 18 | @interface RealmBarChartViewController : RealmDemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmDemos/RealmBubbleChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmBubbleChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "RealmDemoBaseViewController.h" 16 | #import 17 | 18 | @interface RealmBubbleChartViewController : RealmDemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmDemos/RealmCandleChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmCandleChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "RealmDemoBaseViewController.h" 16 | #import 17 | 18 | @interface RealmCandleChartViewController : RealmDemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmDemos/RealmHorizontalBarChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmHorizontalBarChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "RealmDemoBaseViewController.h" 16 | #import 17 | 18 | @interface RealmHorizontalBarChartViewController : RealmDemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmDemos/RealmLineChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmLineChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "RealmDemoBaseViewController.h" 16 | #import 17 | 18 | @interface RealmLineChartViewController : RealmDemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmDemos/RealmPieChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmPieChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "RealmDemoBaseViewController.h" 16 | #import 17 | 18 | @interface RealmPieChartViewController : RealmDemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmDemos/RealmRadarChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmRadarChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "RealmDemoBaseViewController.h" 16 | #import 17 | 18 | @interface RealmRadarChartViewController : RealmDemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmDemos/RealmScatterChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmScatterChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/3/15. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "RealmDemoBaseViewController.h" 16 | #import 17 | 18 | @interface RealmScatterChartViewController : RealmDemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Classes/RealmDemos/RealmWikiExampleChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RealmWikiExampleChartViewController.h 3 | // ChartsDemo 4 | // 5 | // Created by Daniel Cohen Gindi on 17/01/2016. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | #import 15 | #import "RealmDemoBaseViewController.h" 16 | #import 17 | 18 | @interface RealmWikiExampleChartViewController : RealmDemoBaseViewController 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-29@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-29@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "40x40", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-40@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-40@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "60x60", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-60@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-60@3x.png", 37 | "scale" : "3x" 38 | } 39 | ], 40 | "info" : { 41 | "version" : 1, 42 | "author" : "xcode" 43 | } 44 | } -------------------------------------------------------------------------------- /ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "736h", 7 | "filename" : "Default-736h@3x.png", 8 | "minimum-system-version" : "8.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "extent" : "full-screen", 14 | "idiom" : "iphone", 15 | "subtype" : "667h", 16 | "filename" : "Default-667h@2x.png", 17 | "minimum-system-version" : "8.0", 18 | "orientation" : "portrait", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "orientation" : "portrait", 23 | "idiom" : "iphone", 24 | "extent" : "full-screen", 25 | "minimum-system-version" : "7.0", 26 | "filename" : "Default@2x.png", 27 | "scale" : "2x" 28 | }, 29 | { 30 | "extent" : "full-screen", 31 | "idiom" : "iphone", 32 | "subtype" : "retina4", 33 | "filename" : "Default-568h@2x.png", 34 | "minimum-system-version" : "7.0", 35 | "orientation" : "portrait", 36 | "scale" : "2x" 37 | } 38 | ], 39 | "info" : { 40 | "version" : 1, 41 | "author" : "xcode" 42 | } 43 | } -------------------------------------------------------------------------------- /ChartsDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default-736h@3x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/Images.xcassets/LaunchImage.launchimage/Default@2x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/app-icon/Icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/app-icon/Icon-29@2x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/app-icon/Icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/app-icon/Icon-29@3x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/app-icon/Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/app-icon/Icon-40@2x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/app-icon/Icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/app-icon/Icon-40@3x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/app-icon/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/app-icon/Icon-60@2x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/app-icon/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/app-icon/Icon-60@3x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/app-icon/iTunesArtwork: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/app-icon/iTunesArtwork -------------------------------------------------------------------------------- /ChartsDemo/Resources/app-icon/iTunesArtwork@2x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/app-icon/iTunesArtwork@2x -------------------------------------------------------------------------------- /ChartsDemo/Resources/launch-image/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/launch-image/Default-568h@2x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/launch-image/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/launch-image/Default-667h@2x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/launch-image/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/launch-image/Default-736h@3x.png -------------------------------------------------------------------------------- /ChartsDemo/Resources/launch-image/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsDemo/Resources/launch-image/Default@2x.png -------------------------------------------------------------------------------- /ChartsDemo/Supporting Files/ChartsDemo-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /ChartsDemo/Supporting Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /ChartsDemo/Supporting Files/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | #import 16 | #import "AppDelegate.h" 17 | 18 | int main(int argc, char * argv[]) { 19 | @autoreleasepool { 20 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ChartsRealm/Classes/Data/RealmBarData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmBarData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | import Charts 18 | import Realm 19 | import Realm.Dynamic 20 | 21 | public class RealmBarData: BarChartData 22 | { 23 | public init(results: RLMResults?, xValueField: String, dataSets: [IChartDataSet]?) 24 | { 25 | if results == nil 26 | { 27 | super.init(xVals: [String](), dataSets: dataSets) 28 | } 29 | else 30 | { 31 | super.init(xVals: RealmChartUtils.toXVals(results: results!, xValueField: xValueField), dataSets: dataSets) 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /ChartsRealm/Classes/Data/RealmBarLineScatterCandleBubbleDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmBarLineScatterCandleBubbleDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | import Charts 18 | import Realm 19 | import Realm.Dynamic 20 | 21 | public class RealmBarLineScatterCandleBubbleDataSet: RealmBaseDataSet, IBarLineScatterCandleBubbleChartDataSet 22 | { 23 | // MARK: - Data functions and accessors 24 | 25 | // MARK: - Styling functions and accessors 26 | 27 | public var highlightColor = NSUIColor(red: 255.0/255.0, green: 187.0/255.0, blue: 115.0/255.0, alpha: 1.0) 28 | public var highlightLineWidth = CGFloat(0.5) 29 | public var highlightLineDashPhase = CGFloat(0.0) 30 | public var highlightLineDashLengths: [CGFloat]? 31 | 32 | // MARK: - NSCopying 33 | 34 | public override func copyWithZone(zone: NSZone) -> AnyObject 35 | { 36 | let copy = super.copyWithZone(zone) as! RealmBarLineScatterCandleBubbleDataSet 37 | copy.highlightColor = highlightColor 38 | copy.highlightLineWidth = highlightLineWidth 39 | copy.highlightLineDashPhase = highlightLineDashPhase 40 | copy.highlightLineDashLengths = highlightLineDashLengths 41 | return copy 42 | } 43 | } -------------------------------------------------------------------------------- /ChartsRealm/Classes/Data/RealmBubbleData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmBubbleData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | import Charts 18 | import Realm 19 | import Realm.Dynamic 20 | 21 | public class RealmBubbleData: BubbleChartData 22 | { 23 | public init(results: RLMResults?, xValueField: String, dataSets: [IChartDataSet]?) 24 | { 25 | if results == nil 26 | { 27 | super.init(xVals: [String](), dataSets: dataSets) 28 | } 29 | else 30 | { 31 | super.init(xVals: RealmChartUtils.toXVals(results: results!, xValueField: xValueField), dataSets: dataSets) 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /ChartsRealm/Classes/Data/RealmCandleData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmCandleData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | import Charts 18 | import Realm 19 | import Realm.Dynamic 20 | 21 | public class RealmCandleData: CandleChartData 22 | { 23 | public init(results: RLMResults?, xValueField: String, dataSets: [IChartDataSet]?) 24 | { 25 | if results == nil 26 | { 27 | super.init(xVals: [String](), dataSets: dataSets) 28 | } 29 | else 30 | { 31 | super.init(xVals: RealmChartUtils.toXVals(results: results!, xValueField: xValueField), dataSets: dataSets) 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /ChartsRealm/Classes/Data/RealmLineData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmLineData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | import Charts 18 | import Realm 19 | import Realm.Dynamic 20 | 21 | public class RealmLineData: LineChartData 22 | { 23 | public init(results: RLMResults?, xValueField: String, dataSets: [IChartDataSet]?) 24 | { 25 | if results == nil 26 | { 27 | super.init(xVals: [String](), dataSets: dataSets) 28 | } 29 | else 30 | { 31 | super.init(xVals: RealmChartUtils.toXVals(results: results!, xValueField: xValueField), dataSets: dataSets) 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /ChartsRealm/Classes/Data/RealmLineScatterCandleRadarDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmLineScatterCandleRadarDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | import Charts 18 | import Realm 19 | import Realm.Dynamic 20 | 21 | public class RealmLineScatterCandleRadarDataSet: RealmBarLineScatterCandleBubbleDataSet, ILineScatterCandleRadarChartDataSet 22 | { 23 | // MARK: - Data functions and accessors 24 | 25 | // MARK: - Styling functions and accessors 26 | 27 | /// Enables / disables the horizontal highlight-indicator. If disabled, the indicator is not drawn. 28 | public var drawHorizontalHighlightIndicatorEnabled = true 29 | 30 | /// Enables / disables the vertical highlight-indicator. If disabled, the indicator is not drawn. 31 | public var drawVerticalHighlightIndicatorEnabled = true 32 | 33 | /// - returns: true if horizontal highlight indicator lines are enabled (drawn) 34 | public var isHorizontalHighlightIndicatorEnabled: Bool { return drawHorizontalHighlightIndicatorEnabled } 35 | 36 | /// - returns: true if vertical highlight indicator lines are enabled (drawn) 37 | public var isVerticalHighlightIndicatorEnabled: Bool { return drawVerticalHighlightIndicatorEnabled } 38 | 39 | /// Enables / disables both vertical and horizontal highlight-indicators. 40 | /// :param: enabled 41 | public func setDrawHighlightIndicators(enabled: Bool) 42 | { 43 | drawHorizontalHighlightIndicatorEnabled = enabled 44 | drawVerticalHighlightIndicatorEnabled = enabled 45 | } 46 | 47 | // MARK: NSCopying 48 | 49 | public override func copyWithZone(zone: NSZone) -> AnyObject 50 | { 51 | let copy = super.copyWithZone(zone) as! RealmLineScatterCandleRadarDataSet 52 | copy.drawHorizontalHighlightIndicatorEnabled = drawHorizontalHighlightIndicatorEnabled 53 | copy.drawVerticalHighlightIndicatorEnabled = drawVerticalHighlightIndicatorEnabled 54 | return copy 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /ChartsRealm/Classes/Data/RealmPieData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmPieData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | import Charts 18 | import Realm 19 | import Realm.Dynamic 20 | 21 | public class RealmPieData: PieChartData 22 | { 23 | public init(results: RLMResults?, xValueField: String, dataSets: [IChartDataSet]?) 24 | { 25 | if results == nil 26 | { 27 | super.init(xVals: [String](), dataSets: dataSets) 28 | } 29 | else 30 | { 31 | super.init(xVals: RealmChartUtils.toXVals(results: results!, xValueField: xValueField), dataSets: dataSets) 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /ChartsRealm/Classes/Data/RealmPieDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmPieDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | import Charts 18 | import Realm 19 | import Realm.Dynamic 20 | 21 | public class RealmPieDataSet: RealmBaseDataSet, IPieChartDataSet 22 | { 23 | public override func initialize() 24 | { 25 | self.valueTextColor = NSUIColor.whiteColor() 26 | self.valueFont = NSUIFont.systemFontOfSize(13.0) 27 | } 28 | 29 | // MARK: - Styling functions and accessors 30 | 31 | private var _sliceSpace = CGFloat(0.0) 32 | 33 | /// the space in pixels between the pie-slices 34 | /// **default**: 0 35 | /// **maximum**: 20 36 | public var sliceSpace: CGFloat 37 | { 38 | get 39 | { 40 | return _sliceSpace 41 | } 42 | set 43 | { 44 | var space = newValue 45 | if (space > 20.0) 46 | { 47 | space = 20.0 48 | } 49 | if (space < 0.0) 50 | { 51 | space = 0.0 52 | } 53 | _sliceSpace = space 54 | } 55 | } 56 | 57 | /// indicates the selection distance of a pie slice 58 | public var selectionShift = CGFloat(18.0) 59 | 60 | // MARK: - NSCopying 61 | 62 | public override func copyWithZone(zone: NSZone) -> AnyObject 63 | { 64 | let copy = super.copyWithZone(zone) as! RealmPieDataSet 65 | copy._sliceSpace = _sliceSpace 66 | copy.selectionShift = selectionShift 67 | return copy 68 | } 69 | } -------------------------------------------------------------------------------- /ChartsRealm/Classes/Data/RealmRadarData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmRadarData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | import Charts 17 | 18 | import Realm 19 | import Realm.Dynamic 20 | 21 | public class RealmRadarData: RadarChartData 22 | { 23 | public init(results: RLMResults?, xValueField: String, dataSets: [IChartDataSet]?) 24 | { 25 | if results == nil 26 | { 27 | super.init(xVals: [String](), dataSets: dataSets) 28 | } 29 | else 30 | { 31 | super.init(xVals: RealmChartUtils.toXVals(results: results!, xValueField: xValueField), dataSets: dataSets) 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /ChartsRealm/Classes/Data/RealmRadarDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmRadarDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | import Charts 18 | import Realm 19 | import Realm.Dynamic 20 | 21 | public class RealmRadarDataSet: RealmLineRadarDataSet, IRadarChartDataSet 22 | { 23 | public override func initialize() 24 | { 25 | self.valueFont = NSUIFont.systemFontOfSize(13.0) 26 | } 27 | 28 | // MARK: - Data functions and accessors 29 | 30 | // MARK: - Styling functions and accessors 31 | 32 | /// flag indicating whether highlight circle should be drawn or not 33 | /// **default**: false 34 | public var drawHighlightCircleEnabled: Bool = false 35 | 36 | /// - returns: true if highlight circle should be drawn, false if not 37 | public var isDrawHighlightCircleEnabled: Bool { return drawHighlightCircleEnabled } 38 | 39 | public var highlightCircleFillColor: UIColor? = UIColor.whiteColor() 40 | 41 | /// The stroke color for highlight circle. 42 | /// If `nil`, the color of the dataset is taken. 43 | public var highlightCircleStrokeColor: UIColor? 44 | 45 | public var highlightCircleStrokeAlpha: CGFloat = 0.3 46 | 47 | public var highlightCircleInnerRadius: CGFloat = 3.0 48 | 49 | public var highlightCircleOuterRadius: CGFloat = 4.0 50 | 51 | public var highlightCircleStrokeWidth: CGFloat = 2.0 52 | } -------------------------------------------------------------------------------- /ChartsRealm/Classes/Data/RealmScatterData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmScatterData.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | import Charts 18 | import Realm 19 | import Realm.Dynamic 20 | 21 | public class RealmScatterData: ScatterChartData 22 | { 23 | public init(results: RLMResults?, xValueField: String, dataSets: [IChartDataSet]?) 24 | { 25 | if results == nil 26 | { 27 | super.init(xVals: [String](), dataSets: dataSets) 28 | } 29 | else 30 | { 31 | super.init(xVals: RealmChartUtils.toXVals(results: results!, xValueField: xValueField), dataSets: dataSets) 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /ChartsRealm/Classes/Data/RealmScatterDataSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmScatterDataSet.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | import Foundation 16 | 17 | import Charts 18 | import Realm 19 | import Realm.Dynamic 20 | 21 | public class RealmScatterDataSet: RealmLineScatterCandleRadarDataSet, IScatterChartDataSet 22 | { 23 | // The size the scatter shape will have 24 | public var scatterShapeSize = CGFloat(15.0) 25 | 26 | // The type of shape that is set to be drawn where the values are at 27 | // **default**: .Square 28 | public var scatterShape = ScatterChartDataSet.ScatterShape.Square 29 | 30 | // The radius of the hole in the shape (applies to Square, Circle and Triangle) 31 | // **default**: 0.0 32 | public var scatterShapeHoleRadius: CGFloat = 0.0 33 | 34 | // Color for the hole in the shape. Setting to `nil` will behave as transparent. 35 | // **default**: nil 36 | public var scatterShapeHoleColor: NSUIColor? = nil 37 | 38 | // Custom path object to draw where the values are at. 39 | // This is used when shape is set to Custom. 40 | public var customScatterShape: CGPath? 41 | 42 | public override func initialize() 43 | { 44 | 45 | } 46 | 47 | // MARK: NSCopying 48 | 49 | public override func copyWithZone(zone: NSZone) -> AnyObject 50 | { 51 | let copy = super.copyWithZone(zone) as! RealmScatterDataSet 52 | copy.scatterShapeSize = scatterShapeSize 53 | copy.scatterShape = scatterShape 54 | copy.customScatterShape = customScatterShape 55 | return copy 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /ChartsRealm/Classes/Utils/RealmChartUtils.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RealmChartUtils.swift 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 1/17/16. 6 | // 7 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 8 | // A port of MPAndroidChart for iOS 9 | // Licensed under Apache License 2.0 10 | // 11 | // https://github.com/danielgindi/ios-charts 12 | // 13 | 14 | import Foundation 15 | import Realm 16 | 17 | public class RealmChartUtils: NSObject 18 | { 19 | /// Transforms the given Realm-ResultSet into an xValue array, using the specified xValueField 20 | public static func toXVals(results results: RLMResults, xValueField: String) -> [String] 21 | { 22 | let addedValues = NSMutableSet() 23 | var xVals = [String]() 24 | 25 | for object in results 26 | { 27 | let xVal = (object as! RLMObject)[xValueField] as! String! 28 | if !addedValues.containsObject(xVal) 29 | { 30 | addedValues.addObject(xVal) 31 | xVals.append(xVal) 32 | } 33 | } 34 | 35 | return xVals 36 | } 37 | } 38 | 39 | extension RLMResults: SequenceType 40 | { 41 | public func generate() -> NSFastGenerator 42 | { 43 | return NSFastGenerator(self) 44 | } 45 | } 46 | 47 | extension RLMArray: SequenceType 48 | { 49 | public func generate() -> NSFastGenerator 50 | { 51 | return NSFastGenerator(self) 52 | } 53 | } -------------------------------------------------------------------------------- /ChartsRealm/Supporting Files/ChartsRealm.h: -------------------------------------------------------------------------------- 1 | // 2 | // ChartsRealm.h 3 | // Charts 4 | // 5 | // Created by Daniel Cohen Gindi on 23/2/15. 6 | 7 | // 8 | // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda 9 | // A port of MPAndroidChart for iOS 10 | // Licensed under Apache License 2.0 11 | // 12 | // https://github.com/danielgindi/ios-charts 13 | // 14 | 15 | #import 16 | 17 | //! Project version number for ChartsRealm. 18 | FOUNDATION_EXPORT double ChartsRealmVersionNumber; 19 | 20 | //! Project version string for ChartsRealm. 21 | FOUNDATION_EXPORT const unsigned char ChartsRealmVersionString[]; 22 | 23 | // In this header, you should import all the public headers of your framework using statements like #import 24 | 25 | 26 | -------------------------------------------------------------------------------- /ChartsRealm/Supporting Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 2.2.3 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 19 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/Headers/RLMObjectBase.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | #import 21 | 22 | RLM_ASSUME_NONNULL_BEGIN 23 | 24 | @class RLMRealm; 25 | @class RLMSchema; 26 | @class RLMObjectSchema; 27 | 28 | /// :nodoc: 29 | @interface RLMObjectBase : NSObject 30 | 31 | @property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated; 32 | 33 | - (instancetype)init; 34 | 35 | + (NSString *)className; 36 | 37 | // Returns whether the class is included in the default set of classes persisted in a Realm. 38 | + (BOOL)shouldIncludeInDefaultSchema; 39 | 40 | @end 41 | 42 | RLM_ASSUME_NONNULL_END 43 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/Headers/RLMObjectSchema.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | #import 21 | 22 | RLM_ASSUME_NONNULL_BEGIN 23 | 24 | @class RLMProperty; 25 | 26 | /** 27 | This class represents Realm model object schemas. 28 | 29 | When using Realm, RLMObjectSchema objects allow performing migrations and 30 | introspecting the database's schema. 31 | 32 | Object schemas map to tables in the core database. 33 | */ 34 | @interface RLMObjectSchema : NSObject 35 | 36 | #pragma mark - Properties 37 | 38 | /** 39 | Array of persisted RLMProperty objects for an object. 40 | 41 | @see RLMProperty 42 | */ 43 | @property (nonatomic, readonly, copy) NSArray RLM_GENERIC(RLMProperty *) *properties; 44 | 45 | /** 46 | The name of the class this schema describes. 47 | */ 48 | @property (nonatomic, readonly) NSString *className; 49 | 50 | /** 51 | The property which is the primary key for this object (if any). 52 | */ 53 | @property (nonatomic, readonly, nullable) RLMProperty *primaryKeyProperty; 54 | 55 | #pragma mark - Methods 56 | 57 | /** 58 | Retrieve an RLMProperty object by name. 59 | 60 | @param propertyName The property's name. 61 | 62 | @return RLMProperty object or nil if there is no property with the given name. 63 | */ 64 | - (nullable RLMProperty *)objectForKeyedSubscript:(id )propertyName; 65 | 66 | /** 67 | Returns YES if equal to objectSchema 68 | */ 69 | - (BOOL)isEqualToObjectSchema:(RLMObjectSchema *)objectSchema; 70 | 71 | @end 72 | 73 | RLM_ASSUME_NONNULL_END 74 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/Headers/RLMPlatform.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #if !TARGET_OS_IPHONE 20 | #error Attempting to use Realm's iOS framework in an OSX project. 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/Headers/Realm.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/ios/Realm.framework/Info.plist -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module Realm { 2 | umbrella header "Realm.h" 3 | 4 | export * 5 | module * { export * } 6 | 7 | explicit module Private { 8 | header "RLMAccessor.h" 9 | header "RLMArray_Private.h" 10 | header "RLMListBase.h" 11 | header "RLMMigration_Private.h" 12 | header "RLMObjectSchema_Private.h" 13 | header "RLMObjectStore.h" 14 | header "RLMObject_Private.h" 15 | header "RLMOptionalBase.h" 16 | header "RLMProperty_Private.h" 17 | header "RLMRealmConfiguration_Private.h" 18 | header "RLMRealm_Private.h" 19 | header "RLMResults_Private.h" 20 | header "RLMSchema_Private.h" 21 | } 22 | 23 | explicit module Dynamic { 24 | header "RLMRealm_Dynamic.h" 25 | header "RLMObjectBase_Dynamic.h" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/PrivateHeaders/RLMArray_Private.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | 21 | @interface RLMArray () 22 | - (instancetype)initWithObjectClassName:(NSString *)objectClassName; 23 | - (NSString *)descriptionWithMaxDepth:(NSUInteger)depth; 24 | @end 25 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/PrivateHeaders/RLMListBase.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | 21 | @class RLMArray; 22 | 23 | // A base class for Swift generic Lists to make it possible to interact with 24 | // them from obj-c 25 | @interface RLMListBase : NSObject 26 | @property (nonatomic, strong) RLMArray *_rlmArray; 27 | 28 | - (instancetype)initWithArray:(RLMArray *)array; 29 | @end 30 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/PrivateHeaders/RLMMigration_Private.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | #import 21 | #import 22 | 23 | typedef void (^RLMObjectBaseMigrationBlock)(RLMObjectBase *oldObject, RLMObjectBase *newObject); 24 | 25 | @interface RLMMigration () 26 | 27 | @property (nonatomic, strong) RLMRealm *oldRealm; 28 | @property (nonatomic, strong) RLMRealm *realm; 29 | 30 | - (instancetype)initWithRealm:(RLMRealm *)realm oldRealm:(RLMRealm *)oldRealm; 31 | 32 | - (void)execute:(RLMMigrationBlock)block; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/PrivateHeaders/RLMOptionalBase.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2015 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | #import 21 | 22 | @class RLMObjectBase, RLMProperty; 23 | 24 | @interface RLMOptionalBase : NSProxy 25 | 26 | - (instancetype)init; 27 | 28 | @property (nonatomic, weak) RLMObjectBase *object; 29 | 30 | @property (nonatomic, unsafe_unretained) RLMProperty *property; 31 | 32 | @property (nonatomic) id underlyingValue; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/PrivateHeaders/RLMRealmConfiguration_Private.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2015 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | 21 | @class RLMSchema; 22 | 23 | @interface RLMRealmConfiguration () 24 | 25 | @property (nonatomic, readwrite) bool cache; 26 | @property (nonatomic, readwrite) bool dynamic; 27 | @property (nonatomic, readwrite) bool disableFormatUpgrade; 28 | @property (nonatomic, copy) RLMSchema *customSchema; 29 | 30 | // Get the default confiugration without copying it 31 | + (RLMRealmConfiguration *)rawDefaultConfiguration; 32 | 33 | + (void)resetRealmConfigurationState; 34 | @end 35 | 36 | // Get a path in the platform-appropriate documents directory with the given filename 37 | FOUNDATION_EXTERN NSString *RLMRealmPathForFile(NSString *fileName); 38 | FOUNDATION_EXTERN NSString *RLMRealmPathForFileAndBundleIdentifier(NSString *fileName, NSString *mainBundleIdentifier); 39 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/PrivateHeaders/RLMRealmUtil.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | #import 21 | #import 22 | 23 | @class RLMRealm; 24 | 25 | namespace realm { 26 | class BindingContext; 27 | } 28 | 29 | // Add a Realm to the weak cache 30 | void RLMCacheRealm(std::string const& path, RLMRealm *realm); 31 | // Get a Realm for the given path which can be used on the current thread 32 | RLMRealm *RLMGetThreadLocalCachedRealmForPath(std::string const& path); 33 | // Get a Realm for the given path 34 | RLMRealm *RLMGetAnyCachedRealmForPath(std::string const& path); 35 | // Clear the weak cache of Realms 36 | void RLMClearRealmCache(); 37 | 38 | // Install an uncaught exception handler that cancels write transactions 39 | // for all cached realms on the current thread 40 | void RLMInstallUncaughtExceptionHandler(); 41 | 42 | std::unique_ptr RLMCreateBindingContext(RLMRealm *realm); 43 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/PrivateHeaders/RLMResults_Private.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | 21 | @class RLMObjectSchema; 22 | 23 | @interface RLMResults () 24 | @property (nonatomic, unsafe_unretained) RLMObjectSchema *objectSchema; 25 | @end 26 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/PrivateHeaders/RLMSchema_Private.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #import 24 | #import 25 | 26 | RLM_ASSUME_NONNULL_BEGIN 27 | 28 | @class RLMRealm; 29 | 30 | // 31 | // RLMSchema private interface 32 | // 33 | @interface RLMSchema () 34 | 35 | /** 36 | Returns an `RLMSchema` containing only the given `RLMObject` subclasses. 37 | 38 | @param classes The classes to be included in the schema. 39 | 40 | @return An `RLMSchema` containing only the given classes. 41 | */ 42 | + (instancetype)schemaWithObjectClasses:(NSArray RLM_GENERIC(Class) *)classes; 43 | 44 | @property (nonatomic, readwrite, copy) NSArray RLM_GENERIC(RLMObjectSchema *) *objectSchema; 45 | 46 | // schema based on runtime objects 47 | + (instancetype)sharedSchema; 48 | 49 | // schema based upon all currently registered object classes 50 | + (instancetype)partialSharedSchema; 51 | 52 | // schema based on tables in a Realm 53 | + (instancetype)dynamicSchemaFromRealm:(RLMRealm *)realm; 54 | 55 | // class for string 56 | + (nullable Class)classForString:(NSString *)className; 57 | 58 | // shallow copy for reusing schema properties accross the same Realm on multiple threads 59 | - (instancetype)shallowCopy; 60 | 61 | @end 62 | 63 | RLM_ASSUME_NONNULL_END 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/Realm.framework/Realm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/ios/Realm.framework/Realm -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Info.plist -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftdoc -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftmodule -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftdoc -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftmodule -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/i386.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/i386.swiftdoc -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/i386.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/i386.swiftmodule -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftdoc -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module RealmSwift { 2 | header "RealmSwift-Swift.h" 3 | } 4 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/RealmSwift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/ios/RealmSwift.framework/RealmSwift -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/Headers/RLMObjectBase.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | #import 21 | 22 | RLM_ASSUME_NONNULL_BEGIN 23 | 24 | @class RLMRealm; 25 | @class RLMSchema; 26 | @class RLMObjectSchema; 27 | 28 | /// :nodoc: 29 | @interface RLMObjectBase : NSObject 30 | 31 | @property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated; 32 | 33 | - (instancetype)init; 34 | 35 | + (NSString *)className; 36 | 37 | // Returns whether the class is included in the default set of classes persisted in a Realm. 38 | + (BOOL)shouldIncludeInDefaultSchema; 39 | 40 | @end 41 | 42 | RLM_ASSUME_NONNULL_END 43 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/Headers/RLMObjectSchema.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | #import 21 | 22 | RLM_ASSUME_NONNULL_BEGIN 23 | 24 | @class RLMProperty; 25 | 26 | /** 27 | This class represents Realm model object schemas. 28 | 29 | When using Realm, RLMObjectSchema objects allow performing migrations and 30 | introspecting the database's schema. 31 | 32 | Object schemas map to tables in the core database. 33 | */ 34 | @interface RLMObjectSchema : NSObject 35 | 36 | #pragma mark - Properties 37 | 38 | /** 39 | Array of persisted RLMProperty objects for an object. 40 | 41 | @see RLMProperty 42 | */ 43 | @property (nonatomic, readonly, copy) NSArray RLM_GENERIC(RLMProperty *) *properties; 44 | 45 | /** 46 | The name of the class this schema describes. 47 | */ 48 | @property (nonatomic, readonly) NSString *className; 49 | 50 | /** 51 | The property which is the primary key for this object (if any). 52 | */ 53 | @property (nonatomic, readonly, nullable) RLMProperty *primaryKeyProperty; 54 | 55 | #pragma mark - Methods 56 | 57 | /** 58 | Retrieve an RLMProperty object by name. 59 | 60 | @param propertyName The property's name. 61 | 62 | @return RLMProperty object or nil if there is no property with the given name. 63 | */ 64 | - (nullable RLMProperty *)objectForKeyedSubscript:(id )propertyName; 65 | 66 | /** 67 | Returns YES if equal to objectSchema 68 | */ 69 | - (BOOL)isEqualToObjectSchema:(RLMObjectSchema *)objectSchema; 70 | 71 | @end 72 | 73 | RLM_ASSUME_NONNULL_END 74 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/Headers/RLMPlatform.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #if !TARGET_OS_IPHONE 20 | #error Attempting to use Realm's iOS framework in an OSX project. 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/Headers/Realm.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/Info.plist -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module Realm { 2 | umbrella header "Realm.h" 3 | 4 | export * 5 | module * { export * } 6 | 7 | explicit module Private { 8 | header "RLMAccessor.h" 9 | header "RLMArray_Private.h" 10 | header "RLMListBase.h" 11 | header "RLMMigration_Private.h" 12 | header "RLMObjectSchema_Private.h" 13 | header "RLMObjectStore.h" 14 | header "RLMObject_Private.h" 15 | header "RLMOptionalBase.h" 16 | header "RLMProperty_Private.h" 17 | header "RLMRealmConfiguration_Private.h" 18 | header "RLMRealm_Private.h" 19 | header "RLMResults_Private.h" 20 | header "RLMSchema_Private.h" 21 | } 22 | 23 | explicit module Dynamic { 24 | header "RLMRealm_Dynamic.h" 25 | header "RLMObjectBase_Dynamic.h" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/PrivateHeaders/RLMArray_Private.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | 21 | @interface RLMArray () 22 | - (instancetype)initWithObjectClassName:(NSString *)objectClassName; 23 | - (NSString *)descriptionWithMaxDepth:(NSUInteger)depth; 24 | @end 25 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/PrivateHeaders/RLMListBase.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | 21 | @class RLMArray; 22 | 23 | // A base class for Swift generic Lists to make it possible to interact with 24 | // them from obj-c 25 | @interface RLMListBase : NSObject 26 | @property (nonatomic, strong) RLMArray *_rlmArray; 27 | 28 | - (instancetype)initWithArray:(RLMArray *)array; 29 | @end 30 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/PrivateHeaders/RLMMigration_Private.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | #import 21 | #import 22 | 23 | typedef void (^RLMObjectBaseMigrationBlock)(RLMObjectBase *oldObject, RLMObjectBase *newObject); 24 | 25 | @interface RLMMigration () 26 | 27 | @property (nonatomic, strong) RLMRealm *oldRealm; 28 | @property (nonatomic, strong) RLMRealm *realm; 29 | 30 | - (instancetype)initWithRealm:(RLMRealm *)realm oldRealm:(RLMRealm *)oldRealm; 31 | 32 | - (void)execute:(RLMMigrationBlock)block; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/PrivateHeaders/RLMOptionalBase.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2015 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | #import 21 | 22 | @class RLMObjectBase, RLMProperty; 23 | 24 | @interface RLMOptionalBase : NSProxy 25 | 26 | - (instancetype)init; 27 | 28 | @property (nonatomic, weak) RLMObjectBase *object; 29 | 30 | @property (nonatomic, unsafe_unretained) RLMProperty *property; 31 | 32 | @property (nonatomic) id underlyingValue; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/PrivateHeaders/RLMRealmConfiguration_Private.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2015 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | 21 | @class RLMSchema; 22 | 23 | @interface RLMRealmConfiguration () 24 | 25 | @property (nonatomic, readwrite) bool cache; 26 | @property (nonatomic, readwrite) bool dynamic; 27 | @property (nonatomic, readwrite) bool disableFormatUpgrade; 28 | @property (nonatomic, copy) RLMSchema *customSchema; 29 | 30 | // Get the default confiugration without copying it 31 | + (RLMRealmConfiguration *)rawDefaultConfiguration; 32 | 33 | + (void)resetRealmConfigurationState; 34 | @end 35 | 36 | // Get a path in the platform-appropriate documents directory with the given filename 37 | FOUNDATION_EXTERN NSString *RLMRealmPathForFile(NSString *fileName); 38 | FOUNDATION_EXTERN NSString *RLMRealmPathForFileAndBundleIdentifier(NSString *fileName, NSString *mainBundleIdentifier); 39 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/PrivateHeaders/RLMRealmUtil.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | #import 21 | #import 22 | 23 | @class RLMRealm; 24 | 25 | namespace realm { 26 | class BindingContext; 27 | } 28 | 29 | // Add a Realm to the weak cache 30 | void RLMCacheRealm(std::string const& path, RLMRealm *realm); 31 | // Get a Realm for the given path which can be used on the current thread 32 | RLMRealm *RLMGetThreadLocalCachedRealmForPath(std::string const& path); 33 | // Get a Realm for the given path 34 | RLMRealm *RLMGetAnyCachedRealmForPath(std::string const& path); 35 | // Clear the weak cache of Realms 36 | void RLMClearRealmCache(); 37 | 38 | // Install an uncaught exception handler that cancels write transactions 39 | // for all cached realms on the current thread 40 | void RLMInstallUncaughtExceptionHandler(); 41 | 42 | std::unique_ptr RLMCreateBindingContext(RLMRealm *realm); 43 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/PrivateHeaders/RLMResults_Private.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | 21 | @class RLMObjectSchema; 22 | 23 | @interface RLMResults () 24 | @property (nonatomic, unsafe_unretained) RLMObjectSchema *objectSchema; 25 | @end 26 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/PrivateHeaders/RLMSchema_Private.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2014 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////// 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #import 24 | #import 25 | 26 | RLM_ASSUME_NONNULL_BEGIN 27 | 28 | @class RLMRealm; 29 | 30 | // 31 | // RLMSchema private interface 32 | // 33 | @interface RLMSchema () 34 | 35 | /** 36 | Returns an `RLMSchema` containing only the given `RLMObject` subclasses. 37 | 38 | @param classes The classes to be included in the schema. 39 | 40 | @return An `RLMSchema` containing only the given classes. 41 | */ 42 | + (instancetype)schemaWithObjectClasses:(NSArray RLM_GENERIC(Class) *)classes; 43 | 44 | @property (nonatomic, readwrite, copy) NSArray RLM_GENERIC(RLMObjectSchema *) *objectSchema; 45 | 46 | // schema based on runtime objects 47 | + (instancetype)sharedSchema; 48 | 49 | // schema based upon all currently registered object classes 50 | + (instancetype)partialSharedSchema; 51 | 52 | // schema based on tables in a Realm 53 | + (instancetype)dynamicSchemaFromRealm:(RLMRealm *)realm; 54 | 55 | // class for string 56 | + (nullable Class)classForString:(NSString *)className; 57 | 58 | // shallow copy for reusing schema properties accross the same Realm on multiple threads 59 | - (instancetype)shallowCopy; 60 | 61 | @end 62 | 63 | RLM_ASSUME_NONNULL_END 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/Realm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/tvos/Realm.framework/Realm -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/Info.plist -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftdoc -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftmodule -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftdoc -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module RealmSwift { 2 | header "RealmSwift-Swift.h" 3 | } 4 | -------------------------------------------------------------------------------- /ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/RealmSwift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nubank/ios-charts/3339016d2beadb11ff4727f036cc42b9d87a3b78/ChartsRealm/ThirdParty/Realm/tvos/RealmSwift.framework/RealmSwift -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "rake" 4 | gem "xcpretty" 5 | gem "cocoapods" 6 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | activesupport (4.2.5.1) 5 | i18n (~> 0.7) 6 | json (~> 1.7, >= 1.7.7) 7 | minitest (~> 5.1) 8 | thread_safe (~> 0.3, >= 0.3.4) 9 | tzinfo (~> 1.1) 10 | claide (0.9.1) 11 | cocoapods (0.39.0) 12 | activesupport (>= 4.0.2) 13 | claide (~> 0.9.1) 14 | cocoapods-core (= 0.39.0) 15 | cocoapods-downloader (~> 0.9.3) 16 | cocoapods-plugins (~> 0.4.2) 17 | cocoapods-search (~> 0.1.0) 18 | cocoapods-stats (~> 0.6.2) 19 | cocoapods-trunk (~> 0.6.4) 20 | cocoapods-try (~> 0.5.1) 21 | colored (~> 1.2) 22 | escape (~> 0.0.4) 23 | molinillo (~> 0.4.0) 24 | nap (~> 1.0) 25 | xcodeproj (~> 0.28.2) 26 | cocoapods-core (0.39.0) 27 | activesupport (>= 4.0.2) 28 | fuzzy_match (~> 2.0.4) 29 | nap (~> 1.0) 30 | cocoapods-downloader (0.9.3) 31 | cocoapods-plugins (0.4.2) 32 | nap 33 | cocoapods-search (0.1.0) 34 | cocoapods-stats (0.6.2) 35 | cocoapods-trunk (0.6.4) 36 | nap (>= 0.8, < 2.0) 37 | netrc (= 0.7.8) 38 | cocoapods-try (0.5.1) 39 | colored (1.2) 40 | escape (0.0.4) 41 | fuzzy_match (2.0.4) 42 | i18n (0.7.0) 43 | json (1.8.3) 44 | minitest (5.8.4) 45 | molinillo (0.4.1) 46 | nap (1.1.0) 47 | netrc (0.7.8) 48 | rake (10.5.0) 49 | rouge (1.10.1) 50 | thread_safe (0.3.5) 51 | tzinfo (1.2.2) 52 | thread_safe (~> 0.1) 53 | xcodeproj (0.28.2) 54 | activesupport (>= 3) 55 | claide (~> 0.9.1) 56 | colored (~> 1.2) 57 | xcpretty (0.2.2) 58 | rouge (~> 1.8) 59 | 60 | PLATFORMS 61 | ruby 62 | 63 | DEPENDENCIES 64 | cocoapods 65 | rake 66 | xcpretty 67 | 68 | BUNDLED WITH 69 | 1.11.2 70 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | def type 2 | :project # set `:project` for xcodeproj and `:workspace` for xcworkspace 3 | end 4 | 5 | def project_name 6 | "Charts/Charts.xcodeproj" 7 | end 8 | 9 | def configuration 10 | "Debug" 11 | end 12 | 13 | def test_targets 14 | [ 15 | :ios, 16 | # :tvos #no tvOS fbsnapshot 17 | ] 18 | end 19 | 20 | def schemes 21 | { 22 | ios: 'Charts-iOS', 23 | tvos: 'Charts-TV' 24 | } 25 | end 26 | 27 | def sdks 28 | { 29 | ios: 'iphonesimulator', 30 | osx: 'macosx', 31 | tvos: 'appletvsimulator' 32 | } 33 | end 34 | 35 | def devices 36 | { 37 | ios: "name='iPhone 6s'", 38 | osx: "arch='x86_64'", 39 | tvos: "name='Apple TV 1080p'" 40 | } 41 | end 42 | 43 | def xcodebuild(type, name, scheme, configuration, sdk, destination, tasks, xcprety_args: '') 44 | 45 | # set either workspace or project flag for xcodebuild 46 | case type 47 | when :project 48 | project_type = "-project" 49 | when :workspace 50 | project_type = "-workspace" 51 | else 52 | abort "Invalid project type, use `:project` for xcodeproj and `:workspace` for xcworkspace." 53 | end 54 | 55 | sh "set -o pipefail && xcodebuild #{project_type} '#{name}' -scheme '#{scheme}' -configuration '#{configuration}' -sdk #{sdk} -destination #{destination} #{tasks} | xcpretty -c #{xcprety_args}" 56 | 57 | end 58 | 59 | def execute(tasks, platform, xcprety_args) 60 | 61 | # platform specific settings 62 | sdk = sdks[platform] 63 | scheme = schemes[platform] 64 | destination = devices[platform] 65 | 66 | # check if xcodebuild needs to be run on multiple devices 67 | if destination.respond_to?('map') 68 | destination.map do |destination| 69 | xcodebuild type, project_name, scheme, configuration, sdk, destination, tasks, xcprety_args 70 | end 71 | else 72 | xcodebuild type, project_name, scheme, configuration, sdk, destination, tasks, xcprety_args 73 | end 74 | 75 | end 76 | 77 | desc 'Build, then run tests.' 78 | task :test do 79 | 80 | test_targets.map do |platform| 81 | execute 'build test', platform, xcprety_args: '--test' 82 | end 83 | 84 | sh "killall Simulator" 85 | 86 | end 87 | --------------------------------------------------------------------------------