motion-plot 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.DS_Store +0 -0
- data/lib/motion-plot/.DS_Store +0 -0
- data/lib/motion-plot/chart/base.rb +10 -8
- data/lib/motion-plot/chart/line_plot.rb +1 -1
- data/lib/motion-plot/core_ext/hash.rb +11 -0
- data/lib/motion-plot/series/series.rb +3 -1
- data/lib/motion-plot/utilities/plot_symbol.rb +23 -17
- data/lib/motion-plot/version.rb +1 -1
- metadata +5 -2
data/.DS_Store
ADDED
Binary file
|
Binary file
|
@@ -3,7 +3,7 @@ module MotionPlot
|
|
3
3
|
|
4
4
|
attr_reader :layer_hosting_view, :graph, :series, :plot_space, :major_grid_line_style, :plots, :xaxis, :yaxis, :title
|
5
5
|
|
6
|
-
attr_accessor :legend, :
|
6
|
+
attr_accessor :legend, :axes, :theme, :data_label, :orientation, :plot_options
|
7
7
|
|
8
8
|
def bootstrap(options)
|
9
9
|
options.each_pair {|key, value|
|
@@ -34,7 +34,13 @@ module MotionPlot
|
|
34
34
|
@series = {}
|
35
35
|
series = options[:series]
|
36
36
|
series && series.each_with_index {|hash, index|
|
37
|
-
hash.
|
37
|
+
hash.reverse_merge!({
|
38
|
+
index: index,
|
39
|
+
defaults: default_style,
|
40
|
+
plot_options: @plot_options,
|
41
|
+
type: self.plot_type,
|
42
|
+
plot_symbol: (@plot_symbol ? options[:plot_symbol] : nil)
|
43
|
+
})
|
38
44
|
@series[hash[:name]] = Series.new(hash)
|
39
45
|
}
|
40
46
|
|
@@ -46,10 +52,6 @@ module MotionPlot
|
|
46
52
|
@data_label = DataLabel.new(options[:data_label])
|
47
53
|
end
|
48
54
|
|
49
|
-
if(@plot_symbol)
|
50
|
-
@plot_symbol = PlotSymbol.new(options[:plot_symbol])
|
51
|
-
end
|
52
|
-
|
53
55
|
@plots = []
|
54
56
|
end
|
55
57
|
|
@@ -134,8 +136,8 @@ module MotionPlot
|
|
134
136
|
@plot_space.allowsUserInteraction = true
|
135
137
|
end
|
136
138
|
|
137
|
-
def add_plot_symbol(plot,
|
138
|
-
plot.plotSymbol =
|
139
|
+
def add_plot_symbol(plot, symbol)
|
140
|
+
plot.plotSymbol = symbol
|
139
141
|
plot.plotSymbolMarginForHitDetection = 5.0
|
140
142
|
end
|
141
143
|
|
@@ -18,7 +18,7 @@ module MotionPlot
|
|
18
18
|
line.delegate = self
|
19
19
|
line.interpolation = CPTScatterPlotInterpolationCurved if(@curve_inerpolation)
|
20
20
|
|
21
|
-
add_plot_symbol(line,
|
21
|
+
add_plot_symbol(line, @series[name].plot_symbol.symbol_for(line)) if(@series[name].plot_symbol)
|
22
22
|
|
23
23
|
@graph.addPlot(line)
|
24
24
|
@plots << line
|
@@ -4,6 +4,7 @@ module MotionPlot
|
|
4
4
|
COLORS = ['4572A7', 'AA4643', '89A54E', '80699B', '3D96AE', 'DB843D', '92A8CD', 'A47D7C', 'B5CA92']
|
5
5
|
|
6
6
|
attr_accessor :name, :data, :index, :type, :style
|
7
|
+
attr_reader :plot_symbol
|
7
8
|
|
8
9
|
def initialize(args={})
|
9
10
|
args.each_pair {|key, value|
|
@@ -14,7 +15,8 @@ module MotionPlot
|
|
14
15
|
merge_plot_options(style_attr, args[:plot_options])
|
15
16
|
merge_style(style_attr, args[:style])
|
16
17
|
|
17
|
-
@style
|
18
|
+
@style = Style.new(style_attr)
|
19
|
+
@plot_symbol = PlotSymbol.new(args[:plot_symbol].merge(index: @index)) if(args[:plot_symbol])
|
18
20
|
end
|
19
21
|
|
20
22
|
def color
|
@@ -13,18 +13,36 @@ module MotionPlot
|
|
13
13
|
:snow => "snowPlotSymbol"
|
14
14
|
}
|
15
15
|
|
16
|
-
|
16
|
+
class << self
|
17
|
+
def method_missing(m, *args, &block)
|
18
|
+
method_name = m == :default ? :rectangle : m
|
19
|
+
|
20
|
+
raise unless(ALIASES.keys.include?(method_name))
|
21
|
+
|
22
|
+
CPTPlotSymbol.send(ALIASES[method_name])
|
23
|
+
end
|
24
|
+
|
25
|
+
def [](index)
|
26
|
+
index = 0 if(index > 9)
|
27
|
+
|
28
|
+
send(ALIASES.keys[index])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_accessor :enabled, :size, :type
|
17
33
|
|
18
34
|
def initialize(options={})
|
19
35
|
options.each_pair {|key, value|
|
20
36
|
send("#{key}=", value) if(respond_to?("#{key}="))
|
21
37
|
}
|
38
|
+
|
39
|
+
@type = options[:type] ? self.class.send(options[:type]) : MotionPlot::PlotSymbol[options[:index]]
|
22
40
|
end
|
23
41
|
|
24
|
-
def symbol_for(plot
|
42
|
+
def symbol_for(plot)
|
25
43
|
_style = CPTMutableLineStyle.lineStyle
|
26
44
|
_style.lineColor = plot.dataLineStyle.lineColor
|
27
|
-
symbol =
|
45
|
+
symbol = @type
|
28
46
|
symbol.fill = CPTFill.fillWithColor(plot.dataLineStyle.lineColor, colorWithAlphaComponent:0.5)
|
29
47
|
symbol.lineStyle = _style
|
30
48
|
symbol.size = CGSizeMake(size.to_f, size.to_f)
|
@@ -32,20 +50,8 @@ module MotionPlot
|
|
32
50
|
symbol
|
33
51
|
end
|
34
52
|
|
35
|
-
|
36
|
-
|
37
|
-
method_name = m == :default ? :rectangle : m
|
38
|
-
|
39
|
-
raise unless(ALIASES.keys.include?(method_name))
|
40
|
-
|
41
|
-
CPTPlotSymbol.send(ALIASES[method_name])
|
42
|
-
end
|
43
|
-
|
44
|
-
def [](index)
|
45
|
-
index = 0 if(index > 9)
|
46
|
-
|
47
|
-
send(ALIASES.keys[index])
|
48
|
-
end
|
53
|
+
def size
|
54
|
+
@size || 8
|
49
55
|
end
|
50
56
|
end
|
51
57
|
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.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bubble-wrap
|
@@ -67,6 +67,7 @@ executables: []
|
|
67
67
|
extensions: []
|
68
68
|
extra_rdoc_files: []
|
69
69
|
files:
|
70
|
+
- .DS_Store
|
70
71
|
- .gitignore
|
71
72
|
- .repl_history
|
72
73
|
- Gemfile
|
@@ -75,6 +76,7 @@ files:
|
|
75
76
|
- Rakefile
|
76
77
|
- app/app_delegate.rb
|
77
78
|
- lib/motion-plot.rb
|
79
|
+
- lib/motion-plot/.DS_Store
|
78
80
|
- lib/motion-plot/chart/area_plot.rb
|
79
81
|
- lib/motion-plot/chart/bar_plot.rb
|
80
82
|
- lib/motion-plot/chart/base.rb
|
@@ -83,6 +85,7 @@ files:
|
|
83
85
|
- lib/motion-plot/chart/delegates/stack_bar_delegate.rb
|
84
86
|
- lib/motion-plot/chart/line_plot.rb
|
85
87
|
- lib/motion-plot/chart/pie_plot.rb
|
88
|
+
- lib/motion-plot/core_ext/hash.rb
|
86
89
|
- lib/motion-plot/core_ext/ui_color.rb
|
87
90
|
- lib/motion-plot/series/series.rb
|
88
91
|
- lib/motion-plot/theme/theme.rb
|