highcharts_rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +106 -0
  9. data/Rakefile +6 -0
  10. data/highcharts_rails.gemspec +27 -0
  11. data/lib/highcharts_rails/version.rb +3 -0
  12. data/lib/highcharts_rails.rb +8 -0
  13. data/vendor/assets/javascripts/highcharts-3d.src.js +2139 -0
  14. data/vendor/assets/javascripts/highcharts-more.src.js +2982 -0
  15. data/vendor/assets/javascripts/highcharts.src.js +22947 -0
  16. data/vendor/assets/javascripts/js/highcharts-3d.src.js +2085 -0
  17. data/vendor/assets/javascripts/js/highcharts-more.src.js +2820 -0
  18. data/vendor/assets/javascripts/js/highcharts.src.js +20917 -0
  19. data/vendor/assets/javascripts/js/modules/accessibility.src.js +1072 -0
  20. data/vendor/assets/javascripts/js/modules/annotations.src.js +408 -0
  21. data/vendor/assets/javascripts/js/modules/boost.src.js +652 -0
  22. data/vendor/assets/javascripts/js/modules/broken-axis.src.js +338 -0
  23. data/vendor/assets/javascripts/js/modules/data.src.js +981 -0
  24. data/vendor/assets/javascripts/js/modules/drilldown.src.js +756 -0
  25. data/vendor/assets/javascripts/js/modules/exporting.src.js +953 -0
  26. data/vendor/assets/javascripts/js/modules/funnel.src.js +290 -0
  27. data/vendor/assets/javascripts/js/modules/gantt.src.js +791 -0
  28. data/vendor/assets/javascripts/js/modules/grid-axis.src.js +545 -0
  29. data/vendor/assets/javascripts/js/modules/heatmap.src.js +798 -0
  30. data/vendor/assets/javascripts/js/modules/no-data-to-display.src.js +150 -0
  31. data/vendor/assets/javascripts/js/modules/offline-exporting.src.js +492 -0
  32. data/vendor/assets/javascripts/js/modules/overlapping-datalabels.src.js +164 -0
  33. data/vendor/assets/javascripts/js/modules/series-label.src.js +606 -0
  34. data/vendor/assets/javascripts/js/modules/solid-gauge.src.js +305 -0
  35. data/vendor/assets/javascripts/js/modules/treemap.src.js +881 -0
  36. data/vendor/assets/javascripts/js/modules/xrange-series.src.js +254 -0
  37. data/vendor/assets/javascripts/js/themes/dark-blue.js +317 -0
  38. data/vendor/assets/javascripts/js/themes/dark-green.js +314 -0
  39. data/vendor/assets/javascripts/js/themes/dark-unica.js +243 -0
  40. data/vendor/assets/javascripts/js/themes/gray.js +326 -0
  41. data/vendor/assets/javascripts/js/themes/grid-light.js +99 -0
  42. data/vendor/assets/javascripts/js/themes/grid.js +131 -0
  43. data/vendor/assets/javascripts/js/themes/sand-signika.js +129 -0
  44. data/vendor/assets/javascripts/js/themes/skies.js +112 -0
  45. data/vendor/assets/javascripts/lib/canvg.src.js +3073 -0
  46. data/vendor/assets/javascripts/lib/jspdf.src.js +3031 -0
  47. data/vendor/assets/javascripts/lib/rgbcolor.src.js +299 -0
  48. data/vendor/assets/javascripts/lib/svg2pdf.src.js +1451 -0
  49. data/vendor/assets/javascripts/modules/accessibility.src.js +1072 -0
  50. data/vendor/assets/javascripts/modules/annotations.src.js +408 -0
  51. data/vendor/assets/javascripts/modules/boost.src.js +652 -0
  52. data/vendor/assets/javascripts/modules/broken-axis.src.js +338 -0
  53. data/vendor/assets/javascripts/modules/data.src.js +981 -0
  54. data/vendor/assets/javascripts/modules/drilldown.src.js +797 -0
  55. data/vendor/assets/javascripts/modules/exporting.src.js +882 -0
  56. data/vendor/assets/javascripts/modules/funnel.src.js +304 -0
  57. data/vendor/assets/javascripts/modules/gantt.src.js +815 -0
  58. data/vendor/assets/javascripts/modules/grid-axis.src.js +547 -0
  59. data/vendor/assets/javascripts/modules/heatmap.src.js +810 -0
  60. data/vendor/assets/javascripts/modules/no-data-to-display.src.js +161 -0
  61. data/vendor/assets/javascripts/modules/offline-exporting.src.js +492 -0
  62. data/vendor/assets/javascripts/modules/overlapping-datalabels.src.js +164 -0
  63. data/vendor/assets/javascripts/modules/series-label.src.js +606 -0
  64. data/vendor/assets/javascripts/modules/solid-gauge.src.js +316 -0
  65. data/vendor/assets/javascripts/modules/treemap.src.js +935 -0
  66. data/vendor/assets/javascripts/modules/xrange-series.src.js +276 -0
  67. data/vendor/assets/javascripts/themes/dark-blue.js +317 -0
  68. data/vendor/assets/javascripts/themes/dark-green.js +314 -0
  69. data/vendor/assets/javascripts/themes/dark-unica.js +243 -0
  70. data/vendor/assets/javascripts/themes/gray.js +326 -0
  71. data/vendor/assets/javascripts/themes/grid-light.js +99 -0
  72. data/vendor/assets/javascripts/themes/grid.js +131 -0
  73. data/vendor/assets/javascripts/themes/sand-signika.js +129 -0
  74. data/vendor/assets/javascripts/themes/skies.js +112 -0
  75. data/vendor/assets/stylesheets/highcharts.scss +610 -0
  76. metadata +161 -0
