lazy_high_charts 1.4.2 → 1.4.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.
Files changed (48) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +8 -3
  4. data/GEM_VERSION +1 -1
  5. data/Gemfile +1 -1
  6. data/Guardfile +2 -2
  7. data/README.md +4 -4
  8. data/Rakefile +36 -1
  9. data/lazy_high_charts.gemspec +11 -11
  10. data/lib/lazy_high_charts.rb +4 -2
  11. data/lib/lazy_high_charts/core_ext/string.rb +4 -4
  12. data/lib/lazy_high_charts/high_chart.rb +32 -17
  13. data/lib/lazy_high_charts/layout_helper.rb +9 -9
  14. data/lib/lazy_high_charts/railtie.rb +6 -6
  15. data/spec/high_chart_spec.rb +56 -41
  16. data/spec/lazy_high_charts_spec.rb +49 -43
  17. data/spec/spec_helper.rb +1 -1
  18. data/vendor/assets/javascripts/highcharts/adapters/mootools-adapter.js +13 -0
  19. data/vendor/assets/javascripts/highcharts/adapters/prototype-adapter.js +15 -0
  20. data/vendor/assets/javascripts/highcharts/highcharts-more.js +51 -0
  21. data/vendor/assets/javascripts/highcharts/highcharts.js +272 -0
  22. data/vendor/assets/javascripts/highcharts/highstock.js +334 -0
  23. data/vendor/assets/javascripts/highcharts/modules/exporting.js +10 -10
  24. data/vendor/assets/javascripts/highcharts/stock/adapters/mootools-adapter.js +13 -0
  25. data/vendor/assets/javascripts/highcharts/stock/adapters/prototype-adapter.js +15 -0
  26. data/vendor/assets/javascripts/highcharts/stock/highcharts-more.js +51 -0
  27. data/vendor/assets/javascripts/highcharts/stock/modules/exporting.js +22 -0
  28. metadata +59 -52
  29. metadata.gz.sig +3 -2
  30. checksums.yaml +0 -7
  31. checksums.yaml.gz.sig +0 -2
  32. data/lib/generators/lazy_high_charts/install/install_generator.rb +0 -31
  33. data/vendor/assets/javascripts/exporting.js +0 -22
  34. data/vendor/assets/javascripts/highcharts-more.js +0 -50
  35. data/vendor/assets/javascripts/highcharts.js +0 -270
  36. data/vendor/assets/javascripts/highcharts/modules/canvas-tools.js +0 -133
  37. data/vendor/assets/javascripts/highcharts/modules/canvas-tools.src.js +0 -3113
  38. data/vendor/assets/javascripts/highcharts/modules/data.js +0 -16
  39. data/vendor/assets/javascripts/highcharts/modules/data.src.js +0 -537
  40. data/vendor/assets/javascripts/highcharts/modules/exporting.src.js +0 -703
  41. data/vendor/assets/javascripts/highcharts/modules/funnel.js +0 -12
  42. data/vendor/assets/javascripts/highcharts/modules/funnel.src.js +0 -284
  43. data/vendor/assets/javascripts/highcharts/themes/dark-blue.js +0 -254
  44. data/vendor/assets/javascripts/highcharts/themes/dark-green.js +0 -255
  45. data/vendor/assets/javascripts/highcharts/themes/gray.js +0 -257
  46. data/vendor/assets/javascripts/highcharts/themes/grid.js +0 -103
  47. data/vendor/assets/javascripts/highcharts/themes/skies.js +0 -89
  48. data/vendor/assets/javascripts/highstock.js +0 -332
