contour 2.0.0.beta.8 → 2.0.0.beta.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -2
  3. data/app/assets/javascripts/contour.js +1 -2
  4. data/app/assets/javascripts/external/{highcharts-2.3.3.src.js → highcharts-3.0.2.src.js} +3359 -2150
  5. data/contour.gemspec +2 -2
  6. data/lib/contour/version.rb +1 -1
  7. data/test/dummy/config.ru +1 -1
  8. data/test/dummy/config/application.rb +3 -2
  9. data/test/dummy/config/environments/development.rb +2 -0
  10. data/test/dummy/config/environments/production.rb +2 -2
  11. data/test/dummy/config/environments/test.rb +1 -1
  12. data/test/dummy/db/test.sqlite3 +0 -0
  13. data/test/dummy/log/test.log +395 -0
  14. data/test/dummy/tmp/cache/assets/test/sprockets/015542ca3fee2683eedd21c586e8f4d7 +0 -0
  15. data/test/dummy/tmp/cache/assets/test/sprockets/04f8cd84302394fd96a5a1837da2c435 +0 -0
  16. data/test/dummy/tmp/cache/assets/test/sprockets/09eb485019a1180e44fa6e443aa47503 +0 -0
  17. data/test/dummy/tmp/cache/assets/test/sprockets/0b793dc498fe65856d1b31a805f114dc +0 -0
  18. data/test/dummy/tmp/cache/assets/test/sprockets/0e3daa6e1f20f19c7f6f41a866d36e37 +0 -0
  19. data/test/dummy/tmp/cache/assets/test/sprockets/10912716ee41871536663637aac9d90b +0 -0
  20. data/test/dummy/tmp/cache/assets/test/sprockets/10b862dc2fcb57e871b350f99445089a +0 -0
  21. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  22. data/test/dummy/tmp/cache/assets/test/sprockets/1421ef9eb96cc5dd00cd50105a186f79 +0 -0
  23. data/test/dummy/tmp/cache/assets/test/sprockets/14fd6f7e69c6174d57c53b4c89ad02e0 +0 -0
  24. data/test/dummy/tmp/cache/assets/test/sprockets/2316c3ab821288d9cc78527e3b6272a9 +0 -0
  25. data/test/dummy/tmp/cache/assets/test/sprockets/25129d82803be264eda19543144ce764 +0 -0
  26. data/test/dummy/tmp/cache/assets/test/sprockets/25e897b572b78b9e7872682d1a1722e0 +0 -0
  27. data/test/dummy/tmp/cache/assets/test/sprockets/27fce4a03552ba23d04992949c900603 +0 -0
  28. data/test/dummy/tmp/cache/assets/test/sprockets/291c470bea09e91a82ed77cb455b45fc +0 -0
  29. data/test/dummy/tmp/cache/assets/test/sprockets/29e65a0b15bf594999939014080494b0 +0 -0
  30. data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  31. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  32. data/test/dummy/tmp/cache/assets/test/sprockets/3ed734f0003effb5248235744ea7cfbf +0 -0
  33. data/test/dummy/tmp/cache/assets/test/sprockets/408c90980fca5a250881bafa3ef0ca63 +0 -0
  34. data/test/dummy/tmp/cache/assets/test/sprockets/42bbea7a13ce140463a5486a3ae03c94 +0 -0
  35. data/test/dummy/tmp/cache/assets/test/sprockets/43f737dd071b0018e1efcfb1922ff593 +0 -0
  36. data/test/dummy/tmp/cache/assets/test/sprockets/4556873bdb635e908edb1b44651d42e4 +0 -0
  37. data/test/dummy/tmp/cache/assets/test/sprockets/484869e0e90da89451d284b6ea1b97ea +0 -0
  38. data/test/dummy/tmp/cache/assets/test/sprockets/4c1f9630c371980e45f3ae2dfaec8a28 +0 -0
  39. data/test/dummy/tmp/cache/assets/test/sprockets/4e7d7c035444f1095fa7dc67721581db +0 -0
  40. data/test/dummy/tmp/cache/assets/test/sprockets/501011855a4cc902996843acadb9c797 +0 -0
  41. data/test/dummy/tmp/cache/assets/test/sprockets/52cdaf963c787c0aa7e2741ce4340be0 +0 -0
  42. data/test/dummy/tmp/cache/assets/test/sprockets/565a4c5a5681bc36489ea1beae4553b0 +0 -0
  43. data/test/dummy/tmp/cache/assets/test/sprockets/5735b70ef1f983b248a47ab1f71fe267 +0 -0
  44. data/test/dummy/tmp/cache/assets/test/sprockets/5aa48c4b9b88fd0c67e1480c677ac489 +0 -0
  45. data/test/dummy/tmp/cache/assets/test/sprockets/6565915e91061b9bb42eda9dfa4cf3fc +0 -0
  46. data/test/dummy/tmp/cache/assets/test/sprockets/6666059cb20313a69e518d351e00eb1f +0 -0
  47. data/test/dummy/tmp/cache/assets/test/sprockets/6836a9eb9975c10c93f447fc315b8349 +0 -0
  48. data/test/dummy/tmp/cache/assets/test/sprockets/6897902b615db6d106af2822a6e2eb62 +0 -0
  49. data/test/dummy/tmp/cache/assets/test/sprockets/715b9d65172e5d82f05fe7f179e4f641 +0 -0
  50. data/test/dummy/tmp/cache/assets/test/sprockets/768fc2641c0e22c57679e02ed8543d36 +0 -0
  51. data/test/dummy/tmp/cache/assets/test/sprockets/7d06b47b0fa66ce19b154d2355b1ccd1 +0 -0
  52. data/test/dummy/tmp/cache/assets/test/sprockets/7e0eb4be88d9d9a70cd09bbf4007f4a4 +0 -0
  53. data/test/dummy/tmp/cache/assets/test/sprockets/807cd6bd5e0c02ec0772daa3868f9d61 +0 -0
  54. data/test/dummy/tmp/cache/assets/test/sprockets/80cc7db99ad2b64556de9b8229a8f3e7 +0 -0
  55. data/test/dummy/tmp/cache/assets/test/sprockets/844ae5de3828b76089f39336c6f3f6c8 +0 -0
  56. data/test/dummy/tmp/cache/assets/test/sprockets/864e4f1898b310dcf0316a99ba0a3067 +0 -0
  57. data/test/dummy/tmp/cache/assets/test/sprockets/87f0cc2881f608195fdaec58ee54fbfe +0 -0
  58. data/test/dummy/tmp/cache/assets/test/sprockets/884005c51eb580c211fdf86f83cbd7d4 +0 -0
  59. data/test/dummy/tmp/cache/assets/test/sprockets/8c0ac229a3088e0cd0d9db95df428103 +0 -0
  60. data/test/dummy/tmp/cache/assets/test/sprockets/8e0772a1c692d481d2e5ef800602c9b3 +0 -0
  61. data/test/dummy/tmp/cache/assets/test/sprockets/8f0d12234b16caea73d930c4658554e8 +0 -0
  62. data/test/dummy/tmp/cache/assets/test/sprockets/8f6410f2a80e0115a1b8bf6cf7cbf317 +0 -0
  63. data/test/dummy/tmp/cache/assets/test/sprockets/8fdd783b1b18cf2bf735a31f68b32131 +0 -0
  64. data/test/dummy/tmp/cache/assets/test/sprockets/939a36ef1c8fe174ef51ff8a4c5322a8 +0 -0
  65. data/test/dummy/tmp/cache/assets/test/sprockets/950cf58a7bd174e827f4a73f6996e8bd +0 -0
  66. data/test/dummy/tmp/cache/assets/test/sprockets/a049654e5ab2df058699bd8968c0f493 +0 -0
  67. data/test/dummy/tmp/cache/assets/test/sprockets/a143a0bc0632c5cb89f596cf5272528e +0 -0
  68. data/test/dummy/tmp/cache/assets/test/sprockets/a3041faa4e334801f4f495371a8cced2 +0 -0
  69. data/test/dummy/tmp/cache/assets/test/sprockets/a3a6cd207915c1867e51fa92ea7827b8 +0 -0
  70. data/test/dummy/tmp/cache/assets/test/sprockets/a4faa95d6bafec287fc59ff59eec9625 +0 -0
  71. data/test/dummy/tmp/cache/assets/test/sprockets/a7b222735fc6d94f5713fa8e4c00feec +0 -0
  72. data/test/dummy/tmp/cache/assets/test/sprockets/ac9180e2a5edc87eec65cd47141d2e80 +0 -0
  73. data/test/dummy/tmp/cache/assets/test/sprockets/ae168f5fd9c4439b289abdb476b026b7 +0 -0
  74. data/test/dummy/tmp/cache/assets/test/sprockets/b0b29e7227617890cf734f30d2ec810e +0 -0
  75. data/test/dummy/tmp/cache/assets/test/sprockets/b3b0b443293be8cc1ebeefa441c1d56f +0 -0
  76. data/test/dummy/tmp/cache/assets/test/sprockets/bd73f0158510de99a53a18f4aeb1fb90 +0 -0
  77. data/test/dummy/tmp/cache/assets/test/sprockets/bec5edffa453a85a42afd4849f868e81 +0 -0
  78. data/test/dummy/tmp/cache/assets/test/sprockets/c04795d4fdfb36d2041fd2ee97edfdfe +0 -0
  79. data/test/dummy/tmp/cache/assets/test/sprockets/c16b6da8711e06b53e78abd01064762c +0 -0
  80. data/test/dummy/tmp/cache/assets/test/sprockets/c1ccccbc73ad9c18a4f6e82a196a2fc2 +0 -0
  81. data/test/dummy/tmp/cache/assets/test/sprockets/c8030c204c8e82370802bab4d708040d +0 -0
  82. data/test/dummy/tmp/cache/assets/test/sprockets/cc7bd06bb71f2155aeeb684d0d880988 +0 -0
  83. data/test/dummy/tmp/cache/assets/test/sprockets/cd0653a7baafdb4f0f1d06fd848a93ad +0 -0
  84. data/test/dummy/tmp/cache/assets/test/sprockets/cd0d14bed7965532879e84a4b6df7188 +0 -0
  85. data/test/dummy/tmp/cache/assets/test/sprockets/ce2d46fba538c6756b32019ae8500047 +0 -0
  86. data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  87. data/test/dummy/tmp/cache/assets/test/sprockets/d3d217eee875712c702e7b5aa7f61a5f +0 -0
  88. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  89. data/test/dummy/tmp/cache/assets/test/sprockets/dda16ed9cc1e54fd0d97a6036e928d8d +0 -0
  90. data/test/dummy/tmp/cache/assets/test/sprockets/e07c4addcee44a21398170318c44a63c +0 -0
  91. data/test/dummy/tmp/cache/assets/test/sprockets/e26d2dade8b9049db6fe17631d69c20e +0 -0
  92. data/test/dummy/tmp/cache/assets/test/sprockets/e988f9e2cbcefc5fc9b5d9961bb5da0d +0 -0
  93. data/test/dummy/tmp/cache/assets/test/sprockets/f1555999bb69d971b3a4a7128e83efea +0 -0
  94. data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  95. data/test/dummy/tmp/cache/assets/test/sprockets/f8d0960b0d3d42cba6b481ca483dae33 +0 -0
  96. metadata +17 -10
  97. data/app/assets/javascripts/external/exporting-2.3.3.src.js +0 -736
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contour
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta.8
4
+ version: 2.0.0.beta.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Remo Mueller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-07 00:00:00.000000000 Z
11
+ date: 2013-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0.rc1
19
+ version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0.rc1
26
+ version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jquery-rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.2.1
33
+ version: 2.2.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.2.1
40
+ version: 2.2.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coffee-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -220,8 +220,7 @@ files:
220
220
  - app/assets/javascripts/contour.js
