Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/danielgindi/Charts: (23 commits)
  Update ViewPortHandler.swift (ChartsOrg#3143)
  add option to build demo projects unit tests on iOS (ChartsOrg#3121)
  Replaced relevant `ChartUtils` methods with `Double` extensions (ChartsOrg#2994)
  Update 4.0.0 with master (ChartsOrg#3135)
  Removed redundant ivars in BarLineChartViewBase (ChartsOrg#3043)
  fix ChartsOrg#1830. credit from ChartsOrg#2049 (ChartsOrg#2874)
  Makes ChartsDemo compiling again (ChartsOrg#3117)
  Fixed using wrong axis (Issue ChartsOrg#2257)
  Removed methods and properties deprecated in 1.0 (ChartsOrg#2996)
  for ChartsOrg#3061 revert animationUpdate() and animationEnd() not trigger crash if subclass does nothing
  The backing var is not necessary. (ChartsOrg#3000)
  Replaced `ChartUtils.Math` in favour of an extension on `FloatingPoint` (ChartsOrg#2993)
  Minor logic cleanup (ChartsOrg#3041)
  Fix a bug may cause infinite loop. (ChartsOrg#3073)
  for ChartsOrg#2745. chart should be weak.
  fileprivate -> private (ChartsOrg#3042)
  Removed `isKind(of:)`
  Removed @objc from internal properties
  Fixes for PR
  Made use of `==` where appropriate to simplify logic
  ...

# Conflicts:
#	Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift
#	Source/Charts/Renderers/BarChartRenderer.swift
  • Loading branch information
FreddyZeng committed Jan 2, 2018
2 parents 821120e + 9706fa1 commit 6871066
Show file tree
Hide file tree
Showing 84 changed files with 942 additions and 1,675 deletions.
8 changes: 8 additions & 0 deletions Charts.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
17E994DA88777AA1D8CCFC58 /* BarChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C31AA65EA27776F8C653C7E8 /* BarChartDataSet.swift */; };
203A39685CC96FC625F616E4 /* IHighlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 998F2BFE318471AFC05B50AC /* IHighlighter.swift */; };
219192CA6B4895319AB49DCA /* BarLineScatterCandleBubbleRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B1C588E9DF6FFD56D7ADF8E /* BarLineScatterCandleBubbleRenderer.swift */; };
224EFF991FBAAC4700CF9B3B /* EquatableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 224EFF981FBAAC4700CF9B3B /* EquatableTests.swift */; };
23649EFC635A76022F07FFA6 /* PieChartDataEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD02157CF8CEE1189BF681DA /* PieChartDataEntry.swift */; };
23FA50B2730D8C7ACA091C4F /* BarChartRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75F279974FE650E57A061B09 /* BarChartRenderer.swift */; };
24151B0729D77251A8494D70 /* LineRadarRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 105FFC9D3773A9C7A60A897F /* LineRadarRenderer.swift */; };
Expand Down Expand Up @@ -107,6 +108,7 @@
B0D28C68BB9A958DC56EB214 /* DefaultValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 107D8F8163EE54D6D9E916B0 /* DefaultValueFormatter.swift */; };
B13C74B4FF705D7B595D01EF /* IAxisValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BD9DF16AF59680A3BB49452 /* IAxisValueFormatter.swift */; };
B539114951455C35BADAE3F3 /* PieChartDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4FB5E3761EF8B4D1E1E1014 /* PieChartDataSet.swift */; };
B6BF9A561F91993A00E62A5D /* CombinedChartTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6BF9A551F91993A00E62A5D /* CombinedChartTests.swift */; };
B6C9F450D937B87224D29D5C /* IFillFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818AC6B12505B7C0A53D62F9 /* IFillFormatter.swift */; };
B6DCC229615EFE706F64A37D /* LineScatterCandleRadarRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 923206233CA89FD03565FF87 /* LineScatterCandleRadarRenderer.swift */; };
B85DEB06B4C1AFFC8A0E3295 /* CircleShapeRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECE1B1623D3AF69CECAE8562 /* CircleShapeRenderer.swift */; };
Expand Down Expand Up @@ -182,6 +184,7 @@
1F3D55A7E6176D52DC957D27 /* XAxisRendererHorizontalBarChart.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = XAxisRendererHorizontalBarChart.swift; path = Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift; sourceTree = "<group>"; };
2194AA554712E6BA2677F114 /* BubbleChartRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BubbleChartRenderer.swift; path = Source/Charts/Renderers/BubbleChartRenderer.swift; sourceTree = "<group>"; };
219BC9CEA037F897E92E45D1 /* IScatterChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IScatterChartDataSet.swift; path = Source/Charts/Data/Interfaces/IScatterChartDataSet.swift; sourceTree = "<group>"; };
224EFF981FBAAC4700CF9B3B /* EquatableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = EquatableTests.swift; path = Tests/Charts/EquatableTests.swift; sourceTree = "<group>"; };
23D35CF6F9177D77B6B97AE1 /* XShapeRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = XShapeRenderer.swift; path = Source/Charts/Renderers/Scatter/XShapeRenderer.swift; sourceTree = "<group>"; };
2440DB759AB93B4A928A3F6F /* RadarChartView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RadarChartView.swift; path = Source/Charts/Charts/RadarChartView.swift; sourceTree = "<group>"; };
2465CB73738EBAFB46C57288 /* CombinedHighlighter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CombinedHighlighter.swift; path = Source/Charts/Highlight/CombinedHighlighter.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -264,6 +267,7 @@
B137428B41C143D5115726C4 /* Description.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Description.swift; path = Source/Charts/Components/Description.swift; sourceTree = "<group>"; };
B1BA6B21CBDF77A15848994F /* RadarChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RadarChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift; sourceTree = "<group>"; };
B44829AF0ADA583F1F0279B7 /* BubbleChartDataSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BubbleChartDataSet.swift; path = Source/Charts/Data/Implementations/Standard/BubbleChartDataSet.swift; sourceTree = "<group>"; };
B6BF9A551F91993A00E62A5D /* CombinedChartTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = CombinedChartTests.swift; path = Tests/Charts/CombinedChartTests.swift; sourceTree = "<group>"; };
BA157EFF2F952192C11DF937 /* AnimatedMoveViewJob.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnimatedMoveViewJob.swift; path = Source/Charts/Jobs/AnimatedMoveViewJob.swift; sourceTree = "<group>"; };
BA1A58428DC4780BAB4EAADC /* CandleStickChartView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CandleStickChartView.swift; path = Source/Charts/Charts/CandleStickChartView.swift; sourceTree = "<group>"; };
BC19DC2434D65FFB446A61B7 /* XAxisRendererRadarChart.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = XAxisRendererRadarChart.swift; path = Source/Charts/Renderers/XAxisRendererRadarChart.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -510,7 +514,9 @@
isa = PBXGroup;
children = (
5C3F5E1A69EC06E86505F7B1 /* BarChartTests.swift */,
224EFF981FBAAC4700CF9B3B /* EquatableTests.swift */,
7AB9062A28AAB9469752A954 /* ChartUtilsTests.swift */,
B6BF9A551F91993A00E62A5D /* CombinedChartTests.swift */,
D2E1819D72CD7B6C4A4E8048 /* LineChartTests.swift */,
064989451F5C99C7006E8BB3 /* Snapshot.swift */,
);
Expand Down Expand Up @@ -943,8 +949,10 @@
files = (
3B11556EB7DC034E2FC958E4 /* BarChartTests.swift in Sources */,
8E1192F7A7152E9DA92C56A9 /* ChartUtilsTests.swift in Sources */,
B6BF9A561F91993A00E62A5D /* CombinedChartTests.swift in Sources */,
2BF85BEA981B359A65E9BF67 /* LineChartTests.swift in Sources */,
064989461F5C99C7006E8BB3 /* Snapshot.swift in Sources */,
224EFF991FBAAC4700CF9B3B /* EquatableTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
4 changes: 2 additions & 2 deletions ChartsDemo/Objective-C/Demos/CombinedChartViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ - (BarChartData *)generateBarData
[set1 setColor:[UIColor colorWithRed:60/255.f green:220/255.f blue:78/255.f alpha:1.f]];
set1.valueTextColor = [UIColor colorWithRed:60/255.f green:220/255.f blue:78/255.f alpha:1.f];
set1.valueFont = [UIFont systemFontOfSize:10.f];
set1.axisDependency = AxisDependencyLeft;
set1.axisDependency = AxisDependencyRight;

BarChartDataSet *set2 = [[BarChartDataSet alloc] initWithValues:entries2 label:@""];
set2.stackLabels = @[@"Stack 1", @"Stack 2"];
Expand All @@ -226,7 +226,7 @@ - (BarChartData *)generateBarData
];
set2.valueTextColor = [UIColor colorWithRed:61/255.f green:165/255.f blue:255/255.f alpha:1.f];
set2.valueFont = [UIFont systemFontOfSize:10.f];
set2.axisDependency = AxisDependencyLeft;
set2.axisDependency = AxisDependencyRight;

float groupSpace = 0.06f;
float barSpace = 0.02f; // x2 dataset
Expand Down
2 changes: 1 addition & 1 deletion ChartsDemo/Objective-C/Demos/HalfPieChartViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ - (void)optionTapped:(NSString *)key
{
if ([key isEqualToString:@"toggleXValues"])
{
_chartView.drawSliceTextEnabled = !_chartView.isDrawSliceTextEnabled;
_chartView.drawEntryLabelsEnabled = !_chartView.drawEntryLabelsEnabled;

[_chartView setNeedsDisplay];
return;
Expand Down
9 changes: 8 additions & 1 deletion ChartsDemo/Objective-C/Demos/LineChart1ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,14 @@ - (void)optionTapped:(NSString *)key
{
for (id<ILineChartDataSet> set in _chartView.data.dataSets)
{
set.drawSteppedEnabled = !set.isDrawSteppedEnabled;
switch (set.mode) {
case LineChartModeLinear:
case LineChartModeCubicBezier:
case LineChartModeHorizontalBezier:
set.mode = LineChartModeStepped;
break;
case LineChartModeStepped: set.mode = LineChartModeLinear;
}
}

[_chartView setNeedsDisplay];
Expand Down
9 changes: 8 additions & 1 deletion ChartsDemo/Objective-C/Demos/LineChart2ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,14 @@ - (void)optionTapped:(NSString *)key
{
for (id<ILineChartDataSet> set in _chartView.data.dataSets)
{
set.drawSteppedEnabled = !set.isDrawSteppedEnabled;
switch (set.mode) {
case LineChartModeLinear:
case LineChartModeCubicBezier:
case LineChartModeHorizontalBezier:
set.mode = LineChartModeStepped;
break;
case LineChartModeStepped: set.mode = LineChartModeLinear;
}
}

[_chartView setNeedsDisplay];
Expand Down
9 changes: 8 additions & 1 deletion ChartsDemo/Objective-C/Demos/LineChartTimeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,14 @@ - (void)optionTapped:(NSString *)key
{
for (id<ILineChartDataSet> set in _chartView.data.dataSets)
{
set.drawSteppedEnabled = !set.isDrawSteppedEnabled;
switch (set.mode) {
case LineChartModeLinear:
case LineChartModeCubicBezier:
case LineChartModeHorizontalBezier:
set.mode = LineChartModeStepped;
break;
case LineChartModeStepped: set.mode = LineChartModeLinear;
}
}

[_chartView setNeedsDisplay];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,14 @@ - (void)optionTapped:(NSString *)key
{
for (id<ILineChartDataSet> set in _chartView.data.dataSets)
{
set.drawSteppedEnabled = !set.isDrawSteppedEnabled;
switch (set.mode) {
case LineChartModeLinear:
case LineChartModeCubicBezier:
case LineChartModeHorizontalBezier:
set.mode = LineChartModeStepped;
break;
case LineChartModeStepped: set.mode = LineChartModeLinear;
}
}

[_chartView setNeedsDisplay];
Expand Down
2 changes: 1 addition & 1 deletion ChartsDemo/Objective-C/Demos/PieChartViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ - (void)optionTapped:(NSString *)key
{
if ([key isEqualToString:@"toggleXValues"])
{
_chartView.drawSliceTextEnabled = !_chartView.isDrawSliceTextEnabled;
_chartView.drawEntryLabelsEnabled = !_chartView.drawEntryLabelsEnabled;

[_chartView setNeedsDisplay];
return;
Expand Down
64 changes: 49 additions & 15 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ def type
end

def project_name
'Charts.xcodeproj'
'ChartsDemo/ChartsDemo.xcodeproj'
end

def macos_project_name
'ChartsDemo-OSX/ChartsDemo-OSX.xcodeproj'
end

def configuration
Expand All @@ -29,6 +33,19 @@ def build_schemes
]
end

def build_demo_schemes
%i[
ChartsDemo
ChartsDemo-Swift
]
end

def build_macos_demo_schemes
[
'ChartsDemo-OSX'
]
end

def test_schemes
[
'ChartsTests'
Expand Down Expand Up @@ -74,33 +91,43 @@ def xcodebuild(type, name, scheme, configuration, sdk, destination, tasks, xcpre
sh "set -o pipefail && xcodebuild #{project_type} '#{name}' -scheme '#{scheme}' -configuration '#{configuration}' -sdk #{sdk} -destination #{destination} #{tasks} | bundle exec xcpretty -c #{xcprety_args}"
end

def run_xcodebuild(schemes_to_execute, tasks, destination, is_test, xcprety_args)
def run_xcodebuild(tasks, destination, is_build_demo, xcprety_args)
sdk = destination[:sdk]
device = destination[:device]
uuid = destination[:uuid]

is_test = tasks.include?('test')
is_macos = sdk == 'macosx'

project = is_macos ? macos_project_name : project_name

schemes_to_execute = []
if is_test
schemes_to_execute = test_schemes
elsif is_build_demo
schemes_to_execute = is_macos ? build_macos_demo_schemes : build_demo_schemes
else
schemes_to_execute = build_schemes
end

open_simulator_and_sleep uuid if is_test

schemes_to_execute.each do |scheme|
xcodebuild type, project_name, scheme, configuration, sdk, device, tasks, xcprety_args
xcodebuild type, project, scheme, configuration, sdk, device, tasks, xcprety_args
end
end

def execute(tasks, platform, xcprety_args: '')
is_test = tasks.include?('test')

def execute(tasks, platform, is_build_demo = false, xcprety_args: '')
# platform specific settings
destination = devices[platform]

schemes = is_test ? test_schemes : build_schemes

# check if xcodebuild needs to be run on multiple devices
if destination.is_a?(Array)
destination.each do |destination|
run_xcodebuild schemes, tasks, destination, is_test, xcprety_args
run_xcodebuild tasks, destination, is_build_demo, xcprety_args
end
else
run_xcodebuild schemes, tasks, destination, is_test, xcprety_args
run_xcodebuild tasks, destination, is_build_demo, xcprety_args
end
end

Expand All @@ -122,11 +149,18 @@ end
desc 'Run CI tasks. Build and test or build depending on the platform.'
task :ci, [:platform] do |_task, args|
platform = arg_to_key(args[:platform]) if args.key?(:platform)

if test_platforms.include?(platform)
execute 'clean test', platform
elsif build_platforms.include?(platform)
execute 'clean build', platform
is_build_demo = test_platforms.include?(platform) || build_platforms.include?(platform)

if test_platforms.include?(platform) # iOS and tvOS
if platform == :iOS
execute 'clean', platform, is_build_demo
execute 'build', platform, is_build_demo
execute 'test', platform # not use demo specifically
else
execute 'clean test', platform
end
elsif build_platforms.include?(platform) # macOS
execute 'clean build', platform, is_build_demo
else
test_platforms.each do |platform|
execute 'clean test', platform
Expand Down
26 changes: 13 additions & 13 deletions Source/Charts/Animation/Animator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ open class Animator: NSObject
/// the phase that is animated and influences the drawn values on the y-axis
@objc open var phaseY: Double = 1.0

fileprivate var _startTimeX: TimeInterval = 0.0
fileprivate var _startTimeY: TimeInterval = 0.0
fileprivate var _displayLink: NSUIDisplayLink?
private var _startTimeX: TimeInterval = 0.0
private var _startTimeY: TimeInterval = 0.0
private var _displayLink: NSUIDisplayLink?

fileprivate var _durationX: TimeInterval = 0.0
fileprivate var _durationY: TimeInterval = 0.0
private var _durationX: TimeInterval = 0.0
private var _durationY: TimeInterval = 0.0

fileprivate var _endTimeX: TimeInterval = 0.0
fileprivate var _endTimeY: TimeInterval = 0.0
fileprivate var _endTime: TimeInterval = 0.0
private var _endTimeX: TimeInterval = 0.0
private var _endTimeY: TimeInterval = 0.0
private var _endTime: TimeInterval = 0.0

fileprivate var _enabledX: Bool = false
fileprivate var _enabledY: Bool = false
private var _enabledX: Bool = false
private var _enabledY: Bool = false

fileprivate var _easingX: ChartEasingFunctionBlock?
fileprivate var _easingY: ChartEasingFunctionBlock?
private var _easingX: ChartEasingFunctionBlock?
private var _easingY: ChartEasingFunctionBlock?

public override init()
{
Expand Down Expand Up @@ -119,7 +119,7 @@ open class Animator: NSObject
}
}

@objc fileprivate func animationLoop()
@objc private func animationLoop()
{
let currentTime: TimeInterval = CACurrentMediaTime()

Expand Down
8 changes: 4 additions & 4 deletions Source/Charts/Charts/BarChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import CoreGraphics
open class BarChartView: BarLineChartViewBase, BarChartDataProvider
{
/// if set to true, all values are drawn above their bars, instead of below their top
fileprivate var _drawValueAboveBarEnabled = true
private var _drawValueAboveBarEnabled = true

/// if set to true, a grey area is drawn behind each bar that indicates the maximum value
fileprivate var _drawBarShadowEnabled = false
private var _drawBarShadowEnabled = false

internal override func initialize()
{
Expand Down Expand Up @@ -50,10 +50,10 @@ open class BarChartView: BarLineChartViewBase, BarChartDataProvider
}

// calculate axis range (min / max) according to provided data
_leftAxis.calculate(
leftAxis.calculate(
min: data.getYMin(axis: .left),
max: data.getYMax(axis: .left))
_rightAxis.calculate(
rightAxis.calculate(
min: data.getYMin(axis: .right),
max: data.getYMax(axis: .right))
}
Expand Down
Loading

0 comments on commit 6871066

Please sign in to comment.