Class: AlGraph::BarPlot

Inherits:
GraphView show all
Defined in:
lib/al_graph.rb

Overview

バーグラフプロットクラス

Constant Summary

Constants inherited from GraphView

GraphView::ATTR_NAMES

Instance Attribute Summary collapse

Attributes inherited from GraphView

#data_series, #height, #width

Instance Method Summary collapse

Constructor Details

#initialize(width, height) ⇒ BarPlot

(BarPlot) constructor



1590
1591
1592
1593
1594
# File 'lib/al_graph.rb', line 1590

def initialize( width, height )
  super
  @overlap = 0
  @spacing = 100
end

Instance Attribute Details

#overlapNumeric (readonly)

Returns 棒のオーバーラップ率(%).

Returns:

  • (Numeric)

    棒のオーバーラップ率(%)



1580
1581
1582
# File 'lib/al_graph.rb', line 1580

def overlap
  @overlap
end

#spacingNumeric (readonly)

Returns 棒の間隔率(%:100%で軸とスペースが同じ幅).

Returns:

  • (Numeric)

    棒の間隔率(%:100%で軸とスペースが同じ幅)



1583
1584
1585
# File 'lib/al_graph.rb', line 1583

def spacing
  @spacing
end

Instance Method Details

#add_data_series(data_obj, base_bar) ⇒ Object

(BarPlot) データコンテナ追加

Parameters:

  • data_obj (ContainerBar)

    データコンテナオブジェクト

  • base_bar (ContainerBar)

    積み重ねする場合、ベースになるデータコンテナ



1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
# File 'lib/al_graph.rb', line 1603

def add_data_series(data_obj, base_bar)
  if base_bar
    @data_series.each_with_index {|ds, i|
      if ds == base_bar
        @data_series.insert(i, data_obj)
        break
      end
    }
  else
    @data_series << data_obj
  end
end

#set_overlap(v) ⇒ Object Also known as: overlap=

(BarPlot) 棒どうしのオーバーラップ率指定

Parameters:

  • v (Integer)

    オーバーラップ率 (%)

    0から100を指定する。



1624
1625
1626
# File 'lib/al_graph.rb', line 1624

def set_overlap(v)
  @overlap = v
end

#set_spacing(v) ⇒ Object Also known as: spacing=

(BarPlot) 棒どうしの間隔指定

Parameters:

  • v (Integer)

    間隔率 (%)

    0から100を指定する。



1637
1638
1639
# File 'lib/al_graph.rb', line 1637

def set_spacing(v)
  @spacing = v
end