Class: AlGraphPie::GraphPie
- Inherits:
-
AlGraph::GraphBase
- Object
- AlGraph::GraphView
- AlGraph::GraphBase
- AlGraphPie::GraphPie
- Defined in:
- lib/al_graph_pie.rb
Constant Summary
Constants inherited from AlGraph::GraphBase
AlGraph::GraphBase::COLOR_LIST
Constants inherited from AlGraph::GraphView
AlGraph::GraphView::ATTR_NAMES
Instance Attribute Summary collapse
-
#at_data_labels ⇒ Hash
データラベルアトリビュート(未実装).
Attributes inherited from AlGraph::GraphBase
#at_graph_area, #at_legend, #at_main_title, #at_plot_area, #color_list, #output
Attributes inherited from AlGraph::GraphView
Instance Method Summary collapse
-
#add_data(ydata, labels = []) ⇒ Object
(GraphPie) データの追加.
-
#add_data_labels ⇒ Object
(GraphPie) 値ラベルを表示.
-
#initialize(width = 320, height = 240) ⇒ GraphPie
constructor
(GraphPie) constructor.
Methods inherited from AlGraph::GraphBase
#add_aux_tag, #add_legend, #add_main_title, #add_text, #draw_buffer, #set_margin, #set_mode
Constructor Details
#initialize(width = 320, height = 240) ⇒ GraphPie
(GraphPie) constructor
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/al_graph_pie.rb', line 33 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
#at_data_labels ⇒ Hash
Returns データラベルアトリビュート(未実装).
24 25 26 |
# File 'lib/al_graph_pie.rb', line 24 def at_data_labels @at_data_labels end |
Instance Method Details
#add_data(ydata, labels = []) ⇒ Object
(GraphPie) データの追加
54 55 56 57 58 59 60 61 62 |
# File 'lib/al_graph_pie.rb', line 54 def add_data(ydata, labels = []) ydata.each_with_index {|yd, i| color = @color_list[i % @color_list.size] @data_series << ContainerPie.new(yd, labels[i], color) } add_legend() if !labels.empty? return @data_series end |
#add_data_labels ⇒ Object
TODO:
未実装
(GraphPie) 値ラベルを表示
179 180 181 |
# File 'lib/al_graph_pie.rb', line 179 def add_data_labels() @at_data_labels = {:font_size=>9} end |