Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 #1318

Merged
merged 71 commits into from
Aug 12, 2016
Merged

V3 #1318

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
3dbd57b
Work on x-values instead of x-indices (free for all :-)
danielgindi Jul 14, 2016
6af7421
Merge branch 'x-indices' into v3
danielgindi Jul 27, 2016
3a0f638
Improvement for pie slice spacing calculation
danielgindi Aug 2, 2016
141128c
Example improvements
danielgindi Aug 2, 2016
d0e05d8
Docs improvements
danielgindi Aug 2, 2016
f49ef5f
Major work on highlights
danielgindi Aug 2, 2016
2f00975
ChartMarker is now a protocol, and we have ChartMarkerView/Image helpers
danielgindi Aug 3, 2016
761ca85
Improvements regarding irrelevant inherited methods
danielgindi Aug 3, 2016
ee1abfd
Added feature to change color of "no data" text
danielgindi Aug 3, 2016
77d1bf3
More work on highlights
danielgindi Aug 4, 2016
cbb5f66
Viewport enhancements for better horizontal bar support
danielgindi Aug 4, 2016
729b7d9
X-axis renderer enhancements for better horizontal bar support
danielgindi Aug 4, 2016
71b2655
Minor improvement to valueFormatter
danielgindi Aug 4, 2016
f0dafa8
Completed copy routine for scatter dataset
danielgindi Aug 4, 2016
c0d6fcd
Pie: Renamed `drawSliceTextEnabled` to `drawEntryLabelsEnabled`
danielgindi Aug 4, 2016
5835e8c
Pie: Added feature to offset center text
danielgindi Aug 4, 2016
abedb49
Pie: Separate color/font for entry labels (defaults to value color/font)
danielgindi Aug 4, 2016
184f097
Minor improvements to demo
danielgindi Aug 4, 2016
b6a2d18
Minor refactoring of variable names
danielgindi Aug 4, 2016
db836c3
Example cleanup
danielgindi Aug 5, 2016
4772adb
Refactored scatter shape rendering into interface and renderers
danielgindi Aug 5, 2016
d2b344f
Improved docs
danielgindi Aug 5, 2016
16ec10f
Removed deprecated --var / var--
danielgindi Aug 5, 2016
69bd3b9
Update README.md
danielgindi Aug 5, 2016
bcabf06
Dropped iOS 7.0 support from README (Closes #601)
danielgindi Aug 5, 2016
f484ab3
Fixed a RadarChart bug where value labels were misplaced
danielgindi Aug 5, 2016
4f8b68a
Realm fixes
danielgindi Aug 5, 2016
9582c15
Improvements to zoom methods
danielgindi Aug 7, 2016
faab0ac
Legend improvements
danielgindi Aug 7, 2016
c76d53a
DRYed some code
danielgindi Aug 7, 2016
332fb3b
Adjusted maxHighlightDistance defaults
danielgindi Aug 7, 2016
5043834
Removed NaN check for highlight.
danielgindi Aug 7, 2016
9cf7591
Cleanup these comments
danielgindi Aug 7, 2016
e2d0ee4
`drawBarShadowEnabled` is working again
danielgindi Aug 7, 2016
1b3f79a
Do not invalidate here by default, like other zoom methods
danielgindi Aug 8, 2016
90b8454
Simplified scatter shape enum model
danielgindi Aug 8, 2016
a9ee2b5
These return a single pixel (x/y), for values (x value and y value)
danielgindi Aug 8, 2016
6fbbbaf
Renamed x-pos to x-value where appropriate
danielgindi Aug 8, 2016
dd53bbe
Renamed ChartMarker -> IChartMarker
danielgindi Aug 8, 2016
c9fd582
Namespace `Marker` names only for Objc (Swift 2.2)
danielgindi Aug 8, 2016
97bbce1
Do not force unwrap here
danielgindi Aug 8, 2016
96d510e
Fix for comments
danielgindi Aug 8, 2016
48f21da
More improvements to Markers, default behaviour constraint to view size
danielgindi Aug 8, 2016
9bf669a
Docs
danielgindi Aug 8, 2016
5e143be
The highlight breaking changes are a chance to use @objc(name) feature
danielgindi Aug 8, 2016
75b16fc
Use @objc(name) feature for rarely used classes (by users)
danielgindi Aug 8, 2016
31451ab
Improved entryIndex rounding method
danielgindi Aug 8, 2016
3a02b85
Fixed drawing bounds for some of the charts
danielgindi Aug 8, 2016
1a22cc1
Removed unused yValueForXValue / yValuesForXValue
danielgindi Aug 8, 2016
7867f4b
Set a default shape renderer
danielgindi Aug 8, 2016
c7f27a7
Take the correct barData object here
danielgindi Aug 8, 2016
19230cd
Fixed combined chart highlight with bar data
danielgindi Aug 9, 2016
ea193c5
Minor refactoring
danielgindi Aug 9, 2016
55fe33d
Removed the extra offset that messed up legend location
danielgindi Aug 9, 2016
57c975e
Cache XBounds object
danielgindi Aug 9, 2016
cf2b926
Breaking change: `valueFormatter` now accepts an IValueFormatter
danielgindi Aug 9, 2016
07981f9
Avoid x values in Pie's calcMinMax
danielgindi Aug 9, 2016
800e18f
This workaround is not required in the newer compilers
danielgindi Aug 9, 2016
4bc69a2
Renamed formatter interfaces
danielgindi Aug 9, 2016
52fe95d
Avoid truncating using Int(...), it overflows
danielgindi Aug 9, 2016
69777ad
Corrected formula for 29-feb :-)
danielgindi Aug 9, 2016
c5407e8
Some minor bug fixes for formatters
danielgindi Aug 9, 2016
acaf6de
Polished demos
danielgindi Aug 9, 2016
4b3b9fe
More improvements to examples
danielgindi Aug 9, 2016
fc189f3
These should be internal
danielgindi Aug 10, 2016
1e091d9
Fixed xAxis min/max calculation typo
danielgindi Aug 10, 2016
707dd3f
Added helper to generate a fill formatter with a closure (block)
danielgindi Aug 10, 2016
647df50
Added more samples
danielgindi Aug 10, 2016
adebfaf
Updated tests
danielgindi Aug 10, 2016
9db9042
Set default barWidth to match old default behaviour
danielgindi Aug 10, 2016
cd4a473
Renamed axisMinValue/axisMaxValue to axisMinimum/axisMaximum
danielgindi Aug 12, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
676 changes: 412 additions & 264 deletions Charts/Charts.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions Charts/ChartsTests/BarChartTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ class BarChartTests: FBSnapshotTestCase
99, 14, 84, 48, 40, 71, 106, 41, 45, 61]

