gerbilcharts 0.2.10 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,8 +1,18 @@
1
- == 0.2.10 2009-11-03
1
+ == 0.2.11 2009-12-01
2
2
  * Changes
3
- * Applies a css stylesheet to svg elements
4
- * Supports basic styles only
5
- * The goal is to make gc work with the new svgweb
3
+ * inline javascript option now fixed
4
+ * grid sublines work for first label interval now
5
+ * detailed legend showing max/min/avg/latest
6
+ * option to switch between mini and detailed legends
7
+ * various other fixes and tweaks
8
+
9
+ == 0.2.6 2009-10-27
10
+ * Changes
11
+ * Negative values work good
12
+ * Much better timerange selection
13
+ * Auto tooltips for surfaces that allow it
14
+ * Butterfly surface Area surface (such as in/out charts)
15
+ * Other misc changes
6
16
 
7
17
  == 0.2.3 2009-10-19
8
18
  * Changes
data/README.txt CHANGED
@@ -6,8 +6,6 @@
6
6
 
7
7
  SVG based charting library especially suited for timeseries data.
8
8
 
9
- * Now supports Internet Explorer via SVGWEB *
10
-
11
9
  == FEATURES/PROBLEMS:
12
10
 
13
11
  * Many predefined models
@@ -16,12 +16,16 @@ class AreaChart < ChartBase
16
16
  # anchor (line surface)
17
17
  @thechart.create_filter(GerbilCharts::SVGDC::LinearGradientVertical.new("vertgrad","rgb(255,255,255)","rgb(224,224,224)"))
18
18
 
19
+ # additional filter by name
20
+ @thechart.create_filter(GerbilCharts::SVGDC::LikeButton.new('LikeButton')) if @gerbilfilter == 'LikeButton'
21
+
19
22
  # other elements
20
23
  @thechart.add_child(GerbilCharts::Surfaces::SurfaceBackground.new(:orient => ORIENT_OVERLAY))
21
24
  @thechart.add_child(GerbilCharts::Surfaces::BasicGrid.new(:orient => ORIENT_OVERLAY))
22
25
  @thechart.add_child(GerbilCharts::Surfaces::TitlePanel.new(:orient => ORIENT_OVERLAY, :dim => 30))
23
26
  @thechart.add_child(GerbilCharts::Surfaces::AreaSurface.new(:orient => ORIENT_OVERLAY),:anchor => true)
24
27
  @thechart.add_child(GerbilCharts::Surfaces::Legend.new(:orient=> ORIENT_OVERLAY, :dim => @legend_width))
28
+ @thechart.add_child(GerbilCharts::Surfaces::DetailedLegend.new(:orient=> ORIENT_OVERLAY, :dim => 3*@legend_width))
25
29
  @thechart.add_child(GerbilCharts::Surfaces::VerticalAxis.new(:orient => ORIENT_WEST, :dim => 40 ))
26
30
  @thechart.add_child(GerbilCharts::Surfaces::HorizontalTimeAxis.new(:orient => ORIENT_SOUTH, :dim => 25 ))
27
31
 
@@ -20,6 +20,9 @@ class BarChart < ChartBase
20
20
 
21
21
  # anchor (line surface)
22
22
  @thechart.create_filter(GerbilCharts::SVGDC::LinearGradientVertical.new("vertgrad","rgb(255,255,255)","rgb(224,224,224)"))
23
+
24
+ # additional filter by name
25
+ @thechart.create_filter(GerbilCharts::SVGDC::LikeButton.new('LikeButton')) if @gerbilfilter == 'LikeButton'
23
26
 
24
27
  # other elements
25
28
  @thechart.add_child(GerbilCharts::Surfaces::SurfaceBackground.new(:orient => ORIENT_OVERLAY))
@@ -14,6 +14,9 @@ class BarChartCompact < ChartBase
14
14
  # anchor (line surface)
15
15
  @thechart.create_filter(GerbilCharts::SVGDC::LinearGradientVertical.new("vertgrad","rgb(255,255,255)","rgb(224,224,224)"))
16
16
 
17
+ # additional filter by name
18
+ @thechart.create_filter(GerbilCharts::SVGDC::LikeButton.new('LikeButton')) if @gerbilfilter == 'LikeButton'
19
+
17
20
  # other elements
