bio-incanter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/Gemfile +14 -0
  2. data/Gemfile.lock +35 -0
  3. data/LICENSE.txt +20 -0
  4. data/README.rdoc +26 -0
  5. data/Rakefile +51 -0
  6. data/VERSION +1 -0
  7. data/bio-incanter.gemspec +136 -0
  8. data/doc/AreaChart.html +473 -0
  9. data/doc/BarChart.html +519 -0
  10. data/doc/BlandAltman.html +453 -0
  11. data/doc/BoxPlot.html +474 -0
  12. data/doc/FunctionPlot.html +496 -0
  13. data/doc/HeatMap.html +554 -0
  14. data/doc/Histogram.html +444 -0
  15. data/doc/LICENSE_txt.html +130 -0
  16. data/doc/LineChart.html +479 -0
  17. data/doc/Object.html +278 -0
  18. data/doc/PieChart.html +455 -0
  19. data/doc/README_rdoc.html +152 -0
  20. data/doc/ScatterPlot.html +489 -0
  21. data/doc/TimeChart.html +473 -0
  22. data/doc/TracePlot.html +416 -0
  23. data/doc/XyPlot.html +477 -0
  24. data/doc/created.rid +18 -0
  25. data/doc/images/add.png +0 -0
  26. data/doc/images/brick.png +0 -0
  27. data/doc/images/brick_link.png +0 -0
  28. data/doc/images/bug.png +0 -0
  29. data/doc/images/bullet_black.png +0 -0
  30. data/doc/images/bullet_toggle_minus.png +0 -0
  31. data/doc/images/bullet_toggle_plus.png +0 -0
  32. data/doc/images/date.png +0 -0
  33. data/doc/images/delete.png +0 -0
  34. data/doc/images/find.png +0 -0
  35. data/doc/images/loadingAnimation.gif +0 -0
  36. data/doc/images/macFFBgHack.png +0 -0
  37. data/doc/images/package.png +0 -0
  38. data/doc/images/page_green.png +0 -0
  39. data/doc/images/page_white_text.png +0 -0
  40. data/doc/images/page_white_width.png +0 -0
  41. data/doc/images/plugin.png +0 -0
  42. data/doc/images/ruby.png +0 -0
  43. data/doc/images/tag_blue.png +0 -0
  44. data/doc/images/tag_green.png +0 -0
  45. data/doc/images/transparent.png +0 -0
  46. data/doc/images/wrench.png +0 -0
  47. data/doc/images/wrench_orange.png +0 -0
  48. data/doc/images/zoom.png +0 -0
  49. data/doc/index.html +106 -0
  50. data/doc/js/darkfish.js +153 -0
  51. data/doc/js/jquery.js +18 -0
  52. data/doc/js/navigation.js +142 -0
  53. data/doc/js/search.js +94 -0
  54. data/doc/js/search_index.js +1 -0
  55. data/doc/js/searcher.js +228 -0
  56. data/doc/rdoc.css +543 -0
  57. data/doc/table_of_contents.html +295 -0
  58. data/lib/area_chart/area_chart.rb +106 -0
  59. data/lib/bar_chart/bar_chart.rb +142 -0
  60. data/lib/bio-incanter.rb +108 -0
  61. data/lib/bland_altman/bland_altman.rb +120 -0
  62. data/lib/box_plot/box_plot.rb +136 -0
  63. data/lib/function_plot/function_plot.rb +137 -0
  64. data/lib/histogram/histogram.rb +139 -0
  65. data/lib/java/clocomics-1.0.0-standalone.jar +0 -0
  66. data/lib/line_chart/line_chart.rb +148 -0
  67. data/lib/pie_chart/pie_chart.rb +121 -0
  68. data/lib/qq_plot/qq_plot.rb +105 -0
  69. data/lib/scatter_plot/scatter_plot.rb +162 -0
  70. data/lib/time_chart/time_chart.rb +142 -0
  71. data/lib/trace_plot/trace_plot.rb +108 -0
  72. data/lib/xy_plot/xy_plot.rb +149 -0
  73. data/spec/bar_chart_spec.rb +25 -0
  74. data/spec/bland_altman_spec.rb +26 -0
  75. data/spec/box_plot_spec.rb +25 -0
  76. data/spec/function_plot_spec.rb +27 -0
  77. data/spec/histogram_spec.rb +24 -0
  78. data/spec/line_chart_spec.rb +25 -0
  79. data/spec/pie_chart_spec.rb +25 -0
  80. data/spec/qq_plot_spec.rb +24 -0
  81. data/spec/scatter_plot_spec.rb +26 -0
  82. data/spec/spec_helper.rb +13 -0
  83. data/spec/time_chart_spec.rb +26 -0
  84. data/spec/trace_plot_spec.rb +24 -0
  85. data/spec/xy_plot_spec.rb +25 -0
  86. metadata +196 -0
