Class: AlGraph::YAxis
Overview
Y軸クラス
Direct Known Subclasses
Constant Summary
Constants inherited from GraphView
Instance Attribute Summary
Attributes inherited from Axis
#at_interval_marks, #at_labels, #at_scale_line, #labels, #mode_label
Attributes inherited from GraphView
Instance Method Summary collapse
-
#calc_pixcel_position(v) ⇒ Integer
(YAxis) 軸上のピクセル位置を計算する。.
-
#initialize(width, height) ⇒ YAxis
constructor
(Yxis) constructor.
Methods inherited from Axis
#add_grid, #clear_grid, #clear_interval_marks, #clear_labels, #clear_scale_line, #do_scaling, #logarithmic, #max, #min, #reverse, #set_interval, #set_labels, #set_max, #set_min
Constructor Details
#initialize(width, height) ⇒ YAxis
(Yxis) constructor
1220 1221 1222 1223 1224 1225 1226 |
# File 'lib/al_graph.rb', line 1220 def initialize(width, height) super @scale_mode = :LINER @at_labels[:text_anchor] = 'end' @at_interval_marks[:grid] = true end |
Instance Method Details
#calc_pixcel_position(v) ⇒ Integer
(YAxis) 軸上のピクセル位置を計算する。
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 |
# File 'lib/al_graph.rb', line 1237 def calc_pixcel_position(v) case @scale_mode when :LINER y = (@height * (v - @scale_min) / @scale_max_min).to_i when :LOGARITHMIC y = (@height * Math.log10(v/@scale_min) / @scale_max_min).to_i else raise "Not support #{@scale_mode} mode." end return @flag_reverse ? y : @height - y end |