Class: AlGraphPie::ContainerPie

Inherits:
Object
  • Object
show all
Defined in:
lib/al_graph_pie.rb

Overview

円グラフ用データコンテナ

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, legend, color) ⇒ ContainerPie

Note:

データ列を管理するのではなく、一つの値を管理する。 折れ線用(ContainerLine)などとは思想が違うので注意。

(ContainerPie) constructor

Parameters:

  • value (Numeric)

    データ値

  • legend (String)

    凡例文字列

  • color (String)

    色(HTMLカラーコード)



218
219
220
221
222
223
224
# File 'lib/al_graph_pie.rb', line 218

def initialize(value, legend, color)
  @at_piece = {:stroke_width=>1, :stroke=>'black'}

  @data_value = value
  @legend = legend
  @at_piece[:fill] = color
end

Instance Attribute Details

#at_pieceHash

Returns グラフアトリビュート.

Returns:

  • (Hash)

    グラフアトリビュート



204
205
206
# File 'lib/al_graph_pie.rb', line 204

def at_piece
  @at_piece
end

#data_valueNumeric

Returns データ値.

Returns:

  • (Numeric)

    データ値



195
196
197
# File 'lib/al_graph_pie.rb', line 195

def data_value
  @data_value
end

#idString

Returns ID.

Returns:

  • (String)

    ID



192
193
194
# File 'lib/al_graph_pie.rb', line 192

def id
  @id
end

#legendString

Returns 凡例文字列.

Returns:

  • (String)

    凡例文字列



201
202
203
# File 'lib/al_graph_pie.rb', line 201

def legend
  @legend
end

#percentageFloat

Returns 全体率.

Returns:

  • (Float)

    全体率



198
199
200
# File 'lib/al_graph_pie.rb', line 198

def percentage
  @percentage
end

Instance Method Details

#separate(dim = 20) ⇒ Object

(ContainerPie) セパレート

Parameters:

  • dim (Integer) (defaults to: 20)

    距離



242
243
244
# File 'lib/al_graph_pie.rb', line 242

def separate(dim = 20)
  @at_piece[:separate_distance] = dim
end

#set_color(color) ⇒ Object

(ContainerPie) 色の指定

Parameters:

  • color (String)

    色(HTMLカラーコード)



232
233
234
# File 'lib/al_graph_pie.rb', line 232

def set_color(color)
  @at_piece[:fill] = color
end