var entries: [ChartDataEntry] = Array()
var xValues: [String] = Array()

for (i, value) in values.enumerate()
{
entries.append(BarChartDataEntry.init(value: value, xIndex: i))
xValues.append("\(i)")
entries.append(BarChartDataEntry(x: Double(i), y: value))
}

dataSet = BarChartDataSet(yVals: entries, label: "Bar chart unit test data")
dataSet = BarChartDataSet(values: entries, label: "Bar chart unit test data")

let data = BarChartData(dataSet: dataSet)
data.barWidth = 0.85;

chart = BarChartView(frame: CGRectMake(0, 0, 480, 350))
chart.leftAxis.axisMinValue = 0.0
chart.rightAxis.axisMinValue = 0.0
chart.data = BarChartData(xVals: xValues, dataSet: dataSet)
chart.leftAxis.axisMinimum = 0.0
chart.rightAxis.axisMinimum = 0.0
chart.data = data
}

override func tearDown()
Expand Down
12 changes: 5 additions & 7 deletions Charts/ChartsTests/LineChartTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,18 @@ class LineChartTests: FBSnapshotTestCase
99, 14, 84, 48, 40, 71, 106, 41, 45, 61]

var entries: [ChartDataEntry] = Array()
var xValues: [String] = Array()

for (i, value) in values.enumerate()
{
entries.append(ChartDataEntry.init(value: value, xIndex: i))
xValues.append("\(i)")
entries.append(ChartDataEntry(x: Double(i), y: value))
}

dataSet = LineChartDataSet(yVals: entries, label: "First unit test data")
dataSet = LineChartDataSet(values: entries, label: "First unit test data")

