gerbilcharts 0.7.0 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,7 +18,7 @@ class GraphModel
18
18
 
19
19
  def initialize(n="Untitled")
20
20
  @name=n
21
- @transformer = nil
21
+ @transformer = nil
22
22
  end
23
23
 
24
24
  def min_max_x
@@ -13,10 +13,10 @@ class GraphModelGroup
13
13
  attr_accessor :x_markers
14
14
  attr_accessor :ref_model
15
15
 
16
- def initialize(n="Untitled-Group")
16
+ def initialize(n="Untitled-Group",opts={})
17
17
  @models=[]
18
18
  @name=n
19
- @units=""
19
+ @units=opts[:units] || ""
20
20
  end
21
21
 
22
22
  def <<(m)
@@ -56,8 +56,11 @@ class RawRange < Presets
56
56
  # scales a value with respect to the range
57
57
  # val = scale this value
58
58
  def scale_factor(val)
59
- f = (val-@rmin).to_f/(@rmax-@rmin).to_f
60
- return f
59
+ if @rmin==@rmax
60
+ return 0.1
61
+ else
62
+ return (val-@rmin).to_f/(@rmax-@rmin).to_f
63
+ end
61
64
  end
62
65
 
63
66
  def zeromin
@@ -16,26 +16,31 @@ class LineSurface < Surface
16
16
 
17
17
  def int_render(g)
18
18
 
19
- range_options_x = parent.get_global_option(:scaling_x,:auto)
20
- range_options_y = parent.get_global_option(:scaling_y,:auto)
21
- butterfly = parent.get_global_option(:butterfly,false)
19
+ range_options_x = parent.get_global_option(:scaling_x,:auto)
20
+ range_options_y = parent.get_global_option(:scaling_y,:auto)
21
+ butterfly = parent.get_global_option(:butterfly,false)
22
22
 
23
23
  rx = parent.modelgroup.effective_range_x(range_options_x)
24
24
  ry = parent.modelgroup.effective_range_y(range_options_y)
25
25
 
26
- ry.update(-ry.rmax) if butterfly
26
+ ry.update(-ry.rmax) if butterfly
27
27
  set_ajaxSurfaceContext(rx.rmax,ry.rmax,"LINE") if parent.usesAjax?
28
28
 
29
29
  parent.modelgroup.each_model_with_index do |mod,i|
30
30
  mod.each_tuple do |x,y|
31
- y = -y if butterfly and i.odd?
31
+ y = -y if butterfly and i.odd?
32
32
 
33
- # the basic line
33
+ # the basic line
34
34
  xpos = scale_x x,rx
35
35
  ypos = scale_y y,ry
36
+
37
+ if mod.count==1
38
+ ypos0 = scale_y 0,ry
39
+ g.lineto xpos,ypos0
40
+ end
36
41
  g.lineto xpos,ypos
37
42
 
38
- # tooltip
43
+ # tooltip
39
44
  opts = {:id => "item#{i}"}
40
45
  if parent.get_global_option(:auto_tooltips,false)
41
46
  opts.merge!(:onmouseover => "OpacityDown(evt)", :onmouseout => "OpacityUp(evt)")
@@ -44,7 +49,7 @@ class LineSurface < Surface
44
49
  end
45
50
 
46
51
  # cirle dp
47
- g.circle(xpos,ypos,4,opts) if parent.get_global_option(:circle_data_points,false)
52
+ g.circle(xpos,ypos,4,opts) if parent.get_global_option(:circle_data_points,false)
48
53
 
49
54
  end
50
55
  g.endline(:id => "lineitem#{i}")
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.7.0
4
+ version: 0.7.3
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-07 00:00:00.000000000 Z
12
+ date: 2013-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda
@@ -180,7 +180,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
180
  version: '0'
181
181
  segments:
182
182
  - 0
183
- hash: 1136062034129104066
183
+ hash: 4513405572357930179
184
184
  required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  none: false
186
186
  requirements: