We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f101e63 commit e89fd2fCopy full SHA for e89fd2f
1 file changed
lib/rubyplot/artist/plot/area.rb
100644
100755
@@ -6,12 +6,16 @@ class Area < Artist::Plot::Base
6
7
def initialize(*)
8
super
9
- @sort_data = false
+ @sort_data = true
10
+ @fill_opacity = 0.3
11
end
12
- def data y_values, x_values=[]
13
- x_values = Array.new(y_values.size) { |i| i } if x_values.empty?
14
- y_values.sort! if @sort_data
+ def stacked(bool)
+ @fill_opacity = 1 if bool
15
+ end
16
+
17
+ def data x_values, y_values
18
+ x_values, y_values = x_values.zip(y_values).sort.transpose if @sort_data
19
super(x_values, y_values)
20
21
@@ -22,7 +26,7 @@ def draw
22
26
x: x_poly_points,
23
27
y: y_poly_points,
24
28
color: @data[:color],
25
- fill_opacity: 0.3
29
+ fill_opacity: @fill_opacity
30
).draw
31
32
end # class Area
0 commit comments