highcharts_rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +106 -0
- data/Rakefile +6 -0
- data/highcharts_rails.gemspec +27 -0
- data/lib/highcharts_rails/version.rb +3 -0
- data/lib/highcharts_rails.rb +8 -0
- data/vendor/assets/javascripts/highcharts-3d.src.js +2139 -0
- data/vendor/assets/javascripts/highcharts-more.src.js +2982 -0
- data/vendor/assets/javascripts/highcharts.src.js +22947 -0
- data/vendor/assets/javascripts/js/highcharts-3d.src.js +2085 -0
- data/vendor/assets/javascripts/js/highcharts-more.src.js +2820 -0
- data/vendor/assets/javascripts/js/highcharts.src.js +20917 -0
- data/vendor/assets/javascripts/js/modules/accessibility.src.js +1072 -0
- data/vendor/assets/javascripts/js/modules/annotations.src.js +408 -0
- data/vendor/assets/javascripts/js/modules/boost.src.js +652 -0
- data/vendor/assets/javascripts/js/modules/broken-axis.src.js +338 -0
- data/vendor/assets/javascripts/js/modules/data.src.js +981 -0
- data/vendor/assets/javascripts/js/modules/drilldown.src.js +756 -0
- data/vendor/assets/javascripts/js/modules/exporting.src.js +953 -0
- data/vendor/assets/javascripts/js/modules/funnel.src.js +290 -0
- data/vendor/assets/javascripts/js/modules/gantt.src.js +791 -0
- data/vendor/assets/javascripts/js/modules/grid-axis.src.js +545 -0
- data/vendor/assets/javascripts/js/modules/heatmap.src.js +798 -0
- data/vendor/assets/javascripts/js/modules/no-data-to-display.src.js +150 -0
- data/vendor/assets/javascripts/js/modules/offline-exporting.src.js +492 -0
- data/vendor/assets/javascripts/js/modules/overlapping-datalabels.src.js +164 -0
- data/vendor/assets/javascripts/js/modules/series-label.src.js +606 -0
- data/vendor/assets/javascripts/js/modules/solid-gauge.src.js +305 -0
- data/vendor/assets/javascripts/js/modules/treemap.src.js +881 -0
- data/vendor/assets/javascripts/js/modules/xrange-series.src.js +254 -0
- data/vendor/assets/javascripts/js/themes/dark-blue.js +317 -0
- data/vendor/assets/javascripts/js/themes/dark-green.js +314 -0
- data/vendor/assets/javascripts/js/themes/dark-unica.js +243 -0
- data/vendor/assets/javascripts/js/themes/gray.js +326 -0
- data/vendor/assets/javascripts/js/themes/grid-light.js +99 -0
- data/vendor/assets/javascripts/js/themes/grid.js +131 -0
- data/vendor/assets/javascripts/js/themes/sand-signika.js +129 -0
- data/vendor/assets/javascripts/js/themes/skies.js +112 -0
- data/vendor/assets/javascripts/lib/canvg.src.js +3073 -0
- data/vendor/assets/javascripts/lib/jspdf.src.js +3031 -0
- data/vendor/assets/javascripts/lib/rgbcolor.src.js +299 -0
- data/vendor/assets/javascripts/lib/svg2pdf.src.js +1451 -0
- data/vendor/assets/javascripts/modules/accessibility.src.js +1072 -0
- data/vendor/assets/javascripts/modules/annotations.src.js +408 -0
- data/vendor/assets/javascripts/modules/boost.src.js +652 -0
- data/vendor/assets/javascripts/modules/broken-axis.src.js +338 -0
- data/vendor/assets/javascripts/modules/data.src.js +981 -0
- data/vendor/assets/javascripts/modules/drilldown.src.js +797 -0
- data/vendor/assets/javascripts/modules/exporting.src.js +882 -0
- data/vendor/assets/javascripts/modules/funnel.src.js +304 -0
- data/vendor/assets/javascripts/modules/gantt.src.js +815 -0
- data/vendor/assets/javascripts/modules/grid-axis.src.js +547 -0
- data/vendor/assets/javascripts/modules/heatmap.src.js +810 -0
- data/vendor/assets/javascripts/modules/no-data-to-display.src.js +161 -0
- data/vendor/assets/javascripts/modules/offline-exporting.src.js +492 -0
- data/vendor/assets/javascripts/modules/overlapping-datalabels.src.js +164 -0
- data/vendor/assets/javascripts/modules/series-label.src.js +606 -0
- data/vendor/assets/javascripts/modules/solid-gauge.src.js +316 -0
- data/vendor/assets/javascripts/modules/treemap.src.js +935 -0
- data/vendor/assets/javascripts/modules/xrange-series.src.js +276 -0
- data/vendor/assets/javascripts/themes/dark-blue.js +317 -0
- data/vendor/assets/javascripts/themes/dark-green.js +314 -0
- data/vendor/assets/javascripts/themes/dark-unica.js +243 -0
- data/vendor/assets/javascripts/themes/gray.js +326 -0
- data/vendor/assets/javascripts/themes/grid-light.js +99 -0
- data/vendor/assets/javascripts/themes/grid.js +131 -0
- data/vendor/assets/javascripts/themes/sand-signika.js +129 -0
- data/vendor/assets/javascripts/themes/skies.js +112 -0
- data/vendor/assets/stylesheets/highcharts.scss +610 -0
- metadata +161 -0
@@ -0,0 +1,164 @@
|
|
1
|
+
/**
|
2
|
+
* @license Highcharts JS v5.0.6 (2016-12-07)
|
3
|
+
*
|
4
|
+
* (c) 2009-2016 Torstein Honsi
|
5
|
+
*
|
6
|
+
* License: www.highcharts.com/license
|
7
|
+
*/
|
8
|
+
(function(factory) {
|
9
|
+
if (typeof module === 'object' && module.exports) {
|
10
|
+
module.exports = factory;
|
11
|
+
} else {
|
12
|
+
factory(Highcharts);
|
13
|
+
}
|
14
|
+
}(function(Highcharts) {
|
15
|
+
(function(H) {
|
16
|
+
/**
|
17
|
+
* (c) 2009-2016 Torstein Honsi
|
18
|
+
*
|
19
|
+
* License: www.highcharts.com/license
|
20
|
+
*/
|
21
|
+
'use strict';
|
22
|
+
/**
|
23
|
+
* Highcharts module to hide overlapping data labels. This module is included in Highcharts.
|
24
|
+
*/
|
25
|
+
var Chart = H.Chart,
|
26
|
+
each = H.each,
|
27
|
+
pick = H.pick,
|
28
|
+
addEvent = H.addEvent;
|
29
|
+
|
30
|
+
// Collect potensial overlapping data labels. Stack labels probably don't need to be
|
31
|
+
// considered because they are usually accompanied by data labels that lie inside the columns.
|
32
|
+
Chart.prototype.callbacks.push(function(chart) {
|
33
|
+
function collectAndHide() {
|
34
|
+
var labels = [];
|
35
|
+
|
36
|
+
each(chart.series, function(series) {
|
37
|
+
var dlOptions = series.options.dataLabels,
|
38
|
+
collections = series.dataLabelCollections || ['dataLabel']; // Range series have two collections
|
39
|
+
if ((dlOptions.enabled || series._hasPointLabels) && !dlOptions.allowOverlap && series.visible) { // #3866
|
40
|
+
each(collections, function(coll) {
|
41
|
+
each(series.points, function(point) {
|
42
|
+
if (point[coll]) {
|
43
|
+
point[coll].labelrank = pick(point.labelrank, point.shapeArgs && point.shapeArgs.height); // #4118
|
44
|
+
labels.push(point[coll]);
|
45
|
+
}
|
46
|
+
});
|
47
|
+
});
|
48
|
+
}
|
49
|
+
});
|
50
|
+
chart.hideOverlappingLabels(labels);
|
51
|
+
}
|
52
|
+
|
53
|
+
// Do it now ...
|
54
|
+
collectAndHide();
|
55
|
+
|
56
|
+
// ... and after each chart redraw
|
57
|
+
addEvent(chart, 'redraw', collectAndHide);
|
58
|
+
|
59
|
+
});
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Hide overlapping labels. Labels are moved and faded in and out on zoom to provide a smooth
|
63
|
+
* visual imression.
|
64
|
+
*/
|
65
|
+
Chart.prototype.hideOverlappingLabels = function(labels) {
|
66
|
+
|
67
|
+
var len = labels.length,
|
68
|
+
label,
|
69
|
+
i,
|
70
|
+
j,
|
71
|
+
label1,
|
72
|
+
label2,
|
73
|
+
isIntersecting,
|
74
|
+
pos1,
|
75
|
+
pos2,
|
76
|
+
parent1,
|
77
|
+
parent2,
|
78
|
+
padding,
|
79
|
+
intersectRect = function(x1, y1, w1, h1, x2, y2, w2, h2) {
|
80
|
+
return !(
|
81
|
+
x2 > x1 + w1 ||
|
82
|
+
x2 + w2 < x1 ||
|
83
|
+
y2 > y1 + h1 ||
|
84
|
+
y2 + h2 < y1
|
85
|
+
);
|
86
|
+
};
|
87
|
+
|
88
|
+
// Mark with initial opacity
|
89
|
+
for (i = 0; i < len; i++) {
|
90
|
+
label = labels[i];
|
91
|
+
if (label) {
|
92
|
+
label.oldOpacity = label.opacity;
|
93
|
+
label.newOpacity = 1;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
// Prevent a situation in a gradually rising slope, that each label
|
98
|
+
// will hide the previous one because the previous one always has
|
99
|
+
// lower rank.
|
100
|
+
labels.sort(function(a, b) {
|
101
|
+
return (b.labelrank || 0) - (a.labelrank || 0);
|
102
|
+
});
|
103
|
+
|
104
|
+
// Detect overlapping labels
|
105
|
+
for (i = 0; i < len; i++) {
|
106
|
+
label1 = labels[i];
|
107
|
+
|
108
|
+
for (j = i + 1; j < len; ++j) {
|
109
|
+
label2 = labels[j];
|
110
|
+
if (label1 && label2 && label1.placed && label2.placed && label1.newOpacity !== 0 && label2.newOpacity !== 0) {
|
111
|
+
pos1 = label1.alignAttr;
|
112
|
+
pos2 = label2.alignAttr;
|
113
|
+
parent1 = label1.parentGroup; // Different panes have different positions
|
114
|
+
parent2 = label2.parentGroup;
|
115
|
+
padding = 2 * (label1.box ? 0 : label1.padding); // Substract the padding if no background or border (#4333)
|
116
|
+
isIntersecting = intersectRect(
|
117
|
+
pos1.x + parent1.translateX,
|
118
|
+
pos1.y + parent1.translateY,
|
119
|
+
label1.width - padding,
|
120
|
+
label1.height - padding,
|
121
|
+
pos2.x + parent2.translateX,
|
122
|
+
pos2.y + parent2.translateY,
|
123
|
+
label2.width - padding,
|
124
|
+
label2.height - padding
|
125
|
+
);
|
126
|
+
|
127
|
+
if (isIntersecting) {
|
128
|
+
(label1.labelrank < label2.labelrank ? label1 : label2).newOpacity = 0;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
// Hide or show
|
135
|
+
each(labels, function(label) {
|
136
|
+
var complete,
|
137
|
+
newOpacity;
|
138
|
+
|
139
|
+
if (label) {
|
140
|
+
newOpacity = label.newOpacity;
|
141
|
+
|
142
|
+
if (label.oldOpacity !== newOpacity && label.placed) {
|
143
|
+
|
144
|
+
// Make sure the label is completely hidden to avoid catching clicks (#4362)
|
145
|
+
if (newOpacity) {
|
146
|
+
label.show(true);
|
147
|
+
} else {
|
148
|
+
complete = function() {
|
149
|
+
label.hide();
|
150
|
+
};
|
151
|
+
}
|
152
|
+
|
153
|
+
// Animate or set the opacity
|
154
|
+
label.alignAttr.opacity = newOpacity;
|
155
|
+
label[label.isOld ? 'animate' : 'attr'](label.alignAttr, null, complete);
|
156
|
+
|
157
|
+
}
|
158
|
+
label.isOld = true;
|
159
|
+
}
|
160
|
+
});
|
161
|
+
};
|
162
|
+
|
163
|
+
}(Highcharts));
|
164
|
+
}));
|