221
221
  - app/assets/javascripts/external/bootstrap-datepicker.js
222
222
  - app/assets/javascripts/external/bootstrap-timepicker.js
223
- - app/assets/javascripts/external/exporting-2.3.3.src.js
224
- - app/assets/javascripts/external/highcharts-2.3.3.src.js
223
+ - app/assets/javascripts/external/highcharts-3.0.2.src.js
225
224
  - app/assets/javascripts/external/jquery-ui-1.10.0.custom.min.js
226
225
  - app/assets/javascripts/twitter-bootstrap/bootstrap-scroll-modal.js
227
226
  - app/assets/javascripts/twitter-bootstrap/bootstrap.js.coffee
@@ -380,9 +379,11 @@ files:
380
379
  - test/dummy/tmp/cache/assets/test/sprockets/10b862dc2fcb57e871b350f99445089a
381
380
  - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
382
381
  - test/dummy/tmp/cache/assets/test/sprockets/1421ef9eb96cc5dd00cd50105a186f79
382
+ - test/dummy/tmp/cache/assets/test/sprockets/14fd6f7e69c6174d57c53b4c89ad02e0
383
383
  - test/dummy/tmp/cache/assets/test/sprockets/2316c3ab821288d9cc78527e3b6272a9
384
384
  - test/dummy/tmp/cache/assets/test/sprockets/25129d82803be264eda19543144ce764