chart = LineChartView(frame: CGRectMake(0, 0, 480, 350))
chart.leftAxis.axisMinValue = 0.0
chart.rightAxis.axisMinValue = 0.0
chart.data = LineChartData(xVals: xValues, dataSet: dataSet)
chart.leftAxis.axisMinimum = 0.0
chart.rightAxis.axisMinimum = 0.0
chart.data = LineChartData(dataSet: dataSet)
}

override func tearDown()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// ChartAnimator.swift
// Animator.swift
// Charts
//
// Created by Daniel Cohen Gindi on 3/3/15.
Expand All @@ -18,27 +18,28 @@ import CoreGraphics
import UIKit
#endif

@objc
public protocol ChartAnimatorDelegate
@objc(ChartAnimatorDelegate)
public protocol AnimatorDelegate
{
/// Called when the Animator has stepped.
func chartAnimatorUpdated(chartAnimator: ChartAnimator)
func animatorUpdated(chartAnimator: Animator)

/// Called when the Animator has stopped.
func chartAnimatorStopped(chartAnimator: ChartAnimator)
func animatorStopped(chartAnimator: Animator)
}

public class ChartAnimator: NSObject
@objc(ChartAnimator)
public class Animator: NSObject
{
public weak var delegate: ChartAnimatorDelegate?
public weak var delegate: AnimatorDelegate?
public var updateBlock: (() -> Void)?
public var stopBlock: (() -> Void)?

/// the phase that is animated and influences the drawn values on the x-axis
public var phaseX: CGFloat = 1.0
public var phaseX: Double = 1.0

/// the phase that is animated and influences the drawn values on the y-axis
public var phaseY: CGFloat = 1.0
public var phaseY: Double = 1.0

private var _startTimeX: NSTimeInterval = 0.0
private var _startTimeY: NSTimeInterval = 0.0
Expand Down Expand Up @@ -85,7 +86,7 @@ public class ChartAnimator: NSObject

if (delegate != nil)
{
delegate!.chartAnimatorUpdated(self)
delegate!.animatorUpdated(self)
}
if (updateBlock != nil)
{
Expand All @@ -95,7 +96,7 @@ public class ChartAnimator: NSObject

if (delegate != nil)
{
delegate!.chartAnimatorStopped(self)
delegate!.animatorStopped(self)
}
if (stopBlock != nil)
{
Expand All @@ -122,7 +123,7 @@ public class ChartAnimator: NSObject
}
else
{
phaseX = CGFloat(elapsed / duration)
phaseX = Double(elapsed / duration)
}
}
if (_enabledY)
Expand All @@ -141,7 +142,7 @@ public class ChartAnimator: NSObject
}
else
{
phaseY = CGFloat(elapsed / duration)
phaseY = Double(elapsed / duration)
}
}
}
Expand All @@ -154,7 +155,7 @@ public class ChartAnimator: NSObject

if (delegate != nil)
{
delegate!.chartAnimatorUpdated(self)
delegate!.animatorUpdated(self)
}
if (updateBlock != nil)
{
Expand Down Expand Up @@ -195,7 +196,7 @@ public class ChartAnimator: NSObject

if (_enabledX || _enabledY)
{
_displayLink = NSUIDisplayLink(target: self, selector: #selector(ChartAnimator.animationLoop))
_displayLink = NSUIDisplayLink(target: self, selector: #selector(Animator.animationLoop))
_displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes)
}
}
Expand Down Expand Up @@ -261,7 +262,7 @@ public class ChartAnimator: NSObject
{
if _displayLink === nil
{
_displayLink = NSUIDisplayLink(target: self, selector: #selector(ChartAnimator.animationLoop))
_displayLink = NSUIDisplayLink(target: self, selector: #selector(Animator.animationLoop))
_displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes)
}
}
Expand Down Expand Up @@ -305,7 +306,7 @@ public class ChartAnimator: NSObject
{
if _displayLink === nil
{
_displayLink = NSUIDisplayLink(target: self, selector: #selector(ChartAnimator.animationLoop))
_displayLink = NSUIDisplayLink(target: self, selector: #selector(Animator.animationLoop))
_displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes)
}
}
Expand Down
Loading