analytics_charts 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/analytics_charts/custom_pie.rb +22 -2
- data/lib/analytics_charts/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf544e26a312df5a7c3fe77336c6301bd975d724
|
4
|
+
data.tar.gz: cbf4b35a37df2280eed7a167be2b40a3df1f5bfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97d4408298cd2b52e7fd6545f1f9269701b8777d7976721f636f154632dff361993ee2e36a7b031a2a279f876410081ee7ec659ee3b13124b2d1266bd91d1ad6
|
7
|
+
data.tar.gz: 812e73da9f056401bfd3ef84d429c9347b08237ef65cbf2ac7b2b123803558805cfbc5da7b069b4f68b017ecabb4b281840bae54c75ecf8f8b5f9acc5513339a
|
@@ -21,7 +21,7 @@ class AnalyticsCharts::CustomPie
|
|
21
21
|
@pie_label_hash = Hash.new
|
22
22
|
@label_hash = label_hash if label_hash
|
23
23
|
@pie_label_hash = pie_label_hash if pie_label_hash
|
24
|
-
set_pie_colors(%w(#AD1F25 #BE6428 #C1B630 #1E753B))
|
24
|
+
set_pie_colors(%w(#AD1F25 #BE6428 #C1B630 #1E753B #000000))
|
25
25
|
end
|
26
26
|
|
27
27
|
def set_label_values(label_start_x, label_start_y, label_offset)
|
@@ -56,12 +56,32 @@ class AnalyticsCharts::CustomPie
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def draw
|
59
|
+
total_sum = @aggregate.inject(:+) + 0.0 # Sum elements and make it a float
|
60
|
+
if total_sum == 0
|
61
|
+
@d.stroke_width(@pie_radius)
|
62
|
+
@d = @d.stroke "#FFFFFF"
|
63
|
+
@d = @d.ellipse(@pie_center_x, @pie_center_y,
|
64
|
+
@pie_radius / 2.0 , @pie_radius / 2.0,
|
65
|
+
0, 360) # <= +0.5 'fudge factor' gets rid of the ugly gaps
|
66
|
+
@d = @d.stroke "#000000"
|
67
|
+
@d.stroke_width(5)
|
68
|
+
@d = @d.line(@pie_center_x-30,@pie_center_y-30,@pie_center_x-14,@pie_center_y-14)
|
69
|
+
@d = @d.line(@pie_center_x-30,@pie_center_y-14,@pie_center_x-14,@pie_center_y-30)
|
70
|
+
@d = @d.line(@pie_center_x+14,@pie_center_y-30,@pie_center_x+30,@pie_center_y-14)
|
71
|
+
@d = @d.line(@pie_center_x+14,@pie_center_y-14,@pie_center_x+30,@pie_center_y-30)
|
72
|
+
@d.stroke_width(10)
|
73
|
+
@d = @d.ellipse(@pie_center_x, @pie_center_y + 20,
|
74
|
+
5,5,
|
75
|
+
0, 360) # <= +0.5 'fudge factor' gets rid of the ugly gaps
|
76
|
+
draw_pie_label(@pie_center_x,@pie_center_y, 90,
|
77
|
+
@pie_radius, "(We found nothing)", 4)
|
78
|
+
return
|
79
|
+
end
|
59
80
|
if @data.size > 0
|
60
81
|
@d.stroke_width(@pie_radius)
|
61
82
|
total_sum = 0.0
|
62
83
|
prev_degrees = 60.0
|
63
84
|
@d.fill_opacity(0) # VERY IMPORTANT, otherwise undesired artifact can result.
|
64
|
-
total_sum = @aggregate.inject(:+) + 0.0 # Sum elements and make it a float
|
65
85
|
degrees = Array([0,0,0,0])
|
66
86
|
label_offset_degrees = Array([0,0,0,0])
|
67
87
|
@aggregate.each_with_index do |data_row, index|
|