385
385
  - test/dummy/tmp/cache/assets/test/sprockets/25e897b572b78b9e7872682d1a1722e0
386
+ - test/dummy/tmp/cache/assets/test/sprockets/27fce4a03552ba23d04992949c900603
386
387
  - test/dummy/tmp/cache/assets/test/sprockets/291c470bea09e91a82ed77cb455b45fc
387
388
  - test/dummy/tmp/cache/assets/test/sprockets/29e65a0b15bf594999939014080494b0
388
389
  - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
@@ -390,6 +391,7 @@ files:
390
391
  - test/dummy/tmp/cache/assets/test/sprockets/3ed734f0003effb5248235744ea7cfbf
391
392
  - test/dummy/tmp/cache/assets/test/sprockets/408c90980fca5a250881bafa3ef0ca63
392
393
  - test/dummy/tmp/cache/assets/test/sprockets/42bbea7a13ce140463a5486a3ae03c94
394
+ - test/dummy/tmp/cache/assets/test/sprockets/43f737dd071b0018e1efcfb1922ff593
393
395
  - test/dummy/tmp/cache/assets/test/sprockets/4556873bdb635e908edb1b44651d42e4
394
396
  - test/dummy/tmp/cache/assets/test/sprockets/484869e0e90da89451d284b6ea1b97ea
395
397
  - test/dummy/tmp/cache/assets/test/sprockets/4c1f9630c371980e45f3ae2dfaec8a28
@@ -455,6 +457,7 @@ files:
455
457
  - test/dummy/tmp/cache/assets/test/sprockets/f1555999bb69d971b3a4a7128e83efea
456
458
  - test/dummy/tmp/cache/assets/test/sprockets/f47b8145ec07e458d6b81a369c688ff7
457
459
  - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
460
+ - test/dummy/tmp/cache/assets/test/sprockets/f8d0960b0d3d42cba6b481ca483dae33
458
461
  - test/dummy/tmp/cache/assets/test/sprockets/fc1a71f26b662f0fdb7dc872c0d12cc2
459
462
  - test/helpers/contour_helper_test.rb
460
463
  - test/integration/navigation_test.rb
@@ -544,9 +547,11 @@ test_files:
544
547
  - test/dummy/tmp/cache/assets/test/sprockets/10b862dc2fcb57e871b350f99445089a
545
548
  - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
546
549
  - test/dummy/tmp/cache/assets/test/sprockets/1421ef9eb96cc5dd00cd50105a186f79
550
+ - test/dummy/tmp/cache/assets/test/sprockets/14fd6f7e69c6174d57c53b4c89ad02e0
547
551
  - test/dummy/tmp/cache/assets/test/sprockets/2316c3ab821288d9cc78527e3b6272a9