18
21
  @thechart.add_child(GerbilCharts::Surfaces::SurfaceBackground.new(:orient => ORIENT_OVERLAY))
19
22
  @thechart.add_child(GerbilCharts::Surfaces::TitlePanel.new(:orient => ORIENT_OVERLAY, :dim => 30, :just => :right))
@@ -67,6 +67,8 @@ class ChartBase
67
67
 
68
68
  # common relative widths
69
69
  @legend_width = [opt[:width]/4,100].max
70
+
71
+ @gerbilfilter = opt[:filter] || ""
70
72
  end
71
73
 
72
74
  def set_renderoptions=(opts)
@@ -11,7 +11,6 @@ class PieChart < ChartBase
11
11
  def initialize(opt={})
12
12
  super(opt)
13
13
 
14
- @gerbilfilter = opt[:filter] || ""
15
14
 
16
15
  end
17
16
 
@@ -21,8 +20,8 @@ class PieChart < ChartBase
21
20
  @thechart.create_filter(GerbilCharts::SVGDC::LinearGradientVertical.new("vertgrad",
22
21
  "rgb(255,255,255)","rgb(224,224,224)"))
23
22
 
24
- # additional filter by name
25
- @thechart.create_filter(GerbilCharts::SVGDC::LikeButton.new('LikeButton')) if @gerbilfilter == 'LikeButton'
23
+ # additional filter by name
24
+ @thechart.create_filter(GerbilCharts::SVGDC::LikeButton.new('LikeButton')) if @gerbilfilter == 'LikeButton'
26
25
 
27
26
 
28
27
  # other elements
@@ -17,6 +17,7 @@ class StackedAreaChart < ChartBase
17
17
  @thechart.add_child(GerbilCharts::Surfaces::TitlePanel.new(:orient => ORIENT_OVERLAY, :dim => 30))
18
18
  @thechart.add_child(GerbilCharts::Surfaces::StackedAreaSurface.new(:orient => ORIENT_OVERLAY),:anchor => true)
19
19
  @thechart.add_child(GerbilCharts::Surfaces::Legend.new(:orient=> ORIENT_OVERLAY, :dim => @legend_width))
20
+ @thechart.add_child(GerbilCharts::Surfaces::DetailedLegend.new(:orient=> ORIENT_OVERLAY, :dim => 3*@legend_width))
20
21
  @thechart.add_child(GerbilCharts::Surfaces::VerticalAxis.new(:orient => ORIENT_WEST, :dim => 40 , :cumulative => true ))
21
22
  @thechart.add_child(GerbilCharts::Surfaces::HorizontalTimeAxis.new(:orient => ORIENT_SOUTH, :dim => 25 ))
22
23
 
@@ -20,10 +20,19 @@ class DiscreteTimeRange
20
20
  end
21
21
  end
22
22
 
23
+ def rmax
24
+ @points.first
25
+ end
26
+
27
+ def rmin
28
+ @points.last
29
+ end
30
+
31
+
23
32
  # provide ticks (per label interval)
24
33
  def each_tick(tpl)
25
34
  @points.each do |t|
26
- yield v
35
+ yield t
27
36
  end
28
37
  end
29
38
 
@@ -82,6 +82,10 @@ class MonotonousGraphModel < GraphModel
82
82
  def latest_formatted_val
83
83
  return @yrange.format_value(@yarr.last)
84
84
  end
85
+
86
+ def formatted_val rawval
87
+ return @yrange.format_value(rawval)
88
+ end
85
89
 
86
90
  def ranges
87
91
  yield @xrange, @yrange if block_given?
@@ -143,8 +147,30 @@ class MonotonousGraphModel < GraphModel
143
147
  v=@yarr.last
144
148
  @yarr[@yarr.size-1]=v * ( 0.5 + rand())
145
149
  end
146
-
147
150
 
151
+ # statistical analysis
152
+ # standard deviation and 95th percentile go here
153
+ #
154
+ # mode => :normal or :ninety_fifth
155
+ #
156
+ # returns array 0 = min, 1 = max, 2 = avg, 3 = total, 4 = latest
157
+ # todo : 5 = stddev
158
+ # todo : support :ninety_fifth
159
+ #
160
+ def get_statistical_analysis(mode = :normal)
161
+ a = []
162
+ a[0]= @yrange.rmin
163
+ a[1]= @yrange.rmax
164
+ a[3]=0
165
+
166
+ @yarr.each do |v|
167
+ a[3] = a[3] + v
168
+ end
169
+ a[2] = a[3]/@yarr.size
170
+ a[4] = latest_val
171
+ return a
172
+ end
173
+
148
174
  private
