Class: AlGraph::GraphPie

Inherits:
GraphUtil show all
Defined in:
lib/al_graph_pie.rb

Constant Summary

Constant Summary

Constants inherited from GraphBase

AlGraph::GraphBase::ATTR_NAMES, AlGraph::GraphBase::ATTR_UNITS

Instance Attribute Summary (collapse)

Attributes inherited from GraphUtil

#at_graph_area, #at_legend, #at_main_title, #color_list

Attributes inherited from GraphBase

#height, #output, #width

Instance Method Summary (collapse)

Methods inherited from GraphUtil

#add_aux_tag, #add_legend, #add_main_title, #add_text, #draw_buffer, #set_margin, #set_mode

Constructor Details

- (GraphPie) initialize(width = 320, height = 240)

constructor

Parameters:

  • width (Integer) (defaults to: 320)

  • height (Integer) (defaults to: 240)

    高さ



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/al_graph_pie.rb', line 30

def initialize(width = 320, height = 240)
  super
  @at_plot_area = {:x => 10, :y => 10, :fill => '#fff'}
  @at_data_labels = nil

  #
  # make default
  #
  @at_plot_area[:width] = @width - 20
  @at_plot_area[:width] = 0 if @at_plot_area[:width] < 0
  @at_plot_area[:height] = @height - 20
  @at_plot_area[:height] = 0 if @at_plot_area[:height] < 0
end

Instance Attribute Details

- (Object) at_data_labels

データラベルアトリビュート(未実装)



22
23
24
# File 'lib/al_graph_pie.rb', line 22

def at_data_labels
  @at_data_labels
end

- (Object) at_plot_area

プロットエリアアトリビュート



20
21
22
# File 'lib/al_graph_pie.rb', line 20

def at_plot_area
  @at_plot_area
end

Instance Method Details

- (Object) add_data(ydata, labels)

データの追加

Parameters:

  • ydata (Array<Numeric>)

    データの配列

  • labels (Array<String>)

    ラベルの配列



50
51
52
53
54
55
56
57
58
59
# File 'lib/al_graph_pie.rb', line 50

def add_data(ydata, labels)
  ydata.each_with_index do |yd, i|
    color = @color_list[i % @color_list.size]
    @data_series << ContainerPie.new(yd, labels[i], color)
  end

  add_legend unless @at_legend

  return @data_series
end

- (Object) add_data_labels

未実装



170
171
172
# File 'lib/al_graph_pie.rb', line 170

def add_data_labels()
  @at_data_labels = {:font_size => 9}
end