548
552
  - test/dummy/tmp/cache/assets/test/sprockets/25129d82803be264eda19543144ce764
549
553
  - test/dummy/tmp/cache/assets/test/sprockets/25e897b572b78b9e7872682d1a1722e0
554
+ - test/dummy/tmp/cache/assets/test/sprockets/27fce4a03552ba23d04992949c900603
550
555
  - test/dummy/tmp/cache/assets/test/sprockets/291c470bea09e91a82ed77cb455b45fc
551
556
  - test/dummy/tmp/cache/assets/test/sprockets/29e65a0b15bf594999939014080494b0
552
557
  - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
@@ -554,6 +559,7 @@ test_files:
554
559
  - test/dummy/tmp/cache/assets/test/sprockets/3ed734f0003effb5248235744ea7cfbf
555
560
  - test/dummy/tmp/cache/assets/test/sprockets/408c90980fca5a250881bafa3ef0ca63
556
561
  - test/dummy/tmp/cache/assets/test/sprockets/42bbea7a13ce140463a5486a3ae03c94
562
+ - test/dummy/tmp/cache/assets/test/sprockets/43f737dd071b0018e1efcfb1922ff593
557
563
  - test/dummy/tmp/cache/assets/test/sprockets/4556873bdb635e908edb1b44651d42e4
558
564
  - test/dummy/tmp/cache/assets/test/sprockets/484869e0e90da89451d284b6ea1b97ea
559
565
  - test/dummy/tmp/cache/assets/test/sprockets/4c1f9630c371980e45f3ae2dfaec8a28
@@ -619,6 +625,7 @@ test_files:
619
625
  - test/dummy/tmp/cache/assets/test/sprockets/f1555999bb69d971b3a4a7128e83efea
620
626
  - test/dummy/tmp/cache/assets/test/sprockets/f47b8145ec07e458d6b81a369c688ff7
621
627
  - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
628
+ - test/dummy/tmp/cache/assets/test/sprockets/f8d0960b0d3d42cba6b481ca483dae33
622
629
  - test/dummy/tmp/cache/assets/test/sprockets/fc1a71f26b662f0fdb7dc872c0d12cc2
623
630
  - test/helpers/contour_helper_test.rb
624
631
  - test/integration/navigation_test.rb
