analytica 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/analytica.rb +1 -1
- data/lib/visualization.rb +26 -38
- metadata +4 -4
data/lib/analytica.rb
CHANGED
data/lib/visualization.rb
CHANGED
@@ -38,10 +38,14 @@ module Analytica
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def set_title(params)
|
41
|
+
enforce_map_defaults!({
|
42
|
+
:text => ' ',
|
43
|
+
:size => 11,
|
44
|
+
:color => "000000"}, params)
|
41
45
|
enforce_map!({
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
46
|
+
:text => :string,
|
47
|
+
:size => :natural_number,
|
48
|
+
:color => :hex_color}, params)
|
45
49
|
|
46
50
|
@title = params
|
47
51
|
@title_set = true
|
@@ -58,7 +62,7 @@ module Analytica
|
|
58
62
|
def generate_title
|
59
63
|
options = {}
|
60
64
|
if @title_set
|
61
|
-
options.merge!(@title)
|
65
|
+
options.merge!({:title => @title[:text], :title_size => @title[:size], :title_color => @title[:color]})
|
62
66
|
end
|
63
67
|
options
|
64
68
|
end
|
@@ -114,9 +118,7 @@ module Analytica
|
|
114
118
|
|
115
119
|
def to_linegraph(params={})
|
116
120
|
enforce_map_defaults!({
|
117
|
-
:title => ' ',
|
118
|
-
:title_size => 12,
|
119
|
-
:title_color => '000000',
|
121
|
+
:title => {:text => ' ', :color => "000000", :size => 12},
|
120
122
|
:color => 'ffffff',
|
121
123
|
:background_color => '000000',
|
122
124
|
:width => 600,
|
@@ -125,15 +127,14 @@ module Analytica
|
|
125
127
|
:bar_settings => {}}, params)
|
126
128
|
|
127
129
|
enforce_map!({
|
128
|
-
:title => :
|
129
|
-
:title_size => :natural_number,
|
130
|
-
:title_color => :hex_color,
|
130
|
+
:title => :hash_map,
|
131
131
|
:width => :natural_number,
|
132
132
|
:height => :natural_number,
|
133
133
|
:background_color => :hex_color,
|
134
134
|
:format => [:url, :image_tag],
|
135
135
|
:color => :hex_color}, params)
|
136
136
|
|
137
|
+
set_title(params[:title])
|
137
138
|
|
138
139
|
options = {}
|
139
140
|
|
@@ -162,9 +163,7 @@ module Analytica
|
|
162
163
|
|
163
164
|
def to_sparkline(params={})
|
164
165
|
enforce_map_defaults!({
|
165
|
-
:title => ' ',
|
166
|
-
:title_size => 12,
|
167
|
-
:title_color => '000000',
|
166
|
+
:title => {:text => ' ', :color => "000000", :size => 12},
|
168
167
|
:color => '0000ff',
|
169
168
|
:background_color => 'ffffff',
|
170
169
|
:width => 600,
|
@@ -173,19 +172,14 @@ module Analytica
|
|
173
172
|
:bar_settings => {}}, params)
|
174
173
|
|
175
174
|
enforce_map!({
|
176
|
-
:title => :
|
177
|
-
:title_size => :natural_number,
|
178
|
-
:title_color => :hex_color,
|
175
|
+
:title => :hash_map,
|
179
176
|
:width => :natural_number,
|
180
177
|
:height => :natural_number,
|
181
178
|
:background_color => :hex_color,
|
182
179
|
:format => [:url, :image_tag],
|
183
180
|
:color => :hex_color}, params)
|
184
181
|
|
185
|
-
params[:title]
|
186
|
-
params[:title_size] = 12 unless params.has_key? :title_size
|
187
|
-
params[:title_color] = '000000' unless params.has_key? :title_color
|
188
|
-
|
182
|
+
set_title(params[:title])
|
189
183
|
|
190
184
|
options = {}
|
191
185
|
|
@@ -215,9 +209,7 @@ module Analytica
|
|
215
209
|
|
216
210
|
def to_bargraph(params={})
|
217
211
|
enforce_map_defaults!({
|
218
|
-
:title => ' ',
|
219
|
-
:title_size => 12,
|
220
|
-
:title_color => '000000',
|
212
|
+
:title => {:text => ' ', :color => "000000", :size => 12},
|
221
213
|
:orientation => :vertical,
|
222
214
|
:color => '00bb00',
|
223
215
|
:background_color => 'ffffff',
|
@@ -229,9 +221,7 @@ module Analytica
|
|
229
221
|
:bar_settings => {}}, params)
|
230
222
|
|
231
223
|
enforce_map!({
|
232
|
-
:title => :
|
233
|
-
:title_size => :natural_number,
|
234
|
-
:title_color => :hex_color,
|
224
|
+
:title => :hash_map,
|
235
225
|
:width => :natural_number,
|
236
226
|
:height => :natural_number,
|
237
227
|
:orientation => [:vertical, :horizontal],
|
@@ -240,6 +230,8 @@ module Analytica
|
|
240
230
|
:color => :hex_color,
|
241
231
|
:format => [:url, :image_tag],
|
242
232
|
:bar_settings => :hash_map}, params)
|
233
|
+
|
234
|
+
set_title(params[:title])
|
243
235
|
|
244
236
|
options = {}
|
245
237
|
|
@@ -278,9 +270,7 @@ module Analytica
|
|
278
270
|
|
279
271
|
def to_linegraph(params={})
|
280
272
|
enforce_map_defaults!({
|
281
|
-
:title => ' ',
|
282
|
-
:title_size => 12,
|
283
|
-
:title_color => '000000',
|
273
|
+
:title => {:text => ' ', :color => "000000", :size => 12},
|
284
274
|
:color => 'ffffff',
|
285
275
|
:width => 600,
|
286
276
|
:height => 280,
|
@@ -288,15 +278,15 @@ module Analytica
|
|
288
278
|
:background_color => '000000'}, params)
|
289
279
|
|
290
280
|
enforce_map!({
|
291
|
-
:title => :
|
292
|
-
:title_size => :natural_number,
|
293
|
-
:title_color => :hex_color,
|
281
|
+
:title => :hash_map,
|
294
282
|
:width => :natural_number,
|
295
283
|
:height => :natural_number,
|
296
284
|
:background_color => :hex_color,
|
297
285
|
:format => [:url, :image_tag],
|
298
286
|
:color => :hex_color}, params)
|
299
287
|
|
288
|
+
set_title(params[:title])
|
289
|
+
|
300
290
|
options = {}
|
301
291
|
|
302
292
|
options.merge!({:format => 'image_tag'}) if params[:format] == :image_tag
|
@@ -324,9 +314,7 @@ module Analytica
|
|
324
314
|
|
325
315
|
def to_bargraph(params={})
|
326
316
|
enforce_map_defaults!({
|
327
|
-
:title => ' ',
|
328
|
-
:title_size => 12,
|
329
|
-
:title_color => '000000',
|
317
|
+
:title => {:text => ' ', :color => "000000", :size => 12},
|
330
318
|
:orientation => :vertical,
|
331
319
|
:color => 'ffffff',
|
332
320
|
:background_color => '000000',
|
@@ -337,9 +325,7 @@ module Analytica
|
|
337
325
|
:bar_settings => {}}, params)
|
338
326
|
|
339
327
|
enforce_map!({
|
340
|
-
:title => :
|
341
|
-
:title_size => :natural_number,
|
342
|
-
:title_color => :hex_color,
|
328
|
+
:title => :hash_map,
|
343
329
|
:width => :natural_number,
|
344
330
|
:height => :natural_number,
|
345
331
|
:orientation => [:vertical, :horizontal],
|
@@ -349,6 +335,8 @@ module Analytica
|
|
349
335
|
:format => [:url, :image_tag],
|
350
336
|
:bar_settings => :hash_map}, params)
|
351
337
|
|
338
|
+
set_title(params[:title])
|
339
|
+
|
352
340
|
options = {}
|
353
341
|
|
354
342
|
options.merge!({:format => 'image_tag'}) if params[:format] == :image_tag
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: analytica
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 55
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 20
|
10
|
+
version: 0.0.20
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Raeez Lorgat
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-22 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|