gerbilcharts 0.6.8 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,7 @@ module GerbilCharts::Charts;end;
9
9
 
10
10
  require 'gerbilcharts/charts/chart_base'
11
11
  require 'gerbilcharts/charts/area_chart'
12
+ require 'gerbilcharts/charts/area_chart_table'
12
13
  require 'gerbilcharts/charts/bar_chart_compact'
13
14
  require 'gerbilcharts/charts/bar_chart'
14
15
  require 'gerbilcharts/charts/impulse_chart'
@@ -0,0 +1,38 @@
1
+ module GerbilCharts::Charts
2
+
3
+
4
+ # =Area Chart Table
5
+ # Same with detailed legend at bottom
6
+ #
7
+ class AreaChartTable < ChartBase
8
+
9
+ def initialize(opt={})
10
+ super(opt)
11
+ end
12
+
13
+ def create_chart_elements
14
+
15
+ # anchor (line surface)
16
+ @thechart.create_filter(GerbilCharts::SVGDC::LinearGradientVertical.new("vertgrad","rgb(255,255,255)","rgb(224,224,224)"))
17
+
18
+ # additional filter by name
19
+ @thechart.create_filter(GerbilCharts::SVGDC::LikeButton.new('LikeButton')) if @gerbilfilter == 'LikeButton'
20
+
21
+ # other elements
22
+ @thechart.add_child(GerbilCharts::Surfaces::SurfaceBackground.new(:orient => ORIENT_OVERLAY))
23
+ @thechart.add_child(GerbilCharts::Surfaces::BasicGrid.new(:orient => ORIENT_OVERLAY))
24
+ @thechart.add_child(GerbilCharts::Surfaces::TitlePanel.new(:orient => ORIENT_OVERLAY, :dim => 30))
25
+ @thechart.add_child(GerbilCharts::Surfaces::AreaSurface.new(:orient => ORIENT_OVERLAY),:anchor => true)
26
+ @thechart.add_child(GerbilCharts::Surfaces::DetailedLegend.new(:orient=> ORIENT_SOUTH, :dim => 80 , :always_visible => true ))
27
+ @thechart.add_child(GerbilCharts::Surfaces::VerticalAxis.new(:orient => ORIENT_WEST, :dim => 40 ))
28
+ @thechart.add_child(GerbilCharts::Surfaces::HorizontalTimeAxis.new(:orient => ORIENT_SOUTH, :dim => 25 ))
29
+
30
+ # optional features
31
+ if @feature_timetracker
32
+ @thechart.add_child(GerbilCharts::Surfaces::Tracker.new(:orient => ORIENT_OVERLAY ))
33
+ end
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -21,7 +21,7 @@ class DetailedLegend < GraphElement
21
21
 
22
22
  def int_render(g)
23
23
 
24
- return unless parent.get_global_option(:enable_detailed_legend,true)
24
+
25
25
 
26
26
  if @always_visible
27
27
  w=g.newwin("legendpanel_detail")
@@ -62,9 +62,8 @@ class DetailedLegend < GraphElement
62
62
  rbox.bottom = rbox.top+10
63
63
 
64
64
 
65
-
66
65
  stat_label_pos = rbox.right + STAT_TABLE_OFFSET
67
- lab = %w(Max Min Avg Latest).inject("") { |m,ai| m += ai.rjust(9)}
66
+ lab = %w(Max Min Avg Latest Total).inject("") { |m,ai| m += ai.rjust(9)}
68
67
  if @show_stats
69
68
  g.textout(stat_label_pos, rbox.bottom-2, lab, {'xml:space' => 'preserve', :class => "legendstats"} )
70
69
  end
@@ -72,6 +71,7 @@ class DetailedLegend < GraphElement
72
71
  rbox.top += 16
73
72
  rbox.bottom = rbox.top+10
74
73
 
74
+
75
75
  parent.modelgroup.each_model_with_index do | mod, i|
76
76
 
77
77
  # Adding tool tips
@@ -86,12 +86,14 @@ class DetailedLegend < GraphElement
86
86
  g.textout(rbox.right+5, rbox.bottom-2, mod.name,opts)
87
87
 
88
88
  stat_ana = mod.get_statistical_analysis
89
+ bucketsize = mod.respond_to?(:bucket_size_secs)? mod.bucket_size_secs: 1
89
90
 
90
91
  stat_label_pos = rbox.right + STAT_TABLE_OFFSET
91
92
  outs = mod.formatted_val(stat_ana[1]).to_s.rjust(9) +
92
93
  mod.formatted_val(stat_ana[0]).to_s.rjust(9) +
93
94
  mod.formatted_val(stat_ana[2]).to_s.rjust(9) +
94
- mod.formatted_val(stat_ana[4]).to_s.rjust(9)
95
+ mod.formatted_val(stat_ana[4]).to_s.rjust(9) +
96
+ fmt_prefix_2(stat_ana[3]*bucketsize/8).to_s.rjust(9)
95
97
  if @show_stats