@@ -0,0 +1,295 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>Table of Contents - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body class="indexpage">
24
+ <h1>Table of Contents - RDoc Documentation</h1>
25
+
26
+ <h2>Pages</h2>
27
+ <ul>
28
+ <li class="file">
29
+ <a href="LICENSE_txt.html">LICENSE</a>
30
+ </li>
31
+ <li class="file">
32
+ <a href="README_rdoc.html">README</a>
33
+
34
+ <img class="toc-toggle" src="images/transparent.png" alt="" title="toggle headings">
35
+ <ul class="initially-hidden">
36
+ <li><a href="README_rdoc.html#label-bio-incanter">bio-incanter</a>
37
+ <li><a href="README_rdoc.html#label-Use+">Use </a>
38
+ <li><a href="README_rdoc.html#label-Contributing+to+bio-incanter">Contributing to bio-incanter</a>
39
+ <li><a href="README_rdoc.html#label-Copyright">Copyright</a>
40
+ </ul>
41
+ </li>
42
+
43
+ </ul>
44
+
45
+ <h2 id="classes">Classes/Modules</h2>
46
+ <ul>
47
+ <li class="class">
48
+ <a href="AreaChart.html">AreaChart</a>
49
+ </li>
50
+ <li class="class">
51
+ <a href="BarChart.html">BarChart</a>
52
+ </li>
53
+ <li class="class">
54
+ <a href="BlandAltman.html">BlandAltman</a>
55
+ </li>
56
+ <li class="class">
57
+ <a href="BoxPlot.html">BoxPlot</a>
58
+ </li>
59
+ <li class="class">
60
+ <a href="FunctionPlot.html">FunctionPlot</a>
61
+ </li>
62
+ <li class="class">
63
+ <a href="HeatMap.html">HeatMap</a>
64
+ </li>
65
+ <li class="class">
66
+ <a href="Histogram.html">Histogram</a>
67
+ </li>
68
+ <li class="class">
69
+ <a href="LineChart.html">LineChart</a>
70
+ </li>
71
+ <li class="class">
72
+ <a href="Object.html">Object</a>
73
+ </li>
74
+ <li class="class">
75
+ <a href="PieChart.html">PieChart</a>
76
+ </li>
77
+ <li class="class">
78
+ <a href="ScatterPlot.html">ScatterPlot</a>
79
+ </li>
80
+ <li class="class">
81
+ <a href="TimeChart.html">TimeChart</a>
82
+ </li>
83
+ <li class="class">
84
+ <a href="TracePlot.html">TracePlot</a>
85
+ </li>
86
+ <li class="class">
87
+ <a href="XyPlot.html">XyPlot</a>
88
+ </li>
89
+
90
+ </ul>
91
+
92
+ <h2 id="methods">Methods</h2>
93
+ <ul>
94
+
95
+ <li class="method"><a href="BoxPlot.html#method-c-new">::new &mdash; BoxPlot</a>
96
+
97
+ <li class="method"><a href="TimeChart.html#method-c-new">::new &mdash; TimeChart</a>
98
+
99
+ <li class="method"><a href="ScatterPlot.html#method-c-new">::new &mdash; ScatterPlot</a>
100
+
101
+ <li class="method"><a href="AreaChart.html#method-c-new">::new &mdash; AreaChart</a>
102
+
103
+ <li class="method"><a href="PieChart.html#method-c-new">::new &mdash; PieChart</a>
104
+
105
+ <li class="method"><a href="FunctionPlot.html#method-c-new">::new &mdash; FunctionPlot</a>
106
+
107
+ <li class="method"><a href="BarChart.html#method-c-new">::new &mdash; BarChart</a>
108
+
109
+ <li class="method"><a href="BlandAltman.html#method-c-new">::new &mdash; BlandAltman</a>
110
+
111
+ <li class="method"><a href="TracePlot.html#method-c-new">::new &mdash; TracePlot</a>
112
+
113
+ <li class="method"><a href="HeatMap.html#method-c-new">::new &mdash; HeatMap</a>
114
+
115
+ <li class="method"><a href="Histogram.html#method-c-new">::new &mdash; Histogram</a>
116
+
117
+ <li class="method"><a href="XyPlot.html#method-c-new">::new &mdash; XyPlot</a>
118
+
119
+ <li class="method"><a href="LineChart.html#method-c-new">::new &mdash; LineChart</a>
120
+
121
+ <li class="method"><a href="Object.html#method-i-check_grp">#check_grp &mdash; Object</a>
122
+
123
+ <li class="method"><a href="BarChart.html#method-i-check_par">#check_par &mdash; BarChart</a>
124
+
125
+ <li class="method"><a href="BoxPlot.html#method-i-check_par">#check_par &mdash; BoxPlot</a>
126
+
127
+ <li class="method"><a href="TimeChart.html#method-i-check_par">#check_par &mdash; TimeChart</a>
128
+
129
+ <li class="method"><a href="Histogram.html#method-i-check_par">#check_par &mdash; Histogram</a>
130
+
131
+ <li class="method"><a href="HeatMap.html#method-i-check_par">#check_par &mdash; HeatMap</a>
132
+
133
+ <li class="method"><a href="ScatterPlot.html#method-i-check_par">#check_par &mdash; ScatterPlot</a>
134
+
135
+ <li class="method"><a href="PieChart.html#method-i-check_par">#check_par &mdash; PieChart</a>
136
+
137
+ <li class="method"><a href="BlandAltman.html#method-i-check_par">#check_par &mdash; BlandAltman</a>
138
+
139
+ <li class="method"><a href="FunctionPlot.html#method-i-check_par">#check_par &mdash; FunctionPlot</a>
140
+
141
+ <li class="method"><a href="TracePlot.html#method-i-check_par">#check_par &mdash; TracePlot</a>
142
+
143
+ <li class="method"><a href="XyPlot.html#method-i-check_par">#check_par &mdash; XyPlot</a>
144
+
145
+ <li class="method"><a href="AreaChart.html#method-i-check_par">#check_par &mdash; AreaChart</a>
146
+
147
+ <li class="method"><a href="LineChart.html#method-i-check_par">#check_par &mdash; LineChart</a>
148
+
149
+ <li class="method"><a href="Object.html#method-i-check_val">#check_val &mdash; Object</a>
150
+
151
+ <li class="method"><a href="Object.html#method-i-check_val_int">#check_val_int &mdash; Object</a>
152
+
153
+ <li class="method"><a href="HeatMap.html#method-i-getFunction">#getFunction &mdash; HeatMap</a>
154
+
155
+ <li class="method"><a href="FunctionPlot.html#method-i-getFunction">#getFunction &mdash; FunctionPlot</a>
156
+
157
+ <li class="method"><a href="BoxPlot.html#method-i-getGroup">#getGroup &mdash; BoxPlot</a>
158
+
159
+ <li class="method"><a href="AreaChart.html#method-i-getGroup">#getGroup &mdash; AreaChart</a>
160
+
161
+ <li class="method"><a href="LineChart.html#method-i-getGroup">#getGroup &mdash; LineChart</a>
162
+
163
+ <li class="method"><a href="BlandAltman.html#method-i-getGroup">#getGroup &mdash; BlandAltman</a>
164
+
165
+ <li class="method"><a href="PieChart.html#method-i-getGroup">#getGroup &mdash; PieChart</a>
166
+
167
+ <li class="method"><a href="BarChart.html#method-i-getGroup">#getGroup &mdash; BarChart</a>
168
+
169
+ <li class="method"><a href="FunctionPlot.html#method-i-getMax">#getMax &mdash; FunctionPlot</a>
170
+
171
+ <li class="method"><a href="HeatMap.html#method-i-getMaxX">#getMaxX &mdash; HeatMap</a>
172
+
173
+ <li class="method"><a href="HeatMap.html#method-i-getMaxY">#getMaxY &mdash; HeatMap</a>
174
+
175
+ <li class="method"><a href="FunctionPlot.html#method-i-getMin">#getMin &mdash; FunctionPlot</a>
176
+
177
+ <li class="method"><a href="HeatMap.html#method-i-getMinX">#getMinX &mdash; HeatMap</a>
178
+
179
+ <li class="method"><a href="HeatMap.html#method-i-getMinY">#getMinY &mdash; HeatMap</a>
180
+
181
+ <li class="method"><a href="BarChart.html#method-i-getParams">#getParams &mdash; BarChart</a>
182
+
183
+ <li class="method"><a href="Histogram.html#method-i-getParams">#getParams &mdash; Histogram</a>
184
+
185
+ <li class="method"><a href="LineChart.html#method-i-getParams">#getParams &mdash; LineChart</a>
186
+
187
+ <li class="method"><a href="BlandAltman.html#method-i-getParams">#getParams &mdash; BlandAltman</a>
188
+
189
+ <li class="method"><a href="TimeChart.html#method-i-getParams">#getParams &mdash; TimeChart</a>
190
+
191
+ <li class="method"><a href="TracePlot.html#method-i-getParams">#getParams &mdash; TracePlot</a>
192
+
193
+ <li class="method"><a href="BoxPlot.html#method-i-getParams">#getParams &mdash; BoxPlot</a>
194
+
195
+ <li class="method"><a href="ScatterPlot.html#method-i-getParams">#getParams &mdash; ScatterPlot</a>
196
+
197
+ <li class="method"><a href="HeatMap.html#method-i-getParams">#getParams &mdash; HeatMap</a>
198
+
199
+ <li class="method"><a href="AreaChart.html#method-i-getParams">#getParams &mdash; AreaChart</a>
200
+
201
+ <li class="method"><a href="PieChart.html#method-i-getParams">#getParams &mdash; PieChart</a>
202
+
203
+ <li class="method"><a href="XyPlot.html#method-i-getParams">#getParams &mdash; XyPlot</a>
204
+
205
+ <li class="method"><a href="FunctionPlot.html#method-i-getParams">#getParams &mdash; FunctionPlot</a>
206
+
207
+ <li class="method"><a href="PieChart.html#method-i-getValue">#getValue &mdash; PieChart</a>
208
+
209
+ <li class="method"><a href="AreaChart.html#method-i-getValue">#getValue &mdash; AreaChart</a>
210
+
211
+ <li class="method"><a href="BarChart.html#method-i-getValue">#getValue &mdash; BarChart</a>
212
+
213
+ <li class="method"><a href="BoxPlot.html#method-i-getValue">#getValue &mdash; BoxPlot</a>
214
+
215
+ <li class="method"><a href="BlandAltman.html#method-i-getValue">#getValue &mdash; BlandAltman</a>
216
+
217
+ <li class="method"><a href="LineChart.html#method-i-getValue">#getValue &mdash; LineChart</a>
218
+
219
+ <li class="method"><a href="Histogram.html#method-i-getValue">#getValue &mdash; Histogram</a>
220
+
221
+ <li class="method"><a href="TracePlot.html#method-i-getValue">#getValue &mdash; TracePlot</a>
222
+
223
+ <li class="method"><a href="ScatterPlot.html#method-i-getValuex">#getValuex &mdash; ScatterPlot</a>
224
+
225
+ <li class="method"><a href="XyPlot.html#method-i-getValuex">#getValuex &mdash; XyPlot</a>
226
+
227
+ <li class="method"><a href="ScatterPlot.html#method-i-getValuey">#getValuey &mdash; ScatterPlot</a>
228
+
229
+ <li class="method"><a href="XyPlot.html#method-i-getValuey">#getValuey &mdash; XyPlot</a>
230
+
231
+ <li class="method"><a href="TimeChart.html#method-i-getX">#getX &mdash; TimeChart</a>
232
+
233
+ <li class="method"><a href="TimeChart.html#method-i-getY">#getY &mdash; TimeChart</a>
234
+
235
+ <li class="method"><a href="HeatMap.html#method-i-save">#save &mdash; HeatMap</a>
236
+
237
+ <li class="method"><a href="ScatterPlot.html#method-i-save">#save &mdash; ScatterPlot</a>
238
+
239
+ <li class="method"><a href="BoxPlot.html#method-i-save">#save &mdash; BoxPlot</a>
240
+
241
+ <li class="method"><a href="PieChart.html#method-i-save">#save &mdash; PieChart</a>
242
+
243
+ <li class="method"><a href="AreaChart.html#method-i-save">#save &mdash; AreaChart</a>
244
+
245
+ <li class="method"><a href="TracePlot.html#method-i-save">#save &mdash; TracePlot</a>
246
+
247
+ <li class="method"><a href="TimeChart.html#method-i-save">#save &mdash; TimeChart</a>
248
+
249
+ <li class="method"><a href="BlandAltman.html#method-i-save">#save &mdash; BlandAltman</a>
250
+
251
+ <li class="method"><a href="LineChart.html#method-i-save">#save &mdash; LineChart</a>
252
+
253
+ <li class="method"><a href="FunctionPlot.html#method-i-save">#save &mdash; FunctionPlot</a>
254
+
255
+ <li class="method"><a href="Histogram.html#method-i-save">#save &mdash; Histogram</a>
256
+
257
+ <li class="method"><a href="BarChart.html#method-i-save">#save &mdash; BarChart</a>
258
+
259
+ <li class="method"><a href="XyPlot.html#method-i-save">#save &mdash; XyPlot</a>
260
+
261
+ <li class="method"><a href="HeatMap.html#method-i-view">#view &mdash; HeatMap</a>
262
+
263
+ <li class="method"><a href="PieChart.html#method-i-view">#view &mdash; PieChart</a>
264
+
265
+ <li class="method"><a href="ScatterPlot.html#method-i-view">#view &mdash; ScatterPlot</a>
266
+
267
+ <li class="method"><a href="BoxPlot.html#method-i-view">#view &mdash; BoxPlot</a>
268
+
269
+ <li class="method"><a href="TracePlot.html#method-i-view">#view &mdash; TracePlot</a>
270
+
271
+ <li class="method"><a href="AreaChart.html#method-i-view">#view &mdash; AreaChart</a>
272
+
273
+ <li class="method"><a href="BlandAltman.html#method-i-view">#view &mdash; BlandAltman</a>
274
+
275
+ <li class="method"><a href="FunctionPlot.html#method-i-view">#view &mdash; FunctionPlot</a>
276
+
277
+ <li class="method"><a href="TimeChart.html#method-i-view">#view &mdash; TimeChart</a>
278
+
279
+ <li class="method"><a href="LineChart.html#method-i-view">#view &mdash; LineChart</a>
280
+
281
+ <li class="method"><a href="Histogram.html#method-i-view">#view &mdash; Histogram</a>
282
+
283
+ <li class="method"><a href="BarChart.html#method-i-view">#view &mdash; BarChart</a>
284
+
285
+ <li class="method"><a href="XyPlot.html#method-i-view">#view &mdash; XyPlot</a>
286
+
287
+ </ul>
288
+
289
+
290
+ <footer id="validator-badges">
291
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
292
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
293
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
294
+ </footer>
295
+
@@ -0,0 +1,106 @@
1
+ class AreaChart
2
+ def initialize(group,value,params)
3
+ @group=check_grp(group)
4
+ @value=check_val(value)
5
+ @params=self.check_par(params)
6
+ end
7
+
8
+ def check_par(params)
9
+ hash = Hash.new
10
+ permitted = ["title","x_label","y_label","vertical","group_by","legend","width","height","file_name"]
11
+ keys = params.keys
12
+ keys.each{ |key|
13
+ if permitted.include?(key)==false
14
+ raise "Error : Permitted key are title,x_label,y_label,vertical,group_by,legend,width,height"
15
+ end
16
+ }
17
+
18
+ if params["title"]==nil
19
+ hash["title"]="A sample Graph"
20
+ else
21
+ hash["title"]=params["title"]
22
+ end
23
+
24
+ if params["x_label"]==nil
25
+ hash["x_label"]="Categories"
26
+ else
27
+ hash["x_label"]=params["x_label"]
28
+ end
29
+
30
+ if params["y_label"]==nil
31
+ hash["y_label"]="Values"
32
+ else
33
+ hash["y_label"]=params["y_label"]
34
+ end
35
+
36
+ if params["vertical"]==nil
37
+ hash["vertical"]=true
38
+ else
39
+ hash["vertical"]=params["vertical"]
40
+ end
41
+
42
+ if params["legend"]==nil
43
+ hash["legend"]=false
44
+ else
45
+ hash["legend"]=params["legend"]
46
+ end
47
+
48
+ if params["gruop_by"]==nil
49
+ hash["group_by"]=nil
50
+ else
51
+ hash["group_by"]=params["group_by"]
52
+ end
53
+
54
+ if params["width"]==nil
55
+ hash["width"]=1500
56
+ else
57
+ hash["width"]=params["width"]
58
+ end
59
+
60
+ if params["height"]==nil
61
+ hash["height"]=800
62
+ else
63
+ hash["height"]=params["height"]
64
+ end
65
+
66
+ if params["file_name"]==nil
67
+ hash["file_name"]="sample.jpg"
68
+ else
69
+ hash["file_name"]=params["file_name"]
70
+ end
71
+
72
+ params_map = HashMap.new(hash)
73
+ return params_map
74
+ end
75
+
76
+ def getGroup
77
+ @group
78
+ end
79
+
80
+ def getValue
81
+ @value
82
+ end
83
+
84
+ def getParams
85
+ @params
86
+ end
87
+
88
+
89
+ def save
90
+ begin
91
+ a = Java::ComDomain::clocomics
92
+ a.save_area(self.getGroup,self.getValue,self.getParams)
93
+ rescue Exception => ex
94
+ end
95
+ end
96
+ def view
97
+ begin
98
+ a = Java::ComDomain::clocomics
99
+ a.view_area(self.getGroup,self.getValue,self.getParams)
100
+ rescue Exception => ex
101
+ end
102
+
103
+
104
+ end
105
+
106
+ end
@@ -0,0 +1,142 @@
1
+ class BarChart
2
+ # ==== Attributes
3
+ #
4
+ # * +group+ - a vector of String categories
5
+ # * +value+ - a vector of Float numeric value
6
+ # * +parms+ - an Hash whit parametrs value
7
+ #
8
+ # ==== Parms
9
+ #
10
+ # This Hash contain parmas .
11
+ # List of key permitted .
12
+ #
13
+ #
14
+ #
15
+ # * +:title+ - (default "A sample Graph") Graph main title
16
+ # * +:x_label+ - (default 'Categories') Label of x ass
17
+ # * +:y_label+ - (default 'Value') Label of y ass
18
+ # * +:legend+ - (default false) Prints legend
19
+ # * +:vertical+ - (default true) The orientation of the plot
20
+ # * +:group_by+ - (default nil) A vector of values used to group the values into series within each category.
21
+ # * +:height+ - (default 1500) Graph height
22
+ # * +:width+ - (default 800) Graph width
23
+ # * +:file_name+ - (default sample.jpg) Graph File Name/Path to save plot. You can chose jpg or pdf
24
+ #
25
+ # ==== Examples
26
+ #
27
+ # Class Usage:
28
+ #
29
+ # categories = ["uman","elf","dwarfs"]
30
+ # values = [1.0,2.0,3.0]
31
+ # params = {"title" => "Popolation of middle heart","x_label"=>"Popolation","y_label"=>"greed"}
32
+ # plot = BarChart.new(categories,values,params)
33
+ # #To view
34
+ # plot.view
35
+ # #to save
36
+ # plot.save
37
+
38
+ def initialize(group,value,params)
39
+ @group=check_grp(group)
40
+ @value=check_val(value)
41
+ @params=self.check_par(params)
42
+ end
43
+
44
+ def check_par(params)
45
+ hash = Hash.new
46
+ permitted = ["title","x_label","y_label","vertical","group_by","legend","width","height","file_name"]
47
+ keys = params.keys
48
+ keys.each{ |key|
49
+ if permitted.include?(key)==false
50
+ raise "Error : Permitted key are title,x_label,y_label,vertical,group_by,legend,width,height"
51
+ end
52
+ }
53
+
54
+ if params["title"]==nil
55
+ hash["title"]="A sample Graph"
56
+ else
57
+ hash["title"]=params["title"]
58
+ end
59
+
60
+ if params["x_label"]==nil
61
+ hash["x_label"]="Categories"
62
+ else
63
+ hash["x_label"]=params["x_label"]
64
+ end
65
+
66
+ if params["y_label"]==nil
67
+ hash["y_label"]="Values"
68
+ else
69
+ hash["y_label"]=params["y_label"]
70
+ end
71
+
72
+ if params["vertical"]==nil
73
+ hash["vertical"]=true
74
+ else
75
+ hash["vertical"]=params["vertical"]
76
+ end
77
+
78
+ if params["legend"]==nil
79
+ hash["legend"]=false
80
+ else
81
+ hash["legend"]=params["legend"]
82
+ end
83
+
84
+ if params["gruop_by"]==nil
85
+ hash["group_by"]=nil
86
+ else
87
+ hash["group_by"]=params["group_by"]
88
+ end
89
+
90
+ if params["width"]==nil
91
+ hash["width"]=1500
92
+ else
93
+ hash["width"]=params["width"]
94
+ end
95
+
96
+ if params["height"]==nil
97
+ hash["height"]=800
98
+ else
99
+ hash["height"]=params["height"]
100
+ end
101
+
102
+ if params["file_name"]==nil
103
+ hash["file_name"]="sample.jpg"
104
+ else
105
+ hash["file_name"]=params["file_name"]
106
+ end
107
+
108
+ params_map = HashMap.new(hash)
109
+ return params_map
110
+ end
111
+
112
+ def getGroup
113
+ @group
114
+ end
115
+
116
+ def getValue
117
+ @value
118
+ end
119
+
120
+ def getParams
121
+ @params
122
+ end
123
+
124
+
125
+ def save
126
+ begin
127
+ a = Java::ComDomain::clocomics
128
+ a.save_bar(self.getGroup,self.getValue,self.getParams)
129
+ rescue Exception => ex
130
+ end
131
+ end
132
+ def view
133
+ begin
134
+ a = Java::ComDomain::clocomics
135
+ a.view_bar(self.getGroup,self.getValue,self.getParams)
136
+ rescue Exception => ex
137
+ end
138
+
139
+
140
+ end
141
+
142
+ end