Class: Charts::BarChart::VerticalBar
- Inherits:
-
Bar
- Object
- Bar
- Charts::BarChart::VerticalBar
show all
- Defined in:
- lib/charts/bar_chart/bar/vertical_bar.rb
Instance Attribute Summary
Attributes inherited from Bar
#bar_nr_in_set, #chart, #data_value, #set_nr
Instance Method Summary
collapse
Methods inherited from Bar
#bar_number_in_chart, #draw, #initialize
Instance Method Details
#height ⇒ Object
30
31
32
|
# File 'lib/charts/bar_chart/bar/vertical_bar.rb', line 30
def height
chart.inner_height * (data_value - chart.base_line).abs
end
|
#width ⇒ Object
26
27
28
|
# File 'lib/charts/bar_chart/bar/vertical_bar.rb', line 26
def width
chart.bar_inner_width.floor.to_i
end
|
#x ⇒ Object
2
3
4
|
# File 'lib/charts/bar_chart/bar/vertical_bar.rb', line 2
def x
(x_margin + x_offset).floor.to_i
end
|
#x_margin ⇒ Object
6
7
8
|
# File 'lib/charts/bar_chart/bar/vertical_bar.rb', line 6
def x_margin
chart.outer_margin + chart.bar_margin + chart.group_margin * bar_nr_in_set
end
|
#x_offset ⇒ Object
10
11
12
|
# File 'lib/charts/bar_chart/bar/vertical_bar.rb', line 10
def x_offset
chart.bar_outer_width * bar_number_in_chart
end
|
#y ⇒ Object
14
15
16
|
# File 'lib/charts/bar_chart/bar/vertical_bar.rb', line 14
def y
y_margin + y_offset
end
|
#y_margin ⇒ Object
18
19
20
|
# File 'lib/charts/bar_chart/bar/vertical_bar.rb', line 18
def y_margin
chart.outer_margin
end
|
#y_offset ⇒ Object
22
23
24
|
# File 'lib/charts/bar_chart/bar/vertical_bar.rb', line 22
def y_offset
chart.inner_height * [(1 - data_value), (1 - chart.base_line)].min
end
|