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カラーコード)



220
221
222
223
224
225
226
# File 'lib/al_graph_pie.rb', line 220

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)

    グラフアトリビュート



206
207
208
# File 'lib/al_graph_pie.rb', line 206

def at_piece
  @at_piece
end

#data_valueNumeric

Returns データ値.

Returns:

  • (Numeric)

    データ値



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

def data_value
  @data_value
end

#idString

Returns ID.

Returns:

  • (String)

    ID



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

def id
  @id
end

#legendString

Returns 凡例文字列.

Returns:

  • (String)

    凡例文字列



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

def legend
  @legend
end

#percentageFloat

Returns 全体率.

Returns:

  • (Float)

    全体率



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

def percentage
  @percentage
end

Instance Method Details

#separate(dim = 20) ⇒ Object

(ContainerPie) セパレート

Parameters:

  • dim (Integer) (defaults to: 20)

    距離



244
245
246
# File 'lib/al_graph_pie.rb', line 244

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

#set_color(color) ⇒ Object

(ContainerPie) 色の指定

Parameters:

  • color (String)

    色(HTMLカラーコード)



234
235
236
# File 'lib/al_graph_pie.rb', line 234

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