Class: AlGraph::ContainerLine

Inherits:
DataContainer show all
Defined in:
lib/al_graph.rb

Overview

折れ線グラフ用データコンテナ

線を消してマーカのみの表示にすることもできる。

Direct Known Subclasses

AlGraphXY::ContainerXY

Instance Attribute Summary collapse

Attributes inherited from DataContainer

#at_data_labels, #id, #labels, #legend, #plot, #x_axis, #y_axis, #y_data

Instance Method Summary collapse

Methods inherited from DataContainer

#add_data_labels, #each, #size

Constructor Details

#initialize(ydata, legend = nil) ⇒ ContainerLine

(ContainerLine) constructor

Parameters:

  • ydata (Array<Numeric>)

    Y値データ

  • legend (String) (defaults to: nil)

    凡例文字列



1870
1871
1872
1873
1874
1875
1876
1877
# File 'lib/al_graph.rb', line 1870

def initialize(ydata, legend = nil)
  super

  @at_plot_line = {:stroke_width=>2, :fill=>:none}
  @at_marker = {:format=>nil, :stroke=>:black, :stroke_width=>2}
  @at_marker_several = []
  @mode_missing_data = :MODE_CONTINUOUS
end

Instance Attribute Details

#at_markerHash

Returns マーカーの描画アトリビュート.

Returns:

  • (Hash)

    マーカーの描画アトリビュート



1854
1855
1856
# File 'lib/al_graph.rb', line 1854

def at_marker
  @at_marker
end

#at_marker_severalArray<Hash>

Returns 個別のマーカーの描画アトリビュート.

Returns:

  • (Array<Hash>)

    個別のマーカーの描画アトリビュート



1857
1858
1859
# File 'lib/al_graph.rb', line 1857

def at_marker_several
  @at_marker_several
end

#at_plot_lineHash

Returns 線の描画アトリビュート.

Returns:

  • (Hash)

    線の描画アトリビュート



1851
1852
1853
# File 'lib/al_graph.rb', line 1851

def at_plot_line
  @at_plot_line
end

#mode_missing_dataSymbol

Returns 欠損データに対する描画モード :MODE_CONTINUOUS :MODE_BREAK.

Returns:

  • (Symbol)

    欠損データに対する描画モード :MODE_CONTINUOUS :MODE_BREAK



1860
1861
1862
# File 'lib/al_graph.rb', line 1860

def mode_missing_data
  @mode_missing_data
end

Instance Method Details

#clear_lineObject

(ContainerLine) 線を表示しない



1883
1884
1885
# File 'lib/al_graph.rb', line 1883

def clear_line()
  @at_plot_line.clear
end

#clear_markerObject

(ContainerLine) マーカーを表示しない



1891
1892
1893
# File 'lib/al_graph.rb', line 1891

def clear_marker()
  @at_marker.clear
end

#set_color(color) ⇒ Object Also known as: color=

(ContainerLine) 色の指定

Parameters:

  • color (String)

    色(HTMLカラーコード)

    折れ線の場合、線とマーカーの両方の色変えなければならないので、アトリビュートを2ヶ所変更するよりも簡単にするために作成。



1904
1905
1906
1907
# File 'lib/al_graph.rb', line 1904

def set_color(color)
  @at_plot_line[:stroke] = color if !@at_plot_line.empty?
  @at_marker[:fill] = color if !@at_marker.empty?
end