graphite_graph 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/graphite_graph/version.rb +1 -1
- data/lib/graphite_graph.rb +17 -2
- metadata +4 -4
data/lib/graphite_graph.rb
CHANGED
@@ -32,10 +32,12 @@ class GraphiteGraph
|
|
32
32
|
:hide_grid => nil,
|
33
33
|
:ymin => nil,
|
34
34
|
:ymax => nil,
|
35
|
+
:yunit_system => nil,
|
35
36
|
:linewidth => nil,
|
36
37
|
:linemode => nil,
|
37
38
|
:fontsize => nil,
|
38
39
|
:fontbold => false,
|
40
|
+
:fontname => nil,
|
39
41
|
:timezone => nil,
|
40
42
|
:background_color => nil,
|
41
43
|
:foreground_color => nil,
|
@@ -265,10 +267,12 @@ class GraphiteGraph
|
|
265
267
|
url_parts << "hideGrid=#{properties[:hide_grid]}" if properties[:hide_grid]
|
266
268
|
url_parts << "yMin=#{properties[:ymin]}" if properties[:ymin]
|
267
269
|
url_parts << "yMax=#{properties[:ymax]}" if properties[:ymax]
|
270
|
+
url_parts << "yUnitSystem=#{properties[:yunit_system]}" if properties[:yunit_system]
|
268
271
|
url_parts << "lineWidth=#{properties[:linewidth]}" if properties[:linewidth]
|
269
272
|
url_parts << "lineMode=#{properties[:linemode]}" if properties[:linemode]
|
270
273
|
url_parts << "fontSize=#{properties[:fontsize]}" if properties[:fontsize]
|
271
274
|
url_parts << "fontBold=#{properties[:fontbold]}" if properties[:fontbold]
|
275
|
+
url_parts << "fontName=#{properties[:fontname]}" if properties[:fontname]
|
272
276
|
url_parts << "drawNullAsZero=#{properties[:draw_null_as_zero]}" if properties[:draw_null_as_zero]
|
273
277
|
url_parts << "tz=#{properties[:timezone]}" if properties[:timezone]
|
274
278
|
url_parts << "majorGridLineColor=#{properties[:major_grid_line_color]}" if properties[:major_grid_line_color]
|
@@ -288,7 +292,16 @@ class GraphiteGraph
|
|
288
292
|
|
289
293
|
graphite_target = "derivative(#{graphite_target})" if target[:derivative]
|
290
294
|
graphite_target = "highestAverage(#{graphite_target},#{target[:highest_average]})" if target[:highest_average]
|
291
|
-
|
295
|
+
if target[:scale]
|
296
|
+
graphite_target = "scale(#{graphite_target},#{target[:scale]})"
|
297
|
+
elsif target[:scale_to_seconds]
|
298
|
+
graphite_target = "scaleToSeconds(#{graphite_target},#{target[:scale_to_seconds]})"
|
299
|
+
end
|
300
|
+
if target[:as_percent] == true
|
301
|
+
graphite_target = "asPercent(#{graphite_target})"
|
302
|
+
elsif target[:as_percent]
|
303
|
+
graphite_target = "asPercent(#{graphite_target},#{target[:as_percent]})"
|
304
|
+
end
|
292
305
|
graphite_target = "drawAsInfinite(#{graphite_target})" if target[:line]
|
293
306
|
graphite_target = "movingAverage(#{graphite_target},#{target[:smoothing]})" if target[:smoothing]
|
294
307
|
|
@@ -299,6 +312,8 @@ class GraphiteGraph
|
|
299
312
|
unless target.include?(:subgroup)
|
300
313
|
if target[:alias_by_node]
|
301
314
|
graphite_target = "aliasByNode(#{graphite_target},#{target[:alias_by_node]})"
|
315
|
+
elsif target[:alias_sub_search]
|
316
|
+
graphite_target = "aliasSub(#{graphite_target},\"#{target[:alias_sub_search]}\",\"#{target[:alias_sub_replace]}\")"
|
302
317
|
elsif target[:alias]
|
303
318
|
graphite_target = "alias(#{graphite_target},\"#{target[:alias]}\")"
|
304
319
|
elsif target[:no_alias]
|
@@ -324,7 +339,7 @@ class GraphiteGraph
|
|
324
339
|
url_str = url_parts.join("&")
|
325
340
|
properties[:placeholders].each { |k,v| url_str.gsub!("%{#{k}}", v.to_s) } if properties[:placeholders].is_a?(Hash)
|
326
341
|
|
327
|
-
URI.encode(url_str)
|
342
|
+
URI.encode(url_str, Regexp.union(URI::REGEXP::UNSAFE, /[+]/))
|
328
343
|
else
|
329
344
|
url_parts
|
330
345
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphite_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- R.I.Pienaar
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-
|
19
|
+
date: 2012-07-04 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|