Class: XyPlot
- Inherits:
-
Object
- Object
- XyPlot
- Defined in:
- lib/xy_plot/xy_plot.rb
Instance Method Summary collapse
- #check_par(params) ⇒ Object
- #getParams ⇒ Object
- #getValuex ⇒ Object
- #getValuey ⇒ Object
-
#initialize(valuex, valuey, params) ⇒ XyPlot
constructor
A new instance of XyPlot.
- #save ⇒ Object
- #view ⇒ Object
Constructor Details
#initialize(valuex, valuey, params) ⇒ XyPlot
Returns a new instance of XyPlot.
40 41 42 43 44 |
# File 'lib/xy_plot/xy_plot.rb', line 40 def initialize(valuex,valuey,params) @value_x=check_val(valuex) @value_y=check_val(valuey) @params=self.check_par(params) end |
Instance Method Details
#check_par(params) ⇒ Object
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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/xy_plot/xy_plot.rb', line 46 def check_par(params) hash = Hash.new permitted = ["title","x_label","y_label","vertical","points","gruop_by","legend","width","height","file_name"] keys = params.keys keys.each{ |key| if permitted.include?(key)==false raise "Error : Permitted key are title,x_label,y_label,vertical,n_bins,density,group_by,gardient,legend,width,height" end } if params["title"]==nil hash["title"]="A sample Graph" else hash["title"]=params["title"] end if params["x_label"]==nil hash["x_label"]="Categories" else hash["x_label"]=params["x_label"] end if params["y_label"]==nil hash["y_label"]="Values" else hash["y_label"]=params["y_label"] end if params["vertical"]==nil hash["vertical"]=true else hash["vertical"]=params["vertical"] end if params["legend"]==nil hash["legend"]=false else hash["legend"]=params["legend"] end if params["points"]==nil hash["points"]=false else hash["points"]=params["points"] end if params["group_by"]==nil hash["group_by"]=nil else hash["group_by"]=params["group_by"] 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
129 130 131 |
# File 'lib/xy_plot/xy_plot.rb', line 129 def getParams @params end |
#getValuex ⇒ Object
120 121 122 |
# File 'lib/xy_plot/xy_plot.rb', line 120 def getValuex @value_x end |
#getValuey ⇒ Object
124 125 126 |
# File 'lib/xy_plot/xy_plot.rb', line 124 def getValuey @value_y end |
#save ⇒ Object
134 135 136 137 138 139 140 |
# File 'lib/xy_plot/xy_plot.rb', line 134 def save begin a = Java::ComDomain::clocomics a.save_xy(self.getValuex,self.getValuey,self.getParams) rescue Exception => ex end end |
#view ⇒ Object
141 142 143 144 145 146 147 |
# File 'lib/xy_plot/xy_plot.rb', line 141 def view begin a = Java::ComDomain::clocomics a.view_xy(self.getValuex,self.getValuey,self.getParams) rescue Exception => ex end end |