Class: AlGraphXY::XAxisReal
- Inherits:
-
AlGraph::XAxis
- Object
- AlGraph::GraphView
- AlGraph::Axis
- AlGraph::XAxis
- AlGraphXY::XAxisReal
- Defined in:
- lib/al_graph_xy.rb
Overview
XYグラフ及び散布図用 X軸クラス
Constant Summary
Constants inherited from AlGraph::GraphView
AlGraph::GraphView::ATTR_NAMES
Instance Attribute Summary
Attributes inherited from AlGraph::Axis
#at_interval_marks, #at_labels, #at_scale_line, #labels, #mode_label
Attributes inherited from AlGraph::GraphView
Instance Method Summary collapse
-
#calc_pixcel_position(v) ⇒ Integer
(XAxisReal) 軸上のピクセル位置を計算する。.
-
#do_scaling ⇒ Boolean
(XAxisReal) 目盛りスケーリング.
-
#initialize(width, height) ⇒ XAxisReal
constructor
(XAxisReal) constructor.
Methods inherited from AlGraph::XAxis
#change_mode, #set_max, #set_min
Methods inherited from AlGraph::Axis
#add_grid, #clear_grid, #clear_interval_marks, #clear_labels, #clear_scale_line, #logarithmic, #max, #min, #reverse, #set_interval, #set_labels, #set_max, #set_min
Constructor Details
#initialize(width, height) ⇒ XAxisReal
(XAxisReal) constructor
106 107 108 109 110 111 |
# File 'lib/al_graph_xy.rb', line 106 def initialize(width, height) super @scale_mode = :LINER @at_interval_marks[:grid] = true end |
Instance Method Details
#calc_pixcel_position(v) ⇒ Integer
(XAxisReal) 軸上のピクセル位置を計算する。
142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/al_graph_xy.rb', line 142 def calc_pixcel_position(v) case @scale_mode when :LINER x = (@width * (v - @scale_min) / @scale_max_min).to_i when :LOGARITHMIC x = (@width * Math.log10(v/@scale_min) / @scale_max_min).to_i else raise "Not support #{@scale_mode} mode." end return @flag_reverse ? @width - x : x end |
#do_scaling ⇒ Boolean
(XAxisReal) 目盛りスケーリング
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/al_graph_xy.rb', line 122 def do_scaling() case @scale_mode when :LINER do_scaling_liner(:@x_data) when :LOGARITHMIC do_scaling_logarithmic(:@x_data) else raise "Not support #{@scale_mode} mode." end end |