149
175
  # recompute ranges
150
176
  def recompute_ranges
@@ -158,7 +184,6 @@ private
158
184
 
159
185
  end
160
186
 
161
-
162
187
  # rudimentary binary search
163
188
  def binarySearch(array, target, i, n)
164
189
  case n
@@ -46,6 +46,8 @@ class RoundRange < RawRange
46
46
  def each_tick(tpl)
47
47
 
48
48
  raise "Range not aligned with presets (call round range first)" if not @lmax
49
+
50
+ return if @lmax==0
49
51
 
50
52
  lint = @lmax/tpl
51
53
  if @rmin % lint != 0
@@ -60,13 +60,13 @@ class RoundTimeRange < RawRange
60
60
  subtick_delta = ideal_subtick_interval(@ldelta)
61
61
 
62
62
  if (@rmin.tv_sec % @ldelta) != @gmhalfhour
63
- ni_sec = (@rmin.tv_sec+@ldelta)/@ldelta
63
+ ni_sec = (@rmin.tv_sec+subtick_delta)/subtick_delta
64
64
 
65
65
  # if labeling hours, make sure you account tz weirdness like india GMT +5:30
66
66
  if @ldelta >= 3600
67
- v = Time.at(@ldelta* ni_sec.to_i - @gmhalfhour)
67
+ v = Time.at(subtick_delta* ni_sec.to_i - @gmhalfhour)
68
68
  else
69
- v = Time.at(@ldelta * ni_sec.to_i)
69
+ v = Time.at(subtick_delta * ni_sec.to_i)
70
70
  end
71
71
  else
72
72
  v = @rmin
@@ -182,11 +182,19 @@
182
182
 
183
183
  .legendtext
184
184
  {
185
- font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
185
+ font-family: sans;
186
186
  font-size: 10px;
187
187
  fill: black;
188
188
  stroke: none;
189
189
  }
190
+ .legendstats
191
+ {
192
+ font-family: sans;
193
+ font-size: 9px;
194
+ fill: black;
195
+ stroke: none;
196
+ }
197
+
190
198
  .elementlabel
191
199
  {
192
200
  font-family: sans;
@@ -57,6 +57,36 @@ function TestUpdates1(evt)
57
57
  tnode.firstChild.nodeValue="Changed by Ajax2";
58
58
  }
59
59
 
60
+ // Switch between detailed and mini legend panels
61
+ function showMiniLegend()
62
+ {
63
+ var l_hide = SVGDocument.getElementById("legendpanel_detail");
64
+ if (l_hide)
65
+ {
66
+ l_hide.setAttributeNS(null, 'visibility', 'hidden');
67
+ }
68
+ var l_show = SVGDocument.getElementById("legendpanel_mini");
69
+ if (l_show)
70
+ {
71
+ l_show.setAttributeNS(null, 'visibility', 'visible');
72
+ }
73
+ }
74
+
75
+ // Switch between detailed and mini legend panels
76
+ function showDetailedLegend()
77
+ {
78
+ var l_hide = SVGDocument.getElementById("legendpanel_mini");
79
+ if (l_hide)
80
+ {
81
+ l_hide.setAttributeNS(null, 'visibility', 'hidden');
82
+ }
83
+ var l_show = SVGDocument.getElementById("legendpanel_detail");
84
+ if (l_show)
85
+ {
86
+ l_show.setAttributeNS(null, 'visibility', 'visible');
87
+ }
88
+ }
89
+
60
90
  // The chart needs to fill in the following options
61
91
  // axurl , response will either do noop/full/delta replacement
62
92
  function SvgAjaxUpdate()
@@ -11,6 +11,7 @@ require 'gerbilcharts/surfaces/graph_element'
11
11
  require 'gerbilcharts/surfaces/surface'
12
12
  require 'gerbilcharts/surfaces/panel'
13
13
  require 'gerbilcharts/surfaces/legend'
14
+ require 'gerbilcharts/surfaces/detailed_legend'
14
15
  require 'gerbilcharts/surfaces/title_panel'
