gerbilcharts 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/gerbilcharts/models/graph_model_group.rb +14 -7
- data/lib/gerbilcharts/models/monotonous_graph_model.rb +1 -1
- data/lib/gerbilcharts/models/raw_range.rb +8 -2
- data/lib/gerbilcharts/models/round_range.rb +5 -3
- data/lib/gerbilcharts/models/sampled_timeseries_graph_model.rb +5 -0
- data/lib/gerbilcharts/models/time_series_graph_model.rb +6 -1
- data/lib/gerbilcharts/surfaces/grid.rb +2 -0
- data/lib/gerbilcharts/surfaces/tracker.rb +1 -1
- data/lib/gerbilcharts/version.rb +1 -1
- metadata +3 -3
data/History.txt
CHANGED
@@ -109,9 +109,7 @@ class GraphModelGroup
|
|
109
109
|
# rounds both x and y scales, returns two ranges
|
110
110
|
def effective_round_range
|
111
111
|
|
112
|
-
if
|
113
|
-
return 0,0
|
114
|
-
end
|
112
|
+
return 0,0 if @models.empty?
|
115
113
|
|
116
114
|
reffx = RawRange.new
|
117
115
|
reffy = RawRange.new
|
@@ -127,11 +125,19 @@ class GraphModelGroup
|
|
127
125
|
|
128
126
|
# round the x ranges of all models
|
129
127
|
def effective_round_range_x
|
128
|
+
|
129
|
+
return 0,0 if @models.empty?
|
130
130
|
|
131
131
|
reffx = RawRange.new
|
132
132
|
@models.each do |m|
|
133
133
|
reffx.update_r(m.xrange)
|
134
134
|
end
|
135
|
+
|
136
|
+
if reffx.invalid?
|
137
|
+
reffx.update 10
|
138
|
+
end
|
139
|
+
|
140
|
+
|
135
141
|
return models[0].round_given_x(reffx)
|
136
142
|
end
|
137
143
|
|
@@ -162,7 +168,7 @@ class GraphModelGroup
|
|
162
168
|
reffy = RawRange.new
|
163
169
|
reffy.zeromin
|
164
170
|
@models.each do |m|
|
165
|
-
reffy.update_r(m.yrange)
|
171
|
+
reffy.update_r(m.yrange)
|
166
172
|
end
|
167
173
|
return @models[0].round_given_y(reffy)
|
168
174
|
end
|
@@ -179,6 +185,9 @@ class GraphModelGroup
|
|
179
185
|
|
180
186
|
# sum of model ranges with min y being 0
|
181
187
|
def cumulative_round_range_y0
|
188
|
+
|
189
|
+
return 0,100 if models.empty?
|
190
|
+
|
182
191
|
reffy = RawRange.new
|
183
192
|
reffy.update(0)
|
184
193
|
@models.each do |m|
|
@@ -215,9 +224,7 @@ class GraphModelGroup
|
|
215
224
|
|
216
225
|
def cumulative_round_range
|
217
226
|
|
218
|
-
if
|
219
|
-
return 0,0
|
220
|
-
end
|
227
|
+
return 0,0 if @models.empty?
|
221
228
|
|
222
229
|
reffx = RawRange.new
|
223
230
|
reffy = RawRange.new
|
@@ -10,13 +10,19 @@ class RawRange < Presets
|
|
10
10
|
def initialize
|
11
11
|
@rmax,@rmin=nil,nil
|
12
12
|
end
|
13
|
+
|
14
|
+
def invalid?
|
15
|
+
@rmin.nil?
|
16
|
+
end
|
13
17
|
|
14
18
|
# update - updates the range
|
15
19
|
# newval - new incoming value
|
16
20
|
#
|
17
21
|
def update(newval)
|
18
|
-
|
19
|
-
|
22
|
+
if not newval.nil?
|
23
|
+
@rmax=newval if @rmax.nil? or newval > @rmax
|
24
|
+
@rmin=newval if @rmin.nil? or newval < @rmin
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
# update - updates the range (using another range)
|
@@ -10,9 +10,9 @@ class RoundRange < RawRange
|
|
10
10
|
# given a raw range, we calculate a round range
|
11
11
|
def initialize(raw_range)
|
12
12
|
super()
|
13
|
-
@rmin=round_min(raw_range.rmin)
|
14
|
-
@rmax=round_max(raw_range.rmax)
|
15
|
-
@lmax=label_step
|
13
|
+
@rmin=round_min(raw_range.rmin) if not raw_range.rmin.nil?
|
14
|
+
@rmax=round_max(raw_range.rmax) if not raw_range.rmax.nil?
|
15
|
+
@lmax=label_step if not raw_range.rmax.nil?
|
16
16
|
end
|
17
17
|
|
18
18
|
# provide labels
|
@@ -24,6 +24,8 @@ class RoundRange < RawRange
|
|
24
24
|
# end
|
25
25
|
#
|
26
26
|
def each_label
|
27
|
+
|
28
|
+
return if not @lmax
|
27
29
|
|
28
30
|
raise "Range not aligned with presets (call round range first)" if not @lmax
|
29
31
|
raise "No data points in model" if @rmax == -1
|
@@ -15,8 +15,13 @@ class TimeSeriesGraphModel < MonotonousGraphModel
|
|
15
15
|
@roundery=RoundRange
|
16
16
|
end
|
17
17
|
|
18
|
+
# we add Timeval objects (those that respond to tv_sec)
|
18
19
|
def add(timeobj, val)
|
19
|
-
|
20
|
+
if timeobj.is_a? Time
|
21
|
+
super timeobj, val
|
22
|
+
elsif timeobj.is_a? Fixnum
|
23
|
+
super Time.at(timeobj),val
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
# crop older than the given timestamp
|
data/lib/gerbilcharts/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gerbilcharts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vivek Rajagopalan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-17 00:00:00 +05:30
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 2.3.3
|
24
24
|
version:
|
25
25
|
description: SVG based charting library for timeseries data
|
26
26
|
email:
|