Compare commits
79 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 78390657d7 | |||
| 87a5de93af | |||
| edfca9b780 | |||
| 14c7aa7c98 | |||
| b928cd1849 | |||
| 2d6c6e291d | |||
| 5addeeae83 | |||
| ec14cc002e | |||
| e3174efa9e | |||
| 4a1380668e | |||
| 3752b7d598 | |||
| e1d10ffb7e | |||
| f2e5641d58 | |||
| b0c68377a3 | |||
| d3cb39b566 | |||
| 99f727c0d6 | |||
| b6bc9c29ca | |||
| 124eabe98c | |||
| 1f0f3351c3 | |||
| 5f8863ede1 | |||
| bf8d5de61e | |||
| 23935a3b55 | |||
| f7d15d4905 | |||
| 372b69ff4a | |||
| b17a37c1d7 | |||
| a1f34f78fb | |||
| 15e73af3b3 | |||
| aac41605aa | |||
| 0bfc904f58 | |||
| b54f27e67d | |||
| ff17a56eff | |||
| 93d98d7b87 | |||
| ba0a44ba3f | |||
| 621e9a7386 | |||
| 28ad5d7557 | |||
| d299cd6e7e | |||
| abf14f342a | |||
| 299405efe1 | |||
| 27ebf131c9 | |||
| e3c8fb2794 | |||
| 93bea88b47 | |||
| fe7f8bbae7 | |||
| 394bb70599 | |||
| 4e1411c302 | |||
| 21bc7d3a3e | |||
| 21dc1d004a | |||
| 40e4434e18 | |||
| ac3c379af4 | |||
| 2c803e87dd | |||
| 7efeaa1ef1 | |||
| a454e221a6 | |||
| 7046cf7045 | |||
| e4b0fddd16 | |||
| b1c632f5a3 | |||
| 162619b825 | |||
| 32cbb39d0b | |||
| 3a0fac18c5 | |||
| 4c0a22d962 | |||
| 76c1c41886 | |||
| e3b8ccd704 | |||
| b179f20ef9 | |||
| d89472dea5 | |||
| 907a4f25ae | |||
| 51454fe3f6 | |||
| 131f251df8 | |||
| 64451dd5ac | |||
| 36d72ce510 | |||
| efd8f97335 | |||
| 243c28cffb | |||
| 66bf3b14e8 | |||
| 7287712da3 | |||
| e71db56a76 | |||
| 4be903eda7 | |||
| d5210eff99 | |||
| 956386c7db | |||
| c6dfb48047 | |||
| fff2bd22d6 | |||
| 23e8e3084a | |||
| d04eaa2622 |
+522
-160
@@ -1,207 +1,569 @@
|
||||
# Changelog
|
||||
# Change Log
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.8.6">2.8.6</a>
|
||||
#### 08/29/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/issues/100">#100</a>.
|
||||
## [v2.8.17](https://github.com/Jawbone/JBChartView/tree/v2.8.17) (2015-11-21)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.16...v2.8.17)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.8.5">2.8.5</a>
|
||||
#### 08/28/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/issues/98">#98</a>.
|
||||
**Implemented enhancements:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.8.4">2.8.4</a>
|
||||
#### 08/27/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/issues/97">#97</a>.
|
||||
- Disabling/Enabling certain functionality: line chart selection and x-axis values [\#185](https://github.com/Jawbone/JBChartView/issues/185)
|
||||
- Add ability to set selection permanently. [\#153](https://github.com/Jawbone/JBChartView/issues/153)
|
||||
- The line fill color doesn't match the bottom of the drawn line [\#146](https://github.com/Jawbone/JBChartView/issues/146)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.8.3">2.8.3</a>
|
||||
#### 08/26/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/issues/93">#93</a>.
|
||||
**Fixed bugs:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.8.2">2.8.2</a>
|
||||
#### 08/26/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/issues/96">#96</a>.
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/issues/95">#95</a>.
|
||||
- Bug when quickly tapping a line chart in two different places [\#159](https://github.com/Jawbone/JBChartView/issues/159)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.8.1">2.8.1</a>
|
||||
#### 08/22/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/issues/92">#92</a>.
|
||||
**Closed issues:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.8.0">2.8.0</a>
|
||||
#### 08/14/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/90">#90</a>.
|
||||
- Show dot only on vertical line selection [\#190](https://github.com/Jawbone/JBChartView/issues/190)
|
||||
- Needs to support negative values [\#189](https://github.com/Jawbone/JBChartView/issues/189)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.7.4">2.7.4</a>
|
||||
#### 08/14/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/89">#89</a>.
|
||||
## [v2.8.16](https://github.com/Jawbone/JBChartView/tree/v2.8.16) (2015-09-18)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.15...v2.8.16)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.7.3">2.7.3</a>
|
||||
#### 08/07/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/83">#83</a>.
|
||||
**Closed issues:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.7.2">2.7.2</a>
|
||||
#### 08/04/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/78">#78</a>.
|
||||
- Partially filled bar [\#186](https://github.com/Jawbone/JBChartView/issues/186)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.7.1">2.7.1</a>
|
||||
#### 08/04/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/77">#77</a>.
|
||||
**Merged pull requests:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.7.0">2.7.0</a>
|
||||
#### 08/02/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/76">#76</a>.
|
||||
- Delegate call to ignore touches on selected lines [\#188](https://github.com/Jawbone/JBChartView/pull/188) ([andrewloyola](https://github.com/andrewloyola))
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.6.3">2.6.3</a>
|
||||
#### 07/31/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/75">#75</a>.
|
||||
## [v2.8.15](https://github.com/Jawbone/JBChartView/tree/v2.8.15) (2015-08-12)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.14...v2.8.15)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.6.2">2.6.2</a>
|
||||
#### 07/25/14
|
||||
- Added new controller (JBAreaChartViewController) to demonstrate area charts.
|
||||
**Implemented enhancements:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.6.1">2.6.1</a>
|
||||
#### 07/25/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/74">#74</a>.
|
||||
- Suggestion for the README.md [\#176](https://github.com/Jawbone/JBChartView/issues/176)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.6.0">2.6.0</a>
|
||||
#### 07/24/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/71">#71</a>.
|
||||
**Fixed bugs:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.5.5">2.5.5</a>
|
||||
#### 05/13/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/57">#57</a>.
|
||||
- Line color overlap issue [\#168](https://github.com/Jawbone/JBChartView/issues/168)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.5.4">2.5.4</a>
|
||||
#### 05/07/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/53">#53</a>.
|
||||
**Closed issues:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.5.3">2.5.3</a>
|
||||
#### 05/06/14
|
||||
- More compiler warning fixes.
|
||||
- JBLineChart reloadData problem [\#181](https://github.com/Jawbone/JBChartView/issues/181)
|
||||
- JBLineChartView: wrong width on iPhone6/6+ [\#177](https://github.com/Jawbone/JBChartView/issues/177)
|
||||
- Is there anyway to plot two vertical values for one horizontal index in the bar chart? [\#172](https://github.com/Jawbone/JBChartView/issues/172)
|
||||
- Charts not rendering properly [\#171](https://github.com/Jawbone/JBChartView/issues/171)
|
||||
- How can you set the bar chart to fill the width of a UIView? [\#170](https://github.com/Jawbone/JBChartView/issues/170)
|
||||
- Adding X and Y Values [\#169](https://github.com/Jawbone/JBChartView/issues/169)
|
||||
- Undefined symbols for architecture i386 [\#167](https://github.com/Jawbone/JBChartView/issues/167)
|
||||
- Not All Data Points Visible in Flexible View [\#166](https://github.com/Jawbone/JBChartView/issues/166)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.5.2">2.5.2</a>
|
||||
#### 05/06/14
|
||||
- Fixed compiler warnings.
|
||||
**Merged pull requests:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.5.1">2.5.1</a>
|
||||
#### 05/05/14
|
||||
- Additional fixes to issue <a href="https://github.com/Jawbone/JBChartView/pull/48">#48</a>.
|
||||
- Return the available height instead of 0 [\#183](https://github.com/Jawbone/JBChartView/pull/183) ([0xPr0xy](https://github.com/0xPr0xy))
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.5.0">2.5.0</a>
|
||||
#### 05/04/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/48">#48</a>.
|
||||
## [v2.8.14](https://github.com/Jawbone/JBChartView/tree/v2.8.14) (2015-04-30)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.13...v2.8.14)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.4.3">2.4.3</a>
|
||||
#### 05/04/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/49">#49</a>.
|
||||
**Closed issues:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.4.2">2.4.2</a>
|
||||
#### 04/30/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/46">#46</a>.
|
||||
- Will JBChartView integrated with React Native? [\#164](https://github.com/Jawbone/JBChartView/issues/164)
|
||||
- white dot+dotted lines sometimes does not appear when touched. [\#161](https://github.com/Jawbone/JBChartView/issues/161)
|
||||
- Small offset when using a footer for a x-axis [\#160](https://github.com/Jawbone/JBChartView/issues/160)
|
||||
- gradient for bar chart is lost / sizing problem [\#158](https://github.com/Jawbone/JBChartView/issues/158)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.4.1">2.4.1</a>
|
||||
#### 04/30/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/45">#45</a>.
|
||||
**Merged pull requests:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.4.0">2.4.0</a>
|
||||
#### 04/28/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/23">#23</a>.
|
||||
- Nil out delegate and datasource on dealloc [\#165](https://github.com/Jawbone/JBChartView/pull/165) ([eventualbuddha](https://github.com/eventualbuddha))
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.3.0">2.3.0</a>
|
||||
#### 04/17/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/34">#34</a>.
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.2.0">2.2.0</a>
|
||||
#### 04/14/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/37">#37</a>.
|
||||
## [v2.8.13](https://github.com/Jawbone/JBChartView/tree/v2.8.13) (2015-04-16)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.12...v2.8.13)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.1.6">2.1.6</a>
|
||||
#### 04/11/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/33">#33</a>.
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.1.5">2.1.5</a>
|
||||
#### 04/10/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/30">#30</a>.
|
||||
**Fixed bugs:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.1.4">2.1.4</a>
|
||||
#### 04/10/14
|
||||
- Added ability to specify a radius for dotted lines.
|
||||
- Wrong calculation of the lineIndex [\#157](https://github.com/Jawbone/JBChartView/issues/157)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.1.3">2.1.3</a>
|
||||
#### 04/03/14
|
||||
- Added the ability to force a chart's state.
|
||||
**Closed issues:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.1.2">2.1.2</a>
|
||||
#### 04/02/14
|
||||
- Added dynamic padding to JBLineChartView (based on max line width).
|
||||
- Swift round up for respondsToSelector\(\) and sizeWithFont\(\) [\#156](https://github.com/Jawbone/JBChartView/issues/156)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.1.1">2.1.1</a>
|
||||
#### 04/02/14
|
||||
- Fixed minimumValue and maximumValue getter functions.
|
||||
## [v2.8.12](https://github.com/Jawbone/JBChartView/tree/v2.8.12) (2015-04-13)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.11...v2.8.12)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.1.0">2.1.0</a>
|
||||
#### 03/30/14
|
||||
- Added minimumValue and maximumValue properties.
|
||||
- Changed default min value implementation from 0 to chart's actual minimum value.
|
||||
**Fixed bugs:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.0.2">2.0.2</a>
|
||||
#### 03/27/14
|
||||
- Added the ability to add point dots for lines in JBLineChartView.
|
||||
- Streamlined line styling.
|
||||
- Footer and Header view Swift implementation [\#152](https://github.com/Jawbone/JBChartView/issues/152)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.0.1">2.0.1</a>
|
||||
#### 03/19/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/22">#22</a>.
|
||||
**Closed issues:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v2.0.0">2.0.0</a>
|
||||
#### 03/18/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/21">#21</a>.
|
||||
- Added multi-line support for JBLineChartView.
|
||||
- Added position delegation on touch events.
|
||||
- Added tooltip views (demo-only).
|
||||
- Problems with selection when JBLineChartView is within UITableView [\#155](https://github.com/Jawbone/JBChartView/issues/155)
|
||||
- Show chart selection permanently [\#151](https://github.com/Jawbone/JBChartView/issues/151)
|
||||
- Crash when returning NAN [\#150](https://github.com/Jawbone/JBChartView/issues/150)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v1.1.6">1.1.6</a>
|
||||
#### 03/02/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/15">#15</a>.
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/14">#14</a>.
|
||||
**Merged pull requests:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v1.1.5">1.1.5</a>
|
||||
#### 02/11/14
|
||||
- Chart selection improvements.
|
||||
- Animation performance improvements.
|
||||
- Fix warnings when building w/ Xcode 6.3 [\#154](https://github.com/Jawbone/JBChartView/pull/154) ([amro](https://github.com/amro))
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v1.1.4">1.1.4</a>
|
||||
#### 02/06/14
|
||||
- Fixed compilation warnings.
|
||||
## [v2.8.11](https://github.com/Jawbone/JBChartView/tree/v2.8.11) (2015-03-31)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.10...v2.8.11)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v1.1.3">1.1.3</a>
|
||||
#### 01/06/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/11">#11</a>.
|
||||
**Implemented enhancements:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v1.1.2">1.1.2</a>
|
||||
#### 01/03/14
|
||||
- Added CGFloat support for chart heights intead of integers.
|
||||
- Pass back barView & dot instances on selection [\#118](https://github.com/Jawbone/JBChartView/issues/118)
|
||||
- Add ability to have the line start or end at any given point [\#115](https://github.com/Jawbone/JBChartView/issues/115)
|
||||
- Consolidate dot view selection/unselection/color calls [\#101](https://github.com/Jawbone/JBChartView/issues/101)
|
||||
- Change dot radius to dot diameter [\#99](https://github.com/Jawbone/JBChartView/issues/99)
|
||||
- need Swift implementation details and example [\#80](https://github.com/Jawbone/JBChartView/issues/80)
|
||||
- Add bar/line caching for only visible content. [\#61](https://github.com/Jawbone/JBChartView/issues/61)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v1.1.1">1.1.1</a>
|
||||
#### 01/02/14
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/7">#7</a>.
|
||||
**Closed issues:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v1.1.0">1.1.0</a>
|
||||
#### 12/26/13
|
||||
- Updated JBBarChartView datasource to request UIView subclasses for bars.
|
||||
- Pie Chart support [\#149](https://github.com/Jawbone/JBChartView/issues/149)
|
||||
- hi is it possible to have x,y value because in example there is no y value and only 2 x value [\#141](https://github.com/Jawbone/JBChartView/issues/141)
|
||||
- imports without pods [\#140](https://github.com/Jawbone/JBChartView/issues/140)
|
||||
- How can I group Bars? [\#139](https://github.com/Jawbone/JBChartView/issues/139)
|
||||
- request: AreaChart - fillColorForLineAtLineIndex - add custom color for a specific X axis range [\#137](https://github.com/Jawbone/JBChartView/issues/137)
|
||||
- smallest value is shown as a blank bar [\#136](https://github.com/Jawbone/JBChartView/issues/136)
|
||||
- Is there any way I can use JBBarChartView as horizontal bars? [\#135](https://github.com/Jawbone/JBChartView/issues/135)
|
||||
- Multiple colors to a line graph [\#134](https://github.com/Jawbone/JBChartView/issues/134)
|
||||
- Overriding - \(void\)barChartView:\(JBBarChartView \*\)barChartView didSelectBarAtIndex:\(NSUInteger\)index is not showing selection view? [\#133](https://github.com/Jawbone/JBChartView/issues/133)
|
||||
- Exception thrown on setState: [\#132](https://github.com/Jawbone/JBChartView/issues/132)
|
||||
- X and Y scale and reference values [\#131](https://github.com/Jawbone/JBChartView/issues/131)
|
||||
- Determine x-value of a certain point by a number instead of it's index in the input array? [\#130](https://github.com/Jawbone/JBChartView/issues/130)
|
||||
- How to accomplish similar didUnselectBarChartView [\#129](https://github.com/Jawbone/JBChartView/issues/129)
|
||||
- Is posible - scroll chart [\#126](https://github.com/Jawbone/JBChartView/issues/126)
|
||||
- Crash when vertical value for horizontal at index x less than zero [\#125](https://github.com/Jawbone/JBChartView/issues/125)
|
||||
- JBBarChartView does not display all the bars [\#124](https://github.com/Jawbone/JBChartView/issues/124)
|
||||
- "automatically normalized across the entire chart" [\#123](https://github.com/Jawbone/JBChartView/issues/123)
|
||||
- reloadData in viewDidLayoutSubviews does not trigger didDeselectLineInLineChartView on first selection [\#122](https://github.com/Jawbone/JBChartView/issues/122)
|
||||
- Question [\#121](https://github.com/Jawbone/JBChartView/issues/121)
|
||||
- Sublayers not properly resized [\#120](https://github.com/Jawbone/JBChartView/issues/120)
|
||||
- It will be really cool if "while on tap on line charts dots I can get the dot object do some scale animation" or something? [\#119](https://github.com/Jawbone/JBChartView/issues/119)
|
||||
- Is there any way I can pass new bar view while user selects particular bar? [\#117](https://github.com/Jawbone/JBChartView/issues/117)
|
||||
- Typo error in README [\#114](https://github.com/Jawbone/JBChartView/issues/114)
|
||||
- Dynamic/append values [\#113](https://github.com/Jawbone/JBChartView/issues/113)
|
||||
- It needs better documentation [\#112](https://github.com/Jawbone/JBChartView/issues/112)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v1.0.3">1.0.3</a>
|
||||
#### 12/23/13
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/4">#4</a>.
|
||||
**Merged pull requests:**
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v1.0.2">1.0.2</a>
|
||||
#### 12/17/13
|
||||
- Additional fixes for issue <a href="https://github.com/Jawbone/JBChartView/pull/2">#2</a>.
|
||||
- Keep tooltip subviews above line subviews [\#144](https://github.com/Jawbone/JBChartView/pull/144) ([vocaro](https://github.com/vocaro))
|
||||
- Fix crash and warnings that can occur when a chart line has no data [\#143](https://github.com/Jawbone/JBChartView/pull/143) ([vocaro](https://github.com/vocaro))
|
||||
- Add automatically generated change log file. [\#142](https://github.com/Jawbone/JBChartView/pull/142) ([skywinder](https://github.com/skywinder))
|
||||
- Update README.md [\#127](https://github.com/Jawbone/JBChartView/pull/127) ([paal123](https://github.com/paal123))
|
||||
- Add ability to have the line start or end at any given point [\#116](https://github.com/Jawbone/JBChartView/pull/116) ([sebastianreloaded](https://github.com/sebastianreloaded))
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v1.0.1">1.0.1</a>
|
||||
#### (12/14/13)
|
||||
- Fixes issue <a href="https://github.com/Jawbone/JBChartView/pull/2">#2</a>.
|
||||
## [v2.8.10](https://github.com/Jawbone/JBChartView/tree/v2.8.10) (2014-09-23)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.9...v2.8.10)
|
||||
|
||||
## <a href="https://github.com/Jawbone/JBChartView/tree/v1.0">1.0</a>
|
||||
#### 12/10/13
|
||||
- Initial public release.
|
||||
- Base line and bar charts.
|
||||
- Basic customization; color, positioning, selections.
|
||||
## [v2.8.9](https://github.com/Jawbone/JBChartView/tree/v2.8.9) (2014-09-22)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.8...v2.8.9)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- JBLineChartView doesn't resize its subviews [\#111](https://github.com/Jawbone/JBChartView/issues/111)
|
||||
|
||||
## [v2.8.8](https://github.com/Jawbone/JBChartView/tree/v2.8.8) (2014-09-20)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.7...v2.8.8)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- iOS 8 warnings [\#110](https://github.com/Jawbone/JBChartView/issues/110)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Noob level tutorial [\#109](https://github.com/Jawbone/JBChartView/issues/109)
|
||||
- Data points with uneavenly distributed x-values? [\#108](https://github.com/Jawbone/JBChartView/issues/108)
|
||||
|
||||
## [v2.8.7](https://github.com/Jawbone/JBChartView/tree/v2.8.7) (2014-09-09)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.6...v2.8.7)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Add hide custom dot functionality [\#100](https://github.com/Jawbone/JBChartView/issues/100)
|
||||
- Add footer padding [\#98](https://github.com/Jawbone/JBChartView/issues/98)
|
||||
- DotView is hidden when inside selected table view cell [\#82](https://github.com/Jawbone/JBChartView/issues/82)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- There should be flexibility to change to touch point to nearest data point so vertical selection view just jumps from one data point to another in JBLineChartView. [\#105](https://github.com/Jawbone/JBChartView/issues/105)
|
||||
- barWidth Method and barPadding property should be in JBBarChartView header file. [\#104](https://github.com/Jawbone/JBChartView/issues/104)
|
||||
- Why minimum and maximum should be positive? [\#102](https://github.com/Jawbone/JBChartView/issues/102)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- iOS Framework Support [\#107](https://github.com/Jawbone/JBChartView/pull/107) ([thefirstnikhil](https://github.com/thefirstnikhil))
|
||||
- Only call `numberOfLinesInLineChartView:` once per loop. [\#106](https://github.com/Jawbone/JBChartView/pull/106) ([eventualbuddha](https://github.com/eventualbuddha))
|
||||
|
||||
## [v2.8.6](https://github.com/Jawbone/JBChartView/tree/v2.8.6) (2014-08-29)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.5...v2.8.6)
|
||||
|
||||
## [v2.8.5](https://github.com/Jawbone/JBChartView/tree/v2.8.5) (2014-08-28)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.4...v2.8.5)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Invert option for bar charts [\#97](https://github.com/Jawbone/JBChartView/issues/97)
|
||||
|
||||
## [v2.8.4](https://github.com/Jawbone/JBChartView/tree/v2.8.4) (2014-08-27)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.3...v2.8.4)
|
||||
|
||||
## [v2.8.3](https://github.com/Jawbone/JBChartView/tree/v2.8.3) (2014-08-26)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.2...v2.8.3)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- return type of barPaddingForBarChartView: [\#93](https://github.com/Jawbone/JBChartView/issues/93)
|
||||
- Custom dot functionality [\#92](https://github.com/Jawbone/JBChartView/issues/92)
|
||||
|
||||
## [v2.8.2](https://github.com/Jawbone/JBChartView/tree/v2.8.2) (2014-08-26)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.1...v2.8.2)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Selection view width should equal bar width [\#96](https://github.com/Jawbone/JBChartView/issues/96)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Changing dot radius in dotRadiusForLineAtLineIndex has no effect [\#95](https://github.com/Jawbone/JBChartView/issues/95)
|
||||
|
||||
## [v2.8.1](https://github.com/Jawbone/JBChartView/tree/v2.8.1) (2014-08-23)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.8.0...v2.8.1)
|
||||
|
||||
## [v2.8.0](https://github.com/Jawbone/JBChartView/tree/v2.8.0) (2014-08-15)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.7.4...v2.8.0)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Don't bring selection view to front with line view [\#89](https://github.com/Jawbone/JBChartView/issues/89)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Add per-line vertical selection color support. [\#90](https://github.com/Jawbone/JBChartView/pull/90) ([mszaro](https://github.com/mszaro))
|
||||
|
||||
## [v2.7.4](https://github.com/Jawbone/JBChartView/tree/v2.7.4) (2014-08-15)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.7.3...v2.7.4)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Not able to create Y-Axis labels or background grid [\#20](https://github.com/Jawbone/JBChartView/issues/20)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- \[Enhancement\] Provide an option to disable Y-axis normalization for line graphs [\#88](https://github.com/Jawbone/JBChartView/issues/88)
|
||||
- Add left padding to the graph for y-axis labels [\#87](https://github.com/Jawbone/JBChartView/issues/87)
|
||||
- Error Protocol not implemented [\#86](https://github.com/Jawbone/JBChartView/issues/86)
|
||||
- What if I want to animate the LineChartView progression? [\#85](https://github.com/Jawbone/JBChartView/issues/85)
|
||||
- Enabling smooth lines in line chart view results in line graph clipping \(Out of bounds\)? [\#83](https://github.com/Jawbone/JBChartView/issues/83)
|
||||
|
||||
## [v2.7.3](https://github.com/Jawbone/JBChartView/tree/v2.7.3) (2014-08-07)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.7.2...v2.7.3)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Can I animate bar charts? [\#79](https://github.com/Jawbone/JBChartView/issues/79)
|
||||
- Create generic dataSource and delegate for extensibility. [\#78](https://github.com/Jawbone/JBChartView/issues/78)
|
||||
|
||||
## [v2.7.2](https://github.com/Jawbone/JBChartView/tree/v2.7.2) (2014-08-04)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.7.1...v2.7.2)
|
||||
|
||||
## [v2.7.1](https://github.com/Jawbone/JBChartView/tree/v2.7.1) (2014-08-04)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.7.0...v2.7.1)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Typo in JBBarChartView.h [\#77](https://github.com/Jawbone/JBChartView/issues/77)
|
||||
- Refactor datasource and delegate functions [\#76](https://github.com/Jawbone/JBChartView/issues/76)
|
||||
|
||||
## [v2.7.0](https://github.com/Jawbone/JBChartView/tree/v2.7.0) (2014-08-02)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.6.3...v2.7.0)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Incorrect padding on line widths [\#75](https://github.com/Jawbone/JBChartView/issues/75)
|
||||
|
||||
## [v2.6.3](https://github.com/Jawbone/JBChartView/tree/v2.6.3) (2014-07-31)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.6.2...v2.6.3)
|
||||
|
||||
## [v2.6.2](https://github.com/Jawbone/JBChartView/tree/v2.6.2) (2014-07-25)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.6.1...v2.6.2)
|
||||
|
||||
## [v2.6.1](https://github.com/Jawbone/JBChartView/tree/v2.6.1) (2014-07-25)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.6.0...v2.6.1)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- iOS 6 support [\#74](https://github.com/Jawbone/JBChartView/pull/74) ([luosheng](https://github.com/luosheng))
|
||||
|
||||
## [v2.6.0](https://github.com/Jawbone/JBChartView/tree/v2.6.0) (2014-07-24)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.5.5...v2.6.0)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Allow setting views for lines as well as bars [\#73](https://github.com/Jawbone/JBChartView/issues/73)
|
||||
- Requires iOS 7 or later [\#72](https://github.com/Jawbone/JBChartView/issues/72)
|
||||
- How to Know the x,width of each bar [\#70](https://github.com/Jawbone/JBChartView/issues/70)
|
||||
- Multiple y-axis [\#69](https://github.com/Jawbone/JBChartView/issues/69)
|
||||
- NSInternalInconsistencyException - JBLineChartView // dataSource must implement [\#68](https://github.com/Jawbone/JBChartView/issues/68)
|
||||
- Zoom and scrolling? \(Question\) [\#65](https://github.com/Jawbone/JBChartView/issues/65)
|
||||
- Support for missing data points rather than going to 0? [\#63](https://github.com/Jawbone/JBChartView/issues/63)
|
||||
- Interesting behavior 'barViewAtIndex' and 'colorForBarViewAtIndex'. [\#62](https://github.com/Jawbone/JBChartView/issues/62)
|
||||
- In LineChart x-axis, splits into more numbers and not able view x-axis last point [\#60](https://github.com/Jawbone/JBChartView/issues/60)
|
||||
- Overlay more than 1 chart? [\#59](https://github.com/Jawbone/JBChartView/issues/59)
|
||||
- Footer Views - Can they be perpendicular to the x-axis [\#58](https://github.com/Jawbone/JBChartView/issues/58)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fill Color on Line Chart [\#71](https://github.com/Jawbone/JBChartView/pull/71) ([legranddamien](https://github.com/legranddamien))
|
||||
- Added documentation for usage in a Swift project [\#67](https://github.com/Jawbone/JBChartView/pull/67) ([jonparker](https://github.com/jonparker))
|
||||
|
||||
## [v2.5.5](https://github.com/Jawbone/JBChartView/tree/v2.5.5) (2014-05-14)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.5.4...v2.5.5)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Ability to draw lines with negative values [\#51](https://github.com/Jawbone/JBChartView/issues/51)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- How to adjust selected bar height for LineChart in demo project [\#56](https://github.com/Jawbone/JBChartView/issues/56)
|
||||
- Line Chart Collapse Animation Changed? [\#54](https://github.com/Jawbone/JBChartView/issues/54)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fixed barView's frame. [\#57](https://github.com/Jawbone/JBChartView/pull/57) ([pala](https://github.com/pala))
|
||||
- Update sample code in readme [\#55](https://github.com/Jawbone/JBChartView/pull/55) ([pala](https://github.com/pala))
|
||||
|
||||
## [v2.5.4](https://github.com/Jawbone/JBChartView/tree/v2.5.4) (2014-05-07)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.5.3...v2.5.4)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Add delegate method barChartView:colorForBarViewAtIndex: to JBBarChartViewDataSource [\#53](https://github.com/Jawbone/JBChartView/pull/53) ([skywinder](https://github.com/skywinder))
|
||||
- Compiling warrnings and typos [\#52](https://github.com/Jawbone/JBChartView/pull/52) ([skywinder](https://github.com/skywinder))
|
||||
|
||||
## [v2.5.3](https://github.com/Jawbone/JBChartView/tree/v2.5.3) (2014-05-06)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.5.2...v2.5.3)
|
||||
|
||||
## [v2.5.2](https://github.com/Jawbone/JBChartView/tree/v2.5.2) (2014-05-06)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.5.1...v2.5.2)
|
||||
|
||||
## [v2.5.1](https://github.com/Jawbone/JBChartView/tree/v2.5.1) (2014-05-05)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.5.0...v2.5.1)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- non-evenly distributed plots [\#50](https://github.com/Jawbone/JBChartView/issues/50)
|
||||
- Using minimum of 0 as default [\#48](https://github.com/Jawbone/JBChartView/issues/48)
|
||||
|
||||
## [v2.5.0](https://github.com/Jawbone/JBChartView/tree/v2.5.0) (2014-05-04)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.4.3...v2.5.0)
|
||||
|
||||
## [v2.4.3](https://github.com/Jawbone/JBChartView/tree/v2.4.3) (2014-05-04)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.4.2...v2.4.3)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Bars not drawn when all have the same height [\#47](https://github.com/Jawbone/JBChartView/issues/47)
|
||||
- Moving podspec to root [\#46](https://github.com/Jawbone/JBChartView/issues/46)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- fixed typo, renamed mininum -\> minimum [\#49](https://github.com/Jawbone/JBChartView/pull/49) ([simonnickel](https://github.com/simonnickel))
|
||||
|
||||
## [v2.4.2](https://github.com/Jawbone/JBChartView/tree/v2.4.2) (2014-05-01)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.4.1...v2.4.2)
|
||||
|
||||
## [v2.4.1](https://github.com/Jawbone/JBChartView/tree/v2.4.1) (2014-04-30)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.4.0...v2.4.1)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Curved line charts [\#23](https://github.com/Jawbone/JBChartView/issues/23)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- JBChartView demo footerview problem [\#44](https://github.com/Jawbone/JBChartView/issues/44)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Smooth curve fix [\#45](https://github.com/Jawbone/JBChartView/pull/45) ([ktran03](https://github.com/ktran03))
|
||||
|
||||
## [v2.4.0](https://github.com/Jawbone/JBChartView/tree/v2.4.0) (2014-04-28)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.3.0...v2.4.0)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Aligning X-axis, padding? [\#43](https://github.com/Jawbone/JBChartView/issues/43)
|
||||
- `JBLineChartFooterView` Value Marks are Inaccurate [\#41](https://github.com/Jawbone/JBChartView/issues/41)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- smooth curve using bezierpath [\#39](https://github.com/Jawbone/JBChartView/pull/39) ([ktran03](https://github.com/ktran03))
|
||||
|
||||
## [v2.3.0](https://github.com/Jawbone/JBChartView/tree/v2.3.0) (2014-04-18)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.2.0...v2.3.0)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Crash, lineChartView "must implement numberOfPointsInLineChartView" ? [\#38](https://github.com/Jawbone/JBChartView/issues/38)
|
||||
|
||||
## [v2.2.0](https://github.com/Jawbone/JBChartView/tree/v2.2.0) (2014-04-14)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.1.6...v2.2.0)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Typo in readme? [\#36](https://github.com/Jawbone/JBChartView/issues/36)
|
||||
- Nav bar background remains black [\#35](https://github.com/Jawbone/JBChartView/issues/35)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Added delegate method to configure the width of the vertical selection bar in a line chart. [\#37](https://github.com/Jawbone/JBChartView/pull/37) ([ghost](https://github.com/ghost))
|
||||
|
||||
## [v2.1.6](https://github.com/Jawbone/JBChartView/tree/v2.1.6) (2014-04-11)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.1.5...v2.1.6)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- `showsLineSelection` Does Nothing [\#33](https://github.com/Jawbone/JBChartView/issues/33)
|
||||
- cocoapods [\#31](https://github.com/Jawbone/JBChartView/issues/31)
|
||||
|
||||
## [v2.1.5](https://github.com/Jawbone/JBChartView/tree/v2.1.5) (2014-04-10)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.1.4...v2.1.5)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- JBChartView: needs initWithCoder initializer for inflation from a xib [\#30](https://github.com/Jawbone/JBChartView/pull/30) ([gumbypp](https://github.com/gumbypp))
|
||||
|
||||
## [v2.1.4](https://github.com/Jawbone/JBChartView/tree/v2.1.4) (2014-04-10)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.1.3...v2.1.4)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Stach bars? [\#29](https://github.com/Jawbone/JBChartView/issues/29)
|
||||
- Problem with Bar Height [\#28](https://github.com/Jawbone/JBChartView/issues/28)
|
||||
- Selection does not work without Auto Layout in iPhone 3.5" [\#27](https://github.com/Jawbone/JBChartView/issues/27)
|
||||
|
||||
## [v2.1.3](https://github.com/Jawbone/JBChartView/tree/v2.1.3) (2014-04-03)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.1.2...v2.1.3)
|
||||
|
||||
## [v2.1.2](https://github.com/Jawbone/JBChartView/tree/v2.1.2) (2014-04-02)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.1.1...v2.1.2)
|
||||
|
||||
## [v2.1.1](https://github.com/Jawbone/JBChartView/tree/v2.1.1) (2014-04-02)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.1.0...v2.1.1)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- representing negative values [\#26](https://github.com/Jawbone/JBChartView/issues/26)
|
||||
- Real time [\#25](https://github.com/Jawbone/JBChartView/issues/25)
|
||||
|
||||
## [v2.1.0](https://github.com/Jawbone/JBChartView/tree/v2.1.0) (2014-03-31)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.0.2...v2.1.0)
|
||||
|
||||
## [v2.0.2](https://github.com/Jawbone/JBChartView/tree/v2.0.2) (2014-03-27)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.0.1...v2.0.2)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Negative Bars? [\#24](https://github.com/Jawbone/JBChartView/issues/24)
|
||||
|
||||
## [v2.0.1](https://github.com/Jawbone/JBChartView/tree/v2.0.1) (2014-03-19)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v2.0.0...v2.0.1)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- NSAssert on bar height in JBBarChartView, \> 0 when it should be \>= [\#22](https://github.com/Jawbone/JBChartView/issues/22)
|
||||
|
||||
## [v2.0.0](https://github.com/Jawbone/JBChartView/tree/v2.0.0) (2014-03-19)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v1.1.6...v2.0.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Multiple Lines on chart [\#6](https://github.com/Jawbone/JBChartView/issues/6)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- JBBarChartView Bar Height Problem With Storyboard/Autolayout [\#19](https://github.com/Jawbone/JBChartView/issues/19)
|
||||
- blank result [\#18](https://github.com/Jawbone/JBChartView/issues/18)
|
||||
- Bar Highlight Offset Issue [\#17](https://github.com/Jawbone/JBChartView/issues/17)
|
||||
- Following the tutorial creates an empty/blank view [\#16](https://github.com/Jawbone/JBChartView/issues/16)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Multiple Line Support & Tooltips [\#21](https://github.com/Jawbone/JBChartView/pull/21) ([terryworona](https://github.com/terryworona))
|
||||
|
||||
## [v1.1.6](https://github.com/Jawbone/JBChartView/tree/v1.1.6) (2014-03-03)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v1.1.5...v1.1.6)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Added customization for line width [\#15](https://github.com/Jawbone/JBChartView/pull/15) ([kmcbride](https://github.com/kmcbride))
|
||||
- fix spelling mistake [\#14](https://github.com/Jawbone/JBChartView/pull/14) ([Undo1](https://github.com/Undo1))
|
||||
|
||||
## [v1.1.5](https://github.com/Jawbone/JBChartView/tree/v1.1.5) (2014-02-12)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v1.1.4...v1.1.5)
|
||||
|
||||
## [v1.1.4](https://github.com/Jawbone/JBChartView/tree/v1.1.4) (2014-02-06)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v1.1.3...v1.1.4)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- What about ios6 [\#13](https://github.com/Jawbone/JBChartView/issues/13)
|
||||
- Could the Bar Chart data be nil ? [\#12](https://github.com/Jawbone/JBChartView/issues/12)
|
||||
|
||||
## [v1.1.3](https://github.com/Jawbone/JBChartView/tree/v1.1.3) (2014-01-06)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v1.1.2...v1.1.3)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- heightForIndex should return CGFloat instead of NSInteger [\#9](https://github.com/Jawbone/JBChartView/issues/9)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fixes small typos in README [\#11](https://github.com/Jawbone/JBChartView/pull/11) ([sampage](https://github.com/sampage))
|
||||
|
||||
## [v1.1.2](https://github.com/Jawbone/JBChartView/tree/v1.1.2) (2014-01-03)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v1.1.1...v1.1.2)
|
||||
|
||||
## [v1.1.1](https://github.com/Jawbone/JBChartView/tree/v1.1.1) (2014-01-02)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v1.1.0...v1.1.1)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- reloadData is not reducing height of other bars [\#7](https://github.com/Jawbone/JBChartView/issues/7)
|
||||
- Add barViewAtIndex: to datasource [\#5](https://github.com/Jawbone/JBChartView/issues/5)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Reset cached max height on data reload Fixes \#7 [\#8](https://github.com/Jawbone/JBChartView/pull/8) ([l4u](https://github.com/l4u))
|
||||
|
||||
## [v1.1.0](https://github.com/Jawbone/JBChartView/tree/v1.1.0) (2013-12-26)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v1.0.3...v1.1.0)
|
||||
|
||||
## [v1.0.3](https://github.com/Jawbone/JBChartView/tree/v1.0.3) (2013-12-23)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v1.0.2...v1.0.3)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Single press on bar [\#3](https://github.com/Jawbone/JBChartView/issues/3)
|
||||
|
||||
## [v1.0.2](https://github.com/Jawbone/JBChartView/tree/v1.0.2) (2013-12-17)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v1.0.1...v1.0.2)
|
||||
|
||||
## [v1.0.1](https://github.com/Jawbone/JBChartView/tree/v1.0.1) (2013-12-15)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/v1.0...v1.0.1)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- If there is no footer view, bars won't be added to the chart. [\#2](https://github.com/Jawbone/JBChartView/pull/2) ([joelkraut](https://github.com/joelkraut))
|
||||
|
||||
## [v1.0](https://github.com/Jawbone/JBChartView/tree/v1.0) (2013-12-11)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/0.2.0...v1.0)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- JBChartViewDemo and JBChartView [\#1](https://github.com/Jawbone/JBChartView/pull/1) ([terryworona](https://github.com/terryworona))
|
||||
|
||||
## [0.2.0](https://github.com/Jawbone/JBChartView/tree/0.2.0) (2013-08-20)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/1.0...0.2.0)
|
||||
|
||||
## [1.0](https://github.com/Jawbone/JBChartView/tree/1.0) (2012-04-23)
|
||||
[Full Changelog](https://github.com/Jawbone/JBChartView/compare/1.0.0...1.0)
|
||||
|
||||
## [1.0.0](https://github.com/Jawbone/JBChartView/tree/1.0.0) (2012-04-23)
|
||||
|
||||
|
||||
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
||||
@@ -136,4 +136,15 @@
|
||||
*/
|
||||
@property (nonatomic, assign, getter=isInverted) BOOL inverted;
|
||||
|
||||
/**
|
||||
* The bar view at a particular index.
|
||||
*
|
||||
* Default: nil.
|
||||
*
|
||||
* @param index The 0-based index of a given bar (left to right, x-axis).
|
||||
*
|
||||
* @return The UIView representing the bar view at a given index or nil if the index is out of range.
|
||||
*/
|
||||
- (UIView *)barViewAtIndex:(NSUInteger)index;
|
||||
|
||||
@end
|
||||
|
||||
+45
-34
@@ -41,7 +41,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
|
||||
// View quick accessors
|
||||
- (CGFloat)availableHeight;
|
||||
- (CGFloat)normalizedHeightForRawHeight:(NSNumber*)rawHeight;
|
||||
- (CGFloat)normalizedHeightForRawHeight:(NSNumber *)rawHeight;
|
||||
- (CGFloat)barWidth;
|
||||
|
||||
// Touch helpers
|
||||
@@ -57,6 +57,9 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
|
||||
@implementation JBBarChartView
|
||||
|
||||
@dynamic dataSource;
|
||||
@dynamic delegate;
|
||||
|
||||
#pragma mark - Alloc/Init
|
||||
|
||||
+ (void)initialize
|
||||
@@ -296,7 +299,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
return self.bounds.size.height - self.headerView.frame.size.height - self.footerView.frame.size.height - self.headerPadding - self.footerPadding;
|
||||
}
|
||||
|
||||
- (CGFloat)normalizedHeightForRawHeight:(NSNumber*)rawHeight
|
||||
- (CGFloat)normalizedHeightForRawHeight:(NSNumber *)rawHeight
|
||||
{
|
||||
CGFloat minHeight = [self minimumValue];
|
||||
CGFloat maxHeight = [self maximumValue];
|
||||
@@ -304,7 +307,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
|
||||
if ((maxHeight - minHeight) <= 0)
|
||||
{
|
||||
return 0;
|
||||
return [self availableHeight];
|
||||
}
|
||||
|
||||
return ((value - minHeight) / (maxHeight - minHeight)) * [self availableHeight];
|
||||
@@ -400,7 +403,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
[UIView animateWithDuration:kJBBarChartViewStateAnimationDuration delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
|
||||
updateBarView(barView, NO);
|
||||
} completion:^(BOOL lastBarFinished) {
|
||||
if (barView.tag == [self.barViews count] - 1)
|
||||
if ((NSUInteger)barView.tag == [self.barViews count] - 1)
|
||||
{
|
||||
if (callbackCopy)
|
||||
{
|
||||
@@ -438,6 +441,33 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
[self setState:state animated:animated force:NO callback:callback];
|
||||
}
|
||||
|
||||
- (void)setVerticalSelectionViewVisible:(BOOL)verticalSelectionViewVisible animated:(BOOL)animated
|
||||
{
|
||||
_verticalSelectionViewVisible = verticalSelectionViewVisible;
|
||||
|
||||
if (animated)
|
||||
{
|
||||
[UIView animateWithDuration:kJBChartViewDefaultAnimationDuration delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
|
||||
self.verticalSelectionView.alpha = self.verticalSelectionViewVisible ? 1.0 : 0.0;
|
||||
} completion:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.verticalSelectionView.alpha = _verticalSelectionViewVisible ? 1.0 : 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setVerticalSelectionViewVisible:(BOOL)verticalSelectionViewVisible
|
||||
{
|
||||
[self setVerticalSelectionViewVisible:verticalSelectionViewVisible animated:NO];
|
||||
}
|
||||
|
||||
- (void)setShowsVerticalSelection:(BOOL)showsVerticalSelection
|
||||
{
|
||||
_showsVerticalSelection = showsVerticalSelection;
|
||||
self.verticalSelectionView.hidden = _showsVerticalSelection ? NO : YES;
|
||||
}
|
||||
|
||||
#pragma mark - Getters
|
||||
|
||||
- (CGFloat)cachedMinHeight
|
||||
@@ -478,6 +508,15 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
return self.cachedMaxHeight;
|
||||
}
|
||||
|
||||
- (UIView *)barViewAtIndex:(NSUInteger)index
|
||||
{
|
||||
if (index < [self.barViews count])
|
||||
{
|
||||
return [self.barViews objectAtIndex:index];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - Touch Helpers
|
||||
|
||||
- (NSInteger)barViewIndexForPoint:(CGPoint)point
|
||||
@@ -522,7 +561,7 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
UITouch *touch = [touches anyObject];
|
||||
CGPoint touchPoint = [touch locationInView:self];
|
||||
UIView *barView = [self barViewForForPoint:touchPoint];
|
||||
@@ -581,39 +620,11 @@ static UIColor *kJBBarChartViewDefaultBarColor = nil;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
- (void)setVerticalSelectionViewVisible:(BOOL)verticalSelectionViewVisible animated:(BOOL)animated
|
||||
{
|
||||
_verticalSelectionViewVisible = verticalSelectionViewVisible;
|
||||
|
||||
if (animated)
|
||||
{
|
||||
[UIView animateWithDuration:kJBChartViewDefaultAnimationDuration delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
|
||||
self.verticalSelectionView.alpha = self.verticalSelectionViewVisible ? 1.0 : 0.0;
|
||||
} completion:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.verticalSelectionView.alpha = _verticalSelectionViewVisible ? 1.0 : 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setVerticalSelectionViewVisible:(BOOL)verticalSelectionViewVisible
|
||||
{
|
||||
[self setVerticalSelectionViewVisible:verticalSelectionViewVisible animated:NO];
|
||||
}
|
||||
|
||||
- (void)setShowsVerticalSelection:(BOOL)showsVerticalSelection
|
||||
{
|
||||
_showsVerticalSelection = showsVerticalSelection;
|
||||
self.verticalSelectionView.hidden = _showsVerticalSelection ? NO : YES;
|
||||
}
|
||||
|
||||
#pragma mark - Touches
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
[self setVerticalSelectionViewVisible:NO animated:NO];
|
||||
[self touchesBeganOrMovedWithTouches:touches];
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
extern CGFloat const kJBChartViewDefaultAnimationDuration;
|
||||
|
||||
@@ -119,6 +120,7 @@ typedef NS_ENUM(NSInteger, JBChartViewState){
|
||||
/**
|
||||
* Acts similiar to a UITableView's reloadData function.
|
||||
* The entire chart will be torn down and re-constructed via datasource and delegate protocls.
|
||||
* If a chart's frame changes, reloadData must be called directly afterwards for the changes to take effect.
|
||||
*/
|
||||
- (void)reloadData;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ typedef NS_ENUM(NSInteger, JBLineChartViewLineStyle){
|
||||
* Dot size is relative to the line width and not adjustable.
|
||||
* Dot color is equal to the line color and not adjustable.
|
||||
*
|
||||
* Default: NO
|
||||
* Default: NO.
|
||||
*
|
||||
* @param lineChartView The line chart object requesting this information.
|
||||
* @param lineIndex An index number identifying a line in the chart.
|
||||
@@ -66,7 +66,7 @@ typedef NS_ENUM(NSInteger, JBLineChartViewLineStyle){
|
||||
/**
|
||||
* Returns whether or not a line should be rendered with curved connections and rounded end caps.
|
||||
*
|
||||
* Default: NO
|
||||
* Default: NO.
|
||||
*
|
||||
* @param lineChartView The line chart object requesting this information.
|
||||
* @param lineIndex An index number identifying a line in the chart.
|
||||
@@ -75,6 +75,19 @@ typedef NS_ENUM(NSInteger, JBLineChartViewLineStyle){
|
||||
*/
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView smoothLineAtLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
/**
|
||||
* Returns the opacity value to be used for dimming the line & fill during selection events.
|
||||
* This value is applied to the line or fill's opacity anytime it's not selected (but another line is).
|
||||
*
|
||||
* Default: 0.2.
|
||||
*
|
||||
* @param lineChartView The line chart object requesting this information.
|
||||
* @param lineIndex An index number identifying a line in the chart.
|
||||
*
|
||||
* @return A value between 0.0 and 1.0 (will be clamped accordingly).
|
||||
*/
|
||||
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView dimmedSelectionOpacityAtLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
/**
|
||||
* Returns a (custom) UIView instance representing a dot (x,y point) within the chart.
|
||||
* For this value to apply, showsDotsForLineAtLineIndex: must return YES for the line at lineIndex.
|
||||
@@ -96,7 +109,7 @@ typedef NS_ENUM(NSInteger, JBLineChartViewLineStyle){
|
||||
/**
|
||||
* Returns whether or not a (custom) dot view should be hidden on selection events.
|
||||
*
|
||||
* Default: NO
|
||||
* Default: NO.
|
||||
*
|
||||
* @param lineChartView The line chart object requesting this information.
|
||||
* @param horizontalIndex The 0-based horizontal index of a selection point (left to right, x-axis).
|
||||
@@ -115,6 +128,8 @@ typedef NS_ENUM(NSInteger, JBLineChartViewLineStyle){
|
||||
/**
|
||||
* Vertical value for a line point at a given index (left to right). There is no ceiling on the the height;
|
||||
* the chart will automatically normalize all values between the overal min and max heights.
|
||||
* NAN may able be retuend to indicate missing values. The chart's line will begin at the first non-NAN value and end at the last non-NAN value.
|
||||
* Furthermore, the line will interopolate any NAN values in between (ie. the line will not be interrupted).
|
||||
*
|
||||
* @param lineChartView The line chart object requesting this information.
|
||||
* @param horizontalIndex The 0-based horizontal index of a selection point (left to right, x-axis).
|
||||
@@ -130,8 +145,8 @@ typedef NS_ENUM(NSInteger, JBLineChartViewLineStyle){
|
||||
* Occurs whenever there is a touch gesture on the chart (chart must be expanded).
|
||||
* The horizontal index is the closest index to the touch point & is clamped to it's max/min value if it moves outside of the view's bounds.
|
||||
* The lineIndex remains constant until the line is deselected and will be highlighted using the (optional) selectionColorForLineAtLineIndex: protocol.
|
||||
* Futhermore, all other lines that aren't selected will be dimmed to 20%% opacity throughout the duration of the touch/move. Any dotted line that isn't the
|
||||
* primary selection will have it's dots dimmed to hidden (to avoid transparency issues).
|
||||
* Futhermore, all other lines that aren't selected will be dimmed to 20% opacity (default) throughout the duration of the touch/move.
|
||||
* Any dotted line that isn't the primary selection will have it's dots dimmed to hidden (to avoid transparency issues).
|
||||
*
|
||||
* @param lineChartView A line chart object informing the delegate about the new selection.
|
||||
* @param lineIndex An index number identifying the closest line in the chart to the current touch
|
||||
@@ -148,6 +163,16 @@ typedef NS_ENUM(NSInteger, JBLineChartViewLineStyle){
|
||||
*/
|
||||
- (void)didDeselectLineInLineChartView:(JBLineChartView *)lineChartView;
|
||||
|
||||
/**
|
||||
* Returns whether or not a line at a particular index responds to selection events.
|
||||
*
|
||||
* Default: YES
|
||||
*
|
||||
* @param lineChartView A line chart object informing the delegate about the new selection.
|
||||
* @param lineIndex An index number identifying the closest line in the chart to the current touch
|
||||
*/
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView shouldIgnoreSelectionAtIndex:(NSUInteger)lineIndex;
|
||||
|
||||
/**
|
||||
* Returns the color of particular line at lineIndex within the chart.
|
||||
*
|
||||
@@ -204,7 +229,7 @@ typedef NS_ENUM(NSInteger, JBLineChartViewLineStyle){
|
||||
* For this value to apply, showsDotsForLineAtLineIndex: must return YES for the line at lineIndex.
|
||||
* Any value can be returned for lineIndex's that don't support dots, as it will never be called.
|
||||
*
|
||||
* Default: line width x 3.
|
||||
* Default: line width x 6.
|
||||
*
|
||||
* @param lineChartView The line chart object requesting this information.
|
||||
* @param horizontalIndex The 0-based horizontal index of a selection point (left to right, x-axis).
|
||||
@@ -283,7 +308,7 @@ typedef NS_ENUM(NSInteger, JBLineChartViewLineStyle){
|
||||
* Returns the line style of a particular line at lineIndex within the chart.
|
||||
* See JBLineChartViewLineStyle for line style descriptions.
|
||||
*
|
||||
* Default: JBLineChartViewLineStyleSolid
|
||||
* Default: JBLineChartViewLineStyleSolid.
|
||||
*
|
||||
* @param lineChartView The line chart object requesting this information.
|
||||
* @param lineIndex An index number identifying a line in the chart.
|
||||
@@ -315,4 +340,16 @@ typedef NS_ENUM(NSInteger, JBLineChartViewLineStyle){
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL showsLineSelection;
|
||||
|
||||
/**
|
||||
* The dot view within a particular line at a horizontalIndex.
|
||||
*
|
||||
* Default: nil.
|
||||
*
|
||||
* @param horizontalIndex The 0-based horizontal index of a selection point (left to right, x-axis)
|
||||
* @param lineIndex An index number identifying a line in the chart.
|
||||
*
|
||||
* @return The UIView representing the dot view at a given horizontalIndex within a line or nil if any index is out of range.
|
||||
*/
|
||||
- (UIView *)dotViewAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
@end
|
||||
|
||||
+187
-111
@@ -75,6 +75,7 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
@interface JBLineChartPoint : NSObject
|
||||
|
||||
@property (nonatomic, assign) CGPoint position;
|
||||
@property (nonatomic, assign) BOOL hidden;
|
||||
|
||||
@end
|
||||
|
||||
@@ -112,6 +113,7 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
- (CGFloat)paddingForLineChartLinesView:(JBLineChartLinesView *)lineChartLinesView;
|
||||
- (JBLineChartViewLineStyle)lineChartLinesView:(JBLineChartLinesView *)lineChartLinesView lineStyleForLineAtLineIndex:(NSUInteger)lineIndex;
|
||||
- (BOOL)lineChartLinesView:(JBLineChartLinesView *)lineChartLinesView smoothLineAtLineIndex:(NSUInteger)lineIndex;
|
||||
- (CGFloat)lineChartLinesView:(JBLineChartLinesView *)lineChartLinesView dimmedSelectionOpacityAtLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
@end
|
||||
|
||||
@@ -186,6 +188,9 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
|
||||
@implementation JBLineChartView
|
||||
|
||||
@dynamic dataSource;
|
||||
@dynamic delegate;
|
||||
|
||||
#pragma mark - Alloc/Init
|
||||
|
||||
+ (void)initialize
|
||||
@@ -267,7 +272,8 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
|
||||
NSMutableArray *mutableChartData = [NSMutableArray array];
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(numberOfLinesInLineChartView:)], @"JBLineChartView // dataSource must implement - (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView");
|
||||
for (NSUInteger lineIndex=0; lineIndex<[self.dataSource numberOfLinesInLineChartView:self]; lineIndex++)
|
||||
NSUInteger numberOfLines = [self.dataSource numberOfLinesInLineChartView:self];
|
||||
for (NSUInteger lineIndex=0; lineIndex<numberOfLines; lineIndex++)
|
||||
{
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartView:numberOfVerticalValuesAtLineIndex:)], @"JBLineChartView // dataSource must implement - (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex");
|
||||
NSUInteger dataCount = [self.dataSource lineChartView:self numberOfVerticalValuesAtLineIndex:lineIndex];
|
||||
@@ -276,14 +282,20 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
{
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartView:verticalValueForHorizontalIndex:atLineIndex:)], @"JBLineChartView // delegate must implement - (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex");
|
||||
CGFloat rawHeight = [self.delegate lineChartView:self verticalValueForHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||
NSAssert(rawHeight >= 0, @"JBLineChartView // delegate function - (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex must return a CGFloat >= 0");
|
||||
NSAssert(isnan(rawHeight) || (rawHeight >= 0), @"JBLineChartView // delegate function - (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex must return a CGFloat >= 0 OR NAN");
|
||||
|
||||
JBLineChartPoint *chartPoint = [[JBLineChartPoint alloc] init];
|
||||
if(isnan(rawHeight))
|
||||
{
|
||||
chartPoint.hidden = YES;
|
||||
rawHeight = 0; //set to 0 so we can calculate the x position
|
||||
}
|
||||
|
||||
CGFloat normalizedHeight = [self normalizedHeightForRawHeight:rawHeight];
|
||||
yOffset = mainViewRect.size.height - normalizedHeight;
|
||||
|
||||
JBLineChartPoint *chartPoint = [[JBLineChartPoint alloc] init];
|
||||
chartPoint.position = CGPointMake(xOffset, yOffset);
|
||||
|
||||
|
||||
[chartPointData addObject:chartPoint];
|
||||
xOffset += pointSpace;
|
||||
}
|
||||
@@ -301,6 +313,7 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
// Remove old line view
|
||||
if (self.linesView)
|
||||
{
|
||||
self.linesView.delegate = nil;
|
||||
[self.linesView removeFromSuperview];
|
||||
self.linesView = nil;
|
||||
}
|
||||
@@ -328,6 +341,7 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
// Remove old dot view
|
||||
if (self.dotsView)
|
||||
{
|
||||
self.dotsView.delegate = nil;
|
||||
[self.dotsView removeFromSuperview];
|
||||
self.dotsView = nil;
|
||||
}
|
||||
@@ -422,7 +436,7 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
|
||||
if ((maxHeight - minHeight) <= 0)
|
||||
{
|
||||
return 0;
|
||||
return [self availableHeight];
|
||||
}
|
||||
|
||||
return ((rawHeight - minHeight) / (maxHeight - minHeight)) * [self availableHeight];
|
||||
@@ -437,8 +451,9 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
{
|
||||
CGFloat maxLineWidth = 0.0f;
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(numberOfLinesInLineChartView:)], @"JBLineChartView // dataSource must implement - (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView");
|
||||
NSInteger numberOfLines = [self.dataSource numberOfLinesInLineChartView:self];
|
||||
|
||||
for (NSUInteger lineIndex=0; lineIndex<[self.dataSource numberOfLinesInLineChartView:self]; lineIndex++)
|
||||
for (NSInteger lineIndex=0; lineIndex<numberOfLines; lineIndex++)
|
||||
{
|
||||
BOOL showsDots = NO;
|
||||
if ([self.dataSource respondsToSelector:@selector(lineChartView:showsDotsForLineAtLineIndex:)])
|
||||
@@ -455,72 +470,68 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
CGFloat maxDotLength = 0;
|
||||
if (showsDots)
|
||||
{
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(numberOfLinesInLineChartView:)], @"JBLineChartView // dataSource must implement - (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView");
|
||||
for (NSUInteger lineIndex=0; lineIndex<[self.dataSource numberOfLinesInLineChartView:self]; lineIndex++)
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartView:numberOfVerticalValuesAtLineIndex:)], @"JBLineChartView // dataSource must implement - (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex");
|
||||
NSUInteger dataCount = [self.dataSource lineChartView:self numberOfVerticalValuesAtLineIndex:lineIndex];
|
||||
|
||||
for (NSUInteger horizontalIndex=0; horizontalIndex<dataCount; horizontalIndex++)
|
||||
{
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartView:numberOfVerticalValuesAtLineIndex:)], @"JBLineChartView // dataSource must implement - (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex");
|
||||
NSUInteger dataCount = [self.dataSource lineChartView:self numberOfVerticalValuesAtLineIndex:lineIndex];
|
||||
BOOL shouldEvaluateDotSize = NO;
|
||||
|
||||
for (NSUInteger horizontalIndex=0; horizontalIndex<dataCount; horizontalIndex++)
|
||||
// Left dot
|
||||
if (horizontalIndex == 0)
|
||||
{
|
||||
BOOL shouldEvaluateDotSize = NO;
|
||||
shouldEvaluateDotSize = YES;
|
||||
}
|
||||
// Right dot
|
||||
else if (horizontalIndex == (dataCount - 1))
|
||||
{
|
||||
shouldEvaluateDotSize = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartView:verticalValueForHorizontalIndex:atLineIndex:)], @"JBLineChartView // delegate must implement - (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex");
|
||||
CGFloat height = [self.delegate lineChartView:self verticalValueForHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||
|
||||
// Left dot
|
||||
if (horizontalIndex == 0)
|
||||
// Top
|
||||
if (height == [self cachedMaxHeight])
|
||||
{
|
||||
shouldEvaluateDotSize = YES;
|
||||
}
|
||||
// Right dot
|
||||
else if (horizontalIndex == (dataCount - 1))
|
||||
|
||||
// Bottom
|
||||
else if (height == [self cachedMinHeight])
|
||||
{
|
||||
shouldEvaluateDotSize = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartView:verticalValueForHorizontalIndex:atLineIndex:)], @"JBLineChartView // delegate must implement - (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex");
|
||||
CGFloat height = [self.delegate lineChartView:self verticalValueForHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||
|
||||
// Top
|
||||
if (height == [self cachedMaxHeight])
|
||||
{
|
||||
shouldEvaluateDotSize = YES;
|
||||
}
|
||||
|
||||
// Bottom
|
||||
else if (height == [self cachedMinHeight])
|
||||
{
|
||||
shouldEvaluateDotSize = YES;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldEvaluateDotSize)
|
||||
}
|
||||
|
||||
if (shouldEvaluateDotSize)
|
||||
{
|
||||
if ([self.dataSource respondsToSelector:@selector(lineChartView:dotViewAtHorizontalIndex:atLineIndex:)])
|
||||
{
|
||||
if ([self.dataSource respondsToSelector:@selector(lineChartView:dotViewAtHorizontalIndex:atLineIndex:)])
|
||||
{
|
||||
if ([self.dataSource respondsToSelector:@selector(lineChartView:dotViewAtHorizontalIndex:atLineIndex:)])
|
||||
UIView *customDotView = [self.dataSource lineChartView:self dotViewAtHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||
if (customDotView.frame.size.width > maxDotLength || customDotView.frame.size.height > maxDotLength)
|
||||
{
|
||||
UIView *customDotView = [self.dataSource lineChartView:self dotViewAtHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||
if (customDotView.frame.size.width > maxDotLength || customDotView.frame.size.height > maxDotLength)
|
||||
{
|
||||
maxDotLength = fmaxf(customDotView.frame.size.width, customDotView.frame.size.height);
|
||||
}
|
||||
maxDotLength = fmaxf(customDotView.frame.size.width, customDotView.frame.size.height);
|
||||
}
|
||||
}
|
||||
else if ([self.delegate respondsToSelector:@selector(lineChartView:dotRadiusForDotAtHorizontalIndex:atLineIndex:)])
|
||||
}
|
||||
else if ([self.delegate respondsToSelector:@selector(lineChartView:dotRadiusForDotAtHorizontalIndex:atLineIndex:)])
|
||||
{
|
||||
CGFloat dotRadius = ([self.delegate lineChartView:self dotRadiusForDotAtHorizontalIndex:horizontalIndex atLineIndex:lineIndex] * 2.0f);
|
||||
if (dotRadius > maxDotLength)
|
||||
{
|
||||
CGFloat dotRadius = [self.delegate lineChartView:self dotRadiusForDotAtHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||
if (dotRadius > maxDotLength)
|
||||
{
|
||||
maxDotLength = dotRadius;
|
||||
}
|
||||
maxDotLength = dotRadius;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
CGFloat defaultDotRadius = ((lineWidth * kJBLineChartDotsViewDefaultRadiusFactor) * 2.0f);
|
||||
if (defaultDotRadius > maxDotLength)
|
||||
{
|
||||
CGFloat defaultDotRadius = lineWidth * kJBLineChartDotsViewDefaultRadiusFactor;
|
||||
if (defaultDotRadius > maxDotLength)
|
||||
{
|
||||
maxDotLength = defaultDotRadius;
|
||||
}
|
||||
maxDotLength = defaultDotRadius;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -540,7 +551,8 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
{
|
||||
NSUInteger dataCount = 0;
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(numberOfLinesInLineChartView:)], @"JBLineChartView // dataSource must implement - (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView");
|
||||
for (NSUInteger lineIndex=0; lineIndex<[self.dataSource numberOfLinesInLineChartView:self]; lineIndex++)
|
||||
NSInteger numberOfLines = [self.dataSource numberOfLinesInLineChartView:self];
|
||||
for (NSInteger lineIndex=0; lineIndex<numberOfLines; lineIndex++)
|
||||
{
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartView:numberOfVerticalValuesAtLineIndex:)], @"JBLineChartView // dataSource must implement - (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex");
|
||||
NSUInteger lineDataCount = [self.dataSource lineChartView:self numberOfVerticalValuesAtLineIndex:lineIndex];
|
||||
@@ -627,6 +639,15 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (CGFloat)lineChartLinesView:(JBLineChartLinesView *)lineChartLinesView dimmedSelectionOpacityAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
if ([self.dataSource respondsToSelector:@selector(lineChartView:dimmedSelectionOpacityAtLineIndex:)])
|
||||
{
|
||||
return [self.dataSource lineChartView:self dimmedSelectionOpacityAtLineIndex:lineIndex];
|
||||
}
|
||||
return kJBLineChartLinesViewDefaultDimmedOpacity;
|
||||
}
|
||||
|
||||
#pragma mark - JBLineChartDotsViewDelegate
|
||||
|
||||
- (NSArray *)chartDataForLineChartDotsView:(JBLineChartDotsView*)lineChartDotsView
|
||||
@@ -766,6 +787,33 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
[self setState:state animated:animated force:NO callback:callback];
|
||||
}
|
||||
|
||||
- (void)setVerticalSelectionViewVisible:(BOOL)verticalSelectionViewVisible animated:(BOOL)animated
|
||||
{
|
||||
_verticalSelectionViewVisible = verticalSelectionViewVisible;
|
||||
|
||||
if (animated)
|
||||
{
|
||||
[UIView animateWithDuration:kJBChartViewDefaultAnimationDuration delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
|
||||
self.verticalSelectionView.alpha = self.verticalSelectionViewVisible ? 1.0 : 0.0;
|
||||
} completion:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.verticalSelectionView.alpha = _verticalSelectionViewVisible ? 1.0 : 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setVerticalSelectionViewVisible:(BOOL)verticalSelectionViewVisible
|
||||
{
|
||||
[self setVerticalSelectionViewVisible:verticalSelectionViewVisible animated:NO];
|
||||
}
|
||||
|
||||
- (void)setShowsVerticalSelection:(BOOL)showsVerticalSelection
|
||||
{
|
||||
_showsVerticalSelection = showsVerticalSelection;
|
||||
self.verticalSelectionView.hidden = _showsVerticalSelection ? NO : YES;
|
||||
}
|
||||
|
||||
#pragma mark - Getters
|
||||
|
||||
- (CGFloat)cachedMinHeight
|
||||
@@ -774,7 +822,8 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
{
|
||||
CGFloat minHeight = FLT_MAX;
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(numberOfLinesInLineChartView:)], @"JBLineChartView // dataSource must implement - (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView");
|
||||
for (NSUInteger lineIndex=0; lineIndex<[self.dataSource numberOfLinesInLineChartView:self]; lineIndex++)
|
||||
NSUInteger numberOfLines = [self.dataSource numberOfLinesInLineChartView:self];
|
||||
for (NSUInteger lineIndex=0; lineIndex<numberOfLines; lineIndex++)
|
||||
{
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartView:numberOfVerticalValuesAtLineIndex:)], @"JBLineChartView // dataSource must implement - (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex");
|
||||
NSUInteger dataCount = [self.dataSource lineChartView:self numberOfVerticalValuesAtLineIndex:lineIndex];
|
||||
@@ -782,8 +831,8 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
{
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartView:verticalValueForHorizontalIndex:atLineIndex:)], @"JBLineChartView // delegate must implement - (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex");
|
||||
CGFloat height = [self.delegate lineChartView:self verticalValueForHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||
NSAssert(height >= 0, @"JBLineChartView // delegate function - (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex must return a CGFloat >= 0");
|
||||
if (height < minHeight)
|
||||
NSAssert(isnan(height) || (height >= 0), @"JBLineChartView // delegate function - (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex must return a CGFloat >= 0 OR NAN");
|
||||
if (!isnan(height) && height < minHeight)
|
||||
{
|
||||
minHeight = height;
|
||||
}
|
||||
@@ -800,7 +849,8 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
{
|
||||
CGFloat maxHeight = 0;
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(numberOfLinesInLineChartView:)], @"JBLineChartView // dataSource must implement - (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView");
|
||||
for (NSUInteger lineIndex=0; lineIndex<[self.dataSource numberOfLinesInLineChartView:self]; lineIndex++)
|
||||
NSUInteger numberOfLines = [self.dataSource numberOfLinesInLineChartView:self];
|
||||
for (NSUInteger lineIndex=0; lineIndex<numberOfLines; lineIndex++)
|
||||
{
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartView:numberOfVerticalValuesAtLineIndex:)], @"JBLineChartView // dataSource must implement - (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex");
|
||||
NSUInteger dataCount = [self.dataSource lineChartView:self numberOfVerticalValuesAtLineIndex:lineIndex];
|
||||
@@ -808,8 +858,8 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
{
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartView:verticalValueForHorizontalIndex:atLineIndex:)], @"JBLineChartView // delegate must implement - (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex");
|
||||
CGFloat height = [self.delegate lineChartView:self verticalValueForHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||
NSAssert(height >= 0, @"JBLineChartView // delegate function - (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex must return a CGFloat >= 0");
|
||||
if (height > maxHeight)
|
||||
NSAssert(isnan(height) || (height >= 0), @"JBLineChartView // delegate function - (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex must return a CGFloat >= 0 OR NAN");
|
||||
if (!isnan(height) && height > maxHeight)
|
||||
{
|
||||
maxHeight = height;
|
||||
}
|
||||
@@ -838,6 +888,16 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
return self.cachedMaxHeight;
|
||||
}
|
||||
|
||||
- (UIView *)dotViewAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
NSArray *dotViews = [self.dotsView.dotViewsDict objectForKey:@(lineIndex)];
|
||||
if (horizontalIndex < [dotViews count])
|
||||
{
|
||||
return [dotViews objectAtIndex:horizontalIndex];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - Touch Helpers
|
||||
|
||||
- (CGPoint)clampPoint:(CGPoint)point toBounds:(CGRect)bounds padding:(CGFloat)padding
|
||||
@@ -855,9 +915,9 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
for (JBLineChartPoint *lineChartPoint in lineData)
|
||||
{
|
||||
BOOL clamped = (indexClamp == JBLineChartHorizontalIndexClampNone) ? YES : (indexClamp == JBLineChartHorizontalIndexClampLeft) ? (point.x - lineChartPoint.position.x >= 0) : (point.x - lineChartPoint.position.x <= 0);
|
||||
if ((abs(point.x - lineChartPoint.position.x)) < currentDistance && clamped == YES)
|
||||
if ((fabs(point.x - lineChartPoint.position.x)) < currentDistance && clamped == YES)
|
||||
{
|
||||
currentDistance = (abs(point.x - lineChartPoint.position.x));
|
||||
currentDistance = (fabs(point.x - lineChartPoint.position.x));
|
||||
selectedIndex = index;
|
||||
}
|
||||
index++;
|
||||
@@ -896,11 +956,21 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
NSUInteger shortestDistance = INT_MAX;
|
||||
NSInteger selectedIndex = kJBLineChartUnselectedLineIndex;
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(numberOfLinesInLineChartView:)], @"JBLineChartView // dataSource must implement - (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView");
|
||||
NSUInteger numberOfLines = [self.dataSource numberOfLinesInLineChartView:self];
|
||||
|
||||
// Iterate all lines
|
||||
for (NSUInteger lineIndex=0; lineIndex<[self.dataSource numberOfLinesInLineChartView:self]; lineIndex++)
|
||||
for (NSUInteger lineIndex=0; lineIndex<numberOfLines; lineIndex++)
|
||||
{
|
||||
NSAssert([self.dataSource respondsToSelector:@selector(lineChartView:numberOfVerticalValuesAtLineIndex:)], @"JBLineChartView // dataSource must implement - (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex");
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(lineChartView:shouldIgnoreSelectionAtIndex:)])
|
||||
{
|
||||
if([self.delegate lineChartView:self shouldIgnoreSelectionAtIndex:lineIndex])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ([self.dataSource lineChartView:self numberOfVerticalValuesAtLineIndex:lineIndex] > rightHorizontalIndex)
|
||||
{
|
||||
NSArray *lineData = [self.chartData objectAtIndex:lineIndex];
|
||||
@@ -922,7 +992,7 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
// Insersection point
|
||||
CGPoint interesectionPoint = CGPointMake(normalizedTouchPoint.x, (lineSlope * (normalizedTouchPoint.x - leftPoint.x)) + leftPoint.y);
|
||||
|
||||
CGFloat currentDistance = abs(interesectionPoint.y - normalizedTouchPoint.y);
|
||||
CGFloat currentDistance = fabs(interesectionPoint.y - normalizedTouchPoint.y);
|
||||
if (currentDistance < shortestDistance)
|
||||
{
|
||||
shortestDistance = currentDistance;
|
||||
@@ -937,13 +1007,18 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
{
|
||||
if (self.state == JBChartViewStateCollapsed || [self.chartData count] <= 0)
|
||||
{
|
||||
return;
|
||||
return; // no touch for no data or collapsed
|
||||
}
|
||||
|
||||
|
||||
UITouch *touch = [touches anyObject];
|
||||
CGPoint touchPoint = [self clampPoint:[touch locationInView:self.linesView] toBounds:self.linesView.bounds padding:[self padding]];
|
||||
|
||||
NSUInteger lineIndex = self.linesView.selectedLineIndex != kJBLineChartLinesViewUnselectedLineIndex ? self.linesView.selectedLineIndex : [self lineIndexForPoint:touchPoint];
|
||||
|
||||
if (lineIndex == kJBLineChartLinesViewUnselectedLineIndex || [[self.chartData objectAtIndex:lineIndex] count] <= 0)
|
||||
{
|
||||
return; // no touch for line without data
|
||||
}
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(lineChartView:didSelectLineAtIndex:horizontalIndex:touchPoint:)])
|
||||
{
|
||||
@@ -963,7 +1038,6 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
self.verticalSelectionView.bgColor = verticalSelectionColor;
|
||||
}
|
||||
|
||||
|
||||
CGFloat xOffset = fmin(self.bounds.size.width - self.verticalSelectionView.frame.size.width, fmax(0, touchPoint.x - (ceil(self.verticalSelectionView.frame.size.width * 0.5))));
|
||||
CGFloat yOffset = self.headerView.frame.size.height + self.headerPadding;
|
||||
|
||||
@@ -1000,35 +1074,6 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
- (void)setVerticalSelectionViewVisible:(BOOL)verticalSelectionViewVisible animated:(BOOL)animated
|
||||
{
|
||||
_verticalSelectionViewVisible = verticalSelectionViewVisible;
|
||||
|
||||
if (animated)
|
||||
{
|
||||
[UIView animateWithDuration:kJBChartViewDefaultAnimationDuration delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
|
||||
self.verticalSelectionView.alpha = self.verticalSelectionViewVisible ? 1.0 : 0.0;
|
||||
} completion:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.verticalSelectionView.alpha = _verticalSelectionViewVisible ? 1.0 : 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setVerticalSelectionViewVisible:(BOOL)verticalSelectionViewVisible
|
||||
{
|
||||
[self setVerticalSelectionViewVisible:verticalSelectionViewVisible animated:NO];
|
||||
}
|
||||
|
||||
- (void)setShowsVerticalSelection:(BOOL)showsVerticalSelection
|
||||
{
|
||||
_showsVerticalSelection = showsVerticalSelection;
|
||||
self.verticalSelectionView.hidden = _showsVerticalSelection ? NO : YES;
|
||||
}
|
||||
|
||||
#pragma mark - Gestures
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
@@ -1040,6 +1085,7 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
[self.linesView setSelectedLineIndex:[self lineIndexForPoint:touchPoint] animated:YES];
|
||||
[self.dotsView setSelectedLineIndex:[self lineIndexForPoint:touchPoint] animated:YES];
|
||||
}
|
||||
[self setVerticalSelectionViewVisible:NO animated:NO];
|
||||
[self touchesBeganOrMovedWithTouches:touches];
|
||||
}
|
||||
|
||||
@@ -1180,6 +1226,11 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
NSUInteger lineIndex = 0;
|
||||
for (NSArray *lineData in chartData)
|
||||
{
|
||||
if (lineData.count == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
UIBezierPath *path = [UIBezierPath bezierPath];
|
||||
path.miterLimit = kJBLineChartLinesViewMiterLimit;
|
||||
|
||||
@@ -1189,16 +1240,26 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartLinesView:smoothLineAtLineIndex:)], @"JBLineChartLinesView // delegate must implement - (BOOL)lineChartLinesView:(JBLineChartLinesView *)lineChartLinesView smoothLineAtLineIndex:(NSUInteger)lineIndex");
|
||||
BOOL smoothLine = [self.delegate lineChartLinesView:self smoothLineAtLineIndex:lineIndex];
|
||||
|
||||
NSUInteger index = 0;
|
||||
BOOL visiblePointFound = NO;
|
||||
NSArray *sortedLineData = [lineData sortedArrayUsingSelector:@selector(compare:)];
|
||||
CGFloat firstXPosition = 0.0f;
|
||||
CGFloat lastXPosition = 0.0f;
|
||||
for (JBLineChartPoint *lineChartPoint in sortedLineData)
|
||||
CGFloat firstYPosition = 0.0f;
|
||||
CGFloat lastXPosition = 0.0f;
|
||||
CGFloat lastYPosition = 0.0f;
|
||||
|
||||
for (NSUInteger index = 0; index < [sortedLineData count]; index++)
|
||||
{
|
||||
if (index == 0)
|
||||
JBLineChartPoint *lineChartPoint = [sortedLineData objectAtIndex:index];
|
||||
if(lineChartPoint.hidden) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!visiblePointFound)
|
||||
{
|
||||
[path moveToPoint:CGPointMake(lineChartPoint.position.x, fmin(self.bounds.size.height - padding, fmax(padding, lineChartPoint.position.y)))];
|
||||
firstXPosition = lineChartPoint.position.x;
|
||||
firstYPosition = lineChartPoint.position.y;
|
||||
visiblePointFound = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1231,10 +1292,10 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
}
|
||||
|
||||
lastXPosition = lineChartPoint.position.x;
|
||||
lastYPosition = lineChartPoint.position.y;
|
||||
previousSlope = currentSlope;
|
||||
}
|
||||
previousLineChartPoint = lineChartPoint;
|
||||
index++;
|
||||
}
|
||||
|
||||
JBLineLayer *shapeLayer = [self lineLayerForLineIndex:lineIndex];
|
||||
@@ -1284,9 +1345,15 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
// Continue the path for the fill layer (close and fill)
|
||||
UIBezierPath *fillPath = [path copy];
|
||||
|
||||
[fillPath addLineToPoint:CGPointMake(lastXPosition, self.bounds.size.height - padding)];
|
||||
[fillPath addLineToPoint:CGPointMake(firstXPosition, self.bounds.size.height - padding)];
|
||||
|
||||
if(visiblePointFound)
|
||||
{
|
||||
[fillPath addLineToPoint:CGPointMake(lastXPosition + ceil(padding * 0.5), lastYPosition)];
|
||||
[fillPath addLineToPoint:CGPointMake(lastXPosition + ceil(padding * 0.5), self.bounds.size.height)];
|
||||
|
||||
[fillPath addLineToPoint:CGPointMake(firstXPosition - ceil(padding * 0.5), self.bounds.size.height)];
|
||||
[fillPath addLineToPoint:CGPointMake(firstXPosition - ceil(padding * 0.5), firstYPosition)];
|
||||
}
|
||||
|
||||
shapeFillLayer.path = fillPath.CGPath;
|
||||
shapeFillLayer.frame = self.bounds;
|
||||
|
||||
@@ -1330,7 +1397,9 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
{
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartLinesView:colorForLineAtLineIndex:)], @"JBLineChartLinesView // delegate must implement - (UIColor *)lineChartLinesView:(JBLineChartLinesView *)lineChartLinesView colorForLineAtLineIndex:(NSUInteger)lineIndex");
|
||||
((JBLineLayer *)layer).strokeColor = [self.delegate lineChartLinesView:self colorForLineAtLineIndex:((JBLineLayer *)layer).tag].CGColor;
|
||||
((JBLineLayer *)layer).opacity = (weakSelf.selectedLineIndex == kJBLineChartLinesViewUnselectedLineIndex) ? 1.0f : kJBLineChartLinesViewDefaultDimmedOpacity;
|
||||
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartLinesView:dimmedSelectionOpacityAtLineIndex:)], @"JBLineChartLinesView // delegate must implement - (CGFloat)lineChartLinesView:(JBLineChartLinesView *)lineChartLinesView dimmedSelectionOpacityAtLineIndex:(NSUInteger)lineIndex");
|
||||
((JBLineLayer *)layer).opacity = (weakSelf.selectedLineIndex == kJBLineChartLinesViewUnselectedLineIndex) ? 1.0f : [self.delegate lineChartLinesView:self dimmedSelectionOpacityAtLineIndex:((JBLineLayer *)layer).tag];
|
||||
}
|
||||
}
|
||||
else if ([layer isKindOfClass:[JBFillLayer class]])
|
||||
@@ -1345,7 +1414,9 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
{
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartLinesView:fillColorForLineAtLineIndex:)], @"JBLineChartLinesView // delegate must implement - (UIColor *)lineChartLinesView:(JBLineChartLinesView *)lineChartLinesView fillColorForLineAtLineIndex:(NSUInteger)lineIndex");
|
||||
((JBFillLayer *)layer).fillColor = [self.delegate lineChartLinesView:self fillColorForLineAtLineIndex:((JBLineLayer *)layer).tag].CGColor;
|
||||
((JBFillLayer *)layer).opacity = (weakSelf.selectedLineIndex == kJBLineChartLinesViewUnselectedLineIndex) ? 1.0f : kJBLineChartLinesViewDefaultDimmedOpacity;
|
||||
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartLinesView:dimmedSelectionOpacityAtLineIndex:)], @"JBLineChartLinesView // delegate must implement - (CGFloat)lineChartLinesView:(JBLineChartLinesView *)lineChartLinesView dimmedSelectionOpacityAtLineIndex:(NSUInteger)lineIndex");
|
||||
((JBFillLayer *)layer).opacity = (weakSelf.selectedLineIndex == kJBLineChartLinesViewUnselectedLineIndex) ? 1.0f : [self.delegate lineChartLinesView:self dimmedSelectionOpacityAtLineIndex:((JBLineLayer *)layer).tag];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1455,9 +1526,15 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
if ([self.delegate lineChartDotsView:self showsDotsForLineAtLineIndex:lineIndex]) // line at index contains dots
|
||||
{
|
||||
NSMutableArray *mutableDotViews = [NSMutableArray array];
|
||||
NSUInteger horizontalIndex = 0;
|
||||
for (JBLineChartPoint *lineChartPoint in [lineData sortedArrayUsingSelector:@selector(compare:)])
|
||||
NSArray *sortedLineData = [lineData sortedArrayUsingSelector:@selector(compare:)];
|
||||
for (NSUInteger horizontalIndex = 0; horizontalIndex < [sortedLineData count]; horizontalIndex++)
|
||||
{
|
||||
JBLineChartPoint *lineChartPoint = [sortedLineData objectAtIndex:horizontalIndex];
|
||||
if(lineChartPoint.hidden)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
NSAssert([self.delegate respondsToSelector:@selector(lineChartDotsView:dotViewAtHorizontalIndex:atLineIndex:)], @"JBLineChartDotsView // delegate must implement - (UIView *)lineChartDotsView:(JBLineChartDotsView *)lineChartDotsView dotViewAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex");
|
||||
UIView *currentDotView = [self.delegate lineChartDotsView:self dotViewAtHorizontalIndex:horizontalIndex atLineIndex:lineIndex];
|
||||
|
||||
@@ -1477,7 +1554,6 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
[mutableDotViews addObject:currentDotView];
|
||||
[self addSubview:currentDotView];
|
||||
|
||||
horizontalIndex++;
|
||||
}
|
||||
[mutableDotViewsDict setObject:[NSArray arrayWithArray:mutableDotViews] forKey:[NSNumber numberWithInteger:lineIndex]];
|
||||
}
|
||||
@@ -1563,11 +1639,11 @@ static UIColor *kJBLineChartViewDefaultDotSelectionColor = nil;
|
||||
|
||||
- (id)initWithRadius:(CGFloat)radius
|
||||
{
|
||||
self = [super initWithFrame:CGRectMake(0, 0, radius, radius)];
|
||||
self = [super initWithFrame:CGRectMake(0, 0, (radius * 2.0f), (radius * 2.0f))];
|
||||
if (self)
|
||||
{
|
||||
self.clipsToBounds = YES;
|
||||
self.layer.cornerRadius = (radius * 0.5f);
|
||||
self.layer.cornerRadius = ((radius * 2.0f) * 0.5f);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
## Customization
|
||||
|
||||
Both the line and bar charts support a robust set of customization options.
|
||||
|
||||
The background of a bar or line chart can be set just like any other view:
|
||||
|
||||
self.barChartView.backgroundColor = ...; // UIColor
|
||||
self.lineChartView.backgroundColor = ...; // UIColor
|
||||
|
||||
Any <i>JBChartView</i> subclass supports the use of headers and footers (similiar to that of <i>UITableView</i>):
|
||||
|
||||
self.barChartView.footerView = ...; // UIView
|
||||
self.lineChartView.headerView = ...; // UIView
|
||||
|
||||
Lastly, any JBChartView subclass can be collapsed or expanded programmatically via the <i>state</i> property. If you chose to animate state changes, a callback helper can be used to notify you when the animation has completed:
|
||||
|
||||
- (void)setState:(JBChartViewState)state animated:(BOOL)animated callback:(void (^)())callback;
|
||||
|
||||
#### JBBarChartView
|
||||
|
||||
A bar chart can be inverted such that it's orientation is top->down (including the selection view) by setting the following property:
|
||||
|
||||
@property (nonatomic, assign, getter=isInverted) BOOL inverted;
|
||||
|
||||
By default, a chart's bars will be black and flat. They can be customized by supplying a UIView subclass through the <i>optional</i> protocol:
|
||||
|
||||
- (UIView *)barChartView:(JBBarChartView *)barChartView barViewAtIndex:(NSUInteger)index
|
||||
{
|
||||
return ...; // color of line in chart
|
||||
}
|
||||
|
||||
If you don't require a custom UIView, simply supply a color for the bar instead:
|
||||
|
||||
- (UIColor *)barChartView:(JBBarChartView *)barChartView colorForBarViewAtIndex:(NSUInteger)index;
|
||||
|
||||
Furthermore, the color of the selection bar (on touch events) can be customized via the <i>optional</i> protocol:
|
||||
|
||||
- (UIColor *)barSelectionColorForBarChartView:(JBBarChartView *)barChartView
|
||||
{
|
||||
return ...; // color of selection view
|
||||
}
|
||||
|
||||
Lastly, a bar chart's selection events are delegated back via:
|
||||
|
||||
- (void)barChartView:(JBBarChartView *)barChartView didSelectBarAtIndex:(NSUInteger)index touchPoint:(CGPoint)touchPoint
|
||||
{
|
||||
// Update view
|
||||
}
|
||||
|
||||
- (void)didDeselectBarChartView:(JBBarChartView *)barChartView
|
||||
{
|
||||
// Update view
|
||||
}
|
||||
|
||||
The <b>touchPoint</b> is especially important as it allows you to add custom elements to your chart during selection events. Refer to the demo project (<b>JBarChartViewController</b>) to see how a tooltip can be used to display additional information during selection events.
|
||||
|
||||
#### JBLineChartView
|
||||
|
||||
The color, width and style of each line in the chart can be customized via the <i>optional</i> protocol:
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView colorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // color of line in chart
|
||||
}
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView fillColorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // color of area under line in chart
|
||||
}
|
||||
|
||||
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView widthForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // width of line in chart
|
||||
}
|
||||
|
||||
- (JBLineChartViewLineStyle)lineChartView:(JBLineChartView *)lineChartView lineStyleForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // style of line in chart
|
||||
}
|
||||
|
||||
Furthermore, the color and width of the selection view along with the color of the selected line can be customized via the <i>optional</i> protocols:
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView verticalSelectionColorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // color of selection view
|
||||
}
|
||||
|
||||
- (CGFloat)verticalSelectionWidthForLineChartView:(JBLineChartView *)lineChartView
|
||||
{
|
||||
return ...; // width of selection view
|
||||
}
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView selectionColorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // color of selected line
|
||||
}
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView selectionFillColorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // color of area under selected line
|
||||
}
|
||||
|
||||
By default, each line will not show dots for each point. To enable this on a per-line basis:
|
||||
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView showsDotsForLineAtLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
To the radius of each dot (default is 6x the line width, or 3x the diameter), implement:
|
||||
|
||||
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView dotRadiusForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
To customize the color of each dot during selection and non-selection events (default is white and black respectively), implement:
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView colorForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView selectionColorForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
Alternatively, you can supply your own UIView instead of using the default impelmentation:
|
||||
|
||||
- (UIView *)lineChartView:(JBLineChartView *)lineChartView dotViewAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
Custom dot views are automatically shown when selected unless the following is implemented:
|
||||
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView shouldHideDotViewOnSelectionAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
As well, by default, each line will have squared off end caps and connection points. To enable rounded connections and end caps:
|
||||
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView smoothLineAtLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
Furthermore, a line chart's selection events are delegated back via:
|
||||
|
||||
- (void)lineChartView:(JBLineChartView *)lineChartView didSelectLineAtIndex:(NSUInteger)lineIndex horizontalIndex:(NSUInteger)horizontalIndex touchPoint:(CGPoint)touchPoint
|
||||
{
|
||||
// Update view
|
||||
}
|
||||
|
||||
- (void)didDeselectLineInLineChartView:(JBLineChartView *)lineChartView
|
||||
{
|
||||
// Update view
|
||||
}
|
||||
|
||||
Upon selection, all other lines (+ fills) will be dimmed to 20% opacity (default). To change this value, implement:
|
||||
|
||||
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView dimmedSelectionOpacityAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
// Return new opacity (0.0 to hide completely, and 1.0 to have no effect)
|
||||
}
|
||||
|
||||
If you don't want a line to be selectable:
|
||||
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView shouldIgnoreSelectionAtIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return NO; // Check line index
|
||||
}
|
||||
|
||||
The <b>touchPoint</b> is especially important as it allows you to add custom elements to your chart during selection events. Refer to the demo project (<b>JBLineChartViewController</b>) to see how a tooltip can be used to display additional information during selection events.
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "JBChartView"
|
||||
s.version = "2.8.6"
|
||||
s.version = "2.8.16"
|
||||
s.summary = "Jawbone's iOS-based charting library for both line and bar graphs."
|
||||
s.homepage = "https://github.com/Jawbone/JBChartView"
|
||||
|
||||
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
|
||||
s.author = { "Terry Worona" => "tworona@jawbone.com" }
|
||||
s.source = {
|
||||
:git => "https://github.com/Jawbone/JBChartView.git",
|
||||
:tag => "v2.8.6"
|
||||
:tag => "v2.8.16"
|
||||
}
|
||||
|
||||
s.platform = :ios, '6.0'
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
566C73A61C026858000EC785 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 566C73A51C026858000EC785 /* Default-568h@2x.png */; };
|
||||
94BDFC3419F933B2007492F6 /* JBLineChartMissingPointsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 94BDFC3319F933B2007492F6 /* JBLineChartMissingPointsViewController.m */; };
|
||||
9B0725211829822A0052109B /* JBChartListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0725201829822A0052109B /* JBChartListViewController.m */; };
|
||||
9B2E530518218CF20079B9D2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B2E530418218CF20079B9D2 /* Foundation.framework */; };
|
||||
9B2E530718218CF20079B9D2 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B2E530618218CF20079B9D2 /* CoreGraphics.framework */; };
|
||||
@@ -45,6 +47,9 @@
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
566C73A51C026858000EC785 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
|
||||
94BDFC3219F933B2007492F6 /* JBLineChartMissingPointsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JBLineChartMissingPointsViewController.h; sourceTree = "<group>"; };
|
||||
94BDFC3319F933B2007492F6 /* JBLineChartMissingPointsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JBLineChartMissingPointsViewController.m; sourceTree = "<group>"; };
|
||||
9B07251F1829822A0052109B /* JBChartListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JBChartListViewController.h; sourceTree = "<group>"; };
|
||||
9B0725201829822A0052109B /* JBChartListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JBChartListViewController.m; sourceTree = "<group>"; };
|
||||
9B2E530118218CF20079B9D2 /* JBChartViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JBChartViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -196,6 +201,8 @@
|
||||
9B6A68DD1829BE63006DB3BF /* JBBarChartViewController.m */,
|
||||
9B07251F1829822A0052109B /* JBChartListViewController.h */,
|
||||
9B0725201829822A0052109B /* JBChartListViewController.m */,
|
||||
94BDFC3219F933B2007492F6 /* JBLineChartMissingPointsViewController.h */,
|
||||
94BDFC3319F933B2007492F6 /* JBLineChartMissingPointsViewController.m */,
|
||||
9B6A68DF1829BED5006DB3BF /* JBLineChartViewController.h */,
|
||||
9B6A68E01829BED5006DB3BF /* JBLineChartViewController.m */,
|
||||
);
|
||||
@@ -228,6 +235,7 @@
|
||||
9B603D44182C7002000A76D0 /* Images */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
566C73A51C026858000EC785 /* Default-568h@2x.png */,
|
||||
9B7967ED198317540003A2B0 /* icon-area-chart.png */,
|
||||
9B7967EE198317540003A2B0 /* icon-area-chart@2x.png */,
|
||||
9B698F07182D720E003C135F /* icon-arrow.png */,
|
||||
@@ -347,7 +355,7 @@
|
||||
9B2E52F918218CF20079B9D2 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0510;
|
||||
LastUpgradeCheck = 0710;
|
||||
ORGANIZATIONNAME = Jawbone;
|
||||
};
|
||||
buildConfigurationList = 9B2E52FC18218CF20079B9D2 /* Build configuration list for PBXProject "JBChartViewDemo" */;
|
||||
@@ -382,6 +390,7 @@
|
||||
9B7967EF198317540003A2B0 /* icon-area-chart.png in Resources */,
|
||||
9B603D47182C7002000A76D0 /* icon-jawbone-logo.png in Resources */,
|
||||
9B603D48182C7002000A76D0 /* icon-jawbone-logo@2x.png in Resources */,
|
||||
566C73A61C026858000EC785 /* Default-568h@2x.png in Resources */,
|
||||
9B7967F0198317540003A2B0 /* icon-area-chart@2x.png in Resources */,
|
||||
9B698F19182D7DAE003C135F /* icon-line-chart@2x.png in Resources */,
|
||||
9B698F0A182D720E003C135F /* icon-arrow@2x.png in Resources */,
|
||||
@@ -407,6 +416,7 @@
|
||||
9B603D4E182C7163000A76D0 /* JBBaseTableViewController.m in Sources */,
|
||||
9B6A68DE1829BE63006DB3BF /* JBBarChartViewController.m in Sources */,
|
||||
9B4437AD18D7686800682EF0 /* JBChartTooltipTipView.m in Sources */,
|
||||
94BDFC3419F933B2007492F6 /* JBLineChartMissingPointsViewController.m in Sources */,
|
||||
9BE0B0AD182AD26400232023 /* JBLineChartView.m in Sources */,
|
||||
9BEE694618D2789E005D9BA7 /* JBBaseChartViewController.m in Sources */,
|
||||
9B6A68E11829BED5006DB3BF /* JBLineChartViewController.m in Sources */,
|
||||
@@ -450,6 +460,7 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
@@ -513,6 +524,7 @@
|
||||
GCC_PREFIX_HEADER = "JBChartViewDemo/JBChartViewDemo-Prefix.pch";
|
||||
INFOPLIST_FILE = "JBChartViewDemo/JBChartViewDemo-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.jawbone.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -527,6 +539,7 @@
|
||||
GCC_PREFIX_HEADER = "JBChartViewDemo/JBChartViewDemo-Prefix.pch";
|
||||
INFOPLIST_FILE = "JBChartViewDemo/JBChartViewDemo-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.jawbone.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
|
||||
@@ -38,3 +38,12 @@
|
||||
#define kJBStringLabelHours localize(@"label.hours", @"h")
|
||||
#define kJBStringLabelMoon localize(@"label.moon", @"Moon")
|
||||
#define kJBStringLabelSun localize(@"label.sun", @"Sun")
|
||||
|
||||
#pragma mark - Labels (Missing Points Line Chart)
|
||||
|
||||
#define kJBStringLabel2014 localize(@"label.2014", @"2014")
|
||||
#define kJBStringLabelCyclingDistances localize(@"label.cycling.distances", @"Cycling Distances")
|
||||
#define kJBStringLabelCyclingCurrentLastWeek2014 localize(@"label.cycling.current.last.week.2014", @"Current/Last Week - 2014")
|
||||
#define kJBStringLabelKm2014 localize(@"label.km", @"Km")
|
||||
#define kJBStringLabelLastWeek localize(@"label.last.week", @"Last Week")
|
||||
#define kJBStringLabelCurrentWeek localize(@"label.current.week", @"Current Week")
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#import "JBChartTooltipTipView.h"
|
||||
|
||||
// Numerics
|
||||
CGFloat const kJBBaseChartViewControllerAnimationDuration = 0.25f;
|
||||
CGFloat const kJBBaseChartViewControllerAnimationDuration = 0.1f;
|
||||
|
||||
@interface JBBaseChartViewController ()
|
||||
|
||||
@@ -43,6 +43,8 @@ CGFloat const kJBBaseChartViewControllerAnimationDuration = 0.25f;
|
||||
[self.view addSubview:self.tooltipView];
|
||||
}
|
||||
|
||||
[self.view bringSubviewToFront:self.tooltipView];
|
||||
|
||||
if (!self.tooltipTipView)
|
||||
{
|
||||
self.tooltipTipView = [[JBChartTooltipTipView alloc] init];
|
||||
@@ -50,11 +52,14 @@ CGFloat const kJBBaseChartViewControllerAnimationDuration = 0.25f;
|
||||
[self.view addSubview:self.tooltipTipView];
|
||||
}
|
||||
|
||||
[self.view bringSubviewToFront:self.tooltipTipView];
|
||||
|
||||
dispatch_block_t adjustTooltipPosition = ^{
|
||||
|
||||
CGPoint originalTouchPoint = [self.view convertPoint:touchPoint fromView:chartView];
|
||||
CGPoint convertedTouchPoint = originalTouchPoint; // modified
|
||||
JBChartView *chartView = [self chartView];
|
||||
if (chartView)
|
||||
if (chartView && !CGPointEqualToPoint(touchPoint, CGPointZero))
|
||||
{
|
||||
CGFloat minChartX = (chartView.frame.origin.x + ceil(self.tooltipView.frame.size.width * 0.5));
|
||||
if (convertedTouchPoint.x < minChartX)
|
||||
@@ -66,6 +71,7 @@ CGFloat const kJBBaseChartViewControllerAnimationDuration = 0.25f;
|
||||
{
|
||||
convertedTouchPoint.x = maxChartX;
|
||||
}
|
||||
|
||||
self.tooltipView.frame = CGRectMake(convertedTouchPoint.x - ceil(self.tooltipView.frame.size.width * 0.5), CGRectGetMaxY(chartView.headerView.frame), self.tooltipView.frame.size.width, self.tooltipView.frame.size.height);
|
||||
|
||||
CGFloat minTipX = (chartView.frame.origin.x + self.tooltipTipView.frame.size.width);
|
||||
@@ -79,33 +85,34 @@ CGFloat const kJBBaseChartViewControllerAnimationDuration = 0.25f;
|
||||
originalTouchPoint.x = maxTipX;
|
||||
}
|
||||
self.tooltipTipView.frame = CGRectMake(originalTouchPoint.x - ceil(self.tooltipTipView.frame.size.width * 0.5), CGRectGetMaxY(self.tooltipView.frame), self.tooltipTipView.frame.size.width, self.tooltipTipView.frame.size.height);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
dispatch_block_t adjustTooltipVisibility = ^{
|
||||
self.tooltipView.alpha = _tooltipVisible ? 1.0 : 0.0;
|
||||
self.tooltipTipView.alpha = _tooltipVisible ? 1.0 : 0.0;
|
||||
};
|
||||
|
||||
if (tooltipVisible)
|
||||
{
|
||||
adjustTooltipPosition();
|
||||
}
|
||||
|
||||
|
||||
if (animated)
|
||||
{
|
||||
[UIView animateWithDuration:kJBBaseChartViewControllerAnimationDuration animations:^{
|
||||
adjustTooltipVisibility();
|
||||
} completion:^(BOOL finished) {
|
||||
if (!tooltipVisible)
|
||||
{
|
||||
adjustTooltipPosition();
|
||||
}
|
||||
}];
|
||||
if (tooltipVisible)
|
||||
{
|
||||
adjustTooltipPosition();
|
||||
}
|
||||
|
||||
[UIView animateWithDuration:kJBBaseChartViewControllerAnimationDuration delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
|
||||
adjustTooltipVisibility();
|
||||
} completion:^(BOOL finished) {
|
||||
if (!tooltipVisible)
|
||||
{
|
||||
adjustTooltipPosition();
|
||||
}
|
||||
}];
|
||||
}
|
||||
else
|
||||
{
|
||||
adjustTooltipVisibility();
|
||||
adjustTooltipPosition();
|
||||
adjustTooltipVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
self.tableView.delegate = nil;
|
||||
self.tableView.dataSource = nil;
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDataSource
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSUInteger)supportedInterfaceOrientations
|
||||
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
|
||||
{
|
||||
return UIInterfaceOrientationMaskPortrait;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ CGFloat const kJBAreaChartViewControllerChartHeaderHeight = 75.0f;
|
||||
CGFloat const kJBAreaChartViewControllerChartHeaderPadding = 20.0f;
|
||||
CGFloat const kJBAreaChartViewControllerChartFooterHeight = 20.0f;
|
||||
CGFloat const kJBAreaChartViewControllerChartLineWidth = 2.0f;
|
||||
CGFloat const kJBAreaChartViewControllerChartSunLineDimmedOpacity = 1.0f;
|
||||
CGFloat const kJBAreaChartViewControllerChartMoonLineDimmedOpacity = 0.0f;
|
||||
NSInteger const kJBAreaChartViewControllerMaxNumChartPoints = 12;
|
||||
|
||||
// Strings
|
||||
@@ -84,6 +86,12 @@ NSString * const kJBAreaChartViewControllerNavButtonViewKey = @"view";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
_lineChartView.delegate = nil;
|
||||
_lineChartView.dataSource = nil;
|
||||
}
|
||||
|
||||
#pragma mark - Data
|
||||
|
||||
- (void)initFakeData
|
||||
@@ -192,6 +200,18 @@ NSString * const kJBAreaChartViewControllerNavButtonViewKey = @"view";
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView dimmedSelectionOpacityAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
if (lineIndex == JBLineChartLineMoon)
|
||||
{
|
||||
return kJBAreaChartViewControllerChartMoonLineDimmedOpacity;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kJBAreaChartViewControllerChartSunLineDimmedOpacity;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - JBLineChartViewDelegate
|
||||
|
||||
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex
|
||||
|
||||
@@ -78,6 +78,12 @@ NSString * const kJBBarChartViewControllerNavButtonViewKey = @"view";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
_barChartView.delegate = nil;
|
||||
_barChartView.dataSource = nil;
|
||||
}
|
||||
|
||||
#pragma mark - Date
|
||||
|
||||
- (void)initFakeData
|
||||
@@ -85,7 +91,7 @@ NSString * const kJBBarChartViewControllerNavButtonViewKey = @"view";
|
||||
NSMutableArray *mutableChartData = [NSMutableArray array];
|
||||
for (int i=0; i<kJBBarChartViewControllerNumBars; i++)
|
||||
{
|
||||
NSInteger delta = (kJBBarChartViewControllerNumBars - abs((kJBBarChartViewControllerNumBars - i) - i)) + 2;
|
||||
NSInteger delta = (kJBBarChartViewControllerNumBars - labs((kJBBarChartViewControllerNumBars - i) - i)) + 2;
|
||||
[mutableChartData addObject:[NSNumber numberWithFloat:MAX((delta * kJBBarChartViewControllerMinBarHeight), arc4random() % (delta * kJBBarChartViewControllerMaxBarHeight))]];
|
||||
|
||||
}
|
||||
|
||||
@@ -12,13 +12,15 @@
|
||||
#import "JBBarChartViewController.h"
|
||||
#import "JBLineChartViewController.h"
|
||||
#import "JBAreaChartViewController.h"
|
||||
#import "JBLineChartMissingPointsViewController.h"
|
||||
|
||||
// Views
|
||||
#import "JBChartTableCell.h"
|
||||
|
||||
typedef NS_ENUM(NSInteger, JBChartListViewControllerRow){
|
||||
JBChartListViewControllerRowLineChart,
|
||||
JBChartListViewControllerRowBarChart,
|
||||
JBChartListViewControllerRowLineChartMissingPoints,
|
||||
JBChartListViewControllerRowBarChart,
|
||||
JBChartListViewControllerRowAreaChart,
|
||||
JBChartListViewControllerRowCount
|
||||
};
|
||||
@@ -63,6 +65,11 @@ NSInteger const kJBChartListViewControllerCellHeight = 100;
|
||||
detailText = kJBStringLabelSanFrancisco2013;
|
||||
type = JBChartTableCellTypeLineChart;
|
||||
break;
|
||||
case JBChartListViewControllerRowLineChartMissingPoints:
|
||||
text = kJBStringLabelCyclingDistances;
|
||||
detailText = kJBStringLabelCyclingCurrentLastWeek2014;
|
||||
type = JBChartTableCellTypeLineChart;
|
||||
break;
|
||||
case JBChartListViewControllerRowBarChart:
|
||||
text = kJBStringLabelAverageMonthlyTemperature;
|
||||
detailText = kJBStringLabelWorldwide2012;
|
||||
@@ -99,6 +106,11 @@ NSInteger const kJBChartListViewControllerCellHeight = 100;
|
||||
JBLineChartViewController *lineChartController = [[JBLineChartViewController alloc] init];
|
||||
[self.navigationController pushViewController:lineChartController animated:YES];
|
||||
}
|
||||
else if (indexPath.row == JBChartListViewControllerRowLineChartMissingPoints)
|
||||
{
|
||||
JBLineChartMissingPointsViewController *lineChartController = [[JBLineChartMissingPointsViewController alloc] init];
|
||||
[self.navigationController pushViewController:lineChartController animated:YES];
|
||||
}
|
||||
else if (indexPath.row == JBChartListViewControllerRowBarChart)
|
||||
{
|
||||
JBBarChartViewController *barChartController = [[JBBarChartViewController alloc] init];
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// JBLineChartMissingPointsViewController.h
|
||||
// JBChartViewDemo
|
||||
//
|
||||
// Created by Sebastian Opel on 23.10.14.
|
||||
// Copyright (c) 2014 Jawbone. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JBBaseChartViewController.h"
|
||||
|
||||
@interface JBLineChartMissingPointsViewController : JBBaseChartViewController
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,309 @@
|
||||
//
|
||||
// JBLineChartMissingPointsViewController.m
|
||||
// JBChartViewDemo
|
||||
//
|
||||
// Created by Sebastian Opel on 23.10.14.
|
||||
// Copyright (c) 2014 Jawbone. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JBLineChartMissingPointsViewController.h"
|
||||
|
||||
// Views
|
||||
#import "JBLineChartView.h"
|
||||
#import "JBChartHeaderView.h"
|
||||
#import "JBLineChartFooterView.h"
|
||||
#import "JBChartInformationView.h"
|
||||
|
||||
#define ARC4RANDOM_MAX 0x010000000
|
||||
|
||||
typedef NS_ENUM(NSInteger, JBLineChartLine){
|
||||
JBLineChartLineSolid,
|
||||
JBLineChartLineDashed,
|
||||
JBLineChartLineCount
|
||||
};
|
||||
|
||||
// Numerics
|
||||
CGFloat const kJBLineChartMissingPointsViewControllerChartHeight = 250.0f;
|
||||
CGFloat const kJBLineChartMissingPointsViewControllerChartPadding = 10.0f;
|
||||
CGFloat const kJBLineChartMissingPointsViewControllerChartHeaderHeight = 75.0f;
|
||||
CGFloat const kJBLineChartMissingPointsViewControllerChartHeaderPadding = 20.0f;
|
||||
CGFloat const kJBLineChartMissingPointsViewControllerChartFooterHeight = 20.0f;
|
||||
CGFloat const kJBLineChartMissingPointsViewControllerChartSolidLineWidth = 6.0f;
|
||||
CGFloat const kJBLineChartMissingPointsViewControllerChartSolidLineDotRadius = 5.0f;
|
||||
CGFloat const kJBLineChartMissingPointsViewControllerChartDashedLineWidth = 2.0f;
|
||||
NSInteger const kJBLineChartMissingPointsViewControllerMaxNumChartPoints = 7;
|
||||
|
||||
// Strings
|
||||
NSString * const kJBLineChartMissingPointsViewControllerNavButtonViewKey = @"view";
|
||||
|
||||
@interface JBLineChartMissingPointsViewController () <JBLineChartViewDelegate, JBLineChartViewDataSource>
|
||||
|
||||
@property (nonatomic, strong) JBLineChartView *lineChartView;
|
||||
@property (nonatomic, strong) JBChartInformationView *informationView;
|
||||
@property (nonatomic, strong) NSArray *chartData;
|
||||
@property (nonatomic, strong) NSArray *daysOfWeek;
|
||||
|
||||
// Buttons
|
||||
- (void)chartToggleButtonPressed:(id)sender;
|
||||
|
||||
// Helpers
|
||||
- (void)initFakeData;
|
||||
- (NSArray *)largestLineData; // largest collection of fake line data
|
||||
|
||||
@end
|
||||
|
||||
@implementation JBLineChartMissingPointsViewController
|
||||
|
||||
#pragma mark - Alloc/Init
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
[self initFakeData];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)aDecoder
|
||||
{
|
||||
self = [super initWithCoder:aDecoder];
|
||||
if (self)
|
||||
{
|
||||
[self initFakeData];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||||
{
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
if (self)
|
||||
{
|
||||
[self initFakeData];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
_lineChartView.delegate = nil;
|
||||
_lineChartView.dataSource = nil;
|
||||
}
|
||||
|
||||
#pragma mark - Data
|
||||
|
||||
- (void)initFakeData
|
||||
{
|
||||
NSMutableArray *mutableLineCharts = [NSMutableArray array];
|
||||
for (int lineIndex=0; lineIndex<JBLineChartLineCount; lineIndex++)
|
||||
{
|
||||
NSMutableArray *mutableChartData = [NSMutableArray array];
|
||||
for (int i=0; i<kJBLineChartMissingPointsViewControllerMaxNumChartPoints; i++)
|
||||
{
|
||||
if(i < 2 || i > 5 || i == 3)
|
||||
{
|
||||
[mutableChartData addObject:[NSNumber numberWithFloat:NAN]];
|
||||
} else {
|
||||
[mutableChartData addObject:[NSNumber numberWithFloat:((double)arc4random() / ARC4RANDOM_MAX)]]; // random number between 0 and 1
|
||||
}
|
||||
}
|
||||
[mutableLineCharts addObject:mutableChartData];
|
||||
}
|
||||
_chartData = [NSArray arrayWithArray:mutableLineCharts];
|
||||
_daysOfWeek = [[[NSDateFormatter alloc] init] shortWeekdaySymbols];
|
||||
}
|
||||
|
||||
- (NSArray *)largestLineData
|
||||
{
|
||||
NSArray *largestLineData = nil;
|
||||
for (NSArray *lineData in self.chartData)
|
||||
{
|
||||
if ([lineData count] > [largestLineData count])
|
||||
{
|
||||
largestLineData = lineData;
|
||||
}
|
||||
}
|
||||
return largestLineData;
|
||||
}
|
||||
|
||||
#pragma mark - View Lifecycle
|
||||
|
||||
- (void)loadView
|
||||
{
|
||||
[super loadView];
|
||||
|
||||
self.view.backgroundColor = kJBColorLineChartControllerBackground;
|
||||
self.navigationItem.rightBarButtonItem = [self chartToggleButtonWithTarget:self action:@selector(chartToggleButtonPressed:)];
|
||||
|
||||
self.lineChartView = [[JBLineChartView alloc] init];
|
||||
self.lineChartView.frame = CGRectMake(kJBLineChartMissingPointsViewControllerChartPadding, kJBLineChartMissingPointsViewControllerChartPadding, self.view.bounds.size.width - (kJBLineChartMissingPointsViewControllerChartPadding * 2), kJBLineChartMissingPointsViewControllerChartHeight);
|
||||
self.lineChartView.delegate = self;
|
||||
self.lineChartView.dataSource = self;
|
||||
self.lineChartView.headerPadding = kJBLineChartMissingPointsViewControllerChartHeaderPadding;
|
||||
self.lineChartView.backgroundColor = kJBColorLineChartBackground;
|
||||
|
||||
JBChartHeaderView *headerView = [[JBChartHeaderView alloc] initWithFrame:CGRectMake(kJBLineChartMissingPointsViewControllerChartPadding, ceil(self.view.bounds.size.height * 0.5) - ceil(kJBLineChartMissingPointsViewControllerChartHeaderHeight * 0.5), self.view.bounds.size.width - (kJBLineChartMissingPointsViewControllerChartPadding * 2), kJBLineChartMissingPointsViewControllerChartHeaderHeight)];
|
||||
headerView.titleLabel.text = [kJBStringLabelCyclingDistances uppercaseString];
|
||||
headerView.titleLabel.textColor = kJBColorLineChartHeader;
|
||||
headerView.titleLabel.shadowColor = [UIColor colorWithWhite:1.0 alpha:0.25];
|
||||
headerView.titleLabel.shadowOffset = CGSizeMake(0, 1);
|
||||
headerView.subtitleLabel.text = kJBStringLabel2014;
|
||||
headerView.subtitleLabel.textColor = kJBColorLineChartHeader;
|
||||
headerView.subtitleLabel.shadowColor = [UIColor colorWithWhite:1.0 alpha:0.25];
|
||||
headerView.subtitleLabel.shadowOffset = CGSizeMake(0, 1);
|
||||
headerView.separatorColor = kJBColorLineChartHeaderSeparatorColor;
|
||||
self.lineChartView.headerView = headerView;
|
||||
|
||||
JBLineChartFooterView *footerView = [[JBLineChartFooterView alloc] initWithFrame:CGRectMake(kJBLineChartMissingPointsViewControllerChartPadding, ceil(self.view.bounds.size.height * 0.5) - ceil(kJBLineChartMissingPointsViewControllerChartFooterHeight * 0.5), self.view.bounds.size.width - (kJBLineChartMissingPointsViewControllerChartPadding * 2), kJBLineChartMissingPointsViewControllerChartFooterHeight)];
|
||||
footerView.backgroundColor = [UIColor clearColor];
|
||||
footerView.leftLabel.text = [[self.daysOfWeek firstObject] uppercaseString];
|
||||
footerView.leftLabel.textColor = [UIColor whiteColor];
|
||||
footerView.rightLabel.text = [[self.daysOfWeek lastObject] uppercaseString];;
|
||||
footerView.rightLabel.textColor = [UIColor whiteColor];
|
||||
footerView.sectionCount = [[self largestLineData] count];
|
||||
self.lineChartView.footerView = footerView;
|
||||
|
||||
[self.view addSubview:self.lineChartView];
|
||||
|
||||
self.informationView = [[JBChartInformationView alloc] initWithFrame:CGRectMake(self.view.bounds.origin.x, CGRectGetMaxY(self.lineChartView.frame), self.view.bounds.size.width, self.view.bounds.size.height - CGRectGetMaxY(self.lineChartView.frame) - CGRectGetMaxY(self.navigationController.navigationBar.frame))];
|
||||
[self.informationView setValueAndUnitTextColor:[UIColor colorWithWhite:1.0 alpha:0.75]];
|
||||
[self.informationView setTitleTextColor:kJBColorLineChartHeader];
|
||||
[self.informationView setTextShadowColor:nil];
|
||||
[self.informationView setSeparatorColor:kJBColorLineChartHeaderSeparatorColor];
|
||||
[self.view addSubview:self.informationView];
|
||||
|
||||
[self.lineChartView reloadData];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
[self.lineChartView setState:JBChartViewStateExpanded];
|
||||
}
|
||||
|
||||
#pragma mark - JBChartViewDataSource
|
||||
|
||||
- (BOOL)shouldExtendSelectionViewIntoHeaderPaddingForChartView:(JBChartView *)chartView
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)shouldExtendSelectionViewIntoFooterPaddingForChartView:(JBChartView *)chartView
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
#pragma mark - JBLineChartViewDataSource
|
||||
|
||||
- (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView
|
||||
{
|
||||
return [self.chartData count];
|
||||
}
|
||||
|
||||
- (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return [[self.chartData objectAtIndex:lineIndex] count];
|
||||
}
|
||||
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView showsDotsForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return lineIndex == JBLineChartViewLineStyleDashed;
|
||||
}
|
||||
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView smoothLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return lineIndex == JBLineChartViewLineStyleSolid;
|
||||
}
|
||||
|
||||
#pragma mark - JBLineChartViewDelegate
|
||||
|
||||
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return [[[self.chartData objectAtIndex:lineIndex] objectAtIndex:horizontalIndex] floatValue];
|
||||
}
|
||||
|
||||
- (void)lineChartView:(JBLineChartView *)lineChartView didSelectLineAtIndex:(NSUInteger)lineIndex horizontalIndex:(NSUInteger)horizontalIndex touchPoint:(CGPoint)touchPoint
|
||||
{
|
||||
NSNumber *valueNumber = [[self.chartData objectAtIndex:lineIndex] objectAtIndex:horizontalIndex];
|
||||
if(isnan([valueNumber floatValue])) {
|
||||
[self.informationView setHidden:YES animated:YES];
|
||||
} else {
|
||||
[self.informationView setValueText:[NSString stringWithFormat:@"%.2f", [valueNumber floatValue]] unitText:kJBStringLabelKm2014];
|
||||
[self.informationView setTitleText:lineIndex == JBLineChartLineSolid ? kJBStringLabelLastWeek : kJBStringLabelCurrentWeek];
|
||||
[self.informationView setHidden:NO animated:YES];
|
||||
}
|
||||
[self setTooltipVisible:YES animated:YES atTouchPoint:touchPoint];
|
||||
[self.tooltipView setText:[[self.daysOfWeek objectAtIndex:horizontalIndex] uppercaseString]];
|
||||
}
|
||||
|
||||
- (void)didDeselectLineInLineChartView:(JBLineChartView *)lineChartView
|
||||
{
|
||||
[self.informationView setHidden:YES animated:YES];
|
||||
[self setTooltipVisible:NO animated:YES];
|
||||
}
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView colorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return (lineIndex == JBLineChartLineSolid) ? kJBColorLineChartDefaultSolidLineColor: kJBColorLineChartDefaultDashedLineColor;
|
||||
}
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView colorForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return (lineIndex == JBLineChartLineSolid) ? kJBColorLineChartDefaultSolidLineColor: kJBColorLineChartDefaultDashedLineColor;
|
||||
}
|
||||
|
||||
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView widthForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return (lineIndex == JBLineChartLineSolid) ? kJBLineChartMissingPointsViewControllerChartSolidLineWidth: kJBLineChartMissingPointsViewControllerChartDashedLineWidth;
|
||||
}
|
||||
|
||||
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView dotRadiusForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return (lineIndex == JBLineChartLineSolid) ? 0.0 : kJBLineChartMissingPointsViewControllerChartSolidLineDotRadius;
|
||||
}
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView verticalSelectionColorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return [UIColor whiteColor];
|
||||
}
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView selectionColorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return (lineIndex == JBLineChartLineSolid) ? kJBColorLineChartDefaultSolidSelectedLineColor: kJBColorLineChartDefaultDashedSelectedLineColor;
|
||||
}
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView selectionColorForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return (lineIndex == JBLineChartLineSolid) ? kJBColorLineChartDefaultSolidSelectedLineColor: kJBColorLineChartDefaultDashedSelectedLineColor;
|
||||
}
|
||||
|
||||
- (JBLineChartViewLineStyle)lineChartView:(JBLineChartView *)lineChartView lineStyleForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return (lineIndex == JBLineChartLineSolid) ? JBLineChartViewLineStyleSolid : JBLineChartViewLineStyleDashed;
|
||||
}
|
||||
|
||||
#pragma mark - Buttons
|
||||
|
||||
- (void)chartToggleButtonPressed:(id)sender
|
||||
{
|
||||
UIView *buttonImageView = [self.navigationItem.rightBarButtonItem valueForKey:kJBLineChartMissingPointsViewControllerNavButtonViewKey];
|
||||
buttonImageView.userInteractionEnabled = NO;
|
||||
|
||||
CGAffineTransform transform = self.lineChartView.state == JBChartViewStateExpanded ? CGAffineTransformMakeRotation(M_PI) : CGAffineTransformMakeRotation(0);
|
||||
buttonImageView.transform = transform;
|
||||
|
||||
[self.lineChartView setState:self.lineChartView.state == JBChartViewStateExpanded ? JBChartViewStateCollapsed : JBChartViewStateExpanded animated:YES callback:^{
|
||||
buttonImageView.userInteractionEnabled = YES;
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Overrides
|
||||
|
||||
- (JBChartView *)chartView
|
||||
{
|
||||
return self.lineChartView;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -29,6 +29,7 @@ CGFloat const kJBLineChartViewControllerChartHeaderHeight = 75.0f;
|
||||
CGFloat const kJBLineChartViewControllerChartHeaderPadding = 20.0f;
|
||||
CGFloat const kJBLineChartViewControllerChartFooterHeight = 20.0f;
|
||||
CGFloat const kJBLineChartViewControllerChartSolidLineWidth = 6.0f;
|
||||
CGFloat const kJBLineChartViewControllerChartSolidLineDotRadius = 5.0f;
|
||||
CGFloat const kJBLineChartViewControllerChartDashedLineWidth = 2.0f;
|
||||
NSInteger const kJBLineChartViewControllerMaxNumChartPoints = 7;
|
||||
|
||||
@@ -85,6 +86,12 @@ NSString * const kJBLineChartViewControllerNavButtonViewKey = @"view";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
_lineChartView.delegate = nil;
|
||||
_lineChartView.dataSource = nil;
|
||||
}
|
||||
|
||||
#pragma mark - Data
|
||||
|
||||
- (void)initFakeData
|
||||
@@ -245,7 +252,7 @@ NSString * const kJBLineChartViewControllerNavButtonViewKey = @"view";
|
||||
|
||||
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView dotRadiusForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return (lineIndex == JBLineChartLineSolid) ? 0.0: (kJBLineChartViewControllerChartDashedLineWidth * 4);
|
||||
return (lineIndex == JBLineChartLineSolid) ? 0.0: kJBLineChartViewControllerChartSolidLineDotRadius;
|
||||
}
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView verticalSelectionColorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
|
||||
@@ -5,16 +5,31 @@
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.jawbone.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -38,12 +38,8 @@ Build and run the <i>JBChartViewDemo</i> project in Xcode. The demo demonstrates
|
||||
|
||||
Simply add the following line to your <code>Podfile</code>:
|
||||
|
||||
pod 'JBChartView'
|
||||
|
||||
Your Podfile should look something like:
|
||||
|
||||
platform :ios, '6.0'
|
||||
pod 'JBChartView', '~> 2.8.6'
|
||||
pod 'JBChartView'
|
||||
|
||||
### The Old School Way
|
||||
|
||||
@@ -62,9 +58,9 @@ All JBChartView implementations have a similiar data source and delgate pattern
|
||||
To use JBCartView in a Swift project add the following to your bridging header (JBChartView-Bridging-Header.h):
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "JBChartView/JBChartView.h"
|
||||
#import "JBChartView/JBBarChartView.h"
|
||||
#import "JBChartView/JBLineChartView.h"
|
||||
#import "JBChartView.h"
|
||||
#import "JBBarChartView.h"
|
||||
#import "JBLineChartView.h"
|
||||
|
||||
For more information about adding bridging headers see <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html" target="_blank">Swift and Objective-C in the Same Project</a>.
|
||||
|
||||
@@ -76,6 +72,15 @@ To initialize a <i>JBBarChartView</i>, you only need a few lines of code (see be
|
||||
barChartView.dataSource = self;
|
||||
barChartView.delegate = self;
|
||||
[self addSubview:barChartView];
|
||||
|
||||
Just like you would for a `UITableView`, ensure you clear these properties in your `dealloc`:
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
JBBarChartView *barChartView = ...; // i.e. _barChartView
|
||||
barChartView.delegate = nil;
|
||||
barChartView.dataSource = nil;
|
||||
}
|
||||
|
||||
At a minimum, you need to inform the data source how many bars are in the chart:
|
||||
|
||||
@@ -86,7 +91,7 @@ At a minimum, you need to inform the data source how many bars are in the chart:
|
||||
|
||||
Secondly, you need to inform the delegate the height of each bar (automatically normalized across the entire chart):
|
||||
|
||||
- (CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtAtIndex:(NSUInteger)index
|
||||
- (CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtIndex:(NSUInteger)index
|
||||
{
|
||||
return ...; // height of bar at index
|
||||
}
|
||||
@@ -95,15 +100,26 @@ Lastly, ensure you have set the *frame* of your barChartView & call *reloadData*
|
||||
|
||||
barChartView.frame = CGRectMake( ... );
|
||||
[barChartView reloadData];
|
||||
|
||||
**Note**: subsequent changes to the chart's frame will not invoke *reloadData*; it must be called directly afterwards for any changes to take effect.
|
||||
|
||||
#### JBLineChartView
|
||||
|
||||
Similiarily, to initialize a JBLineChartView, you only need a few lines of code (see below). Line charts can also be initialized via a <b>nib</b> or with a <b>frame</b>.
|
||||
|
||||
JBLineChartView *lineChartView = [[JBLineChartView alloc] init];
|
||||
lineChartView.dataSource = self;
|
||||
lineChartView.delegate = self;
|
||||
[self addSubview:lineChartView];
|
||||
lineChartView.dataSource = self;
|
||||
lineChartView.delegate = self;
|
||||
[self addSubview:lineChartView];
|
||||
|
||||
Just like you would for a `UITableView`, ensure you clear these properties in your `dealloc`:
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
JBLineChartView *lineChartView = ...; // i.e. _lineChartView
|
||||
lineChartView.delegate = nil;
|
||||
lineChartView.dataSource = nil;
|
||||
}
|
||||
|
||||
At a minimum, you need to inform the data source how many lines and vertical data points (for each line) are in the chart:
|
||||
|
||||
@@ -124,153 +140,20 @@ Secondly, you need to inform the delegate of the y-position of each point (autom
|
||||
return ...; // y-position (y-axis) of point at horizontalIndex (x-axis)
|
||||
}
|
||||
|
||||
**Note**: You can return NAN instead of CGFloat to indicate missing values. The chart's line will begin at the first non-NAN value and end at the last non-NAN value. The line will interopolate any NAN values in between (ie. the line will not be interrupted).
|
||||
|
||||
return [[NSNumber numberWithFloat:NAN] floatValue];
|
||||
|
||||
Lastly, ensure you have set the *frame* of your lineChartView & call *reloadData* at least once:
|
||||
|
||||
lineChartView.frame = CGRectMake( ... );
|
||||
[lineChartView reloadData];
|
||||
|
||||
**Note**: subsequent changes to the chart's frame will not invoke *reloadData*; it must be called directly afterwards for any changes to take effect.
|
||||
|
||||
## Customization
|
||||
|
||||
Both the line and bar charts support a robust set of customization options.
|
||||
|
||||
The background of a bar or line chart can be set just like any other view:
|
||||
|
||||
self.barChartView.backgroundColor = ...; // UIColor
|
||||
self.lineChartView.backgroundColor = ...; // UIColor
|
||||
|
||||
Any <i>JBChartView</i> subclass supports the use of headers and footers (similiar to that of <i>UITableView</i>):
|
||||
|
||||
self.barChartView.footerView = ...; // UIView
|
||||
self.lineChartView.headerView = ...; // UIView
|
||||
|
||||
Lastly, any JBChartView subclass can be collapsed or expanded programmatically via the <i>state</i> property. If you chose to animate state changes, a callback helper can be used to notify you when the animation has completed:
|
||||
|
||||
- (void)setState:(JBChartViewState)state animated:(BOOL)animated callback:(void (^)())callback;
|
||||
|
||||
#### JBBarChartView
|
||||
|
||||
A bar chart can be inverted such that it's orientation is top->down (including the selection view) by setting the following property:
|
||||
|
||||
@property (nonatomic, assign, getter=isInverted) BOOL inverted;
|
||||
|
||||
By default, a chart's bars will be black and flat. They can be customized by supplying a UIView subclass through the <i>optional</i> protocol:
|
||||
|
||||
- (UIView *)barChartView:(JBBarChartView *)barChartView barViewAtIndex:(NSUInteger)index
|
||||
{
|
||||
return ...; // color of line in chart
|
||||
}
|
||||
|
||||
If you don't require a custom UIView, simply supply a color for the bar instead:
|
||||
|
||||
- (UIColor *)barChartView:(JBBarChartView *)barChartView colorForBarViewAtIndex:(NSUInteger)index;
|
||||
|
||||
Furthermore, the color of the selection bar (on touch events) can be customized via the <i>optional</i> protocol:
|
||||
|
||||
- (UIColor *)barSelectionColorForBarChartView:(JBBarChartView *)barChartView
|
||||
{
|
||||
return ...; // color of selection view
|
||||
}
|
||||
|
||||
Lastly, a bar chart's selection events are delegated back via:
|
||||
|
||||
- (void)barChartView:(JBBarChartView *)barChartView didSelectBarAtIndex:(NSUInteger)index touchPoint:(CGPoint)touchPoint
|
||||
{
|
||||
// Update view
|
||||
}
|
||||
|
||||
- (void)didDeselectBarChartView:(JBBarChartView *)barChartView
|
||||
{
|
||||
// Update view
|
||||
}
|
||||
|
||||
The <b>touchPoint</b> is especially important as it allows you to add custom elements to your chart during selection events. Refer to the demo project (<b>JBarChartViewController</b>) to see how a tooltip can be used to display additional information during selection events.
|
||||
|
||||
#### JBLineChartView
|
||||
|
||||
The color, width and style of each line in the chart can be customized via the <i>optional</i> protocol:
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView colorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // color of line in chart
|
||||
}
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView fillColorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // color of area under line in chart
|
||||
}
|
||||
|
||||
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView widthForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // width of line in chart
|
||||
}
|
||||
|
||||
- (JBLineChartViewLineStyle)lineChartView:(JBLineChartView *)lineChartView lineStyleForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // style of line in chart
|
||||
}
|
||||
|
||||
Furthermore, the color and width of the selection view along with the color of the selected line can be customized via the <i>optional</i> protocols:
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView verticalSelectionColorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // color of selection view
|
||||
}
|
||||
|
||||
- (CGFloat)verticalSelectionWidthForLineChartView:(JBLineChartView *)lineChartView
|
||||
{
|
||||
return ...; // width of selection view
|
||||
}
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView selectionColorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // color of selected line
|
||||
}
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView selectionFillColorForLineAtLineIndex:(NSUInteger)lineIndex
|
||||
{
|
||||
return ...; // color of area under selected line
|
||||
}
|
||||
|
||||
By default, each line will not show dots for each point. To enable this on a per-line basis:
|
||||
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView showsDotsForLineAtLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
To customize the size of each dot (default 3x the line width), implement:
|
||||
|
||||
- (CGFloat)lineChartView:(JBLineChartView *)lineChartView dotRadiusForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
To customize the color of each dot during selection and non-selection events (default is white and black respectively), implement:
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView colorForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
- (UIColor *)lineChartView:(JBLineChartView *)lineChartView selectionColorForDotAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
Alternatively, you can supply your own UIView instead of using the default impelmentation:
|
||||
|
||||
- (UIView *)lineChartView:(JBLineChartView *)lineChartView dotViewAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
Custom dot views are automatically shown when selected unless the following is implemented:
|
||||
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView shouldHideDotViewOnSelectionAtHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
As well, by default, each line will have squared off end caps and connection points. To enable rounded connections and end caps:
|
||||
|
||||
- (BOOL)lineChartView:(JBLineChartView *)lineChartView smoothLineAtLineIndex:(NSUInteger)lineIndex;
|
||||
|
||||
Lastly, a line chart's selection events are delegated back via:
|
||||
|
||||
- (void)lineChartView:(JBLineChartView *)lineChartView didSelectLineAtIndex:(NSUInteger)lineIndex horizontalIndex:(NSUInteger)horizontalIndex touchPoint:(CGPoint)touchPoint
|
||||
{
|
||||
// Update view
|
||||
}
|
||||
|
||||
- (void)didDeselectLineInLineChartView:(JBLineChartView *)lineChartView
|
||||
{
|
||||
// Update view
|
||||
}
|
||||
|
||||
The <b>touchPoint</b> is especially important as it allows you to add custom elements to your chart during selection events. Refer to the demo project (<b>JBLineChartViewController</b>) to see how a tooltip can be used to display additional information during selection events.
|
||||
Both the line and bar charts support a robust set of customization options. Read more about them <a href="Customization.md">here</a>.
|
||||
|
||||
## Minimum & Maximum Values
|
||||
|
||||
@@ -286,6 +169,9 @@ If value(s) are supplied, they must be >= 0, otherwise an assertion will be thro
|
||||
|
||||
The min/max values are clamped to the ceiling and floor of the actual min/max values of the chart's data source; for example, if a maximumValue of 20 is supplied & the chart's actual max is 100, then 100 will be used. For min/max modifications to take effect, reloadData must be called.
|
||||
|
||||
## Performance
|
||||
|
||||
The nature of charting is to display all available information, unlike a UITableView, which can cache rows that are offscreen. JBChartView's performance will suffer if the number of data points exceed the resolution of the device. The same issue exists with MKMapVie, when hundreds of pins are supplied within a certain geographic area. It's why Apple recommends clustering to avoid performance issues. As such, for large datasets, we recommend that your dataSource to supply a subset of points - perhaps 'clustering' those that are close to one another.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Reference in New Issue
Block a user