15
16
  require 'gerbilcharts/surfaces/axis'
16
17
  require 'gerbilcharts/surfaces/vertical_axis'
@@ -26,6 +26,11 @@ class AreaSurface < Surface
26
26
  ry = parent.modelgroup.effective_range_y(range_options_y)
27
27
 
28
28
 
29
+ # any filters ?
30
+ if parent.get_global_option(:filter,false)
31
+ g.curr_win.add_options({:filter => "url(##{parent.get_global_option(:filter,false)})" })
32
+ end
33
+
29
34
  # ajax if used
30
35
  if parent.usesAjax?
31
36
  set_ajaxSurfaceContext(rx.rmax,ry.rmax,"AREA")
@@ -24,6 +24,12 @@ class BarSurface < Surface
24
24
  parent.modelgroup.empty_caption,{"text-anchor" => "middle"})
25
25
  return
26
26
  end
27
+
28
+ # any filters ?
29
+ if parent.get_global_option(:filter,false)
30
+ g.curr_win.add_options({:filter => "url(##{parent.get_global_option(:filter,false)})" })
31
+ end
32
+
27
33
 
28
34
  # see if the element spacing or width need to be adjusted to fit
29
35
  nmodels = parent.modelgroup.count
@@ -14,11 +14,17 @@ class Legend < GraphElement
14
14
  end
15
15
 
16
16
  def int_render(g)
17
+
18
+ w=g.newwin("legendpanel_mini")
19
+ g.setactivewindow(w)
20
+
17
21
  # count determines the bounds
18
22
  @bounds.bottom = @bounds.top + 15 * parent.modelgroup.count
19
23
  g.rectangle_r(@bounds, {:class => @class})
20
24
 
21
- g.rectangle(@bounds.left-5,@bounds.top,5,5)
25
+ # toggle detail/mini legend
26
+ g.rectangle(@bounds.left-5,@bounds.top,5,5, {:href => "javascript:void(0);",
27
+ :onclick => "showDetailedLegend();" })
22
28
 
23
29
  rbox = Rect.new
24
30
  rbox.initfrom(@bounds)
@@ -33,7 +39,7 @@ class Legend < GraphElement
33
39
  opts = { :class => "legendtext" }
34
40
  opts.merge!(:onmouseover => "OpacityDown(evt)", :onmouseout => "OpacityUp(evt)")
35
41
  opts.store(:gerbiltooltip1, mod.name)
36
- opts.store(:gerbiltooltip2, "Val = #{mod.latest_val}")
42
+ opts.store(:gerbiltooltip2, "Latest Value = #{mod.latest_val}")
37
43
 
38
44
  g.rectangle_r(rbox, :id => "item#{i}")
39
45
  g.textout(rbox.right+5, rbox.bottom-2, mod.name,opts)
@@ -42,6 +48,8 @@ class Legend < GraphElement
42
48
  rbox.bottom = rbox.top+10
43
49
 
44
50
  end
51
+
52
+ g.setactivewindow
45
53
 
46
54
  end
47
55
 
@@ -5,7 +5,7 @@ class PieSurface < Surface
5
5
 
6
6
  MIN_INSIDE_LABEL_ANGLE = 8 # do not draw outer label for small angles
7
7
  MIN_OUTSIDE_LABEL_ANGLE = 3 # do not draw inner percentages (pie slice) for small angles
8
- OUTER_OFFSET_X = 10 # x - distance offset from pie boundary
8
+ OUTER_OFFSET_X = 10 # x - distance offset from pie boundary
9
9
  OUTER_OFFSET_Y = 10 # y - y offset from pie boundary
10
10
  LEFT_LABEL_OFFSET = 30 # labels on the left of the PIE offset by this (90-270 deg)
11
11
 
@@ -22,23 +22,21 @@ class PieSurface < Surface
22
22
 
23
23
  # bail out of empty models quickly
24
24
  if parent.modelgroup.empty?
