Class: StaticChart::Area
Instance Attribute Summary
Attributes inherited from StaticChart
#options
Instance Method Summary
collapse
Methods inherited from StaticChart
#axes, #bg, #colors, #empty?, #font_size, #height, #img_height, #img_width, #initialize, #labels, #render_graph, #retina?, #size, #title, #to_s, #width
Constructor Details
This class inherits a constructor from StaticChart
Instance Method Details
#data ⇒ Object
20
21
22
|
# File 'app/models/static_chart/area.rb', line 20
def data
@data ||= stack_data(super)
end
|
#defaults ⇒ Object
4
5
6
7
8
|
# File 'app/models/static_chart/area.rb', line 4
def defaults
super.merge(
line_weight: 0,
axes: :right )
end
|
#line_weight ⇒ Object
12
13
14
|
# File 'app/models/static_chart/area.rb', line 12
def line_weight
options[:line_weight]
end
|
#marker_colors ⇒ Object
16
17
18
|
# File 'app/models/static_chart/area.rb', line 16
def marker_colors
options.fetch(:marker_colors, colors)
end
|
#max ⇒ Object
28
29
30
|
# File 'app/models/static_chart/area.rb', line 28
def max
options.fetch(:max, data.flatten.compact.max)
end
|
#min ⇒ Object
24
25
26
|
# File 'app/models/static_chart/area.rb', line 24
def min
options.fetch(:min, 0)
end
|
#src ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'app/models/static_chart/area.rb', line 34
def src
src = Gchart.line(
data: data.reverse,
bar_colors: colors.reverse,
bg: bg,
axis_range: [[min, max]],
min_value: min,
max_value: max,
size: size )
src << chm
src << chls
src << chxs
src
end
|