diff --git a/.swift-version b/.swift-version new file mode 100644 index 0000000000..9f55b2ccb5 --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +3.0 diff --git a/.travis.yml b/.travis.yml index 4934eadaf2..7007943b0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,5 @@ before_install: script: - bundle exec rake test -# after_success: -# - bash <(curl -s https://codecov.io/bash) +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/Charts.podspec b/Charts.podspec index 750397e504..7ad985e120 100644 --- a/Charts.podspec +++ b/Charts.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Charts" - s.version = "2.2.5" + s.version = "3.0.0" s.summary = "Charts is a powerful & easy to use chart library for iOS, tvOS and OSX (and Android)" s.homepage = "https://github.com/danielgindi/Charts" s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" } @@ -10,7 +10,6 @@ Pod::Spec.new do |s| s.osx.deployment_target = "10.11" s.source = { :git => "https://github.com/danielgindi/Charts.git", :tag => "v#{s.version}" } s.default_subspec = "Core" - s.prepare_command = "sed -i '' -e 's/import Charts//g' Source/ChartsRealm/**/*.swift" s.subspec "Core" do |ss| ss.source_files = "Source/Charts/**/*.swift" diff --git a/Charts.xcodeproj/project.pbxproj b/Charts.xcodeproj/project.pbxproj index acb219368d..8e389ba535 100644 --- a/Charts.xcodeproj/project.pbxproj +++ b/Charts.xcodeproj/project.pbxproj @@ -810,6 +810,7 @@ isa = PBXNativeTarget; buildConfigurationList = 06165F3B1D8110E700722320 /* Build configuration list for PBXNativeTarget "ChartsTests" */; buildPhases = ( + 064DBAE11D93813D002584CD /* Build Dependencies */, 06165F2A1D8110E600722320 /* Sources */, 06165F2B1D8110E600722320 /* Frameworks */, 06165F2C1D8110E600722320 /* Resources */, @@ -829,6 +830,7 @@ isa = PBXNativeTarget; buildConfigurationList = 06B120DA1D811E6200D14B02 /* Build configuration list for PBXNativeTarget "ChartsRealm" */; buildPhases = ( + 061DF29D1D93774D0002B03B /* Build Dependencies */, 06B120D01D811E6200D14B02 /* Sources */, 06B120D11D811E6200D14B02 /* Frameworks */, 06B120D21D811E6200D14B02 /* Headers */, @@ -847,10 +849,11 @@ isa = PBXNativeTarget; buildConfigurationList = 06B121071D811F1600D14B02 /* Build configuration list for PBXNativeTarget "ChartsRealmTests" */; buildPhases = ( + 064DBAE21D938156002584CD /* Build Dependencies */, 06B120FB1D811F1600D14B02 /* Sources */, 06B120FC1D811F1600D14B02 /* Frameworks */, 06B120FD1D811F1600D14B02 /* Resources */, - 06B121161D81215D00D14B02 /* ShellScript */, + 06B121161D81215D00D14B02 /* Copy Carthage Frameworks */, ); buildRules = ( ); @@ -937,6 +940,49 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 061DF29D1D93774D0002B03B /* Build Dependencies */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "", + ); + name = "Build Dependencies"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec \"${SRCROOT}/scripts/build-dependencies.sh\"\n"; + }; + 064DBAE11D93813D002584CD /* Build Dependencies */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Build Dependencies"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec \"${SRCROOT}/scripts/build-dependencies.sh\"\n"; + }; + 064DBAE21D938156002584CD /* Build Dependencies */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Build Dependencies"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec \"${SRCROOT}/scripts/build-dependencies.sh\"\n"; + }; 06500E641D8116FC00156E8A /* Copy Carthage Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -950,21 +996,23 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "case \"$PLATFORM_NAME\" in\nmacosx) plat=Mac;;\niphone*) plat=iOS;;\nwatch*) plat=watchOS;;\nappletv*) plat=tvOS;;\n*) echo \"error: Unknown PLATFORM_NAME: $PLATFORM_NAME\"; exit 1;;\nesac\nfor (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do\nVAR=SCRIPT_INPUT_FILE_$n\nframework=$(basename \"${!VAR}\")\nexport SCRIPT_INPUT_FILE_$n=\"$SRCROOT\"/Carthage/Build/$plat/\"$framework\".framework\ndone\n\n/usr/local/bin/carthage copy-frameworks || exit\n\nfor (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do\nVAR=SCRIPT_INPUT_FILE_$n\nsource=${!VAR}.dSYM\ndest=${BUILT_PRODUCTS_DIR}/$(basename \"$source\")\nditto \"$source\" \"$dest\" || exit\ndone"; + shellScript = "exec \"${SRCROOT}/scripts/copy-carthage-frameworks.sh\"\n"; }; - 06B121161D81215D00D14B02 /* ShellScript */ = { + 06B121161D81215D00D14B02 /* Copy Carthage Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( FBSnapshotTestCase, + Realm, ); + name = "Copy Carthage Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "case \"$PLATFORM_NAME\" in\nmacosx) plat=Mac;;\niphone*) plat=iOS;;\nwatch*) plat=watchOS;;\nappletv*) plat=tvOS;;\n*) echo \"error: Unknown PLATFORM_NAME: $PLATFORM_NAME\"; exit 1;;\nesac\nfor (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do\nVAR=SCRIPT_INPUT_FILE_$n\nframework=$(basename \"${!VAR}\")\nexport SCRIPT_INPUT_FILE_$n=\"$SRCROOT\"/Carthage/Build/$plat/\"$framework\".framework\ndone\n\n/usr/local/bin/carthage copy-frameworks || exit\n\nfor (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do\nVAR=SCRIPT_INPUT_FILE_$n\nsource=${!VAR}.dSYM\ndest=${BUILT_PRODUCTS_DIR}/$(basename \"$source\")\nditto \"$source\" \"$dest\" || exit\ndone"; + shellScript = "exec \"${SRCROOT}/scripts/copy-carthage-frameworks.sh\"\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -1162,7 +1210,6 @@ /* Begin XCBuildConfiguration section */ 06165F361D8110E700722320 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 063FF0401D8CC9940094A042 /* Carthage.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -1219,7 +1266,6 @@ }; 06165F371D8110E700722320 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 063FF0401D8CC9940094A042 /* Carthage.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -1306,6 +1352,7 @@ }; 06165F3C1D8110E700722320 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 063FF0401D8CC9940094A042 /* Carthage.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; @@ -1320,6 +1367,7 @@ }; 06165F3D1D8110E700722320 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 063FF0401D8CC9940094A042 /* Carthage.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; @@ -1333,6 +1381,7 @@ }; 06B120DB1D811E6200D14B02 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 063FF0401D8CC9940094A042 /* Carthage.xcconfig */; buildSettings = { COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; @@ -1343,6 +1392,7 @@ INFOPLIST_FILE = "$(SRCROOT)/Source/Supporting Files/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + OTHER_SWIFT_FLAGS = "-DNEEDS_CHARTS"; PRODUCT_BUNDLE_IDENTIFIER = com.dcg.ChartsRealm; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1351,6 +1401,7 @@ }; 06B120DC1D811E6200D14B02 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 063FF0401D8CC9940094A042 /* Carthage.xcconfig */; buildSettings = { COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; @@ -1361,6 +1412,7 @@ INFOPLIST_FILE = "$(SRCROOT)/Source/Supporting Files/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + OTHER_SWIFT_FLAGS = "-DNEEDS_CHARTS"; PRODUCT_BUNDLE_IDENTIFIER = com.dcg.ChartsRealm; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1369,9 +1421,9 @@ }; 06B121081D811F1600D14B02 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 063FF0401D8CC9940094A042 /* Carthage.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "$(SRCROOT)/Tests/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1384,9 +1436,9 @@ }; 06B121091D811F1600D14B02 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 063FF0401D8CC9940094A042 /* Carthage.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "$(SRCROOT)/Tests/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; diff --git a/ChartsDemo/Classes/DemoBaseViewController.m b/ChartsDemo/Classes/DemoBaseViewController.m index f5ce3e843f..3a142369fd 100644 --- a/ChartsDemo/Classes/DemoBaseViewController.m +++ b/ChartsDemo/Classes/DemoBaseViewController.m @@ -106,7 +106,7 @@ - (void)handleOption:(NSString *)key forChartView:(ChartViewBase *)chartView if ([key isEqualToString:@"saveToGallery"]) { - [chartView saveToCameraRoll]; + UIImageWriteToSavedPhotosAlbum([chartView getChartImageWithTransparent:NO], nil, nil, nil); } if ([key isEqualToString:@"togglePinchZoom"]) diff --git a/ChartsDemo/Classes/Demos/MultipleLinesChartViewController.m b/ChartsDemo/Classes/Demos/MultipleLinesChartViewController.m index 604d641f28..dcb18cd7df 100644 --- a/ChartsDemo/Classes/Demos/MultipleLinesChartViewController.m +++ b/ChartsDemo/Classes/Demos/MultipleLinesChartViewController.m @@ -69,7 +69,7 @@ - (void)viewDidLoad l.drawInside = NO; _sliderX.value = 20.0; - _sliderY.value = 10.0; + _sliderY.value = 100.0; [self slidersValueChanged:nil]; } diff --git a/Gemfile b/Gemfile index 698f848aae..4c8d9e91f8 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,4 @@ source "https://rubygems.org" gem "rake" gem "xcpretty" -gem "cocoapods" +gem "cocoapods", "1.1.0.rc.2" diff --git a/Gemfile.lock b/Gemfile.lock index e796a4e263..81fde30dc9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,31 +1,33 @@ GEM remote: https://rubygems.org/ specs: - activesupport (5.0.0.1) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (4.2.7.1) i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) claide (1.0.0) - cocoapods (1.0.1) - activesupport (>= 4.0.2) + cocoapods (1.1.0.rc.2) + activesupport (>= 4.0.2, < 5) claide (>= 1.0.0, < 2.0) - cocoapods-core (= 1.0.1) - cocoapods-deintegrate (>= 1.0.0, < 2.0) - cocoapods-downloader (>= 1.0.0, < 2.0) + cocoapods-core (= 1.1.0.rc.2) + cocoapods-deintegrate (>= 1.0.1, < 2.0) + cocoapods-downloader (>= 1.1.1, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) cocoapods-trunk (>= 1.0.0, < 2.0) - cocoapods-try (>= 1.0.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) colored (~> 1.2) escape (~> 0.0.4) - fourflusher (~> 0.3.0) - molinillo (~> 0.4.5) + fourflusher (~> 1.0.1) + gh_inspector (~> 1.0) + molinillo (~> 0.5.1) nap (~> 1.0) - xcodeproj (>= 1.1.0, < 2.0) - cocoapods-core (1.0.1) - activesupport (>= 4.0.2) + xcodeproj (>= 1.3.1, < 2.0) + cocoapods-core (1.1.0.rc.2) + activesupport (>= 4.0.2, < 5) fuzzy_match (~> 2.0.4) nap (~> 1.0) cocoapods-deintegrate (1.0.1) @@ -39,21 +41,22 @@ GEM netrc (= 0.7.8) cocoapods-try (1.1.0) colored (1.2) - concurrent-ruby (1.0.2) escape (0.0.4) - fourflusher (0.3.2) + fourflusher (1.0.1) fuzzy_match (2.0.4) + gh_inspector (1.0.2) i18n (0.7.0) + json (1.8.3) minitest (5.9.0) - molinillo (0.4.5) + molinillo (0.5.1) nap (1.1.0) netrc (0.7.8) - rake (11.2.2) + rake (11.3.0) rouge (1.11.1) thread_safe (0.3.5) tzinfo (1.2.2) thread_safe (~> 0.1) - xcodeproj (1.3.0) + xcodeproj (1.3.1) activesupport (>= 3) claide (>= 1.0.0, < 2.0) colored (~> 1.2) @@ -64,9 +67,9 @@ PLATFORMS ruby DEPENDENCIES - cocoapods + cocoapods (= 1.1.0.rc.2) rake xcpretty BUNDLED WITH - 1.12.5 + 1.13.1 diff --git a/README.md b/README.md index 2fd30505b7..93320a8eb7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ **Version 3.0**, synced to [MPAndroidChart #1b9b3da](https://github.com/PhilJay/MPAndroidChart/commit/a233e38) ![alt tag](https://raw.github.com/danielgindi/Charts/master/Assets/feature_graphic.png) - ![Supported Platforms](https://img.shields.io/cocoapods/p/Charts.svg) [![Releases](https://img.shields.io/github/release/danielgindi/Charts.svg)](https://github.com/danielgindi/Charts/releases) [![Latest pod release](https://img.shields.io/cocoapods/v/Charts.svg)](http://cocoapods.org/pods/charts) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Build Status](https://travis-ci.org/danielgindi/Charts.svg?branch=master)](https://travis-ci.org/danielgindi/Charts) + ![Supported Platforms](https://img.shields.io/cocoapods/p/Charts.svg) [![Releases](https://img.shields.io/github/release/danielgindi/Charts.svg)](https://github.com/danielgindi/Charts/releases) [![Latest pod release](https://img.shields.io/cocoapods/v/Charts.svg)](http://cocoapods.org/pods/charts) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Build Status](https://travis-ci.org/danielgindi/Charts.svg?branch=master)](https://travis-ci.org/danielgindi/Charts) [![codecov](https://codecov.io/gh/danielgindi/Charts/branch/master/graph/badge.svg)](https://codecov.io/gh/danielgindi/Charts) [![Join the chat at https://gitter.im/danielgindi/Charts](https://badges.gitter.im/danielgindi/Charts.svg)](https://gitter.im/danielgindi/Charts?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ## Just a heads up: Charts 3.0 is **not** yet released to CocoaPods, as the version is not finalized yet. diff --git a/Rakefile b/Rakefile index 138ad956c7..abc5745b33 100644 --- a/Rakefile +++ b/Rakefile @@ -10,7 +10,7 @@ def configuration "Debug" end -def test_targets +def test_platforms [ :ios, :tvos @@ -18,27 +18,35 @@ def test_targets end def schemes - { - ios: 'Charts', - tvos: 'Charts', - osx: 'Charts' - } + [ + "Charts", + "ChartsRealm" + ] end -def sdks +def devices { - ios: 'iphonesimulator', - osx: 'macosx', - tvos: 'appletvsimulator' + ios: { + sdk: "iphonesimulator", + device: "name='iPhone 7'", + uuid: "5F911B30-5F23-403B-9697-1DFDC24773C8" + }, + macos: { + sdk: "macosx", + device: "arch='x86_64'", + uuid: nil + }, + tvos: { + sdk: "appletvsimulator", + device: "name='Apple TV 1080p'", + uuid: "273D776F-196E-4F2A-AEF2-E1E3EAE99B47" + } } end -def devices - { - ios: "name='iPhone 7'", - osx: "arch='x86_64'", - tvos: "name='Apple TV 1080p'" - } +def open_simulator_and_sleep(uuid) + return if uuid.nil? # Don't need a sleep on macOS because it runs first. + sh "xcrun instruments -w '#{uuid}' || sleep 15" end def xcodebuild(type, name, scheme, configuration, sdk, destination, tasks, xcprety_args: '') @@ -57,31 +65,46 @@ def xcodebuild(type, name, scheme, configuration, sdk, destination, tasks, xcpre end +def run_xcodebuild(schemes, tasks, destination, is_test, xcprety_args) + sdk = destination[:sdk] + device = destination[:device] + uuid = destination[:uuid] + + if is_test + open_simulator_and_sleep uuid + end + + schemes.each do |scheme| + xcodebuild type, project_name, scheme, configuration, sdk, device, tasks, xcprety_args + end + + if is_test + sh "killall Simulator" + end +end + def execute(tasks, platform, xcprety_args) + is_test = tasks.include?("test") + # platform specific settings - sdk = sdks[platform] - scheme = schemes[platform] destination = devices[platform] # check if xcodebuild needs to be run on multiple devices - if destination.respond_to?('map') - destination.map do |destination| - xcodebuild type, project_name, scheme, configuration, sdk, destination, tasks, xcprety_args + if destination.is_a?(Array) + destination.each do |destination| + run_xcodebuild schemes, tasks, destination, is_test, xcprety_args end - else - xcodebuild type, project_name, scheme, configuration, sdk, destination, tasks, xcprety_args + else + run_xcodebuild schemes, tasks, destination, is_test, xcprety_args end - end -desc 'Build, then run tests.' +desc "Build, then run tests." task :test do - test_targets.map do |platform| - execute 'build test', platform, xcprety_args: '--test' + test_platforms.each do |platform| + execute "build test", platform, xcprety_args: "--test" end - sh "killall Simulator" - end diff --git a/Source/Charts/Charts/BarLineChartViewBase.swift b/Source/Charts/Charts/BarLineChartViewBase.swift index 2c00607bf0..df5f364d5d 100644 --- a/Source/Charts/Charts/BarLineChartViewBase.swift +++ b/Source/Charts/Charts/BarLineChartViewBase.swift @@ -14,26 +14,6 @@ import CoreGraphics #if !os(OSX) import UIKit -fileprivate func < (lhs: T?, rhs: T?) -> Bool { - switch (lhs, rhs) { - case let (l?, r?): - return l < r - case (nil, _?): - return true - default: - return false - } -} - -fileprivate func > (lhs: T?, rhs: T?) -> Bool { - switch (lhs, rhs) { - case let (l?, r?): - return l > r - default: - return rhs < lhs - } -} - #endif /// Base-class of LineChart, BarChart, ScatterChart and CandleStickChart. diff --git a/Source/Charts/Charts/ChartViewBase.swift b/Source/Charts/Charts/ChartViewBase.swift index b4e8772508..248ed7f473 100755 --- a/Source/Charts/Charts/ChartViewBase.swift +++ b/Source/Charts/Charts/ChartViewBase.swift @@ -15,26 +15,6 @@ import CoreGraphics #if !os(OSX) import UIKit -fileprivate func < (lhs: T?, rhs: T?) -> Bool { - switch (lhs, rhs) { - case let (l?, r?): - return l < r - case (nil, _?): - return true - default: - return false - } -} - -fileprivate func > (lhs: T?, rhs: T?) -> Bool { - switch (lhs, rhs) { - case let (l?, r?): - return l > r - default: - return rhs < lhs - } -} - #endif @objc @@ -409,7 +389,7 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate let description = chartDescription, description.isEnabled, let descriptionText = description.text, - descriptionText.lengthOfBytes(using: String.Encoding.utf16) > 0 + descriptionText.characters.count > 0 else { return } var position = description.position @@ -909,16 +889,6 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate return true } - #if !os(tvOS) && !os(OSX) - /// Saves the current state of the chart to the camera roll - open func saveToCameraRoll() - { - if let img = getChartImage(transparent: false) { - UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil) - } - } - #endif - internal var _viewportJobs = [ViewPortJob]() open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) diff --git a/Source/Charts/Components/YAxis.swift b/Source/Charts/Components/YAxis.swift index cd298343a1..1af1e6c327 100644 --- a/Source/Charts/Components/YAxis.swift +++ b/Source/Charts/Components/YAxis.swift @@ -154,14 +154,14 @@ open class YAxis: AxisBase // bottom-space only effects non-custom min if !_customAxisMin { - let bottomSpace = range / 100.0 * Double(spaceBottom) + let bottomSpace = range * Double(spaceBottom) _axisMinimum = (min - bottomSpace) } // top-space only effects non-custom max if !_customAxisMax { - let topSpace = range / 100.0 * Double(spaceTop) + let topSpace = range * Double(spaceTop) _axisMaximum = (max + topSpace) } diff --git a/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift b/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift index fb7bc9ca8a..da2e03e4e4 100644 --- a/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift +++ b/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift @@ -10,26 +10,6 @@ // import Foundation -fileprivate func < (lhs: T?, rhs: T?) -> Bool { - switch (lhs, rhs) { - case let (l?, r?): - return l < r - case (nil, _?): - return true - default: - return false - } -} - -fileprivate func > (lhs: T?, rhs: T?) -> Bool { - switch (lhs, rhs) { - case let (l?, r?): - return l > r - default: - return rhs < lhs - } -} - /// Determines how to round DataSet index values for `ChartDataSet.entryIndex(x, rounding)` when an exact x-value is not found. @objc @@ -402,7 +382,7 @@ open class ChartDataSet: ChartBaseDataSet calcMinMax(entry: e) - if _values.last?.x > e.x + if _values.count > 0 && _values.last!.x > e.x { var closestIndex = entryIndex(x: e.x, rounding: .up) while _values[closestIndex].x < e.x diff --git a/Source/Charts/Renderers/AxisRendererBase.swift b/Source/Charts/Renderers/AxisRendererBase.swift index 7324b6d23a..8fb7357d23 100644 --- a/Source/Charts/Renderers/AxisRendererBase.swift +++ b/Source/Charts/Renderers/AxisRendererBase.swift @@ -209,7 +209,11 @@ open class AxisRendererBase: Renderer axis.centeredEntries.reserveCapacity(n) axis.centeredEntries.removeAll() - let offset = (axis.entries[1] - axis.entries[0]) / 2.0 + var offset: Double = 0.0 + if axis.entries.count > 1 + { + offset = (axis.entries[1] - axis.entries[0]) / 2.0 + } for i in 0 ..< n { diff --git a/Source/Charts/Renderers/LineChartRenderer.swift b/Source/Charts/Renderers/LineChartRenderer.swift index 2f9f20e1dc..bd8854ff65 100644 --- a/Source/Charts/Renderers/LineChartRenderer.swift +++ b/Source/Charts/Renderers/LineChartRenderer.swift @@ -114,22 +114,33 @@ open class LineChartRenderer: LineRadarRenderer var curDx: CGFloat = 0.0 var curDy: CGFloat = 0.0 - var prevPrev: ChartDataEntry! = dataSet.entryForIndex(_xBounds.min) - var prev: ChartDataEntry! = prevPrev - var cur: ChartDataEntry! = prev - var next: ChartDataEntry! = dataSet.entryForIndex(_xBounds.min + 1) + // Take an extra point from the left, and an extra from the right. + // That's because we need 4 points for a cubic bezier (cubic=4), otherwise we get lines moving and doing weird stuff on the edges of the chart. + // So in the starting `prev` and `cur`, go -2, -1 + // And in the `lastIndex`, add +1 + + let firstIndex = _xBounds.min + 1 + let lastIndex = _xBounds.min + _xBounds.range - if cur == nil || next == nil { return } + var prevPrev: ChartDataEntry! = nil + var prev: ChartDataEntry! = dataSet.entryForIndex(max(firstIndex - 2, 0)) + var cur: ChartDataEntry! = dataSet.entryForIndex(max(firstIndex - 1, 0)) + var next: ChartDataEntry! = cur + var nextIndex: Int = -1 + + if cur == nil { return } // let the spline start cubicPath.move(to: CGPoint(x: CGFloat(cur.x), y: CGFloat(cur.y * phaseY)), transform: valueToPixelMatrix) - for j in stride(from: (_xBounds.min + 1), through: _xBounds.range + _xBounds.min, by: 1) + for j in stride(from: firstIndex, through: lastIndex, by: 1) { prevPrev = prev prev = cur - cur = next - next = _xBounds.max > j + 1 ? dataSet.entryForIndex(j + 1) : cur + cur = nextIndex == j ? next : dataSet.entryForIndex(j) + + nextIndex = j + 1 < dataSet.entryCount ? j + 1 : j + next = dataSet.entryForIndex(nextIndex) if next == nil { break } @@ -327,7 +338,7 @@ open class LineChartRenderer: LineRadarRenderer _lineSegments[0].x = CGFloat(e.x) _lineSegments[0].y = CGFloat(e.y * phaseY) - if j < _xBounds.range + if j < _xBounds.max { e = dataSet.entryForIndex(j + 1) @@ -362,7 +373,6 @@ open class LineChartRenderer: LineRadarRenderer // make sure the lines don't do shitty things outside bounds if !viewPortHandler.isInBoundsLeft(_lineSegments[1].x) || (!viewPortHandler.isInBoundsTop(_lineSegments[0].y) && !viewPortHandler.isInBoundsBottom(_lineSegments[1].y)) - || (!viewPortHandler.isInBoundsTop(_lineSegments[0].y) && !viewPortHandler.isInBoundsBottom(_lineSegments[1].y)) { continue } diff --git a/Source/Charts/Renderers/RadarChartRenderer.swift b/Source/Charts/Renderers/RadarChartRenderer.swift index 475e60e708..f94f786c43 100644 --- a/Source/Charts/Renderers/RadarChartRenderer.swift +++ b/Source/Charts/Renderers/RadarChartRenderer.swift @@ -299,7 +299,7 @@ open class RadarChartRenderer: LineRadarRenderer set.isHighlightEnabled else { continue } - guard let e = set.entryForIndex(Int(high.x)) as? RadarChartDataEntry + guard let e = set.entryForXValue(high.x) as? RadarChartDataEntry else { continue } if !isInBoundsX(entry: e, dataSet: set) diff --git a/Source/Charts/Renderers/ScatterChartRenderer.swift b/Source/Charts/Renderers/ScatterChartRenderer.swift index 174c0c2d33..24f54c6044 100644 --- a/Source/Charts/Renderers/ScatterChartRenderer.swift +++ b/Source/Charts/Renderers/ScatterChartRenderer.swift @@ -194,8 +194,6 @@ open class ScatterChartRenderer: LineScatterCandleRadarRenderer let animator = animator else { return } - let chartXMax = dataProvider.chartXMax - context.saveGState() for high in indices @@ -205,41 +203,37 @@ open class ScatterChartRenderer: LineScatterCandleRadarRenderer set.isHighlightEnabled else { continue } - guard let e = set.entryForIndex(Int(high.x)) - else { continue } + let entries = set.entriesForXValue(high.x) - if !isInBoundsX(entry: e, dataSet: set) - { - continue - } - - context.setStrokeColor(set.highlightColor.cgColor) - context.setLineWidth(set.highlightLineWidth) - if set.highlightLineDashLengths != nil - { - context.setLineDash(phase: set.highlightLineDashPhase, lengths: set.highlightLineDashLengths!) - } - else + for entry in entries { - context.setLineDash(phase: 0.0, lengths: []) - } - - let x = high.x // get the x-position - let y = high.y * Double(animator.phaseY) - - if x > chartXMax * animator.phaseX - { - continue + if entry.y != high.y { continue } + + if !isInBoundsX(entry: entry, dataSet: set) { continue } + + context.setStrokeColor(set.highlightColor.cgColor) + context.setLineWidth(set.highlightLineWidth) + if set.highlightLineDashLengths != nil + { + context.setLineDash(phase: set.highlightLineDashPhase, lengths: set.highlightLineDashLengths!) + } + else + { + context.setLineDash(phase: 0.0, lengths: []) + } + + let x = entry.x // get the x-position + let y = entry.y * Double(animator.phaseY) + + let trans = dataProvider.getTransformer(forAxis: set.axisDependency) + + let pt = trans.pixelForValues(x: x, y: y) + + high.setDraw(pt: pt) + + // draw the lines + drawHighlightLines(context: context, point: pt, set: set) } - - let trans = dataProvider.getTransformer(forAxis: set.axisDependency) - - let pt = trans.pixelForValues(x: x, y: y) - - high.setDraw(pt: pt) - - // draw the lines - drawHighlightLines(context: context, point: pt, set: set) } context.restoreGState() diff --git a/Source/Charts/Utils/ChartUtils.swift b/Source/Charts/Utils/ChartUtils.swift index ba8f4e263a..f796615913 100755 --- a/Source/Charts/Utils/ChartUtils.swift +++ b/Source/Charts/Utils/ChartUtils.swift @@ -44,7 +44,7 @@ open class ChartUtils internal class func decimals(_ number: Double) -> Int { - if number == 0.0 + if number.isNaN || number.isInfinite || number == 0.0 { return 0 } diff --git a/Source/ChartsRealm/Data/RealmBarDataSet.swift b/Source/ChartsRealm/Data/RealmBarDataSet.swift index 2ca8407281..3d1b600ecc 100644 --- a/Source/ChartsRealm/Data/RealmBarDataSet.swift +++ b/Source/ChartsRealm/Data/RealmBarDataSet.swift @@ -11,8 +11,9 @@ import Foundation import CoreGraphics - +#if NEEDS_CHARTS import Charts +#endif import Realm import Realm.Dynamic diff --git a/Source/ChartsRealm/Data/RealmBarLineScatterCandleBubbleDataSet.swift b/Source/ChartsRealm/Data/RealmBarLineScatterCandleBubbleDataSet.swift index 9a1cd1b81b..a8ddd01772 100644 --- a/Source/ChartsRealm/Data/RealmBarLineScatterCandleBubbleDataSet.swift +++ b/Source/ChartsRealm/Data/RealmBarLineScatterCandleBubbleDataSet.swift @@ -10,8 +10,9 @@ // import Foundation - +#if NEEDS_CHARTS import Charts +#endif import Realm import Realm.Dynamic diff --git a/Source/ChartsRealm/Data/RealmBaseDataSet.swift b/Source/ChartsRealm/Data/RealmBaseDataSet.swift index ea48d950ee..44e874e282 100644 --- a/Source/ChartsRealm/Data/RealmBaseDataSet.swift +++ b/Source/ChartsRealm/Data/RealmBaseDataSet.swift @@ -10,8 +10,9 @@ // import Foundation - +#if NEEDS_CHARTS import Charts +#endif import Realm import Realm.Dynamic diff --git a/Source/ChartsRealm/Data/RealmBubbleDataSet.swift b/Source/ChartsRealm/Data/RealmBubbleDataSet.swift index e6ba0f932f..3645eb10d0 100644 --- a/Source/ChartsRealm/Data/RealmBubbleDataSet.swift +++ b/Source/ChartsRealm/Data/RealmBubbleDataSet.swift @@ -11,8 +11,9 @@ import Foundation import CoreGraphics - +#if NEEDS_CHARTS import Charts +#endif import Realm import Realm.Dynamic diff --git a/Source/ChartsRealm/Data/RealmCandleDataSet.swift b/Source/ChartsRealm/Data/RealmCandleDataSet.swift index 7f842e7d66..1d6b5eef47 100644 --- a/Source/ChartsRealm/Data/RealmCandleDataSet.swift +++ b/Source/ChartsRealm/Data/RealmCandleDataSet.swift @@ -11,8 +11,9 @@ import Foundation import CoreGraphics - +#if NEEDS_CHARTS import Charts +#endif import Realm import Realm.Dynamic diff --git a/Source/ChartsRealm/Data/RealmLineDataSet.swift b/Source/ChartsRealm/Data/RealmLineDataSet.swift index a1bc6962af..9d8cebc8f3 100644 --- a/Source/ChartsRealm/Data/RealmLineDataSet.swift +++ b/Source/ChartsRealm/Data/RealmLineDataSet.swift @@ -10,8 +10,9 @@ // import Foundation - +#if NEEDS_CHARTS import Charts +#endif import Realm import Realm.Dynamic diff --git a/Source/ChartsRealm/Data/RealmLineRadarDataSet.swift b/Source/ChartsRealm/Data/RealmLineRadarDataSet.swift index 2de596953d..7c728d494e 100644 --- a/Source/ChartsRealm/Data/RealmLineRadarDataSet.swift +++ b/Source/ChartsRealm/Data/RealmLineRadarDataSet.swift @@ -11,8 +11,9 @@ import Foundation import CoreGraphics - +#if NEEDS_CHARTS import Charts +#endif import Realm import Realm.Dynamic diff --git a/Source/ChartsRealm/Data/RealmLineScatterCandleRadarDataSet.swift b/Source/ChartsRealm/Data/RealmLineScatterCandleRadarDataSet.swift index cc13e7f48e..df018d16f5 100644 --- a/Source/ChartsRealm/Data/RealmLineScatterCandleRadarDataSet.swift +++ b/Source/ChartsRealm/Data/RealmLineScatterCandleRadarDataSet.swift @@ -10,8 +10,9 @@ // import Foundation - +#if NEEDS_CHARTS import Charts +#endif import Realm import Realm.Dynamic diff --git a/Source/ChartsRealm/Data/RealmPieDataSet.swift b/Source/ChartsRealm/Data/RealmPieDataSet.swift index f97adbda08..80d524437a 100644 --- a/Source/ChartsRealm/Data/RealmPieDataSet.swift +++ b/Source/ChartsRealm/Data/RealmPieDataSet.swift @@ -11,8 +11,9 @@ import Foundation import CoreGraphics - +#if NEEDS_CHARTS import Charts +#endif import Realm import Realm.Dynamic diff --git a/Source/ChartsRealm/Data/RealmRadarDataSet.swift b/Source/ChartsRealm/Data/RealmRadarDataSet.swift index cb1412ff55..f96d59707a 100644 --- a/Source/ChartsRealm/Data/RealmRadarDataSet.swift +++ b/Source/ChartsRealm/Data/RealmRadarDataSet.swift @@ -11,8 +11,9 @@ import Foundation import CoreGraphics - +#if NEEDS_CHARTS import Charts +#endif import Realm import Realm.Dynamic diff --git a/Source/ChartsRealm/Data/RealmScatterDataSet.swift b/Source/ChartsRealm/Data/RealmScatterDataSet.swift index 0c053b0a8b..ecf61b58f0 100644 --- a/Source/ChartsRealm/Data/RealmScatterDataSet.swift +++ b/Source/ChartsRealm/Data/RealmScatterDataSet.swift @@ -11,8 +11,9 @@ import Foundation import CoreGraphics - +#if NEEDS_CHARTS import Charts +#endif import Realm import Realm.Dynamic diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues.png b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues.png index 9490f87e5d..e2859f18cf 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues@2x.png b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues@2x.png index 1588b331cc..5a31d22773 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues@2x.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testDefaultValues@2x.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines.png b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines.png index 6405d0175e..d33fae7bcd 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines@2x.png b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines@2x.png index 14b2bb4bc9..4d1c2b1495 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines@2x.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideHorizontalGridlines@2x.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis.png b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis.png index 3b37c210a7..f7d076a97c 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis@2x.png b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis@2x.png index d17fee18b1..ac2a3a52b5 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis@2x.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideLeftAxis@2x.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis.png b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis.png index 4cee9efe9e..8cfe95b507 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis@2x.png b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis@2x.png index c5b4123333..703a0e0ac0 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis@2x.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideRightAxis@2x.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines.png b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines.png index dada9b5f1d..ade41b444d 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines@2x.png b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines@2x.png index 9faa827dc2..c88c5b971e 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines@2x.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHideVerticalGridlines@2x.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues.png b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues.png index 990a21e673..72feff1065 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues@2x.png b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues@2x.png index 46a94b4382..16a313fcbc 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues@2x.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.BarChartTests/testHidesValues@2x.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues.png b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues.png index 725006ac8c..2994baffd1 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues@2x.png b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues@2x.png index dc79eff3a7..3026a7201e 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues@2x.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDefaultValues@2x.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole.png b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole.png index 92b62ecef2..35e96fdce0 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole@2x.png b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole@2x.png index 5e110681f1..d3cc987964 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole@2x.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircleHole@2x.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles.png b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles.png index 615ab37080..fdb8154637 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles@2x.png b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles@2x.png index 1608f632cb..fc373d0c0e 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles@2x.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testDoesntDrawCircles@2x.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues.png b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues.png index 73d04a87a0..304021cc7b 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues@2x.png b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues@2x.png index 558badae62..31c9a51a7c 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues@2x.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testHidesValues@2x.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic.png b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic.png index c66161baaf..1828726e4d 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic.png differ diff --git a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic@2x.png b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic@2x.png index 6d1bb04c18..5c6ef1a32c 100644 Binary files a/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic@2x.png and b/Tests/Charts/ReferenceImages_64/ChartsTests.LineChartTests/testIsCubic@2x.png differ diff --git a/scripts/build-dependencies.sh b/scripts/build-dependencies.sh new file mode 100755 index 0000000000..f33a526549 --- /dev/null +++ b/scripts/build-dependencies.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +function build_dependencies { + + has_dependencies=$(ls Carthage/Build/**/*.framework 2> /dev/null | wc -l) + + if [ $has_dependencies != 0 ] + then + echo "Depencies have already been built." + else + echo "Building dependencies..." + carthage bootstrap + fi +} + +function alert_to_install_carthage { + echo "error: Carthage was not found! In order to build Charts you need to use Carthage to build it's dependencies. Carthage can be downloaded from https://github.com/Carthage/Carthage." + exit 1 +} + +if hash carthage 2>/dev/null +then + build_dependencies +else + alert_to_install_carthage +fi \ No newline at end of file diff --git a/scripts/copy-carthage-frameworks.sh b/scripts/copy-carthage-frameworks.sh new file mode 100755 index 0000000000..fe47804c64 --- /dev/null +++ b/scripts/copy-carthage-frameworks.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +case "$PLATFORM_NAME" in + macosx) plat=Mac;; + iphone*) plat=iOS;; + watch*) plat=watchOS;; + appletv*) plat=tvOS;; + *) echo "error: Unknown PLATFORM_NAME: $PLATFORM_NAME"; exit 1;; +esac + +for (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do + VAR=SCRIPT_INPUT_FILE_$n + framework=$(basename "${!VAR}") + export SCRIPT_INPUT_FILE_$n="$SRCROOT"/Carthage/Build/$plat/"$framework".framework +done + +/usr/local/bin/carthage copy-frameworks || exit + +for (( n = 0; n < SCRIPT_INPUT_FILE_COUNT; n++ )); do + VAR=SCRIPT_INPUT_FILE_$n + source=${!VAR}.dSYM + dest=${BUILT_PRODUCTS_DIR}/$(basename "$source") + ditto "$source" "$dest" || exit +done \ No newline at end of file