25
- g.textout(@bounds.left + @bounds.width/2, @bounds.height/2,
25
+ g.textout(@bounds.left + @bounds.width/2, @bounds.height/2,
26
26
  parent.modelgroup.empty_caption,{"text-anchor" => "middle"})
27
27
  return
28
- end
29
-
28
+ end
30
29
 
31
- # any filters ?
32
- if parent.get_global_option(:filter,false)
33
- g.curr_win.add_options({:filter => "url(##{parent.get_global_option(:filter,false)})" })
34
- end
30
+ # any filters ?
31
+ if parent.get_global_option(:filter,false)
32
+ g.curr_win.add_options({:filter => "url(##{parent.get_global_option(:filter,false)})" })
33
+ end
35
34
 
36
35
  # compute totals
37
36
  y_total = 0
38
37
  parent.modelgroup.each_model_with_index do | mod, i|
39
38
  y_total = y_total + mod.latest_val
40
39
  end
41
-
42
40
 
43
41
  radius = @bounds.height * 0.35
44
42
  radius_label = radius + 10
@@ -71,37 +69,46 @@ class PieSurface < Surface
71
69
  if parent.get_global_option(:auto_tooltips,false)
72
70
  opts.merge!(:onmouseover => "OpacityDown(evt)", :onmouseout => "OpacityUp(evt)")
73
71
  opts.store(:gerbiltooltip1, mod.name)
74
- opts.store(:gerbiltooltip2, "Val = #{mod.latest_val}")
72
+ opts.store(:gerbiltooltip2, "Val = #{mod.latest_formatted_val}")
75
73
  end
76
74
  opts.merge!(:href => mod.href) if mod.hasHref?
77
75
 
78
- # draw the slice
76
+ # draw a circle if there is only one data
77
+ if (mod_angle >= 360)
78
+ g.addshape(GerbilCharts::SVGDC::SVGCircle.new(cx,cy,radius),opts)
79
+ end
80
+
81
+ # draw the slice
79
82
  g.addshape(GerbilCharts::SVGDC::SVGArc.new(cx,cy,radius,radius,
80
83
  current_pos_x,current_pos_y,
81
84
  new_pos_x,new_pos_y,mod_angle),
82
85
  opts)
83
86
 
84
87
  if(percent >= MIN_OUTSIDE_LABEL_ANGLE)
85
- if(tot_angle > 270)
86
- if(label_pos_x > cx ) && (label_pos_y > cy )
87
- g.textout( label_pos_x, label_pos_y, "#{mod.latest_val}", :class => 'elementlabel')
88
- g.textout(label_pos_x,label_pos_y+OUTER_OFFSET_Y, "#{mod.name}", :class => 'elementlabel' )
89
- else
90
- g.textout( label_pos_x+OUTER_OFFSET_X, label_pos_y, "#{mod.latest_val}", :class => 'elementlabel' )
91
- g.textout( label_pos_x+OUTER_OFFSET_X, label_pos_y+OUTER_OFFSET_Y, "#{mod.name}", :class => 'elementlabel' )
92
- end
93
- elsif(label_pos_x > cx ) && (label_pos_y > cy )
94
- g.textout( label_pos_x, label_pos_y, "#{mod.latest_val}", :class => 'elementlabel' )
88
+ if(tot_angle > 270)
89
+ if(label_pos_x > cx ) && (label_pos_y > cy )
90
+ g.textout( label_pos_x, label_pos_y, "#{mod.latest_formatted_val}", :class => 'elementlabel')
91
+ g.textout(label_pos_x,label_pos_y+OUTER_OFFSET_Y, "#{mod.name}", :class => 'elementlabel' )
92
+ else
93
+ g.textout( label_pos_x+OUTER_OFFSET_X, label_pos_y, "#{mod.latest_formatted_val}", :class => 'elementlabel' )
94
+ g.textout( label_pos_x+OUTER_OFFSET_X, label_pos_y+OUTER_OFFSET_Y, "#{mod.name}", :class => 'elementlabel' )
95
+ end
96
+ elsif(label_pos_x > cx ) && (label_pos_y > cy)
97
+ g.textout( label_pos_x, label_pos_y, "#{mod.latest_formatted_val}", :class => 'elementlabel' )
95
98
  g.textout( label_pos_x, label_pos_y+OUTER_OFFSET_Y, "#{mod.name}", :class => 'elementlabel' )
96
- else
97
- g.textout( label_pos_x-LEFT_LABEL_OFFSET, label_pos_y, "#{mod.latest_val}", :class => 'elementlabel' )
99
+ else
100
+ g.textout( label_pos_x-LEFT_LABEL_OFFSET, label_pos_y, "#{mod.latest_formatted_val}", :class => 'elementlabel' )
98
101
  g.textout( label_pos_x-LEFT_LABEL_OFFSET, label_pos_y+OUTER_OFFSET_Y, "#{mod.name}", :class => 'elementlabel' )
99
- end
100
- end
102
+ end
103
+ end
101
104
 
102
105
 
103
- if(percent > MIN_INSIDE_LABEL_ANGLE)
104
- g.textout(percent_pos_x,percent_pos_y, "#{percent}%", :class => 'elementvalue')
106
+ if(percent > MIN_INSIDE_LABEL_ANGLE)
107
+ if(tot_angle > 270)
108
+ g.textout(percent_pos_x,percent_pos_y+15, "#{percent}%", :class => 'elementvalue')
109
+ else
110
+ g.textout(percent_pos_x,percent_pos_y, "#{percent}%", :class => 'elementvalue')
111
+ end
105
112
  end
106
113
 
107
114
  current_pos_x = new_pos_x
@@ -21,4 +21,5 @@ require 'gerbilcharts/svgdc/svg_polyline'
21
21
  require 'gerbilcharts/svgdc/svg_rect'
22
22
  require 'gerbilcharts/svgdc/svg_text'
23
23
  require 'gerbilcharts/svgdc/svg_arc'
24
+ require 'gerbilcharts/svgdc/svg_arc'
24
25
  require 'gerbilcharts/svgdc/css_inliner'
@@ -74,7 +74,7 @@ class SVGDC
74
74
  def add_javascriptfile(jsfile_in)
75
75
  return unless jsfile_in
76
76
  jsfile=jsfile_in.gsub(/^inline:/,'')
77
- if jsfile.length < jsfile.length
77
+ if jsfile.length < jsfile_in.length
78
78
  @svg_javascript ||= ""
79
79
  @svg_javascript << get_file_content(jsfile)
80
80
  else
@@ -2,7 +2,7 @@ module GerbilCharts
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 10
5
+ TINY = 12
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/test/test_bar.rb CHANGED
@@ -12,7 +12,7 @@ class TestBar < Test::Unit::TestCase
12
12
  modelgroup = GerbilCharts::Models::SimpleTimeSeriesModelGroup.new(
13
13
  :title => "Sales figures",
14
14
  :timeseries => (1..6).collect { |month| Time.local(2008,month) },
15
- :models => [ ["Bruce", 1, 10, 18, 28, 80, 134],
15
+ :models => [ ["Bruce", 1, 10, 18, 28, 80, 140],
16
16
  ["Rex" , 112,22, 45, 70, 218, 309],
17
17
  ["Sharmila", 112,22, 45, 70, 218, 245],
18
18
  ["Wasim", 112,22, 45, 70, 218, 145],
@@ -27,8 +27,9 @@ class TestBar < Test::Unit::TestCase
27
27
  ]
28
28
  )
29
29
  mychart = GerbilCharts::Charts::BarChart.new( :width => 550, :height => 200,
30
- :style => 'brushmetal.css', :auto_tooltips => true ,
31
- :javascripts => {'/tmp/gerbil.js' => false, '/tmp/prototype.js' => false}
30
+ :style => 'inline:brushmetal.css', :auto_tooltips => true ,
31
+ :javascripts => ['/tmp/gerbil.js', '/tmp/prototype.js'],
32
+ :filter => 'LikeButton'
32
33
  )
33
34
  mychart.modelgroup=modelgroup
34
35
  mychart.render('/tmp/bar_monthly_sales.svg')
data/test/test_lines.rb CHANGED
@@ -35,7 +35,9 @@ class TestLines < Test::Unit::TestCase
35
35
  # test a line chart
36
36
  def test_line_1
37
37
 
38
- mychart = GerbilCharts::Charts::AreaChart.new( :width => 450, :height => 250, :style => 'inline:brushmetal.css')
38
+ mychart = GerbilCharts::Charts::AreaChart.new( :width => 450, :height => 250,
39
+ :javascripts => ['inline:/tmp/gerbil.js' ],
40
+ :auto_tooltips => true, :style => 'inline:brushmetal.css')
39
41
  mychart.setmodelgroup(@modgroup)
40
42
  mychart.render('/tmp/sq_linechart1.svg')
41
43
 
data/test/test_noob.rb CHANGED
@@ -49,18 +49,19 @@ class TestChartsNoob < Test::Unit::TestCase
49
49
 
50
50
  modelgroup = GerbilCharts::Models::GraphModelGroup.new( "External Traffic")
51
51
  modelgroup.add model2
52
- modelgroup.add model1
52
+ # modelgroup.add model1
53
53
 
54
54
  mychart.modelgroup=modelgroup
55
55
  mychart.render('/tmp/n_daily_traffic.svg')
56
56
 
57
57
  # demo resuses the model in a different view (an area chart this time)
58
- myareachart = GerbilCharts::Charts::AreaChart.new( :width => 450, :height => 200, :style => 'brushmetal.css',
59
- :scaling_y => :auto )
58
+ myareachart = GerbilCharts::Charts::AreaChart.new( :width => 450, :height => 200, :style => 'inline:brushmetal.css',
59
+ :scaling_y => :auto, :auto_tooltips => true ,
60
+ :javascripts => ['/tmp/gerbil.js' , '/tmp/prototype.js' ],
61
+ :filter => 'LikeButton' )
60
62
  myareachart.modelgroup=modelgroup
61
63
  myareachart.render('/tmp/n_daily_traffic_area.svg')
62
64
 
63
-
64
65
  # demo to reuse the model ina bar
65
66
  mybarchart = GerbilCharts::Charts::BarChart.new( :width => 450, :height => 200, :style => 'brushmetal.css', :auto_tooltips => true)
66
67
  mybarchart.modelgroup=modelgroup
data/test/test_pie.rb CHANGED
@@ -14,26 +14,26 @@ class TestPie < Test::Unit::TestCase
14
14
  modelgroup = GerbilCharts::Models::SimpleTimeSeriesModelGroup.new(
15
15
  :title => "Sales figures",
16
16
  :timeseries => (1..6).collect { |month| Time.local(2008,month) },
17
- :models => [ ["Bruce", 1, 10, 18, 28, 80, 134],
18
- ["Rex" , 112,22, 45, 70, 218, 309.98],
19
- ["Sharmila", 112,22, 45, 70, 218, 245],
20
- ["Wasim", 112,22, 45, 70, 218, 145],
21
- ["Buzo" , 0, 23, 25, 40, 18, 59],
22
- ["Vipin", 145,112, 22, 45, 18, 70],
23
- ["label", 145,112, 22, 45, 18, 240],
24
- ["9th item ", 145,112, 22, 45, 18, 45],
25
- ["Others ", 145,112, 22, 45, 18, 15],
26
- ["VIVEK", 145,112, 22, 45, 18, 170]
17
+ :models => [ ["Bruce", 1, 10, 18, 28, 80, 1340.7890],
18
+ ["Rex" , 112,22, 45, 70, 218, 3098.98]
19
+ # ["Sharmila", 112,22, 45, 70, 218, 245]
20
+ #["Wasim", 112,22, 45, 70, 218, 145],
21
+ # ["Buzo" , 0, 23, 25, 40, 18, 59],
22
+ #["Vipin", 145,112, 22, 45, 18, 70],
23
+ # ["label", 145,112, 22, 45, 18, 240],
24
+ # ["9th item ", 145,112, 22, 45, 18, 45],
25
+ # ["Others ", 145,112, 22, 45, 18, 15],
26
+ # ["VIVEK", 145,112, 22, 45, 18, 170]
27
27
  ]
28
28
  )
29
29
 
30
30
  mychart = GerbilCharts::Charts::PieChart.new( :width => 350, :height => 200,
31
- :style => 'brushmetal.css', :auto_tooltips => true ,
32
- :javascripts => {'/javascripts/gerbil.js' => false, '/javascripts/prototype.js' => false},
31
+ :style => 'inline:brushmetal.css', :auto_tooltips => true ,
32
+ :javascripts => ['/tmp/gerbil.js' , '/tmp/prototype.js' ],
33
33
  :filter => 'LikeButton'
34
34
  )
35
35
  mychart.modelgroup=modelgroup
36
- mychart.render('/tmp/pie_monthly_sales.svg')
36
+ mychart.render("/tmp/pie_monthly_sales.svg")
37
37
  end
38
38
 
39
39
 
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.2.10
4
+ version: 0.2.12
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-11-03 00:00:00 +05:30
12
+ date: 2009-12-01 00:00:00 +05:30
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency