rack-sparklines 1.0.0 → 1.1.0
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/README.rdoc +3 -2
- data/VERSION +1 -1
- data/lib/rack-sparklines.rb +1 -1
- data/lib/spark_pr.rb +5 -1
- data/rack-sparklines.gemspec +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -22,11 +22,12 @@ Mix and match your own handlers and cachers with your friends!
|
|
22
22
|
|
23
23
|
== Demo
|
24
24
|
|
25
|
-
See demo/sparkline_demo.rb
|
26
|
-
Or http://rack-sparklines.heroku.com/
|
25
|
+
See demo/sparkline_demo.rb or http://rack-sparklines.heroku.com/
|
27
26
|
|
28
27
|
== Codes
|
29
28
|
|
29
|
+
gem install rack-sparklines
|
30
|
+
|
30
31
|
http://github.com/technoweenie/rack-sparklines
|
31
32
|
|
32
33
|
== Copyright
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/lib/rack-sparklines.rb
CHANGED
@@ -4,7 +4,7 @@ module Rack
|
|
4
4
|
# Render sparkline graphs dynamically from datapoints in a matching CSV file
|
5
5
|
# (or anything that there is a Handler for).
|
6
6
|
class Sparklines
|
7
|
-
DEFAULT_SPARK_OPTIONS = {:has_min => true, :has_max => true,
|
7
|
+
DEFAULT_SPARK_OPTIONS = {:has_min => true, :has_max => true, :height => 40, :step => 10}
|
8
8
|
|
9
9
|
# Options:
|
10
10
|
# :spark - Hash of sparkline options. See spark_pr.rb
|
data/lib/spark_pr.rb
CHANGED
@@ -119,7 +119,11 @@ module Spark
|
|
119
119
|
def Spark.normalize( arr, type = :linear )
|
120
120
|
arr.map!{|v| Math.log(v) } if type == :logarithmic
|
121
121
|
adj, fac = arr.min, arr.max-arr.min
|
122
|
-
arr.map
|
122
|
+
arr.map do |v|
|
123
|
+
v = (v-adj).quo(fac) rescue 0
|
124
|
+
v = 0 if v.respond_to?(:nan?) && v.nan?
|
125
|
+
v
|
126
|
+
end
|
123
127
|
end
|
124
128
|
|
125
129
|
def Spark.process_options( options )
|
data/rack-sparklines.gemspec
CHANGED