Class: AlGraph::DataContainer
- Inherits:
-
Object
- Object
- AlGraph::DataContainer
- Defined in:
- lib/al_graph.rb
Overview
データコンテナ スーパークラス
Direct Known Subclasses
Instance Attribute Summary collapse
-
#at_data_labels ⇒ Hash, Nil
データラベルアトリビュート.
-
#id ⇒ String
ID.
-
#labels ⇒ Array, Nil
データラベル.
-
#legend ⇒ String
凡例文字列.
-
#plot ⇒ LinePlot, BarPlot
使用するプロットオブジェクト.
-
#x_axis ⇒ XAxis
使用するX軸オブジェクト.
-
#y_axis ⇒ YAxis
使用するY軸オブジェクト.
-
#y_data ⇒ Array<Numeric>
Y値データ.
Instance Method Summary collapse
-
#add_data_labels(pos = :ABOVE) ⇒ Object
(DataContainer) 値ラベルを表示.
-
#each ⇒ Object
(DataContainer) イテレータ.
-
#initialize(ydata, legend = nil) ⇒ DataContainer
constructor
(DataContainer) constructor.
-
#size ⇒ Object
(DataContainer) データ数を返す.
Constructor Details
#initialize(ydata, legend = nil) ⇒ DataContainer
(DataContainer) constructor
1793 1794 1795 1796 |
# File 'lib/al_graph.rb', line 1793 def initialize(ydata, legend = nil) @y_data = ydata @legend = legend end |
Instance Attribute Details
#at_data_labels ⇒ Hash, Nil
Returns データラベルアトリビュート.
1768 1769 1770 |
# File 'lib/al_graph.rb', line 1768 def at_data_labels @at_data_labels end |
#id ⇒ String
Returns ID.
1762 1763 1764 |
# File 'lib/al_graph.rb', line 1762 def id @id end |
#labels ⇒ Array, Nil
Returns データラベル.
1771 1772 1773 |
# File 'lib/al_graph.rb', line 1771 def labels @labels end |
#legend ⇒ String
Returns 凡例文字列.
1774 1775 1776 |
# File 'lib/al_graph.rb', line 1774 def legend @legend end |
#plot ⇒ LinePlot, BarPlot
Returns 使用するプロットオブジェクト.
1783 1784 1785 |
# File 'lib/al_graph.rb', line 1783 def plot @plot end |
#x_axis ⇒ XAxis
Returns 使用するX軸オブジェクト.
1777 1778 1779 |
# File 'lib/al_graph.rb', line 1777 def x_axis @x_axis end |
#y_axis ⇒ YAxis
Returns 使用するY軸オブジェクト.
1780 1781 1782 |
# File 'lib/al_graph.rb', line 1780 def y_axis @y_axis end |
#y_data ⇒ Array<Numeric>
Returns Y値データ.
1765 1766 1767 |
# File 'lib/al_graph.rb', line 1765 def y_data @y_data end |
Instance Method Details
#add_data_labels(pos = :ABOVE) ⇒ Object
(DataContainer) 値ラベルを表示
1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 |
# File 'lib/al_graph.rb', line 1806 def add_data_labels(pos = :ABOVE) pos = pos.to_sym case pos when :ABOVE, :BELOW, :CENTER @at_data_labels = {position:pos, font_size:9, text_anchor:'middle'} when :LEFT @at_data_labels = {position:pos, font_size:9, text_anchor:'end'} when :RIGHT @at_data_labels = {position:pos, font_size:9, text_anchor:'start'} else raise "Illegal parameter #{pos}" end end |
#each ⇒ Object
(DataContainer) イテレータ
1832 1833 1834 1835 1836 |
# File 'lib/al_graph.rb', line 1832 def each() @y_data.each_with_index {|yd, i| yield( i, yd ,i ) } end |
#size ⇒ Object
(DataContainer) データ数を返す
1824 1825 1826 |
# File 'lib/al_graph.rb', line 1824 def size() return @y_data.size() end |