motion-plot 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Motion::Plot
|
2
2
|
|
3
|
-
|
3
|
+
Create native iOS charts using simple JSON as you are used-to with Highcharts like JS library.
|
4
4
|
This library is a wrapper on top of [CorePlot](https://code.google.com/p/core-plot/), the iOS plotting framework to build native chart using CoreAnimation, Core Data and Cocoa Bindings
|
5
5
|
|
6
6
|
## Installation
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module MotionPlot
|
2
|
+
class WaterfallDelegate < BaseDelegate
|
3
|
+
|
4
|
+
def numberOfRecordsForPlot(plot)
|
5
|
+
@data_size = @delegated_to.series[plot.identifier].data.size + 1
|
6
|
+
end
|
7
|
+
|
8
|
+
def numberForPlot(plot, field:field_enum, recordIndex:index)
|
9
|
+
case field_enum
|
10
|
+
when CPTBarPlotFieldBarLocation
|
11
|
+
index
|
12
|
+
when CPTBarPlotFieldBarTip
|
13
|
+
record_data = @delegated_to.series[plot.identifier].data[index]
|
14
|
+
bar_tip_value(index, recordIndex:index, seriesData: @delegated_to.series[plot.identifier].data, startValue: record_data)
|
15
|
+
when CPTBarPlotFieldBarBase
|
16
|
+
bar_base_value(index, recordIndex:index, seriesData: @delegated_to.series[plot.identifier].data)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
def bar_base_value(data_index, recordIndex:index, seriesData: data)
|
22
|
+
return 0 if(data_index == 0 || data_index == @data_size - 1)
|
23
|
+
|
24
|
+
(0..data_index-1).inject(0) {|base, i| base + data[i] }
|
25
|
+
end
|
26
|
+
|
27
|
+
def bar_tip_value(data_index, recordIndex:index, seriesData: data, startValue: value)
|
28
|
+
data_index = data_index - 1 if(data_index == @data_size - 1)
|
29
|
+
|
30
|
+
return value if(data_index == 0)
|
31
|
+
|
32
|
+
(0..data_index).inject(0) {|base, i| base + data[i] }
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
data/lib/motion-plot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-plot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/motion-plot/chart/delegates/line_delegate.rb
|
87
87
|
- lib/motion-plot/chart/delegates/percent_bar_delegate.rb
|
88
88
|
- lib/motion-plot/chart/delegates/stack_bar_delegate.rb
|
89
|
+
- lib/motion-plot/chart/delegates/waterfall_delegate.rb
|
89
90
|
- lib/motion-plot/chart/line_plot.rb
|
90
91
|
- lib/motion-plot/chart/pie_plot.rb
|
91
92
|
- lib/motion-plot/core_ext/hash.rb
|