@@ -0,0 +1,791 @@
1
+ /**
2
+ * @license Highcharts JS v5.0.6 (2016-12-07)
3
+ * Gantt series
4
+ *
5
+ * (c) 2016 Lars A. V. Cabrera
6
+ *
7
+ * --- WORK IN PROGRESS ---
8
+ *
9
+ * License: www.highcharts.com/license
10
+ */
11
+ (function(factory) {
12
+ if (typeof module === 'object' && module.exports) {
13
+ module.exports = factory;
14
+ } else {
15
+ factory(Highcharts);
16
+ }
17
+ }(function(Highcharts) {
18
+ (function(H) {
19
+ /**
20
+ * (c) 2016 Highsoft AS
21
+ * Authors: Lars A. V. Cabrera
22
+ *
23
+ * License: www.highcharts.com/license
24
+ */
25
+ 'use strict';
26
+
27
+ var dateFormat = H.dateFormat,
28
+ each = H.each,
29
+ isObject = H.isObject,
30
+ pick = H.pick,
31
+ wrap = H.wrap,
32
+ Axis = H.Axis,
33
+ Chart = H.Chart,
34
+ Tick = H.Tick;
35
+
36
+
37
+ // Enum for which side the axis is on.
38
+ // Maps to axis.side
39
+ var axisSide = {
40
+ top: 0,
41
+ right: 1,
42
+ bottom: 2,
43
+ left: 3,
44
+ 0: 'top',
45
+ 1: 'right',
46
+ 2: 'bottom',
47
+ 3: 'left'
48
+ };
49
+
50
+ /**
51
+ * Checks if an axis is the outer axis in its dimension. Since
52
+ * axes are placed outwards in order, the axis with the highest
53
+ * index is the outermost axis.
54
+ *
55
+ * Example: If there are multiple x-axes at the top of the chart,
56
+ * this function returns true if the axis supplied is the last
57
+ * of the x-axes.
58
+ *
59
+ * @return true if the axis is the outermost axis in its dimension;
60
+ * false if not
61
+ */
62
+ Axis.prototype.isOuterAxis = function() {
63
+ var axis = this,
64
+ thisIndex = -1,
65
+ isOuter = true;
66
+
67
+ each(this.chart.axes, function(otherAxis, index) {
68
+ if (otherAxis.side === axis.side) {
69
+ if (otherAxis === axis) {
70
+ // Get the index of the axis in question
71
+ thisIndex = index;
72
+
73
+ // Check thisIndex >= 0 in case thisIndex has
74
+ // not been found yet
75
+ } else if (thisIndex >= 0 && index > thisIndex) {
76
+ // There was an axis on the same side with a
77
+ // higher index. Exit the loop.
78
+ isOuter = false;
79
+ return;
80
+ }
81
+ }
82
+ });
83
+ // There were either no other axes on the same side,
84
+ // or the other axes were not farther from the chart
85
+ return isOuter;
86
+ };
87
+
88
+ /**
89
+ * Shortcut function to Tick.label.getBBox().width.
90
+ *
91
+ * @return {number} width - the width of the tick label
92
+ */
93
+ Tick.prototype.getLabelWidth = function() {
94
+ return this.label.getBBox().width;
95
+ };
96
+
97
+ /**
98
+ * Get the maximum label length.
99
+ * This function can be used in states where the axis.maxLabelLength has not
100
+ * been set.
101
+ *
102
+ * @param {boolean} force - Optional parameter to force a new calculation, even
103
+ * if a value has already been set
104
+ * @return {number} maxLabelLength - the maximum label length of the axis
105
+ */
106
+ Axis.prototype.getMaxLabelLength = function(force) {
107
+ var tickPositions = this.tickPositions,
108
+ ticks = this.ticks,
109
+ maxLabelLength = 0;
110
+
111
+ if (!this.maxLabelLength || force) {
112
+ each(tickPositions, function(tick) {
113
+ tick = ticks[tick];
114
+ if (tick && tick.labelLength > maxLabelLength) {
115
+ maxLabelLength = tick.labelLength;
116
+ }
117
+ });
118
+ this.maxLabelLength = maxLabelLength;
119
+ }
120
+ return this.maxLabelLength;
121
+ };
122
+
123
+ /**
124
+ * Adds the axis defined in axis.options.title
125
+ */
126
+ Axis.prototype.addTitle = function() {
127
+ var axis = this,
128
+ renderer = axis.chart.renderer,
129
+ axisParent = axis.axisParent,
130
+ horiz = axis.horiz,
131
+ opposite = axis.opposite,
132
+ options = axis.options,
133
+ axisTitleOptions = options.title,
134
+ hasData,
135
+ showAxis,
136
+ textAlign;
137
+
138
+ // For reuse in Axis.render
139
+ hasData = axis.hasData();
140
+ axis.showAxis = showAxis = hasData || pick(options.showEmpty, true);
141
+
142
+ // Disregard title generation in original Axis.getOffset()
143
+ options.title = '';
144
+
145
+ if (!axis.axisTitle) {
146
+ textAlign = axisTitleOptions.textAlign;
147
+ if (!textAlign) {
148
+ textAlign = (horiz ? {
149
+ low: 'left',
150
+ middle: 'center',
151
+ high: 'right'
152
+ } : {
153
+ low: opposite ? 'right' : 'left',
154
+ middle: 'center',
155
+ high: opposite ? 'left' : 'right'
156
+ })[axisTitleOptions.align];
157
+ }
158
+ axis.axisTitle = renderer.text(
159
+ axisTitleOptions.text,
160
+ 0,
161
+ 0,
162
+ axisTitleOptions.useHTML
163
+ )
164
+ .attr({
165
+ zIndex: 7,
166
+ rotation: axisTitleOptions.rotation || 0,
167
+ align: textAlign
168
+ })
169
+ .addClass('highcharts-axis-title')
170
+
171
+ // Add to axisParent instead of axisGroup, to ignore the space
172
+ // it takes
173
+ .add(axisParent);
174
+ axis.axisTitle.isNew = true;
175
+ }
176
+
177
+
178
+ // hide or show the title depending on whether showEmpty is set
179
+ axis.axisTitle[showAxis ? 'show' : 'hide'](true);
180
+ };
181
+
182
+ /**
183
+ * Add custom date formats
184
+ */
185
+ H.dateFormats = {
186
+ // Week number
187
+ W: function(timestamp) {
188
+ var date = new Date(timestamp),
189
+ day = date.getUTCDay() === 0 ? 7 : date.getUTCDay(),
190
+ time = date.getTime(),
191
+ startOfYear = new Date(date.getUTCFullYear(), 0, 1, -6),
192
+ dayNumber;
193
+ date.setDate(date.getUTCDate() + 4 - day);
194
+ dayNumber = Math.floor((time - startOfYear) / 86400000);
195
+ return 1 + Math.floor(dayNumber / 7);
196
+ },
197
+ // First letter of the day of the week, e.g. 'M' for 'Monday'.
198
+ E: function(timestamp) {
199
+ return dateFormat('%a', timestamp, true).charAt(0);
200
+ }
201
+ };
202
+
203
+ /**
204
+ * Prevents adding the last tick label if the axis is not a category axis.
205
+ *
206
+ * Since numeric labels are normally placed at starts and ends of a range of
207
+ * value, and this module makes the label point at the value, an "extra" label
208
+ * would appear.
209
+ *
210
+ * @param {function} proceed - the original function
211
+ */
212
+ wrap(Tick.prototype, 'addLabel', function(proceed) {
213
+ var axis = this.axis,
214
+ isCategoryAxis = axis.options.categories !== undefined,
215
+ tickPositions = axis.tickPositions,
216
+ lastTick = tickPositions[tickPositions.length - 1],
217
+ isLastTick = this.pos !== lastTick;
218
+
219
+ if (!axis.options.grid || isCategoryAxis || isLastTick) {
220
+ proceed.apply(this);
221
+ }
222
+ });
223
+
224
+ /**
225
+ * Center tick labels vertically and horizontally between ticks
226
+ *
227
+ * @param {function} proceed - the original function
228
+ *
229
+ * @return {object} object - an object containing x and y positions
230
+ * for the tick
231
+ */
232
+ wrap(Tick.prototype, 'getLabelPosition', function(proceed, x, y, label) {
233
+ var retVal = proceed.apply(this, Array.prototype.slice.call(arguments, 1)),
234
+ axis = this.axis,
235
+ options = axis.options,
236
+ tickInterval = options.tickInterval || 1,
237
+ newX,
238
+ newPos,
239
+ axisHeight,
240
+ fontSize,
241
+ labelMetrics,
242
+ lblB,
243
+ lblH,
244
+ labelCenter;
245
+
246
+ // Only center tick labels if axis has option grid: true
247
+ if (options.grid) {
248
+ fontSize = options.labels.style.fontSize;
249
+ labelMetrics = axis.chart.renderer.fontMetrics(fontSize, label);
250
+ lblB = labelMetrics.b;
251
+ lblH = labelMetrics.h;
252
+
253
+ if (axis.horiz && options.categories === undefined) {
254
+ // Center x position
255
+ axisHeight = axis.axisGroup.getBBox().height;
256
+ newPos = this.pos + tickInterval / 2;
257
+ retVal.x = axis.translate(newPos) + axis.left;
258
+ labelCenter = (axisHeight / 2) + (lblH / 2) - Math.abs(lblH - lblB);
259
+
260
+ // Center y position
261
+ if (axis.side === axisSide.top) {
262
+ retVal.y = y - labelCenter;
263
+ } else {
264
+ retVal.y = y + labelCenter;
265
+ }
266
+ } else {
267
+ // Center y position
268
+ if (options.categories === undefined) {
269
+ newPos = this.pos + (tickInterval / 2);
270
+ retVal.y = axis.translate(newPos) + axis.top + (lblB / 2);
271
+ }
272
+
273
+ // Center x position
274
+ newX = (this.getLabelWidth() / 2) - (axis.maxLabelLength / 2);
275
+ if (axis.side === axisSide.left) {
276
+ retVal.x += newX;
277
+ } else {
278
+ retVal.x -= newX;
279
+ }
280
+ }
281
+ }
282
+ return retVal;
283
+ });
284
+
285
+
286
+ /**
287
+ * Draw vertical ticks extra long to create cell floors and roofs.
288
+ * Overrides the tickLength for vertical axes.
289
+ *
290
+ * @param {function} proceed - the original function
291
+ * @returns {array} retVal -
292
+ */
293
+ wrap(Axis.prototype, 'tickSize', function(proceed) {
294
+ var axis = this,
295
+ retVal = proceed.apply(axis, Array.prototype.slice.call(arguments, 1)),
296
+ labelPadding,
297
+ distance;
298
+
299
+ if (axis.options.grid && !axis.horiz) {
300
+ labelPadding = (Math.abs(axis.defaultLeftAxisOptions.labels.x) * 2);
301
+ if (!axis.maxLabelLength) {
302
+ axis.maxLabelLength = axis.getMaxLabelLength();
303
+ }
304
+ distance = axis.maxLabelLength + labelPadding;
305
+
306
+ retVal[0] = distance;
307
+ }
308
+ return retVal;
309
+ });
310
+
311
+ /**
312
+ * Disregards space required by axisTitle, by adding axisTitle to axisParent
313
+ * instead of axisGroup, and disregarding margins and offsets related to
314
+ * axisTitle.
315
+ *
316
+ * @param {function} proceed - the original function
317
+ */
318
+ wrap(Axis.prototype, 'getOffset', function(proceed) {
319
+ var axis = this,
320
+ axisOffset = axis.chart.axisOffset,
321
+ side = axis.side,
322
+ axisHeight,
323
+ tickSize,
324
+ options = axis.options,
325
+ axisTitleOptions = options.title,
326
+ addTitle = axisTitleOptions &&
327
+ axisTitleOptions.text &&
328
+ axisTitleOptions.enabled !== false;
329
+
330
+ if (axis.options.grid && isObject(axis.options.title)) {
331
+
332
+ tickSize = axis.tickSize('tick')[0];
333
+ if (axisOffset[side] && tickSize) {
334
+ axisHeight = axisOffset[side] + tickSize;
335
+ }
336
+
337
+ if (addTitle) {
338
+ // Use the custom addTitle() to add it, while preventing making room
339
+ // for it
340
+ axis.addTitle();
341
+ }
342
+
343
+ proceed.apply(axis, Array.prototype.slice.call(arguments, 1));
344
+
345
+ axisOffset[side] = pick(axisHeight, axisOffset[side]);
346
+
347
+
348
+ // Put axis options back after original Axis.getOffset() has been called
349
+ options.title = axisTitleOptions;
350
+
351
+ } else {
352
+ proceed.apply(axis, Array.prototype.slice.call(arguments, 1));
353
+ }
354
+ });
355
+
356
+ /**
357
+ * Prevents rotation of labels when squished, as rotating them would not
358
+ * help.
359
+ *
360
+ * @param {function} proceed - the original function
361
+ */
362
+ wrap(Axis.prototype, 'renderUnsquish', function(proceed) {
363
+ if (this.options.grid) {
364
+ this.labelRotation = 0;
365
+ this.options.labels.rotation = 0;
366
+ }
367
+ proceed.apply(this);
368
+ });
369
+
370
+ /**
371
+ * Places leftmost tick at the start of the axis, to create a left wall.
372
+ *
373
+ * @param {function} proceed - the original function
374
+ */
375
+ wrap(Axis.prototype, 'setOptions', function(proceed, userOptions) {
376
+ var axis = this;
377
+ if (userOptions.grid && axis.horiz) {
378
+ userOptions.startOnTick = true;
379
+ userOptions.minPadding = 0;
380
+ userOptions.endOnTick = true;
381
+ }
382
+ proceed.apply(this, Array.prototype.slice.call(arguments, 1));
383
+ });
384
+
385
+ /**
386
+ * Draw an extra line on the far side of the the axisLine,
387
+ * creating cell roofs of a grid.
388
+ *
389
+ * @param {function} proceed - the original function
390
+ */
391
+ wrap(Axis.prototype, 'render', function(proceed) {
392
+ var axis = this,
393
+ options = axis.options,
394
+ labelPadding,
395
+ distance,
396
+ lineWidth,
397
+ linePath,
398
+ yStartIndex,
399
+ yEndIndex,
400
+ xStartIndex,
401
+ xEndIndex,
402
+ renderer = axis.chart.renderer,
403
+ axisGroupBox;
404
+
405
+ if (options.grid) {
406
+ labelPadding = (Math.abs(axis.defaultLeftAxisOptions.labels.x) * 2);
407
+ distance = axis.maxLabelLength + labelPadding;
408
+ lineWidth = options.lineWidth;
409
+
410
+ // Remove right wall before rendering
411
+ if (axis.rightWall) {
412
+ axis.rightWall.destroy();
413
+ }
414
+
415
+ // Call original Axis.render() to obtain axis.axisLine and
416
+ // axis.axisGroup
417
+ proceed.apply(axis);
418
+
419
+ axisGroupBox = axis.axisGroup.getBBox();
420
+
421
+ // Add right wall on horizontal axes
422
+ if (axis.horiz) {
423
+ axis.rightWall = renderer.path([
424
+ 'M',
425
+ axisGroupBox.x + axis.width + 1, // account for left wall
426
+ axisGroupBox.y,
427
+ 'L',
428
+ axisGroupBox.x + axis.width + 1, // account for left wall
429
+ axisGroupBox.y + axisGroupBox.height
430
+ ])
431
+ .attr({
432
+ stroke: options.tickColor || '#ccd6eb',
433
+ 'stroke-width': options.tickWidth || 1,
434
+ zIndex: 7,
435
+ class: 'grid-wall'
436
+ })
437
+ .add(axis.axisGroup);
438
+ }
439
+
440
+ if (axis.isOuterAxis() && axis.axisLine) {
441
+ if (axis.horiz) {
442
+ // -1 to avoid adding distance each time the chart updates
443
+ distance = axisGroupBox.height - 1;
444
+ }
445
+
446
+ if (lineWidth) {
447
+ linePath = axis.getLinePath(lineWidth);
448
+ xStartIndex = linePath.indexOf('M') + 1;
449
+ xEndIndex = linePath.indexOf('L') + 1;
450
+ yStartIndex = linePath.indexOf('M') + 2;
451
+ yEndIndex = linePath.indexOf('L') + 2;
452
+
453
+ // Negate distance if top or left axis
454
+ if (axis.side === axisSide.top || axis.side === axisSide.left) {
455
+ distance = -distance;
456
+ }
457
+
458
+ // If axis is horizontal, reposition line path vertically
459
+ if (axis.horiz) {
460
+ linePath[yStartIndex] = linePath[yStartIndex] + distance;
461
+ linePath[yEndIndex] = linePath[yEndIndex] + distance;
462
+ } else {
463
+ // If axis is vertical, reposition line path horizontally
464
+ linePath[xStartIndex] = linePath[xStartIndex] + distance;
465
+ linePath[xEndIndex] = linePath[xEndIndex] + distance;
466
+ }
467
+
468
+ if (!axis.axisLineExtra) {
469
+ axis.axisLineExtra = renderer.path(linePath)
470
+ .attr({
471
+ stroke: options.lineColor,
472
+ 'stroke-width': lineWidth,
473
+ zIndex: 7
474
+ })
475
+ .add(axis.axisGroup);
476
+ } else {
477
+ axis.axisLineExtra.animate({
478
+ d: linePath
479
+ });
480
+ }
481
+
482
+ // show or hide the line depending on options.showEmpty
483
+ axis.axisLine[axis.showAxis ? 'show' : 'hide'](true);
484
+ }
485
+ }
486
+ } else {
487
+ proceed.apply(axis);
488
+ }
489
+ });
490
+
491
+ /**
492
+ * Wraps chart rendering with the following customizations:
493
+ * 1. Prohibit timespans of multitudes of a time unit
494
+ * 2. Draw cell walls on vertical axes
495
+ *
496
+ * @param {function} proceed - the original function
497
+ */
498
+ wrap(Chart.prototype, 'render', function(proceed) {
499
+ // 25 is optimal height for default fontSize (11px)
500
+ // 25 / 11 ≈ 2.28
501
+ var fontSizeToCellHeightRatio = 25 / 11,
502
+ fontMetrics,
503
+ fontSize;
504
+
505
+ each(this.axes, function(axis) {
506
+ var options = axis.options;
507
+ if (options.grid) {
508
+ fontSize = options.labels.style.fontSize;
509
+ fontMetrics = axis.chart.renderer.fontMetrics(fontSize);
510
+
511
+ // Prohibit timespans of multitudes of a time unit,
512
+ // e.g. two days, three weeks, etc.
513
+ if (options.type === 'datetime') {
514
+ options.units = [
515
+ ['millisecond', [1]],
516
+ ['second', [1]],
517
+ ['minute', [1]],
518
+ ['hour', [1]],
519
+ ['day', [1]],
520
+ ['week', [1]],
521
+ ['month', [1]],
522
+ ['year', null]
523
+ ];
524
+ }
525
+
526
+ // Make tick marks taller, creating cell walls of a grid.
527
+ // Use cellHeight axis option if set
528
+ if (axis.horiz) {
529
+ options.tickLength = options.cellHeight ||
530
+ fontMetrics.h * fontSizeToCellHeightRatio;
531
+ } else {
532
+ options.tickWidth = 1;
533
+ if (!options.lineWidth) {
534
+ options.lineWidth = 1;
535
+ }
536
+ }
537
+ }
538
+ });
539
+
540
+ // Call original Chart.render()
541
+ proceed.apply(this);
542
+ });
543
+
544
+ }(Highcharts));
545
+ (function(H) {
546
+ /**
547
+ * (c) 2014-2016 Highsoft AS
548
+ * Authors: Torstein Honsi, Lars A. V. Cabrera
549
+ *
550
+ * License: www.highcharts.com/license
551
+ */
552
+ 'use strict';
553
+
554
+ var defaultPlotOptions = H.getOptions().plotOptions,
555
+ color = H.Color,
556
+ columnType = H.seriesTypes.column,
557
+ each = H.each,
558
+ extendClass = H.extendClass,
559
+ isNumber = H.isNumber,
560
+ isObject = H.isObject,
561
+ merge = H.merge,
562
+ pick = H.pick,
563
+ seriesTypes = H.seriesTypes,
564
+ wrap = H.wrap,
565
+ Axis = H.Axis,
566
+ Point = H.Point,
567
+ Series = H.Series,
568
+ pointFormat = '<span style="color:{point.color}">' +
569
+ '\u25CF' +
570
+ '</span> {series.name}: <b>{point.yCategory}</b><br/>',
571
+ xrange = 'xrange';
572
+
573
+ defaultPlotOptions.xrange = merge(defaultPlotOptions.column, {
574
+ tooltip: {
575
+ pointFormat: pointFormat
576
+ }
577
+ });
578
+ seriesTypes.xrange = extendClass(columnType, {
579
+ pointClass: extendClass(Point, {
580
+ // Add x2 and yCategory to the available properties for tooltip formats
581
+ getLabelConfig: function() {
582
+ var cfg = Point.prototype.getLabelConfig.call(this);
583
+
584
+ cfg.x2 = this.x2;
585
+ cfg.yCategory = this.yCategory = this.series.yAxis.categories && this.series.yAxis.categories[this.y];
586
+ return cfg;
587
+ }
588
+ }),
589
+ type: xrange,
590
+ forceDL: true,
591
+ parallelArrays: ['x', 'x2', 'y'],
592
+ requireSorting: false,
593
+ animate: seriesTypes.line.prototype.animate,
594
+
595
+ /**
596
+ * Borrow the column series metrics, but with swapped axes. This gives free access
597
+ * to features like groupPadding, grouping, pointWidth etc.
598
+ */
599
+ getColumnMetrics: function() {
600
+ var metrics,
601
+ chart = this.chart;
602
+
603
+ function swapAxes() {
604
+ each(chart.series, function(s) {
605
+ var xAxis = s.xAxis;
606
+ s.xAxis = s.yAxis;
607
+ s.yAxis = xAxis;
608
+ });
609
+ }
610
+
611
+ swapAxes();
612
+
613
+ this.yAxis.closestPointRange = 1;
614
+ metrics = columnType.prototype.getColumnMetrics.call(this);
615
+
616
+ swapAxes();
617
+
618
+ return metrics;
619
+ },
620
+
621
+ /**
622
+ * Override cropData to show a point where x is outside visible range
623
+ * but x2 is outside.
624
+ */
625
+ cropData: function(xData, yData, min, max) {
626
+
627
+ // Replace xData with x2Data to find the appropriate cropStart
628
+ var cropData = Series.prototype.cropData,
629
+ crop = cropData.call(this, this.x2Data, yData, min, max);
630
+
631
+ // Re-insert the cropped xData
632
+ crop.xData = xData.slice(crop.start, crop.end);
633
+
634
+ return crop;
635
+ },
636
+
637
+ translate: function() {
638
+ columnType.prototype.translate.apply(this, arguments);
639
+ var series = this,
640
+ xAxis = series.xAxis,
641
+ metrics = series.columnMetrics,
642
+ minPointLength = series.options.minPointLength || 0;
643
+
644
+ each(series.points, function(point) {
645
+ var plotX = point.plotX,
646
+ posX = pick(point.x2, point.x + (point.len || 0)),
647
+ plotX2 = xAxis.toPixels(posX, true),
648
+ width = plotX2 - plotX,
649
+ widthDifference,
650
+ shapeArgs,
651
+ partialFill;
652
+
653
+ if (minPointLength) {
654
+ widthDifference = minPointLength - width;
655
+ if (widthDifference < 0) {
656
+ widthDifference = 0;
657
+ }
658
+ plotX -= widthDifference / 2;
659
+ plotX2 += widthDifference / 2;
660
+ }
661
+
662
+ plotX = Math.max(plotX, -10);
663
+ plotX2 = Math.min(Math.max(plotX2, -10), xAxis.len + 10);
664
+
665
+ point.shapeArgs = {
666
+ x: plotX,
667
+ y: point.plotY + metrics.offset,
668
+ width: plotX2 - plotX,
669
+ height: metrics.width
670
+ };
671
+ point.tooltipPos[0] += width / 2;
672
+ point.tooltipPos[1] -= metrics.width / 2;
673
+
674
+ // Add a partShapeArgs to the point, based on the shapeArgs property
675
+ partialFill = point.partialFill;
676
+ if (partialFill) {
677
+ // Get the partial fill amount
678
+ if (isObject(partialFill)) {
679
+ partialFill = partialFill.amount;
680
+ }
681
+ // If it was not a number, assume 0
682
+ if (!isNumber(partialFill)) {
683
+ partialFill = 0;
684
+ }
685
+ shapeArgs = point.shapeArgs;
686
+ point.partShapeArgs = {
687
+ x: shapeArgs.x,
688
+ y: shapeArgs.y + 1,
689
+ width: shapeArgs.width * partialFill,
690
+ height: shapeArgs.height - 2
691
+ };
692
+ }
693
+ });
694
+ },
695
+
696
+ drawPoints: function() {
697
+ var series = this,
698
+ chart = this.chart,
699
+ options = series.options,
700
+ renderer = chart.renderer,
701
+ animationLimit = options.animationLimit || 250,
702
+ verb = chart.pointCount < animationLimit ? 'animate' : 'attr';
703
+
704
+ // draw the columns
705
+ each(series.points, function(point) {
706
+ var plotY = point.plotY,
707
+ graphic = point.graphic,
708
+ type = point.shapeType,
709
+ shapeArgs = point.shapeArgs,
710
+ partShapeArgs = point.partShapeArgs,
711
+ seriesOpts = series.options,
712
+ pfOptions = point.partialFill,
713
+ fill,
714
+ state = point.selected && 'select',
715
+ cutOff = options.stacking && !options.borderRadius;
716
+
717
+ if (isNumber(plotY) && point.y !== null) {
718
+ if (graphic) { // update
719
+ point.graphicOriginal[verb](
720
+ merge(shapeArgs)
721
+ );
722
+ if (partShapeArgs) {
723
+ point.graphicOverlay[verb](
724
+ merge(partShapeArgs)
725
+ );
726
+ }
727
+
728
+ } else {
729
+ point.graphic = graphic = renderer.g('point')
730
+ .attr({
731
+ 'class': point.getClassName()
732
+ })
733
+ .add(point.group || series.group);
734
+
735
+ point.graphicOriginal = renderer[type](shapeArgs)
736
+ .addClass('highcharts-partfill-original')
737
+ .add(graphic);
738
+ if (partShapeArgs) {
739
+ point.graphicOverlay = renderer[type](partShapeArgs)
740
+ .addClass('highcharts-partfill-overlay')
741
+ .add(graphic);
742
+ }
743
+ }
744
+
745
+
746
+
747
+ } else if (graphic) {
748
+ point.graphic = graphic.destroy(); // #1269
749
+ }
750
+ });
751
+ }
752
+ });
753
+
754
+ /**
755
+ * Max x2 should be considered in xAxis extremes
756
+ */
757
+ wrap(Axis.prototype, 'getSeriesExtremes', function(proceed) {
758
+ var axis = this,
759
+ series = axis.series,
760
+ dataMax,
761
+ modMax;
762
+
763
+ proceed.call(this);
764
+ if (axis.isXAxis && series.type === xrange) {
765
+ dataMax = pick(axis.dataMax, Number.MIN_VALUE);
766
+ each(this.series, function(series) {
767
+ each(series.x2Data || [], function(val) {
768
+ if (val > dataMax) {
769
+ dataMax = val;
770
+ modMax = true;
771
+ }
772
+ });
773
+ });
774
+ if (modMax) {
775
+ axis.dataMax = dataMax;
776
+ }
777
+ }
778
+ });
779
+
780
+ }(Highcharts));
781
+ (function(H) {
782
+ /**
783
+ * (c) 2016 Highsoft AS
784
+ * Authors: Lars A. V. Cabrera
785
+ *
786
+ * License: www.highcharts.com/license
787
+ */
788
+ 'use strict';
789
+ //
790
+ }(Highcharts));
791
+ }));