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
1795 1796 1797 1798 |
# File 'lib/al_graph.rb', line 1795 def initialize(ydata, legend = nil) @y_data = ydata @legend = legend end |
Instance Attribute Details
#at_data_labels ⇒ Hash, Nil
Returns データラベルアトリビュート.
1770 1771 1772 |
# File 'lib/al_graph.rb', line 1770 def at_data_labels @at_data_labels end |
#id ⇒ String
Returns ID.
1764 1765 1766 |
# File 'lib/al_graph.rb', line 1764 def id @id end |
#labels ⇒ Array, Nil
Returns データラベル.
1773 1774 1775 |
# File 'lib/al_graph.rb', line 1773 def labels @labels end |
#legend ⇒ String
Returns 凡例文字列.
1776 1777 1778 |
# File 'lib/al_graph.rb', line 1776 def legend @legend end |
#plot ⇒ LinePlot, BarPlot
Returns 使用するプロットオブジェクト.
1785 1786 1787 |
# File 'lib/al_graph.rb', line 1785 def plot @plot end |
#x_axis ⇒ XAxis
Returns 使用するX軸オブジェクト.
1779 1780 1781 |
# File 'lib/al_graph.rb', line 1779 def x_axis @x_axis end |
#y_axis ⇒ YAxis
Returns 使用するY軸オブジェクト.
1782 1783 1784 |
# File 'lib/al_graph.rb', line 1782 def y_axis @y_axis end |
#y_data ⇒ Array<Numeric>
Returns Y値データ.
1767 1768 1769 |
# File 'lib/al_graph.rb', line 1767 def y_data @y_data end |
Instance Method Details
#add_data_labels(pos = :ABOVE) ⇒ Object
(DataContainer) 値ラベルを表示
1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 |
# File 'lib/al_graph.rb', line 1808 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) イテレータ
1834 1835 1836 1837 1838 |
# File 'lib/al_graph.rb', line 1834 def each() @y_data.each_with_index {|yd, i| yield( i, yd ,i ) } end |
#size ⇒ Object
(DataContainer) データ数を返す
1826 1827 1828 |
# File 'lib/al_graph.rb', line 1826 def size() return @y_data.size() end |