@@ -1,12 +0,0 @@
1
- /*
2
-
3
- Highcharts funnel module, Beta
4
-
5
- (c) 2010-2012 Torstein Hønsi
6
-
7
- License: www.highcharts.com/license
8
- */
9
- (function(l){var B=l.getOptions().plotOptions,q=l.seriesTypes,D=l.merge,C=function(){},z=l.each;B.funnel=D(B.pie,{center:["50%","50%"],width:"90%",neckWidth:"30%",height:"100%",neckHeight:"25%",dataLabels:{connectorWidth:1,connectorColor:"#606060"},size:!0,states:{select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}}});q.funnel=l.extendClass(q.pie,{type:"funnel",animate:C,translate:function(){var a=function(i,a){return/%$/.test(i)?a*parseInt(i,10)/100:parseInt(i,10)},f=0,d=this.chart,e=d.plotWidth,
10
- d=d.plotHeight,g=0,c=this.options,j=c.center,b=a(j[0],e),j=a(j[0],d),l=a(c.width,e),h,r,m=a(c.height,d),s=a(c.neckWidth,e),u=a(c.neckHeight,d),v=m-u,a=this.data,w,x,q=c.dataLabels.position==="left"?1:0,y,n,A,o,k,t,p;this.getWidthAt=r=function(i){return i>m-u?s:s+(l-s)*((m-u-i)/(m-u))};this.getX=function(i,a){return b+(a?-1:1)*(r(i)/2+c.dataLabels.distance)};this.center=[b,j,m];this.centerX=b;z(a,function(a){f+=a.y});z(a,function(a){p=null;x=f?a.y/f:0;n=g*m;k=n+x*m;h=r(n);y=b-h/2;A=y+h;h=r(k);o=b-
11
- h/2;t=o+h;n>v?(y=o=b-s/2,A=t=b+s/2):k>v&&(p=k,h=r(v),o=b-h/2,t=o+h,k=v);w=["M",y,n,"L",A,n,t,k];p&&w.push(t,p,o,p);w.push(o,k,"Z");a.shapeType="path";a.shapeArgs={d:w};a.percentage=x*100;a.plotX=b;a.plotY=(n+(p||k))/2;a.tooltipPos=[b,a.plotY];a.slice=C;a.half=q;g+=x});this.setTooltipPoints()},drawPoints:function(){var a=this,f=a.options,d=a.chart.renderer;z(a.data,function(e){var g=e.graphic,c=e.shapeArgs;g?g.animate(c):e.graphic=d.path(c).attr({fill:e.color,stroke:f.borderColor,"stroke-width":f.borderWidth}).add(a.group)})},
12
- drawDataLabels:function(){var a=this.data,f=this.options.dataLabels.distance,d,e,g,c=a.length,j,b;for(this.center[2]-=2*f;c--;)g=a[c],e=(d=g.half)?1:-1,b=g.plotY,j=this.getX(b,d),g.labelPos=[0,b,j+(f-5)*e,b,j+f*e,b,d?"right":"left",0];q.pie.prototype.drawDataLabels.call(this)}})})(Highcharts);
@@ -1,284 +0,0 @@
1
- /**
2
- * @license
3
- * Highcharts funnel module, Beta
4
- *
5
- * (c) 2010-2012 Torstein Hønsi
6
- *
7
- * License: www.highcharts.com/license
8
- */
9
-
10
- /*global Highcharts */
11
- (function (Highcharts) {
12
-
13
- 'use strict';
14
-
15
- // create shortcuts
16
- var defaultOptions = Highcharts.getOptions(),
17
- defaultPlotOptions = defaultOptions.plotOptions,
18
- seriesTypes = Highcharts.seriesTypes,
19
- merge = Highcharts.merge,
20
- noop = function () {},
21
- each = Highcharts.each;
22
-
23
- // set default options
24
- defaultPlotOptions.funnel = merge(defaultPlotOptions.pie, {
25
- center: ['50%', '50%'],
26
- width: '90%',
27
- neckWidth: '30%',
28
- height: '100%',
29
- neckHeight: '25%',
30
-
31
- dataLabels: {
32
- //position: 'right',
33
- connectorWidth: 1,
34
- connectorColor: '#606060'
35
- },
36
- size: true, // to avoid adapting to data label size in Pie.drawDataLabels
37
- states: {
38
- select: {
39
- color: '#C0C0C0',
40
- borderColor: '#000000',
41
- shadow: false
42
- }
43
- }
44
- });
45
-
46
-
47
- seriesTypes.funnel = Highcharts.extendClass(seriesTypes.pie, {
48
-
49
- type: 'funnel',
50
- animate: noop,
51
-
52
- /**
53
- * Overrides the pie translate method
54
- */
55
- translate: function () {
56
-
57
- var
58
- // Get positions - either an integer or a percentage string must be given
59
- getLength = function (length, relativeTo) {
60
- return (/%$/).test(length) ?
61
- relativeTo * parseInt(length, 10) / 100 :
62
- parseInt(length, 10);
63
- },
64
-
65
- sum = 0,
66
- series = this,
67
- chart = series.chart,
68
- plotWidth = chart.plotWidth,
69
- plotHeight = chart.plotHeight,
70
- cumulative = 0, // start at top
71
- options = series.options,
72
- center = options.center,
73
- centerX = getLength(center[0], plotWidth),
74
- centerY = getLength(center[0], plotHeight),
75
- width = getLength(options.width, plotWidth),
76
- tempWidth,
77
- getWidthAt,
78
- height = getLength(options.height, plotHeight),
79
- neckWidth = getLength(options.neckWidth, plotWidth),
80
- neckHeight = getLength(options.neckHeight, plotHeight),
81
- neckY = height - neckHeight,
82
- data = series.data,
83
- path,
84
- fraction,
85
- half = options.dataLabels.position === 'left' ? 1 : 0,
86
-
87
- x1,
88
- y1,
89
- x2,
90
- x3,
91
- y3,
92
- x4,
93
- y5;
94
-
95
- // Return the width at a specific y coordinate
96
- series.getWidthAt = getWidthAt = function (y) {
97
- return y > height - neckHeight ?
98
- neckWidth :
99
- neckWidth + (width - neckWidth) * ((height - neckHeight - y) / (height - neckHeight));
100
- };
101
- series.getX = function (y, half) {
102
- return centerX + (half ? -1 : 1) * ((getWidthAt(y) / 2) + options.dataLabels.distance);
103
- };
104
-
105
- // Expose
106
- series.center = [centerX, centerY, height];
107
- series.centerX = centerX;
108
-
109
- /*
110
- * Individual point coordinate naming:
111
- *
112
- * x1,y1 _________________ x2,y1
113
- * \ /
114
- * \ /
115
- * \ /
116
- * \ /
117
- * \ /
118
- * x3,y3 _________ x4,y3
119
- *
120
- * Additional for the base of the neck:
121
- *
122
- * | |
123
- * | |
124
- * | |
125
- * x3,y5 _________ x4,y5
126
- */
127
-
128
-
129
-
130
-
131
- // get the total sum
132
- each(data, function (point) {
133
- sum += point.y;
134
- });
135
-
136
- each(data, function (point) {
137
- // set start and end positions
138
- y5 = null;
139
- fraction = sum ? point.y / sum : 0;
140
- y1 = cumulative * height;
141
- y3 = y1 + fraction * height;
142
- //tempWidth = neckWidth + (width - neckWidth) * ((height - neckHeight - y1) / (height - neckHeight));
143
- tempWidth = getWidthAt(y1);
144
- x1 = centerX - tempWidth / 2;
145
- x2 = x1 + tempWidth;
146
- tempWidth = getWidthAt(y3);
147
- x3 = centerX - tempWidth / 2;
148
- x4 = x3 + tempWidth;
149
-
150
- // the entire point is within the neck
151
- if (y1 > neckY) {
152
- x1 = x3 = centerX - neckWidth / 2;
153
- x2 = x4 = centerX + neckWidth / 2;
154
-
155
- // the base of the neck
156
- } else if (y3 > neckY) {
157
- y5 = y3;
158
-
159
- tempWidth = getWidthAt(neckY);
160
- x3 = centerX - tempWidth / 2;
161
- x4 = x3 + tempWidth;
162
-
163
- y3 = neckY;
164
- }
165
-
166
- // save the path
167
- path = [
168
- 'M',
169
- x1, y1,
170
- 'L',
171
- x2, y1,
172
- x4, y3
173
- ];
174
- if (y5) {
175
- path.push(x4, y5, x3, y5);
176
- }
177
- path.push(x3, y3, 'Z');
178
-
179
- // prepare for using shared dr
180
- point.shapeType = 'path';
181
- point.shapeArgs = { d: path };
182
-
183
-
184
- // for tooltips and data labels
185
- point.percentage = fraction * 100;
186
- point.plotX = centerX;
187
- point.plotY = (y1 + (y5 || y3)) / 2;
188
-
189
- // Placement of tooltips and data labels
190
- point.tooltipPos = [
191
- centerX,
192
- point.plotY
193
- ];
194
-
195
- // Slice is a noop on funnel points
196
- point.slice = noop;
197
-
198
- // Mimicking pie data label placement logic
199
- point.half = half;
200
-
201
- cumulative += fraction;
202
- });
203
-
204
-
205
- series.setTooltipPoints();
206
- },
207
- /**
208
- * Draw a single point (wedge)
209
- * @param {Object} point The point object
210
- * @param {Object} color The color of the point
211
- * @param {Number} brightness The brightness relative to the color
212
- */
213
- drawPoints: function () {
214
- var series = this,
215
- options = series.options,
216
- chart = series.chart,
217
- renderer = chart.renderer;
218
-
219
- each(series.data, function (point) {
220
-
221
- var graphic = point.graphic,
222
- shapeArgs = point.shapeArgs;
223
-
224
- if (!graphic) { // Create the shapes
225
- point.graphic = renderer.path(shapeArgs).
226
- attr({
227
- fill: point.color,
228
- stroke: options.borderColor,
229
- 'stroke-width': options.borderWidth
230
- }).
231
- add(series.group);
232
-
233
- } else { // Update the shapes
234
- graphic.animate(shapeArgs);
235
- }
236
- });
237
- },
238
-
239
- /**
240
- * Extend the pie data label method
241
- */
242
- drawDataLabels: function () {
243
- var data = this.data,
244
- labelDistance = this.options.dataLabels.distance,
245
- leftSide,
246
- sign,
247
- point,
248
- i = data.length,
249
- x,
250
- y;
251
-
252
- // In the original pie label anticollision logic, the slots are distributed
253
- // from one labelDistance above to one labelDistance below the pie. In funnels
254
- // we don't want this.
255
- this.center[2] -= 2 * labelDistance;
256
-
257
- // Set the label position array for each point.
258
- while (i--) {
259
- point = data[i];
260
- leftSide = point.half;
261
- sign = leftSide ? 1 : -1;
262
- y = point.plotY;
263
- x = this.getX(y, leftSide);
264
-
265
- // set the anchor point for data labels
266
- point.labelPos = [
267
- 0, // first break of connector
268
- y, // a/a
269
- x + (labelDistance - 5) * sign, // second break, right outside point shape
270
- y, // a/a
271
- x + labelDistance * sign, // landing point for connector
272
- y, // a/a
273
- leftSide ? 'right' : 'left', // alignment
274
- 0 // center angle
275
- ];
276
- }
277
-
278
- seriesTypes.pie.prototype.drawDataLabels.call(this);
279
- }
280
-
281
- });
282
-
283
-
284
- }(Highcharts));
@@ -1,254 +0,0 @@
1
- /**
2
- * Dark blue theme for Highcharts JS
3
- * @author Torstein Hønsi
4
- */
5
-
6
- Highcharts.theme = {
7
- colors: ["#DDDF0D", "#55BF3B", "#DF5353", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee",
8
- "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"],
9
- chart: {
10
- backgroundColor: {
11
- linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 },
12
- stops: [
13
- [0, 'rgb(48, 48, 96)'],
14
- [1, 'rgb(0, 0, 0)']
15
- ]
16
- },
17
- borderColor: '#000000',
18
- borderWidth: 2,
19
- className: 'dark-container',
20
- plotBackgroundColor: 'rgba(255, 255, 255, .1)',
21
- plotBorderColor: '#CCCCCC',
22
- plotBorderWidth: 1
23
- },
24
- title: {
25
- style: {
26
- color: '#C0C0C0',
27
- font: 'bold 16px "Trebuchet MS", Verdana, sans-serif'
28
- }
29
- },
30
- subtitle: {
31
- style: {
32
- color: '#666666',
33
- font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'
34
- }
35
- },
36
- xAxis: {
37
- gridLineColor: '#333333',
38
- gridLineWidth: 1,
39
- labels: {
40
- style: {
41
- color: '#A0A0A0'
42
- }
43
- },
44
- lineColor: '#A0A0A0',
45
- tickColor: '#A0A0A0',
46
- title: {
47
- style: {
48
- color: '#CCC',
49
- fontWeight: 'bold',
50
- fontSize: '12px',
51
- fontFamily: 'Trebuchet MS, Verdana, sans-serif'
52
-
53
- }
54
- }
55
- },
56
- yAxis: {
57
- gridLineColor: '#333333',
58
- labels: {
59
- style: {
60
- color: '#A0A0A0'
61
- }
62
- },
63
- lineColor: '#A0A0A0',
64
- minorTickInterval: null,
65
- tickColor: '#A0A0A0',
66
- tickWidth: 1,
67
- title: {
68
- style: {
69
- color: '#CCC',
70
- fontWeight: 'bold',
71
- fontSize: '12px',
72
- fontFamily: 'Trebuchet MS, Verdana, sans-serif'
73
- }
74
- }
75
- },
76
- tooltip: {
77
- backgroundColor: 'rgba(0, 0, 0, 0.75)',
78
- style: {
79
- color: '#F0F0F0'
80
- }
81
- },
82
- toolbar: {
83
- itemStyle: {
84
- color: 'silver'
85
- }
86
- },
87
- plotOptions: {
88
- line: {
89
- dataLabels: {
90
- color: '#CCC'
91
- },
92
- marker: {
93
- lineColor: '#333'
94
- }
95
- },
96
- spline: {
97
- marker: {
98
- lineColor: '#333'
99
- }
100
- },
101
- scatter: {
102
- marker: {
103
- lineColor: '#333'
104
- }
105
- },
106
- candlestick: {
107
- lineColor: 'white'
108
- }
109
- },
110
- legend: {
111
- itemStyle: {
112
- font: '9pt Trebuchet MS, Verdana, sans-serif',
113
- color: '#A0A0A0'
114
- },
115
- itemHoverStyle: {
116
- color: '#FFF'
117
- },
118
- itemHiddenStyle: {
119
- color: '#444'
120
- }
121
- },
122
- credits: {
123
- style: {
124
- color: '#666'
125
- }
126
- },
127
- labels: {
128
- style: {
129
- color: '#CCC'
130
- }
131
- },
132
-
133
- navigation: {
134
- buttonOptions: {
135
- symbolStroke: '#DDDDDD',
136
- hoverSymbolStroke: '#FFFFFF',
137
- theme: {
138
- fill: {
139
- linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
140
- stops: [
141
- [0.4, '#606060'],
142
- [0.6, '#333333']
143
- ]
144
- },
145
- stroke: '#000000'
146
- }
147
- }
148
- },
149
-
150
- // scroll charts
151
- rangeSelector: {
152
- buttonTheme: {
153
- fill: {
154
- linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
155
- stops: [
156
- [0.4, '#888'],
157
- [0.6, '#555']
158
- ]
159
- },
160
- stroke: '#000000',
161
- style: {
162
- color: '#CCC',
163
- fontWeight: 'bold'
164
- },
165
- states: {
166
- hover: {
167
- fill: {
168
- linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
169
- stops: [
170
- [0.4, '#BBB'],
171
- [0.6, '#888']
172
- ]
173
- },
174
- stroke: '#000000',
175
- style: {
176
- color: 'white'
177
- }
178
- },
179
- select: {
180
- fill: {
181
- linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
182
- stops: [
183
- [0.1, '#000'],
184
- [0.3, '#333']
185
- ]
186
- },
187
- stroke: '#000000',
188
- style: {
189
- color: 'yellow'
190
- }
191
- }
192
- }
193
- },
194
- inputStyle: {
195
- backgroundColor: '#333',
196
- color: 'silver'
197
- },
198
- labelStyle: {
199
- color: 'silver'
200
- }
201
- },
202
-
203
- navigator: {
204
- handles: {
205
- backgroundColor: '#666',
206
- borderColor: '#AAA'
207
- },
208
- outlineColor: '#CCC',
209
- maskFill: 'rgba(16, 16, 16, 0.5)',
210
- series: {
211
- color: '#7798BF',
212
- lineColor: '#A6C7ED'
213
- }
214
- },
215
-
216
- scrollbar: {
217
- barBackgroundColor: {
218
- linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
219
- stops: [
220
- [0.4, '#888'],
221
- [0.6, '#555']
222
- ]
223
- },
224
- barBorderColor: '#CCC',
225
- buttonArrowColor: '#CCC',
226
- buttonBackgroundColor: {
227
- linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
228
- stops: [
229
- [0.4, '#888'],
230
- [0.6, '#555']
231
- ]
232
- },
233
- buttonBorderColor: '#CCC',
234
- rifleColor: '#FFF',
235
- trackBackgroundColor: {
236
- linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
237
- stops: [
238
- [0, '#000'],
239
- [1, '#333']
240
- ]
241
- },
242
- trackBorderColor: '#666'
243
- },
244
-
245
- // special colors for some of the
246
- legendBackgroundColor: 'rgba(0, 0, 0, 0.5)',
247
- legendBackgroundColorSolid: 'rgb(35, 35, 70)',
248
- dataLabelsColor: '#444',
249
- textColor: '#C0C0C0',
250
- maskColor: 'rgba(255,255,255,0.3)'
251
- };
252
-
253
- // Apply the theme
254
- var highchartsOptions = Highcharts.setOptions(Highcharts.theme);