Class: QqPlot
- Inherits:
-
Object
- Object
- QqPlot
- Defined in:
- lib/qq_plot/qq_plot.rb
Instance Method Summary collapse
- #check_par(params) ⇒ Object
- #getParams ⇒ Object
- #getValue ⇒ Object
-
#initialize(value, params) ⇒ QqPlot
constructor
-
value
- a vector of Float numeric value *parms
- an Hash whit parametrs value ==== Parms This Hash contain parmas .
-
- #save ⇒ Object
- #view ⇒ Object
Constructor Details
#initialize(value, params) ⇒ QqPlot
-
value
- a vector of Float numeric value -
parms
- an Hash whit parametrs value
Parms
This Hash contain parmas . List of key permitted .
-
:title
- (default “A sample Graph”) Graph main title -
:vertical
- (default true) The orientation of the plot -
:height
- (default 1500) Graph height -
:width
- (default 800) Graph width -
:file_name
- (default sample.jpg) Graph File Name/Path to save plot. You can chose jpg or pdf
Examples
Class Usage:
values = [1.0,2.0,3.0]
params = {"title" => "A QQ Plot"}
plot = QqPlot.new(values,params)
#To view
plot.view
#to save
30 31 32 33 |
# File 'lib/qq_plot/qq_plot.rb', line 30 def initialize(value,params) @value=check_val(value) @params=self.check_par(params) end |
Instance Method Details
#check_par(params) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/qq_plot/qq_plot.rb', line 35 def check_par(params) hash = Hash.new permitted = ["title","vertical","width","height","file_name"] keys = params.keys keys.each{ |key| if permitted.include?(key)==false raise "Error : Permitted key are title,vertical,width,height,file-name" end } if params["title"]==nil hash["title"]="A sample Graph" else hash["title"]=params["title"] end if params["vertical"]==nil hash["vertical"]=true else hash["vertical"]=params["vertical"] end if params["width"]==nil hash["width"]=1500 else hash["width"]=params["width"] end if params["height"]==nil hash["height"]=800 else hash["height"]=params["height"] end if params["file_name"]==nil hash["file_name"]="sample.jpg" else hash["file_name"]=params["file_name"] end params_map = HashMap.new(hash) return params_map end |
#getParams ⇒ Object
83 84 85 |
# File 'lib/qq_plot/qq_plot.rb', line 83 def getParams @params end |
#getValue ⇒ Object
79 80 81 |
# File 'lib/qq_plot/qq_plot.rb', line 79 def getValue @value end |
#save ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/qq_plot/qq_plot.rb', line 88 def save begin a = Java::ComDomain::clocomics a.save_qq(self.getValue,self.getParams) rescue Exception => ex end end |
#view ⇒ Object
95 96 97 98 99 100 101 102 103 |
# File 'lib/qq_plot/qq_plot.rb', line 95 def view begin a = Java::ComDomain::clocomics a.view_qq(self.getValue,self.getParams) rescue Exception => ex end end |