96
98
  g.textout(stat_label_pos, rbox.bottom-2, outs, {'xml:space' => 'preserve', :class => 'legendstats'} )
97
99
  end
@@ -114,6 +116,32 @@ class DetailedLegend < GraphElement
114
116
  @bounds.left = @bounds.right - @width
115
117
  end
116
118
  end
119
+
120
+ # format for volumes
121
+ def fmt_prefix_2 raw_value
122
+ units_str = [
123
+ [1099511627776.0,"T","%.2f%s"],
124
+ [1073741824.0, "G","%.2f%s"],
125
+ [1048576.0, "M","%.2f%s"],
126
+ [1024.0, "K","%.2f%s"],
127
+ [1, "", "%d %s"],
128
+ [1e-03, "m","%.3f %s"],
129
+ [1e-06, "u","%.3f %s"],
130
+ [1e-09, "n","%.3f %s"],
131
+ [1e-12, "p","%.3f %s"],
132
+ ]
133
+
134
+ return "0" if raw_value == 0
135
+
136
+ units_str.each do |unit|
137
+ if raw_value >= unit[0]
138
+ retval = raw_value / unit[0]
139
+ return format(unit[2], retval, unit[1])
140
+ end
141
+ end
142
+ return raw_value.to_s
143
+ end
144
+
117
145
  end
118
146
  end
119
147
 
metadata CHANGED
@@ -1,91 +1,92 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gerbilcharts
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 6
8
- - 8
9
- version: 0.6.8
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - vivek
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-06-30 00:00:00 +05:30
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: shoulda
22
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
30
22
  type: :development
31
23
  prerelease: false
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
34
31
  name: bundler
35
- requirement: &id002 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
36
33
  none: false
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- segments:
41
- - 1
42
- - 0
43
- - 0
44
- version: 1.0.0
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
45
38
  type: :development
46
39
  prerelease: false
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
49
47
  name: jeweler
50
- requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
51
49
  none: false
52
- requirements:
53
- - - ~>
54
- - !ruby/object:Gem::Version
55
- segments:
56
- - 1
57
- - 5
58
- - 2
59
- version: 1.5.2
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
60
54
  type: :development
61
55
  prerelease: false
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: rcov
65
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
66
57
  none: false
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- segments:
71
- - 0
72
- version: "0"
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: simplecov
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
73
70
  type: :development
74
71
  prerelease: false
75
- version_requirements: *id004
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
76
78
  description: Gerbilcharts is a server side charting library that outputs SVG text
77
79
  email: vivek_rajagopal@yahoo.com
78
80
  executables: []
79
-
80
81
  extensions: []
81
-
82
- extra_rdoc_files:
82
+ extra_rdoc_files:
83
83
  - LICENSE.txt
84
84
  - README.rdoc
85
- files:
85
+ files:
86
86
  - lib/gerbilcharts.rb
87
87
  - lib/gerbilcharts/charts.rb
88
88
  - lib/gerbilcharts/charts/area_chart.rb
89
+ - lib/gerbilcharts/charts/area_chart_table.rb
89
90
  - lib/gerbilcharts/charts/bar_chart.rb
90
91
  - lib/gerbilcharts/charts/bar_chart_compact.rb
91
92
  - lib/gerbilcharts/charts/bubble_chart.rb
@@ -164,38 +165,32 @@ files:
164
165
  - lib/gerbilcharts/version.rb
165
166
  - LICENSE.txt
166
167
  - README.rdoc
167
- has_rdoc: true
168
168
  homepage: http://github.com/vivekrajan/gerbilcharts
169
- licenses:
169
+ licenses:
170
170
  - MIT
171
171
  post_install_message:
172
172
  rdoc_options: []
173
-
174
- require_paths:
173
+ require_paths:
175
174
  - lib
176
- required_ruby_version: !ruby/object:Gem::Requirement
175
+ required_ruby_version: !ruby/object:Gem::Requirement
177
176
  none: false
178
- requirements:
179
- - - ">="
180
- - !ruby/object:Gem::Version
181
- hash: 117781501
182
- segments:
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ segments:
183
182
  - 0
184
- version: "0"
185
- required_rubygems_version: !ruby/object:Gem::Requirement
183
+ hash: 1136062034129104066
184
+ required_rubygems_version: !ruby/object:Gem::Requirement
186
185
  none: false
187
- requirements:
188
- - - ">="
189
- - !ruby/object:Gem::Version
190
- segments:
191
- - 0
192
- version: "0"
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
193
190
  requirements: []
194
-
195
191
  rubyforge_project:
196
- rubygems_version: 1.3.7
192
+ rubygems_version: 1.8.23
197
193
  signing_key:
198
194
  specification_version: 3
199
195
  summary: SVG timeseries charting
200
196
  test_files: []
201
-