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)

    凡例文字列



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

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)

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



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

def at_marker
  @at_marker
end

#at_marker_severalArray<Hash>

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

Returns:

  • (Array<Hash>)

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



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

def at_marker_several
  @at_marker_several
end

#at_plot_lineHash

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

Returns:

  • (Hash)

    線の描画アトリビュート



1849
1850
1851
# File 'lib/al_graph.rb', line 1849

def at_plot_line
  @at_plot_line
end

#mode_missing_dataSymbol

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

Returns:

  • (Symbol)

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



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

def mode_missing_data
  @mode_missing_data
end

Instance Method Details

#clear_lineObject

(ContainerLine) 線を表示しない



1881
1882
1883
# File 'lib/al_graph.rb', line 1881

def clear_line()
  @at_plot_line.clear
end

#clear_markerObject

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



1889
1890
1891
# File 'lib/al_graph.rb', line 1889

def clear_marker()
  @at_marker.clear
end

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

(ContainerLine) 色の指定

Parameters:

  • color (String)

    色(HTMLカラーコード)

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



1902
1903
1904
1905
# File 'lib/al_graph.rb', line 1902

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