@@ -1,736 +0,0 @@
1
- /**
2
- * @license Highcharts JS v2.3.3 (2012-10-04)
3
- * Exporting module
4
- *
5
- * (c) 2010-2011 Torstein Hønsi
6
- *
7
- * License: www.highcharts.com/license
8
- */
9
-
10
- // JSLint options:
11
- /*global Highcharts, document, window, Math, setTimeout */
12
-
13
- (function () { // encapsulate
14
-
15
- // create shortcuts
16
- var HC = Highcharts,
17
- Chart = HC.Chart,
18
- addEvent = HC.addEvent,
19
- removeEvent = HC.removeEvent,
20
- createElement = HC.createElement,
21
- discardElement = HC.discardElement,
22
- css = HC.css,
23
- merge = HC.merge,
24
- each = HC.each,
25
- extend = HC.extend,
26
- math = Math,
27
- mathMax = math.max,
28
- doc = document,
29
- win = window,
30
- hasTouch = doc.documentElement.ontouchstart !== undefined,
31
- M = 'M',
32
- L = 'L',
33
- DIV = 'div',
34
- HIDDEN = 'hidden',
35
- NONE = 'none',
36
- PREFIX = 'highcharts-',
37
- ABSOLUTE = 'absolute',
38
- PX = 'px',
39
- UNDEFINED,
40
- defaultOptions = HC.getOptions();
41
-
42
- // Add language
43
- extend(defaultOptions.lang, {
44
- downloadPNG: 'Download PNG image',
45
- downloadJPEG: 'Download JPEG image',
46
- downloadPDF: 'Download PDF document',
47
- downloadSVG: 'Download SVG vector image',
48
- exportButtonTitle: 'Export to raster or vector image',
49
- printButtonTitle: 'Print the chart'
50
- });
51
-
52
- // Buttons and menus are collected in a separate config option set called 'navigation'.
53
- // This can be extended later to add control buttons like zoom and pan right click menus.
54
- defaultOptions.navigation = {
55
- menuStyle: {
56
- border: '1px solid #A0A0A0',
57
- background: '#FFFFFF'
58
- },
59
- menuItemStyle: {
60
- padding: '0 5px',
61
- background: NONE,
62
- color: '#303030',
63
- fontSize: hasTouch ? '14px' : '11px'
64
- },
65
- menuItemHoverStyle: {
66
- background: '#4572A5',
67
- color: '#FFFFFF'
68
- },
69
-
70
- buttonOptions: {
71
- align: 'right',
72
- backgroundColor: {
73
- linearGradient: [0, 0, 0, 20],
74
- stops: [
75
- [0.4, '#F7F7F7'],
76
- [0.6, '#E3E3E3']
77
- ]
78
- },
79
- borderColor: '#B0B0B0',
80
- borderRadius: 3,
81
- borderWidth: 1,
82
- //enabled: true,
83
- height: 20,
84
- hoverBorderColor: '#909090',
85
- hoverSymbolFill: '#81A7CF',
86
- hoverSymbolStroke: '#4572A5',
87
- symbolFill: '#E0E0E0',
88
- //symbolSize: 12,
89
- symbolStroke: '#A0A0A0',
90
- //symbolStrokeWidth: 1,
91
- symbolX: 11.5,
92
- symbolY: 10.5,
93
- verticalAlign: 'top',
94
- width: 24,
95
- y: 10
96
- }
97
- };
98
-
99
-
100
-
101
- // Add the export related options
102
- defaultOptions.exporting = {
103
- //enabled: true,
104
- //filename: 'chart',
105
- type: 'image/png',
106
- url: 'http://export.highcharts.com/',
107
- width: 800,
108
- buttons: {
109
- exportButton: {
110
- //enabled: true,
111
- symbol: 'exportIcon',
112
- x: -10,
113
- symbolFill: '#A8BF77',
114
- hoverSymbolFill: '#768F3E',
115
- _id: 'exportButton',
116
- _titleKey: 'exportButtonTitle',
117
- menuItems: [{
118
- textKey: 'downloadPNG',
119
- onclick: function () {
120
- this.exportChart();
121
- }
122
- }, {
123
- textKey: 'downloadJPEG',
124
- onclick: function () {
125
- this.exportChart({
126
- type: 'image/jpeg'
127
- });
128
- }
129
- }, {
130
- textKey: 'downloadPDF',
131
- onclick: function () {
132
- this.exportChart({
133
- type: 'application/pdf'
134
- });
135
- }
136
- }, {
137
- textKey: 'downloadSVG',
138
- onclick: function () {
139
- this.exportChart({
140
- type: 'image/svg+xml'
141
- });
142
- }
143
- }
144
- // Enable this block to add "View SVG" to the dropdown menu
145
- /*
146
- ,{
147
-
148
- text: 'View SVG',
149
- onclick: function () {
150
- var svg = this.getSVG()
151
- .replace(/</g, '\n&lt;')
152
- .replace(/>/g, '&gt;');
153
-
154
- doc.body.innerHTML = '<pre>' + svg + '</pre>';
155
- }
156
- } // */
157
- ]
158
-
159
- },
160
- printButton: {
161
- //enabled: true,
162
- symbol: 'printIcon',
163
- x: -36,
164
- symbolFill: '#B5C9DF',
165
- hoverSymbolFill: '#779ABF',
166
- _id: 'printButton',
167
- _titleKey: 'printButtonTitle',
168
- onclick: function () {
169
- this.print();
170
- }
171
- }
172
- }
173
- };
174
-
175
-
176
-
177
- extend(Chart.prototype, {
178
- /**
179
- * Return an SVG representation of the chart
180
- *
181
- * @param additionalOptions {Object} Additional chart options for the generated SVG representation
182
- */
183
- getSVG: function (additionalOptions) {
184
- var chart = this,
185
- chartCopy,
186
- sandbox,
187
- svg,
188
- seriesOptions,
189
- options = merge(chart.options, additionalOptions); // copy the options and add extra options
190
-
191
- // IE compatibility hack for generating SVG content that it doesn't really understand
192
- if (!doc.createElementNS) {
193
- /*jslint unparam: true*//* allow unused parameter ns in function below */
194
- doc.createElementNS = function (ns, tagName) {
195
- return doc.createElement(tagName);
196
- };
197
- /*jslint unparam: false*/
198
- }
199
-
200
- // create a sandbox where a new chart will be generated
201
- sandbox = createElement(DIV, null, {
202
- position: ABSOLUTE,
203
- top: '-9999em',
204
- width: chart.chartWidth + PX,
205
- height: chart.chartHeight + PX
206
- }, doc.body);
207
-
208
- // override some options
209
- extend(options.chart, {
210
- renderTo: sandbox,
211
- forExport: true
212
- });
213
- options.exporting.enabled = false; // hide buttons in print
214
- options.chart.plotBackgroundImage = null; // the converter doesn't handle images
215
-
216
- // prepare for replicating the chart
217
- options.series = [];
218
- each(chart.series, function (serie) {
219
- seriesOptions = merge(serie.options, {
220
- animation: false, // turn off animation
221
- showCheckbox: false,
222
- visible: serie.visible
223
- });
224
-
225
- if (!seriesOptions.isInternal) { // used for the navigator series that has its own option set
226
-
227
- // remove image markers
228
- if (seriesOptions && seriesOptions.marker && /^url\(/.test(seriesOptions.marker.symbol)) {
229
- seriesOptions.marker.symbol = 'circle';
230
- }
231
-
232
- options.series.push(seriesOptions);
233
- }
234
- });
235
-
236
- // generate the chart copy
237
- chartCopy = new Highcharts.Chart(options);
238
-
239
- // reflect axis extremes in the export
240
- each(['xAxis', 'yAxis'], function (axisType) {
241
- each(chart[axisType], function (axis, i) {
242
- var axisCopy = chartCopy[axisType][i],
243
- extremes = axis.getExtremes(),
244
- userMin = extremes.userMin,
245
- userMax = extremes.userMax;
246
-
247
- if (userMin !== UNDEFINED || userMax !== UNDEFINED) {
248
- axisCopy.setExtremes(userMin, userMax, true, false);
249
- }
250
- });
251
- });
252
-
253
- // get the SVG from the container's innerHTML
254
- svg = chartCopy.container.innerHTML;
255
-
256
- // free up memory
257
- options = null;
258
- chartCopy.destroy();
259
- discardElement(sandbox);
260
-
261
- // sanitize
262
- svg = svg
263
- .replace(/zIndex="[^"]+"/g, '')
264
- .replace(/isShadow="[^"]+"/g, '')
265
- .replace(/symbolName="[^"]+"/g, '')
266
- .replace(/jQuery[0-9]+="[^"]+"/g, '')
267
- .replace(/isTracker="[^"]+"/g, '')
268
- .replace(/url\([^#]+#/g, 'url(#')
269
- .replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ')
270
- .replace(/ href=/g, ' xlink:href=')
271
- .replace(/\n/, ' ')
272
- .replace(/<\/svg>.*?$/, '</svg>') // any HTML added to the container after the SVG (#894)
273
- /* This fails in IE < 8
274
- .replace(/([0-9]+)\.([0-9]+)/g, function(s1, s2, s3) { // round off to save weight
275
- return s2 +'.'+ s3[0];
276
- })*/
277
-
278
- // Replace HTML entities, issue #347
279
- .replace(/&nbsp;/g, '\u00A0') // no-break space
280
- .replace(/&shy;/g, '\u00AD') // soft hyphen
281
-
282
- // IE specific
283
- .replace(/<IMG /g, '<image ')
284
- .replace(/height=([^" ]+)/g, 'height="$1"')
285
- .replace(/width=([^" ]+)/g, 'width="$1"')
286
- .replace(/hc-svg-href="([^"]+)">/g, 'xlink:href="$1"/>')
287
- .replace(/id=([^" >]+)/g, 'id="$1"')
288
- .replace(/class=([^" ]+)/g, 'class="$1"')
289
- .replace(/ transform /g, ' ')
290
- .replace(/:(path|rect)/g, '$1')
291
- .replace(/style="([^"]+)"/g, function (s) {
292
- return s.toLowerCase();
293
- });
294
-
295
- // IE9 beta bugs with innerHTML. Test again with final IE9.
296
- svg = svg.replace(/(url\(#highcharts-[0-9]+)&quot;/g, '$1')
297
- .replace(/&quot;/g, "'");
298
- if (svg.match(/ xmlns="/g).length === 2) {
299
- svg = svg.replace(/xmlns="[^"]+"/, '');
300
- }
301
-
302
- return svg;
303
- },
304
-
305
- /**
306
- * Submit the SVG representation of the chart to the server
307
- * @param {Object} options Exporting options. Possible members are url, type and width.
308
- * @param {Object} chartOptions Additional chart options for the SVG representation of the chart
309
- */
310
- exportChart: function (options, chartOptions) {
311
- var form,
312
- chart = this,
313
- svg = chart.getSVG(merge(chart.options.exporting.chartOptions, chartOptions)); // docs
314
-
315
- // merge the options
316
- options = merge(chart.options.exporting, options);
317
-
318
- // create the form
319
- form = createElement('form', {
320
- method: 'post',
321
- action: options.url,
322
- enctype: 'multipart/form-data'
323
- }, {
324
- display: NONE
325
- }, doc.body);
326
-
327
- // add the values
328
- each(['filename', 'type', 'width', 'svg'], function (name) {
329
- createElement('input', {
330
- type: HIDDEN,
331
- name: name,
332
- value: {
333
- filename: options.filename || 'chart',
334
- type: options.type,
335
- width: options.width,
336
- svg: svg
337
- }[name]
338
- }, null, form);
339
- });
340
-
341
- // submit
342
- form.submit();
343
-
344
- // clean up
345
- discardElement(form);
346
- },
347
-
348
- /**
349
- * Print the chart
350
- */
351
- print: function () {
352
-
353
- var chart = this,
354
- container = chart.container,
355
- origDisplay = [],
356
- origParent = container.parentNode,
357
- body = doc.body,
358
- childNodes = body.childNodes;
359
-
360
- if (chart.isPrinting) { // block the button while in printing mode
361
- return;
362
- }
363
-
364
- chart.isPrinting = true;
365
-
366
- // hide all body content
367
- each(childNodes, function (node, i) {
368
- if (node.nodeType === 1) {
369
- origDisplay[i] = node.style.display;
370
- node.style.display = NONE;
371
- }
372
- });
373
-
374
- // pull out the chart
375
- body.appendChild(container);
376
-
377
- // print
378
- win.print();
379
-
380
- // allow the browser to prepare before reverting
381
- setTimeout(function () {
382
-
383
- // put the chart back in
384
- origParent.appendChild(container);
385
-
386
- // restore all body content
387
- each(childNodes, function (node, i) {
388
- if (node.nodeType === 1) {
389
- node.style.display = origDisplay[i];
390
- }
391
- });
392
-
393
- chart.isPrinting = false;
394
-
395
- }, 1000);
396
-
397
- },
398
-
399
- /**
400
- * Display a popup menu for choosing the export type
401
- *
402
- * @param {String} name An identifier for the menu
403
- * @param {Array} items A collection with text and onclicks for the items
404
- * @param {Number} x The x position of the opener button
405
- * @param {Number} y The y position of the opener button
406
- * @param {Number} width The width of the opener button
407
- * @param {Number} height The height of the opener button
408
- */
409
- contextMenu: function (name, items, x, y, width, height) {
410
- var chart = this,
411
- navOptions = chart.options.navigation,
412
- menuItemStyle = navOptions.menuItemStyle,
413
- chartWidth = chart.chartWidth,
414
- chartHeight = chart.chartHeight,
415
- cacheName = 'cache-' + name,
416
- menu = chart[cacheName],
417
- menuPadding = mathMax(width, height), // for mouse leave detection
418
- boxShadow = '3px 3px 10px #888',
419
- innerMenu,
420
- hide,
421
- menuStyle;
422
-
423
- // create the menu only the first time
424
- if (!menu) {
425
-
426
- // create a HTML element above the SVG
427
- chart[cacheName] = menu = createElement(DIV, {
428
- className: PREFIX + name
429
- }, {
430
- position: ABSOLUTE,
431
- zIndex: 1000,
432
- padding: menuPadding + PX
433
- }, chart.container);
434
-
435
- innerMenu = createElement(DIV, null,
436
- extend({
437
- MozBoxShadow: boxShadow,
438
- WebkitBoxShadow: boxShadow,
439
- boxShadow: boxShadow
440
- }, navOptions.menuStyle), menu);
441
-
442
- // hide on mouse out
443
- hide = function () {
444
- css(menu, { display: NONE });
445
- };
446
-
447
- addEvent(menu, 'mouseleave', hide);
448
-
449
-
450
- // create the items
451
- each(items, function (item) {
452
- if (item) {
453
- var div = createElement(DIV, {
454
- onmouseover: function () {
455
- css(this, navOptions.menuItemHoverStyle);
456
- },
457
- onmouseout: function () {
458
- css(this, menuItemStyle);
459
- },
460
- innerHTML: item.text || chart.options.lang[item.textKey]
461
- }, extend({
462
- cursor: 'pointer'
463
- }, menuItemStyle), innerMenu);
464
-
465
- div[hasTouch ? 'ontouchstart' : 'onclick'] = function () {
466
- hide();
467
- item.onclick.apply(chart, arguments);
468
- };
469
-
470
- // Keep references to menu divs to be able to destroy them
471
- chart.exportDivElements.push(div);
472
- }
473
- });
474
-
475
- // Keep references to menu and innerMenu div to be able to destroy them
476
- chart.exportDivElements.push(innerMenu, menu);
477
-
478
- chart.exportMenuWidth = menu.offsetWidth;
479
- chart.exportMenuHeight = menu.offsetHeight;
480
- }
481
-
482
- menuStyle = { display: 'block' };
483
-
484
- // if outside right, right align it
485
- if (x + chart.exportMenuWidth > chartWidth) {
486
- menuStyle.right = (chartWidth - x - width - menuPadding) + PX;
487
- } else {
488
- menuStyle.left = (x - menuPadding) + PX;
489
- }
490
- // if outside bottom, bottom align it
491
- if (y + height + chart.exportMenuHeight > chartHeight) {
492
- menuStyle.bottom = (chartHeight - y - menuPadding) + PX;
493
- } else {
494
- menuStyle.top = (y + height - menuPadding) + PX;
495
- }
496
-
497
- css(menu, menuStyle);
498
- },
499
-
500
- /**
501
- * Add the export button to the chart
502
- */
503
- addButton: function (options) {
504
- var chart = this,
505
- renderer = chart.renderer,
506
- btnOptions = merge(chart.options.navigation.buttonOptions, options),
507
- onclick = btnOptions.onclick,
508
- menuItems = btnOptions.menuItems,
509
- buttonWidth = btnOptions.width,
510
- buttonHeight = btnOptions.height,
511
- box,
512
- symbol,
513
- button,
514
- borderWidth = btnOptions.borderWidth,
515
- boxAttr = {
516
- stroke: btnOptions.borderColor
517
-
518
- },
519
- symbolAttr = {
520
- stroke: btnOptions.symbolStroke,
521
- fill: btnOptions.symbolFill
522
- },
523
- symbolSize = btnOptions.symbolSize || 12;
524
-
525
- // Keeps references to the button elements
526
- if (!chart.exportDivElements) {
527
- chart.exportDivElements = [];
528
- chart.exportSVGElements = [];
529
- }
530
-
531
- if (btnOptions.enabled === false) {
532
- return;
533
- }
534
-
535
- // element to capture the click
536
- function revert() {
537
- symbol.attr(symbolAttr);
538
- box.attr(boxAttr);
539
- }
540
-
541
- // the box border
542
- box = renderer.rect(
543
- 0,
544
- 0,
545
- buttonWidth,
546
- buttonHeight,
547
- btnOptions.borderRadius,
548
- borderWidth
549
- )
550
- //.translate(buttonLeft, buttonTop) // to allow gradients
551
- .align(btnOptions, true)
552
- .attr(extend({
553
- fill: btnOptions.backgroundColor,
554
- 'stroke-width': borderWidth,
555
- zIndex: 19
556
- }, boxAttr)).add();
557
-
558
- // the invisible element to track the clicks
559
- button = renderer.rect(
560
- 0,
561
- 0,
562
- buttonWidth,
563
- buttonHeight,
564
- 0
565
- )
566
- .align(btnOptions)
567
- .attr({
568
- id: btnOptions._id,
569
- fill: 'rgba(255, 255, 255, 0.001)',
570
- title: chart.options.lang[btnOptions._titleKey],
571
- zIndex: 21
572
- }).css({
573
- cursor: 'pointer'
574
- })
575
- .on('mouseover', function () {
576
- symbol.attr({
577
- stroke: btnOptions.hoverSymbolStroke,
578
- fill: btnOptions.hoverSymbolFill
579
- });
580
- box.attr({
581
- stroke: btnOptions.hoverBorderColor
582
- });
583
- })
584
- .on('mouseout', revert)
585
- .on('click', revert)
586
- .add();
587
-
588
- // add the click event
589
- if (menuItems) {
590
- onclick = function () {
591
- revert();
592
- var bBox = button.getBBox();
593
- chart.contextMenu('export-menu', menuItems, bBox.x, bBox.y, buttonWidth, buttonHeight);
594
- };
595
- }
596
- /*addEvent(button.element, 'click', function() {
597
- onclick.apply(chart, arguments);
598
- });*/
599
- button.on('click', function () {
600
- onclick.apply(chart, arguments);
601
- });
602
-
603
- // the icon
604
- symbol = renderer.symbol(
605
- btnOptions.symbol,
606
- btnOptions.symbolX - (symbolSize / 2),
607
- btnOptions.symbolY - (symbolSize / 2),
608
- symbolSize,
609
- symbolSize
610
- )
611
- .align(btnOptions, true)
612
- .attr(extend(symbolAttr, {
613
- 'stroke-width': btnOptions.symbolStrokeWidth || 1,
614
- zIndex: 20
615
- })).add();
616
-
617
- // Keep references to the renderer element so to be able to destroy them later.
618
- chart.exportSVGElements.push(box, button, symbol);
619
- },
620
-
621
- /**
622
- * Destroy the buttons.
623
- */
624
- destroyExport: function () {
625
- var i,
626
- chart = this,
627
- elem;
628
-
629
- // Destroy the extra buttons added
630
- for (i = 0; i < chart.exportSVGElements.length; i++) {
631
- elem = chart.exportSVGElements[i];
632
- // Destroy and null the svg/vml elements
633
- elem.onclick = elem.ontouchstart = null;
634
- chart.exportSVGElements[i] = elem.destroy();
635
- }
636
-
637
- // Destroy the divs for the menu
638
- for (i = 0; i < chart.exportDivElements.length; i++) {
639
- elem = chart.exportDivElements[i];
640
-
641
- // Remove the event handler
642
- removeEvent(elem, 'mouseleave');
643
-
644
- // Remove inline events
645
- chart.exportDivElements[i] = elem.onmouseout = elem.onmouseover = elem.ontouchstart = elem.onclick = null;
646
-
647
- // Destroy the div by moving to garbage bin
648
- discardElement(elem);
649
- }
650
- }
651
- });
652
-
653
- /**
654
- * Crisp for 1px stroke width, which is default. In the future, consider a smarter,
655
- * global function.
656
- */
657
- function crisp(arr) {
658
- var i = arr.length;
659
- while (i--) {
660
- if (typeof arr[i] === 'number') {
661
- arr[i] = Math.round(arr[i]) - 0.5;
662
- }
663
- }
664
- return arr;
665
- }
666
-
667
- // Create the export icon
668
- HC.Renderer.prototype.symbols.exportIcon = function (x, y, width, height) {
669
- return crisp([
670
- M, // the disk
671
- x, y + width,
672
- L,
673
- x + width, y + height,
674
- x + width, y + height * 0.8,
675
- x, y + height * 0.8,
676
- 'Z',
677
- M, // the arrow
678
- x + width * 0.5, y + height * 0.8,
679
- L,
680
- x + width * 0.8, y + height * 0.4,
681
- x + width * 0.4, y + height * 0.4,
682
- x + width * 0.4, y,
683
- x + width * 0.6, y,
684
- x + width * 0.6, y + height * 0.4,
685
- x + width * 0.2, y + height * 0.4,
686
- 'Z'
687
- ]);
688
- };
689
- // Create the print icon
690
- HC.Renderer.prototype.symbols.printIcon = function (x, y, width, height) {
691
- return crisp([
692
- M, // the printer
693
- x, y + height * 0.7,
694
- L,
695
- x + width, y + height * 0.7,
696
- x + width, y + height * 0.4,
697
- x, y + height * 0.4,
698
- 'Z',
699
- M, // the upper sheet
700
- x + width * 0.2, y + height * 0.4,
701
- L,
702
- x + width * 0.2, y,
703
- x + width * 0.8, y,
704
- x + width * 0.8, y + height * 0.4,
705
- 'Z',
706
- M, // the lower sheet
707
- x + width * 0.2, y + height * 0.7,
708
- L,
709
- x, y + height,
710
- x + width, y + height,
711
- x + width * 0.8, y + height * 0.7,
712
- 'Z'
713
- ]);
714
- };
715
-
716
-
717
- // Add the buttons on chart load
718
- Chart.prototype.callbacks.push(function (chart) {
719
- var n,
720
- exportingOptions = chart.options.exporting,
721
- buttons = exportingOptions.buttons;
722
-
723
- if (exportingOptions.enabled !== false) {
724
-
725
- for (n in buttons) {
726
- chart.addButton(buttons[n]);
727
- }
728
-
729
- // Destroy the export elements at chart destroy
730
- addEvent(chart, 'destroy', chart.destroyExport);
731
- }
732
-
733
- });
734
-
735
-
736
- }());