ext_yarn 0.4.0 → 0.5.0

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 (347) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +41 -47
  3. data/README.md +10 -0
  4. data/bin/yarn_after +12 -0
  5. data/lib/ext_yarn/version.rb +1 -1
  6. data/package.json +14 -13
  7. data/vendor/.yarn-integrity +35 -39
  8. data/vendor/bootswatch-sass/package.json +1 -1
  9. data/vendor/chart.js/dist/Chart.bundle.js +5754 -5711
  10. data/vendor/chart.js/dist/Chart.js +2118 -2046
  11. data/vendor/chart.js/package.json +1 -1
  12. data/vendor/chartkick/LICENSE.txt +1 -1
  13. data/vendor/chartkick/dist/chartkick.js +2239 -0
  14. data/vendor/chartkick/package.json +18 -8
  15. data/vendor/file-saver/dist/FileSaver.js +180 -0
  16. data/vendor/file-saver/package.json +16 -4
  17. data/vendor/jquery/dist/jquery.js +453 -342
  18. data/vendor/jquery/dist/jquery.slim.js +428 -319
  19. data/vendor/jquery/package.json +32 -21
  20. data/vendor/{tempusdominus-bootstrap-4 → jquery-touch-events}/LICENSE +21 -21
  21. data/vendor/jquery-touch-events/package.json +32 -0
  22. data/vendor/jquery-touch-events/src/jquery.mobile-events.js +920 -0
  23. data/vendor/jquery-ui-touch-punch-zoom-fork/jquery.ui.touch-punch.js +186 -0
  24. data/vendor/jquery-ujs/package.json +1 -1
  25. data/vendor/jquery-ujs/src/rails.js +14 -4
  26. data/vendor/{bootswatch → jquery.iframe-transport}/LICENSE +2 -2
  27. data/vendor/jquery.iframe-transport/jquery.iframe-transport.js +247 -0
  28. data/vendor/jquery.iframe-transport/package.json +28 -0
  29. data/vendor/jstz/dist/jstz.js +9 -1
  30. data/vendor/jstz/package.json +6 -4
  31. data/vendor/lazysizes/LICENSE +22 -0
  32. data/vendor/lazysizes/lazysizes-umd.js +706 -0
  33. data/vendor/lazysizes/lazysizes.js +703 -0
  34. data/vendor/lazysizes/package.json +65 -0
  35. data/vendor/lazysizes/plugins/artdirect/ls.artdirect.js +160 -0
  36. data/vendor/lazysizes/plugins/aspectratio/ls.aspectratio.js +209 -0
  37. data/vendor/lazysizes/plugins/attrchange/ls.attrchange.js +129 -0
  38. data/vendor/lazysizes/plugins/bgset/ls.bgset.js +198 -0
  39. data/vendor/lazysizes/plugins/blur-up/ls.blur-up.js +191 -0
  40. data/vendor/lazysizes/plugins/custommedia/ls.custommedia.js +75 -0
  41. data/vendor/lazysizes/plugins/fix-ios-sizes/fix-ios-sizes.js +80 -0
  42. data/vendor/lazysizes/plugins/include/ls.include.js +589 -0
  43. data/vendor/lazysizes/plugins/noscript/ls.noscript.js +87 -0
  44. data/vendor/lazysizes/plugins/object-fit/ls.object-fit.js +149 -0
  45. data/vendor/lazysizes/plugins/optimumx/ls.optimumx.js +273 -0
  46. data/vendor/lazysizes/plugins/parent-fit/ls.parent-fit.js +157 -0
  47. data/vendor/lazysizes/plugins/print/ls.print.js +51 -0
  48. data/vendor/lazysizes/plugins/progressive/ls.progressive.js +49 -0
  49. data/vendor/lazysizes/plugins/respimg/ls.respimg.js +314 -0
  50. data/vendor/lazysizes/plugins/rias/ls.rias.js +391 -0
  51. data/vendor/lazysizes/plugins/static-gecko-picture/ls.static-gecko-picture.js +82 -0
  52. data/vendor/lazysizes/plugins/twitter/ls.twitter.js +63 -0
  53. data/vendor/lazysizes/plugins/unload/ls.unload.js +155 -0
  54. data/vendor/lazysizes/plugins/unveilhooks/ls.unveilhooks.js +145 -0
  55. data/vendor/lazysizes/plugins/video-embed/ls.video-embed.js +114 -0
  56. data/vendor/lodash/core.js +75 -57
  57. data/vendor/lodash/lodash.js +105 -82
  58. data/vendor/lodash/package.json +2 -2
  59. data/vendor/moment/locale/af.js +58 -60
  60. data/vendor/moment/locale/ar-dz.js +45 -47
  61. data/vendor/moment/locale/ar-kw.js +45 -47
  62. data/vendor/moment/locale/ar-ly.js +106 -112
  63. data/vendor/moment/locale/ar-ma.js +45 -48
  64. data/vendor/moment/locale/ar-sa.js +88 -91
  65. data/vendor/moment/locale/ar-tn.js +45 -47
  66. data/vendor/moment/locale/ar.js +119 -128
  67. data/vendor/moment/locale/az.js +89 -91
  68. data/vendor/moment/locale/be.js +111 -115
  69. data/vendor/moment/locale/bg.js +73 -75
  70. data/vendor/moment/locale/bm.js +44 -47
  71. data/vendor/moment/locale/bn.js +103 -105
  72. data/vendor/moment/locale/bo.js +103 -105
  73. data/vendor/moment/locale/br.js +88 -90
  74. data/vendor/moment/locale/bs.js +133 -136
  75. data/vendor/moment/locale/ca.js +68 -70
  76. data/vendor/moment/locale/cs.js +160 -162
  77. data/vendor/moment/locale/cv.js +48 -50
  78. data/vendor/moment/locale/cy.js +64 -67
  79. data/vendor/moment/locale/da.js +46 -48
  80. data/vendor/moment/locale/de-at.js +61 -66
  81. data/vendor/moment/locale/de-ch.js +61 -65
  82. data/vendor/moment/locale/de.js +61 -65
  83. data/vendor/moment/locale/dv.js +82 -85
  84. data/vendor/moment/locale/el.js +82 -84
  85. data/vendor/moment/locale/en-au.js +53 -55
  86. data/vendor/moment/locale/en-ca.js +49 -51
  87. data/vendor/moment/locale/en-gb.js +53 -55
  88. data/vendor/moment/locale/en-ie.js +53 -55
  89. data/vendor/moment/locale/en-il.js +61 -0
  90. data/vendor/moment/locale/en-nz.js +53 -55
  91. data/vendor/moment/locale/eo.js +56 -60
  92. data/vendor/moment/locale/es-do.js +72 -73
  93. data/vendor/moment/locale/es-us.js +64 -66
  94. data/vendor/moment/locale/es.js +72 -74
  95. data/vendor/moment/locale/et.js +64 -67
  96. data/vendor/moment/locale/eu.js +52 -54
  97. data/vendor/moment/locale/fa.js +90 -93
  98. data/vendor/moment/locale/fi.js +93 -95
  99. data/vendor/moment/locale/fo.js +46 -48
  100. data/vendor/moment/locale/fr-ca.js +58 -60
  101. data/vendor/moment/locale/fr-ch.js +62 -64
  102. data/vendor/moment/locale/fr.js +66 -68
  103. data/vendor/moment/locale/fy.js +59 -61
  104. data/vendor/moment/locale/gd.js +57 -59
  105. data/vendor/moment/locale/gl.js +60 -62
  106. data/vendor/moment/locale/gom-latn.js +107 -109
  107. data/vendor/moment/locale/gu.js +108 -110
  108. data/vendor/moment/locale/he.js +77 -81
  109. data/vendor/moment/locale/hi.js +108 -110
  110. data/vendor/moment/locale/hr.js +136 -138
  111. data/vendor/moment/locale/hu.js +92 -94
  112. data/vendor/moment/locale/hy-am.js +78 -80
  113. data/vendor/moment/locale/id.js +67 -70
  114. data/vendor/moment/locale/is.js +110 -112
  115. data/vendor/moment/locale/it.js +53 -56
  116. data/vendor/moment/locale/ja.js +77 -67
  117. data/vendor/moment/locale/jv.js +67 -70
  118. data/vendor/moment/locale/ka.js +70 -72
  119. data/vendor/moment/locale/kk.js +72 -74
  120. data/vendor/moment/locale/km.js +96 -46
  121. data/vendor/moment/locale/kn.js +110 -112
  122. data/vendor/moment/locale/ko.js +66 -69
  123. data/vendor/moment/locale/ky.js +72 -75
  124. data/vendor/moment/locale/lb.js +113 -116
  125. data/vendor/moment/locale/lo.js +55 -57
  126. data/vendor/moment/locale/lt.js +100 -102
  127. data/vendor/moment/locale/lv.js +81 -84
  128. data/vendor/moment/locale/me.js +93 -95
  129. data/vendor/moment/locale/mi.js +50 -52
  130. data/vendor/moment/locale/mk.js +73 -75
  131. data/vendor/moment/locale/ml.js +66 -68
  132. data/vendor/moment/locale/mn.js +103 -0
  133. data/vendor/moment/locale/mr.js +140 -143
  134. data/vendor/moment/locale/ms-my.js +67 -70
  135. data/vendor/moment/locale/ms.js +67 -69
  136. data/vendor/moment/locale/mt.js +46 -48
  137. data/vendor/moment/locale/my.js +77 -82
  138. data/vendor/moment/locale/nb.js +48 -51
  139. data/vendor/moment/locale/ne.js +107 -109
  140. data/vendor/moment/locale/nl-be.js +68 -71
  141. data/vendor/moment/locale/nl.js +68 -71
  142. data/vendor/moment/locale/nn.js +46 -48
  143. data/vendor/moment/locale/pa-in.js +108 -110
  144. data/vendor/moment/locale/pl.js +104 -106
  145. data/vendor/moment/locale/pt-br.js +46 -48
  146. data/vendor/moment/locale/pt.js +50 -52
  147. data/vendor/moment/locale/ro.js +59 -62
  148. data/vendor/moment/locale/ru.js +153 -157
  149. data/vendor/moment/locale/sd.js +82 -84
  150. data/vendor/moment/locale/se.js +46 -49
  151. data/vendor/moment/locale/si.js +56 -58
  152. data/vendor/moment/locale/sk.js +138 -141
  153. data/vendor/moment/locale/sl.js +154 -156
  154. data/vendor/moment/locale/sq.js +54 -58
  155. data/vendor/moment/locale/sr-cyrl.js +93 -95
  156. data/vendor/moment/locale/sr.js +93 -95
  157. data/vendor/moment/locale/ss.js +72 -75
  158. data/vendor/moment/locale/sv.js +55 -57
  159. data/vendor/moment/locale/sw.js +45 -47
  160. data/vendor/moment/locale/ta.js +113 -116
  161. data/vendor/moment/locale/te.js +74 -76
  162. data/vendor/moment/locale/tet.js +53 -56
  163. data/vendor/moment/locale/tg.js +115 -0
  164. data/vendor/moment/locale/th.js +52 -54
  165. data/vendor/moment/locale/tl-ph.js +48 -50
  166. data/vendor/moment/locale/tlh.js +101 -103
  167. data/vendor/moment/locale/tr.js +80 -78
  168. data/vendor/moment/locale/tzl.js +75 -78
  169. data/vendor/moment/locale/tzm-latn.js +44 -46
  170. data/vendor/moment/locale/tzm.js +44 -46
  171. data/vendor/moment/locale/ug-cn.js +118 -0
  172. data/vendor/moment/locale/uk.js +129 -132
  173. data/vendor/moment/locale/ur.js +82 -85
  174. data/vendor/moment/locale/uz-latn.js +44 -46
  175. data/vendor/moment/locale/uz.js +44 -46
  176. data/vendor/moment/locale/vi.js +64 -66
  177. data/vendor/moment/locale/x-pseudo.js +54 -56
  178. data/vendor/moment/locale/yo.js +46 -48
  179. data/vendor/moment/locale/zh-cn.js +95 -98
  180. data/vendor/moment/locale/zh-hk.js +88 -92
  181. data/vendor/moment/locale/zh-tw.js +88 -91
  182. data/vendor/moment/min/locales.js +9701 -9581
  183. data/vendor/moment/min/moment-with-locales.js +13426 -13335
  184. data/vendor/moment/moment.js +3780 -3809
  185. data/vendor/moment/package.json +10 -10
  186. data/vendor/moment-timezone/builds/moment-timezone-with-data-2012-2022.js +43 -35
  187. data/vendor/moment-timezone/builds/moment-timezone-with-data.js +290 -282
  188. data/vendor/moment-timezone/moment-timezone-utils.js +12 -10
  189. data/vendor/moment-timezone/moment-timezone.js +15 -7
  190. data/vendor/moment-timezone/package.json +5 -3
  191. data/vendor/{bootstrap → pako}/LICENSE +2 -3
  192. data/vendor/pako/dist/pako.js +6811 -0
  193. data/vendor/pako/dist/pako_deflate.js +3995 -0
  194. data/vendor/pako/dist/pako_inflate.js +3295 -0
  195. data/vendor/pako/package.json +48 -0
  196. data/yarn.lock +51 -78
  197. metadata +45 -155
  198. data/vendor/bootstrap/dist/js/bootstrap.bundle.js +0 -6461
  199. data/vendor/bootstrap/dist/js/bootstrap.js +0 -3944
  200. data/vendor/bootstrap/js/dist/alert.js +0 -204
  201. data/vendor/bootstrap/js/dist/button.js +0 -192
  202. data/vendor/bootstrap/js/dist/carousel.js +0 -567
  203. data/vendor/bootstrap/js/dist/collapse.js +0 -431
  204. data/vendor/bootstrap/js/dist/dropdown.js +0 -552
  205. data/vendor/bootstrap/js/dist/index.js +0 -23
  206. data/vendor/bootstrap/js/dist/modal.js +0 -634
  207. data/vendor/bootstrap/js/dist/popover.js +0 -266
  208. data/vendor/bootstrap/js/dist/scrollspy.js +0 -379
  209. data/vendor/bootstrap/js/dist/tab.js +0 -278
  210. data/vendor/bootstrap/js/dist/tooltip.js +0 -734
  211. data/vendor/bootstrap/js/dist/util.js +0 -144
  212. data/vendor/bootstrap/package.json +0 -217
  213. data/vendor/bootstrap/scss/_alert.scss +0 -51
  214. data/vendor/bootstrap/scss/_badge.scss +0 -47
  215. data/vendor/bootstrap/scss/_breadcrumb.scss +0 -41
  216. data/vendor/bootstrap/scss/_button-group.scss +0 -172
  217. data/vendor/bootstrap/scss/_buttons.scss +0 -143
  218. data/vendor/bootstrap/scss/_card.scss +0 -301
  219. data/vendor/bootstrap/scss/_carousel.scss +0 -236
  220. data/vendor/bootstrap/scss/_close.scss +0 -35
  221. data/vendor/bootstrap/scss/_code.scss +0 -48
  222. data/vendor/bootstrap/scss/_custom-forms.scss +0 -433
  223. data/vendor/bootstrap/scss/_dropdown.scss +0 -166
  224. data/vendor/bootstrap/scss/_forms.scss +0 -333
  225. data/vendor/bootstrap/scss/_functions.scss +0 -86
  226. data/vendor/bootstrap/scss/_grid.scss +0 -52
  227. data/vendor/bootstrap/scss/_images.scss +0 -42
  228. data/vendor/bootstrap/scss/_input-group.scss +0 -173
  229. data/vendor/bootstrap/scss/_jumbotron.scss +0 -16
  230. data/vendor/bootstrap/scss/_list-group.scss +0 -115
  231. data/vendor/bootstrap/scss/_media.scss +0 -8
  232. data/vendor/bootstrap/scss/_mixins.scss +0 -41
  233. data/vendor/bootstrap/scss/_modal.scss +0 -180
  234. data/vendor/bootstrap/scss/_nav.scss +0 -118
  235. data/vendor/bootstrap/scss/_navbar.scss +0 -299
  236. data/vendor/bootstrap/scss/_pagination.scss +0 -78
  237. data/vendor/bootstrap/scss/_popover.scss +0 -183
  238. data/vendor/bootstrap/scss/_print.scss +0 -141
  239. data/vendor/bootstrap/scss/_progress.scss +0 -34
  240. data/vendor/bootstrap/scss/_reboot.scss +0 -483
  241. data/vendor/bootstrap/scss/_root.scss +0 -19
  242. data/vendor/bootstrap/scss/_tables.scss +0 -187
  243. data/vendor/bootstrap/scss/_tooltip.scss +0 -115
  244. data/vendor/bootstrap/scss/_transitions.scss +0 -22
  245. data/vendor/bootstrap/scss/_type.scss +0 -125
  246. data/vendor/bootstrap/scss/_utilities.scss +0 -15
  247. data/vendor/bootstrap/scss/_variables.scss +0 -952
  248. data/vendor/bootstrap/scss/bootstrap-grid.scss +0 -32
  249. data/vendor/bootstrap/scss/bootstrap-reboot.scss +0 -12
  250. data/vendor/bootstrap/scss/bootstrap.scss +0 -42
  251. data/vendor/bootstrap/scss/mixins/_alert.scss +0 -13
  252. data/vendor/bootstrap/scss/mixins/_background-variant.scss +0 -21
  253. data/vendor/bootstrap/scss/mixins/_badge.scss +0 -12
  254. data/vendor/bootstrap/scss/mixins/_border-radius.scss +0 -35
  255. data/vendor/bootstrap/scss/mixins/_box-shadow.scss +0 -5
  256. data/vendor/bootstrap/scss/mixins/_breakpoints.scss +0 -123
  257. data/vendor/bootstrap/scss/mixins/_buttons.scss +0 -109
  258. data/vendor/bootstrap/scss/mixins/_caret.scss +0 -66
  259. data/vendor/bootstrap/scss/mixins/_clearfix.scss +0 -7
  260. data/vendor/bootstrap/scss/mixins/_float.scss +0 -11
  261. data/vendor/bootstrap/scss/mixins/_forms.scss +0 -147
  262. data/vendor/bootstrap/scss/mixins/_gradients.scss +0 -45
  263. data/vendor/bootstrap/scss/mixins/_grid-framework.scss +0 -67
  264. data/vendor/bootstrap/scss/mixins/_grid.scss +0 -52
  265. data/vendor/bootstrap/scss/mixins/_hover.scss +0 -37
  266. data/vendor/bootstrap/scss/mixins/_image.scss +0 -36
  267. data/vendor/bootstrap/scss/mixins/_list-group.scss +0 -21
  268. data/vendor/bootstrap/scss/mixins/_lists.scss +0 -7
  269. data/vendor/bootstrap/scss/mixins/_nav-divider.scss +0 -10
  270. data/vendor/bootstrap/scss/mixins/_pagination.scss +0 -22
  271. data/vendor/bootstrap/scss/mixins/_reset-text.scss +0 -17
  272. data/vendor/bootstrap/scss/mixins/_resize.scss +0 -6
  273. data/vendor/bootstrap/scss/mixins/_screen-reader.scss +0 -33
  274. data/vendor/bootstrap/scss/mixins/_size.scss +0 -6
  275. data/vendor/bootstrap/scss/mixins/_table-row.scss +0 -30
  276. data/vendor/bootstrap/scss/mixins/_text-emphasis.scss +0 -14
  277. data/vendor/bootstrap/scss/mixins/_text-hide.scss +0 -13
  278. data/vendor/bootstrap/scss/mixins/_text-truncate.scss +0 -8
  279. data/vendor/bootstrap/scss/mixins/_transition.scss +0 -13
  280. data/vendor/bootstrap/scss/mixins/_visibility.scss +0 -7
  281. data/vendor/bootstrap/scss/utilities/_align.scss +0 -8
  282. data/vendor/bootstrap/scss/utilities/_background.scss +0 -19
  283. data/vendor/bootstrap/scss/utilities/_borders.scss +0 -59
  284. data/vendor/bootstrap/scss/utilities/_clearfix.scss +0 -3
  285. data/vendor/bootstrap/scss/utilities/_display.scss +0 -38
  286. data/vendor/bootstrap/scss/utilities/_embed.scss +0 -52
  287. data/vendor/bootstrap/scss/utilities/_flex.scss +0 -51
  288. data/vendor/bootstrap/scss/utilities/_float.scss +0 -9
  289. data/vendor/bootstrap/scss/utilities/_position.scss +0 -37
  290. data/vendor/bootstrap/scss/utilities/_screenreaders.scss +0 -11
  291. data/vendor/bootstrap/scss/utilities/_shadows.scss +0 -6
  292. data/vendor/bootstrap/scss/utilities/_sizing.scss +0 -12
  293. data/vendor/bootstrap/scss/utilities/_spacing.scss +0 -51
  294. data/vendor/bootstrap/scss/utilities/_text.scss +0 -58
  295. data/vendor/bootstrap/scss/utilities/_visibility.scss +0 -11
  296. data/vendor/bootswatch/dist/cerulean/_bootswatch.scss +0 -99
  297. data/vendor/bootswatch/dist/cerulean/_variables.scss +0 -57
  298. data/vendor/bootswatch/dist/cosmo/_bootswatch.scss +0 -38
  299. data/vendor/bootswatch/dist/cosmo/_variables.scss +0 -68
  300. data/vendor/bootswatch/dist/cyborg/_bootswatch.scss +0 -230
  301. data/vendor/bootswatch/dist/cyborg/_variables.scss +0 -173
  302. data/vendor/bootswatch/dist/darkly/_bootswatch.scss +0 -186
  303. data/vendor/bootswatch/dist/darkly/_variables.scss +0 -178
  304. data/vendor/bootswatch/dist/flatly/_bootswatch.scss +0 -185
  305. data/vendor/bootswatch/dist/flatly/_variables.scss +0 -113
  306. data/vendor/bootswatch/dist/journal/_bootswatch.scss +0 -73
  307. data/vendor/bootswatch/dist/journal/_variables.scss +0 -60
  308. data/vendor/bootswatch/dist/litera/_bootswatch.scss +0 -212
  309. data/vendor/bootswatch/dist/litera/_variables.scss +0 -77
  310. data/vendor/bootswatch/dist/lumen/_bootswatch.scss +0 -429
  311. data/vendor/bootswatch/dist/lumen/_variables.scss +0 -82
  312. data/vendor/bootswatch/dist/lux/_bootswatch.scss +0 -157
  313. data/vendor/bootswatch/dist/lux/_variables.scss +0 -120
  314. data/vendor/bootswatch/dist/materia/_bootswatch.scss +0 -677
  315. data/vendor/bootswatch/dist/materia/_variables.scss +0 -131
  316. data/vendor/bootswatch/dist/minty/_bootswatch.scss +0 -258
  317. data/vendor/bootswatch/dist/minty/_variables.scss +0 -97
  318. data/vendor/bootswatch/dist/pulse/_bootswatch.scss +0 -154
  319. data/vendor/bootswatch/dist/pulse/_variables.scss +0 -100
  320. data/vendor/bootswatch/dist/sandstone/_bootswatch.scss +0 -235
  321. data/vendor/bootswatch/dist/sandstone/_variables.scss +0 -143
  322. data/vendor/bootswatch/dist/simplex/_bootswatch.scss +0 -130
  323. data/vendor/bootswatch/dist/simplex/_variables.scss +0 -108
  324. data/vendor/bootswatch/dist/sketchy/_bootswatch.scss +0 -411
  325. data/vendor/bootswatch/dist/sketchy/_variables.scss +0 -164
  326. data/vendor/bootswatch/dist/slate/_bootswatch.scss +0 -425
  327. data/vendor/bootswatch/dist/slate/_variables.scss +0 -160
  328. data/vendor/bootswatch/dist/solar/_bootswatch.scss +0 -119
  329. data/vendor/bootswatch/dist/solar/_variables.scss +0 -175
  330. data/vendor/bootswatch/dist/spacelab/_bootswatch.scss +0 -167
  331. data/vendor/bootswatch/dist/spacelab/_variables.scss +0 -63
  332. data/vendor/bootswatch/dist/superhero/_bootswatch.scss +0 -200
  333. data/vendor/bootswatch/dist/superhero/_variables.scss +0 -148
  334. data/vendor/bootswatch/dist/united/_bootswatch.scss +0 -26
  335. data/vendor/bootswatch/dist/united/_variables.scss +0 -53
  336. data/vendor/bootswatch/dist/yeti/_bootswatch.scss +0 -468
  337. data/vendor/bootswatch/dist/yeti/_variables.scss +0 -110
  338. data/vendor/bootswatch/package.json +0 -38
  339. data/vendor/chartkick/chartkick.js +0 -1872
  340. data/vendor/file-saver/FileSaver.js +0 -188
  341. data/vendor/popper.js/dist/umd/popper-utils.js +0 -1133
  342. data/vendor/popper.js/dist/umd/popper.js +0 -2540
  343. data/vendor/popper.js/package.json +0 -54
  344. data/vendor/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.js +0 -2779
  345. data/vendor/tempusdominus-bootstrap-4/package.json +0 -79
  346. data/vendor/tempusdominus-bootstrap-4/src/sass/_tempusdominus-bootstrap-4.scss +0 -342
  347. data/vendor/tempusdominus-bootstrap-4/src/sass/tempusdominus-bootstrap-4-build.scss +0 -12
@@ -0,0 +1,2239 @@
1
+ /*
2
+ * Chartkick.js
3
+ * Create beautiful charts with one line of JavaScript
4
+ * https://github.com/ankane/chartkick.js
5
+ * v3.0.1
6
+ * MIT License
7
+ */
8
+
9
+ (function (global, factory) {
10
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
11
+ typeof define === 'function' && define.amd ? define(factory) :
12
+ (global.Chartkick = factory());
13
+ }(this, (function () { 'use strict';
14
+
15
+ function isArray(variable) {
16
+ return Object.prototype.toString.call(variable) === "[object Array]";
17
+ }
18
+
19
+ function isFunction(variable) {
20
+ return variable instanceof Function;
21
+ }
22
+
23
+ function isPlainObject(variable) {
24
+ return !isFunction(variable) && variable instanceof Object;
25
+ }
26
+
27
+ // https://github.com/madrobby/zepto/blob/master/src/zepto.js
28
+ function extend(target, source) {
29
+ var key;
30
+ for (key in source) {
31
+ if (isPlainObject(source[key]) || isArray(source[key])) {
32
+ if (isPlainObject(source[key]) && !isPlainObject(target[key])) {
33
+ target[key] = {};
34
+ }
35
+ if (isArray(source[key]) && !isArray(target[key])) {
36
+ target[key] = [];
37
+ }
38
+ extend(target[key], source[key]);
39
+ } else if (source[key] !== undefined) {
40
+ target[key] = source[key];
41
+ }
42
+ }
43
+ }
44
+
45
+ function merge(obj1, obj2) {
46
+ var target = {};
47
+ extend(target, obj1);
48
+ extend(target, obj2);
49
+ return target;
50
+ }
51
+
52
+ var DATE_PATTERN = /^(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)$/i;
53
+
54
+ // https://github.com/Do/iso8601.js
55
+ var ISO8601_PATTERN = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)?(:)?(\d\d)?([.,]\d+)?($|Z|([+-])(\d\d)(:)?(\d\d)?)/i;
56
+ var DECIMAL_SEPARATOR = String(1.5).charAt(1);
57
+
58
+ function parseISO8601(input) {
59
+ var day, hour, matches, milliseconds, minutes, month, offset, result, seconds, type, year;
60
+ type = Object.prototype.toString.call(input);
61
+ if (type === "[object Date]") {
62
+ return input;
63
+ }
64
+ if (type !== "[object String]") {
65
+ return;
66
+ }
67
+ matches = input.match(ISO8601_PATTERN);
68
+ if (matches) {
69
+ year = parseInt(matches[1], 10);
70
+ month = parseInt(matches[3], 10) - 1;
71
+ day = parseInt(matches[5], 10);
72
+ hour = parseInt(matches[7], 10);
73
+ minutes = matches[9] ? parseInt(matches[9], 10) : 0;
74
+ seconds = matches[11] ? parseInt(matches[11], 10) : 0;
75
+ milliseconds = matches[12] ? parseFloat(DECIMAL_SEPARATOR + matches[12].slice(1)) * 1000 : 0;
76
+ result = Date.UTC(year, month, day, hour, minutes, seconds, milliseconds);
77
+ if (matches[13] && matches[14]) {
78
+ offset = matches[15] * 60;
79
+ if (matches[17]) {
80
+ offset += parseInt(matches[17], 10);
81
+ }
82
+ offset *= matches[14] === "-" ? -1 : 1;
83
+ result -= offset * 60 * 1000;
84
+ }
85
+ return new Date(result);
86
+ }
87
+ }
88
+ // end iso8601.js
89
+
90
+ function negativeValues(series) {
91
+ var i, j, data;
92
+ for (i = 0; i < series.length; i++) {
93
+ data = series[i].data;
94
+ for (j = 0; j < data.length; j++) {
95
+ if (data[j][1] < 0) {
96
+ return true;
97
+ }
98
+ }
99
+ }
100
+ return false;
101
+ }
102
+
103
+ function toStr(n) {
104
+ return "" + n;
105
+ }
106
+
107
+ function toFloat(n) {
108
+ return parseFloat(n);
109
+ }
110
+
111
+ function toDate(n) {
112
+ var matches, year, month, day;
113
+ if (typeof n !== "object") {
114
+ if (typeof n === "number") {
115
+ n = new Date(n * 1000); // ms
116
+ } else {
117
+ n = toStr(n);
118
+ if ((matches = n.match(DATE_PATTERN))) {
119
+ year = parseInt(matches[1], 10);
120
+ month = parseInt(matches[3], 10) - 1;
121
+ day = parseInt(matches[5], 10);
122
+ return new Date(year, month, day);
123
+ } else { // str
124
+ // try our best to get the str into iso8601
125
+ // TODO be smarter about this
126
+ var str = n.replace(/ /, "T").replace(" ", "").replace("UTC", "Z");
127
+ n = parseISO8601(str) || new Date(n);
128
+ }
129
+ }
130
+ }
131
+ return n;
132
+ }
133
+
134
+ function toArr(n) {
135
+ if (!isArray(n)) {
136
+ var arr = [], i;
137
+ for (i in n) {
138
+ if (n.hasOwnProperty(i)) {
139
+ arr.push([i, n[i]]);
140
+ }
141
+ }
142
+ n = arr;
143
+ }
144
+ return n;
145
+ }
146
+
147
+ function jsOptionsFunc(defaultOptions, hideLegend, setTitle, setMin, setMax, setStacked, setXtitle, setYtitle) {
148
+ return function (chart, opts, chartOptions) {
149
+ var series = chart.data;
150
+ var options = merge({}, defaultOptions);
151
+ options = merge(options, chartOptions || {});
152
+
153
+ if (chart.hideLegend || "legend" in opts) {
154
+ hideLegend(options, opts.legend, chart.hideLegend);
155
+ }
156
+
157
+ if (opts.title) {
158
+ setTitle(options, opts.title);
159
+ }
160
+
161
+ // min
162
+ if ("min" in opts) {
163
+ setMin(options, opts.min);
164
+ } else if (!negativeValues(series)) {
165
+ setMin(options, 0);
166
+ }
167
+
168
+ // max
169
+ if (opts.max) {
170
+ setMax(options, opts.max);
171
+ }
172
+
173
+ if ("stacked" in opts) {
174
+ setStacked(options, opts.stacked);
175
+ }
176
+
177
+ if (opts.colors) {
178
+ options.colors = opts.colors;
179
+ }
180
+
181
+ if (opts.xtitle) {
182
+ setXtitle(options, opts.xtitle);
183
+ }
184
+
185
+ if (opts.ytitle) {
186
+ setYtitle(options, opts.ytitle);
187
+ }
188
+
189
+ // merge library last
190
+ options = merge(options, opts.library || {});
191
+
192
+ return options;
193
+ };
194
+ }
195
+
196
+ function sortByTime(a, b) {
197
+ return a[0].getTime() - b[0].getTime();
198
+ }
199
+
200
+ function sortByNumberSeries(a, b) {
201
+ return a[0] - b[0];
202
+ }
203
+
204
+ function sortByNumber(a, b) {
205
+ return a - b;
206
+ }
207
+
208
+ function isMinute(d) {
209
+ return d.getMilliseconds() === 0 && d.getSeconds() === 0;
210
+ }
211
+
212
+ function isHour(d) {
213
+ return isMinute(d) && d.getMinutes() === 0;
214
+ }
215
+
216
+ function isDay(d) {
217
+ return isHour(d) && d.getHours() === 0;
218
+ }
219
+
220
+ function isWeek(d, dayOfWeek) {
221
+ return isDay(d) && d.getDay() === dayOfWeek;
222
+ }
223
+
224
+ function isMonth(d) {
225
+ return isDay(d) && d.getDate() === 1;
226
+ }
227
+
228
+ function isYear(d) {
229
+ return isMonth(d) && d.getMonth() === 0;
230
+ }
231
+
232
+ function isDate(obj) {
233
+ return !isNaN(toDate(obj)) && toStr(obj).length >= 6;
234
+ }
235
+
236
+ function isNumber(obj) {
237
+ return typeof obj === "number";
238
+ }
239
+
240
+ function formatValue(pre, value, options) {
241
+ pre = pre || "";
242
+ if (options.prefix) {
243
+ if (value < 0) {
244
+ value = value * -1;
245
+ pre += "-";
246
+ }
247
+ pre += options.prefix;
248
+ }
249
+
250
+ if (options.thousands || options.decimal) {
251
+ value = toStr(value);
252
+ var parts = value.split(".");
253
+ value = parts[0];
254
+ if (options.thousands) {
255
+ value = value.replace(/\B(?=(\d{3})+(?!\d))/g, options.thousands);
256
+ }
257
+ if (parts.length > 1) {
258
+ value += (options.decimal || ".") + parts[1];
259
+ }
260
+ }
261
+
262
+ return pre + value + (options.suffix || "");
263
+ }
264
+
265
+ function allZeros(data) {
266
+ var i, j, d;
267
+ for (i = 0; i < data.length; i++) {
268
+ d = data[i].data;
269
+ for (j = 0; j < d.length; j++) {
270
+ if (d[j][1] != 0) {
271
+ return false;
272
+ }
273
+ }
274
+ }
275
+ return true;
276
+ }
277
+
278
+ var baseOptions = {
279
+ maintainAspectRatio: false,
280
+ animation: false,
281
+ tooltips: {
282
+ displayColors: false,
283
+ callbacks: {}
284
+ },
285
+ legend: {},
286
+ title: {fontSize: 20, fontColor: "#333"}
287
+ };
288
+
289
+ var defaultOptions = {
290
+ scales: {
291
+ yAxes: [
292
+ {
293
+ ticks: {
294
+ maxTicksLimit: 4
295
+ },
296
+ scaleLabel: {
297
+ fontSize: 16,
298
+ // fontStyle: "bold",
299
+ fontColor: "#333"
300
+ }
301
+ }
302
+ ],
303
+ xAxes: [
304
+ {
305
+ gridLines: {
306
+ drawOnChartArea: false
307
+ },
308
+ scaleLabel: {
309
+ fontSize: 16,
310
+ // fontStyle: "bold",
311
+ fontColor: "#333"
312
+ },
313
+ time: {},
314
+ ticks: {}
315
+ }
316
+ ]
317
+ }
318
+ };
319
+
320
+ // http://there4.io/2012/05/02/google-chart-color-list/
321
+ var defaultColors = [
322
+ "#3366CC", "#DC3912", "#FF9900", "#109618", "#990099", "#3B3EAC", "#0099C6",
323
+ "#DD4477", "#66AA00", "#B82E2E", "#316395", "#994499", "#22AA99", "#AAAA11",
324
+ "#6633CC", "#E67300", "#8B0707", "#329262", "#5574A6", "#651067"
325
+ ];
326
+
327
+ var hideLegend = function (options, legend, hideLegend) {
328
+ if (legend !== undefined) {
329
+ options.legend.display = !!legend;
330
+ if (legend && legend !== true) {
331
+ options.legend.position = legend;
332
+ }
333
+ } else if (hideLegend) {
334
+ options.legend.display = false;
335
+ }
336
+ };
337
+
338
+ var setTitle = function (options, title) {
339
+ options.title.display = true;
340
+ options.title.text = title;
341
+ };
342
+
343
+ var setMin = function (options, min) {
344
+ if (min !== null) {
345
+ options.scales.yAxes[0].ticks.min = toFloat(min);
346
+ }
347
+ };
348
+
349
+ var setMax = function (options, max) {
350
+ options.scales.yAxes[0].ticks.max = toFloat(max);
351
+ };
352
+
353
+ var setBarMin = function (options, min) {
354
+ if (min !== null) {
355
+ options.scales.xAxes[0].ticks.min = toFloat(min);
356
+ }
357
+ };
358
+
359
+ var setBarMax = function (options, max) {
360
+ options.scales.xAxes[0].ticks.max = toFloat(max);
361
+ };
362
+
363
+ var setStacked = function (options, stacked) {
364
+ options.scales.xAxes[0].stacked = !!stacked;
365
+ options.scales.yAxes[0].stacked = !!stacked;
366
+ };
367
+
368
+ var setXtitle = function (options, title) {
369
+ options.scales.xAxes[0].scaleLabel.display = true;
370
+ options.scales.xAxes[0].scaleLabel.labelString = title;
371
+ };
372
+
373
+ var setYtitle = function (options, title) {
374
+ options.scales.yAxes[0].scaleLabel.display = true;
375
+ options.scales.yAxes[0].scaleLabel.labelString = title;
376
+ };
377
+
378
+ // https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
379
+ var addOpacity = function(hex, opacity) {
380
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
381
+ return result ? "rgba(" + parseInt(result[1], 16) + ", " + parseInt(result[2], 16) + ", " + parseInt(result[3], 16) + ", " + opacity + ")" : hex;
382
+ };
383
+
384
+ var setLabelSize = function (chart, data, options) {
385
+ var maxLabelSize = Math.ceil(chart.element.offsetWidth / 4.0 / data.labels.length);
386
+ if (maxLabelSize > 25) {
387
+ maxLabelSize = 25;
388
+ } else if (maxLabelSize < 10) {
389
+ maxLabelSize = 10;
390
+ }
391
+ if (!options.scales.xAxes[0].ticks.callback) {
392
+ options.scales.xAxes[0].ticks.callback = function (value) {
393
+ value = toStr(value);
394
+ if (value.length > maxLabelSize) {
395
+ return value.substring(0, maxLabelSize - 2) + "...";
396
+ } else {
397
+ return value;
398
+ }
399
+ };
400
+ }
401
+ };
402
+
403
+ var setFormatOptions = function(chart, options, chartType) {
404
+ var formatOptions = {
405
+ prefix: chart.options.prefix,
406
+ suffix: chart.options.suffix,
407
+ thousands: chart.options.thousands,
408
+ decimal: chart.options.decimal
409
+ };
410
+
411
+ //TODO
412
+ // // PATCH_BEGIN
413
+ // if (chart.options.y2 === true) {
414
+ // dataset.yAxisID = (s.y2 === true) ? 'y-axis-right' : 'y-axis-left';
415
+ // options.scales.yAxes = [
416
+ // { id: 'y-axis-left', position: 'left' },
417
+ // { id: 'y-axis-right', position: 'right' }
418
+ // ];
419
+ // }
420
+ // // PATCH_END
421
+
422
+ if (chartType !== "pie") {
423
+ var myAxes = options.scales.yAxes;
424
+ if (chartType === "bar") {
425
+ myAxes = options.scales.xAxes;
426
+ }
427
+
428
+ if (!myAxes[0].ticks.callback) {
429
+ myAxes[0].ticks.callback = function (value) {
430
+ return formatValue("", value, formatOptions);
431
+ };
432
+ }
433
+ }
434
+
435
+ if (!options.tooltips.callbacks.label) {
436
+ if (chartType === "scatter") {
437
+ options.tooltips.callbacks.label = function (item, data) {
438
+ var label = data.datasets[item.datasetIndex].label || '';
439
+ if (label) {
440
+ label += ': ';
441
+ }
442
+ return label + '(' + item.xLabel + ', ' + item.yLabel + ')';
443
+ };
444
+ } else if (chartType === "bubble") {
445
+ options.tooltips.callbacks.label = function (item, data) {
446
+ var label = data.datasets[item.datasetIndex].label || '';
447
+ if (label) {
448
+ label += ': ';
449
+ }
450
+ var dataPoint = data.datasets[item.datasetIndex].data[item.index];
451
+ return label + '(' + item.xLabel + ', ' + item.yLabel + ', ' + dataPoint.v + ')';
452
+ };
453
+ } else if (chartType === "pie") {
454
+ // need to use separate label for pie charts
455
+ options.tooltips.callbacks.label = function (tooltipItem, data) {
456
+ var dataLabel = data.labels[tooltipItem.index];
457
+ var value = ': ';
458
+
459
+ if (isArray(dataLabel)) {
460
+ // show value on first line of multiline label
461
+ // need to clone because we are changing the value
462
+ dataLabel = dataLabel.slice();
463
+ dataLabel[0] += value;
464
+ } else {
465
+ dataLabel += value;
466
+ }
467
+
468
+ return formatValue(dataLabel, data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index], formatOptions);
469
+ };
470
+ } else {
471
+ var valueLabel = chartType === "bar" ? "xLabel" : "yLabel";
472
+ options.tooltips.callbacks.label = function (tooltipItem, data) {
473
+ var label = data.datasets[tooltipItem.datasetIndex].label || '';
474
+ if (label) {
475
+ label += ': ';
476
+ }
477
+ return formatValue(label, tooltipItem[valueLabel], formatOptions);
478
+ };
479
+ }
480
+ }
481
+ };
482
+
483
+ var jsOptions = jsOptionsFunc(merge(baseOptions, defaultOptions), hideLegend, setTitle, setMin, setMax, setStacked, setXtitle, setYtitle);
484
+
485
+ var createDataTable = function (chart, options, chartType) {
486
+ var datasets = [];
487
+ var labels = [];
488
+
489
+ var colors = chart.options.colors || defaultColors;
490
+
491
+ var day = true;
492
+ var week = true;
493
+ var dayOfWeek;
494
+ var month = true;
495
+ var year = true;
496
+ var hour = true;
497
+ var minute = true;
498
+
499
+ var series = chart.data;
500
+
501
+ var max = 0;
502
+ if (chartType === "bubble") {
503
+ for (var i$1 = 0; i$1 < series.length; i$1++) {
504
+ var s$1 = series[i$1];
505
+ for (var j$1 = 0; j$1 < s$1.data.length; j$1++) {
506
+ if (s$1.data[j$1][2] > max) {
507
+ max = s$1.data[j$1][2];
508
+ }
509
+ }
510
+ }
511
+ }
512
+
513
+ var i, j, s, d, key, rows = [], rows2 = [];
514
+
515
+ if (chartType === "bar" || chartType === "column" || (chart.xtype !== "number" && chart.xtype !== "bubble")) {
516
+ var sortedLabels = [];
517
+
518
+ for (i = 0; i < series.length; i++) {
519
+ s = series[i];
520
+
521
+ for (j = 0; j < s.data.length; j++) {
522
+ d = s.data[j];
523
+ key = chart.xtype == "datetime" ? d[0].getTime() : d[0];
524
+ if (!rows[key]) {
525
+ rows[key] = new Array(series.length);
526
+ }
527
+ rows[key][i] = toFloat(d[1]);
528
+ if (sortedLabels.indexOf(key) === -1) {
529
+ sortedLabels.push(key);
530
+ }
531
+ }
532
+ }
533
+
534
+ if (chart.xtype === "datetime" || chart.xtype === "number") {
535
+ sortedLabels.sort(sortByNumber);
536
+ }
537
+
538
+ for (j = 0; j < series.length; j++) {
539
+ rows2.push([]);
540
+ }
541
+
542
+ var value;
543
+ var k;
544
+ for (k = 0; k < sortedLabels.length; k++) {
545
+ i = sortedLabels[k];
546
+ if (chart.xtype === "datetime") {
547
+ value = new Date(toFloat(i));
548
+ // TODO make this efficient
549
+ day = day && isDay(value);
550
+ if (!dayOfWeek) {
551
+ dayOfWeek = value.getDay();
552
+ }
553
+ week = week && isWeek(value, dayOfWeek);
554
+ month = month && isMonth(value);
555
+ year = year && isYear(value);
556
+ hour = hour && isHour(value);
557
+ minute = minute && isMinute(value);
558
+ } else {
559
+ value = i;
560
+ }
561
+ labels.push(value);
562
+ for (j = 0; j < series.length; j++) {
563
+ // Chart.js doesn't like undefined
564
+ rows2[j].push(rows[i][j] === undefined ? null : rows[i][j]);
565
+ }
566
+ }
567
+ } else {
568
+ for (var i$2 = 0; i$2 < series.length; i$2++) {
569
+ var s$2 = series[i$2];
570
+ var d$1 = [];
571
+ for (var j$2 = 0; j$2 < s$2.data.length; j$2++) {
572
+ var point = {
573
+ x: toFloat(s$2.data[j$2][0]),
574
+ y: toFloat(s$2.data[j$2][1])
575
+ };
576
+ if (chartType === "bubble") {
577
+ point.r = toFloat(s$2.data[j$2][2]) * 20 / max;
578
+ // custom attribute, for tooltip
579
+ point.v = s$2.data[j$2][2];
580
+ }
581
+ d$1.push(point);
582
+ }
583
+ rows2.push(d$1);
584
+ }
585
+ }
586
+
587
+ for (i = 0; i < series.length; i++) {
588
+ s = series[i];
589
+
590
+ var color = s.color || colors[i];
591
+ var backgroundColor = chartType !== "line" ? addOpacity(color, 0.5) : color;
592
+
593
+ var dataset = {
594
+ label: s.name || "",
595
+ data: rows2[i],
596
+ fill: chartType === "area",
597
+ borderColor: color,
598
+ backgroundColor: backgroundColor,
599
+ pointBackgroundColor: color,
600
+ borderWidth: 2,
601
+ pointHoverBackgroundColor: color
602
+ };
603
+
604
+ if (s.stack) {
605
+ dataset.stack = s.stack;
606
+ }
607
+
608
+ if (chart.options.curve === false) {
609
+ dataset.lineTension = 0;
610
+ }
611
+
612
+ if (chart.options.points === false) {
613
+ dataset.pointRadius = 0;
614
+ dataset.pointHitRadius = 5;
615
+ }
616
+
617
+ dataset = merge(dataset, chart.options.dataset || {});
618
+ dataset = merge(dataset, s.library || {});
619
+ dataset = merge(dataset, s.dataset || {});
620
+
621
+ datasets.push(dataset);
622
+ }
623
+
624
+ if (chart.xtype === "datetime" && labels.length > 0) {
625
+ var minTime = labels[0].getTime();
626
+ var maxTime = labels[0].getTime();
627
+ for (i = 1; i < labels.length; i++) {
628
+ var value$1 = labels[i].getTime();
629
+ if (value$1 < minTime) {
630
+ minTime = value$1;
631
+ }
632
+ if (value$1 > maxTime) {
633
+ maxTime = value$1;
634
+ }
635
+ }
636
+
637
+ var timeDiff = (maxTime - minTime) / (86400 * 1000.0);
638
+
639
+ if (!options.scales.xAxes[0].time.unit) {
640
+ var step;
641
+ if (year || timeDiff > 365 * 10) {
642
+ options.scales.xAxes[0].time.unit = "year";
643
+ step = 365;
644
+ } else if (month || timeDiff > 30 * 10) {
645
+ options.scales.xAxes[0].time.unit = "month";
646
+ step = 30;
647
+ } else if (day || timeDiff > 10) {
648
+ options.scales.xAxes[0].time.unit = "day";
649
+ step = 1;
650
+ } else if (hour || timeDiff > 0.5) {
651
+ options.scales.xAxes[0].time.displayFormats = {hour: "MMM D, h a"};
652
+ options.scales.xAxes[0].time.unit = "hour";
653
+ step = 1 / 24.0;
654
+ } else if (minute) {
655
+ options.scales.xAxes[0].time.displayFormats = {minute: "h:mm a"};
656
+ options.scales.xAxes[0].time.unit = "minute";
657
+ step = 1 / 24.0 / 60.0;
658
+ }
659
+
660
+ if (step && timeDiff > 0) {
661
+ var unitStepSize = Math.ceil(timeDiff / step / (chart.element.offsetWidth / 100.0));
662
+ if (week && step === 1) {
663
+ unitStepSize = Math.ceil(unitStepSize / 7.0) * 7;
664
+ }
665
+ options.scales.xAxes[0].time.unitStepSize = unitStepSize;
666
+ }
667
+ }
668
+
669
+ if (!options.scales.xAxes[0].time.tooltipFormat) {
670
+ if (day) {
671
+ options.scales.xAxes[0].time.tooltipFormat = "ll";
672
+ } else if (hour) {
673
+ options.scales.xAxes[0].time.tooltipFormat = "MMM D, h a";
674
+ } else if (minute) {
675
+ options.scales.xAxes[0].time.tooltipFormat = "h:mm a";
676
+ }
677
+ }
678
+ }
679
+
680
+ var data = {
681
+ labels: labels,
682
+ datasets: datasets
683
+ };
684
+
685
+ return data;
686
+ };
687
+
688
+ var defaultExport = function defaultExport(library) {
689
+ this.name = "chartjs";
690
+ this.library = library;
691
+ };
692
+
693
+ defaultExport.prototype.renderLineChart = function renderLineChart (chart, chartType) {
694
+ var chartOptions = {};
695
+ // fix for https://github.com/chartjs/Chart.js/issues/2441
696
+ if (!chart.options.max && allZeros(chart.data)) {
697
+ chartOptions.max = 1;
698
+ }
699
+
700
+ var options = jsOptions(chart, merge(chartOptions, chart.options));
701
+ setFormatOptions(chart, options, chartType);
702
+
703
+ var data = createDataTable(chart, options, chartType || "line");
704
+
705
+ if (chart.xtype === "number") {
706
+ options.scales.xAxes[0].type = "linear";
707
+ options.scales.xAxes[0].position = "bottom";
708
+ } else {
709
+ options.scales.xAxes[0].type = chart.xtype === "string" ? "category" : "time";
710
+ }
711
+
712
+ this.drawChart(chart, "line", data, options);
713
+ };
714
+
715
+ defaultExport.prototype.renderPieChart = function renderPieChart (chart) {
716
+ var options = merge({}, baseOptions);
717
+ if (chart.options.donut) {
718
+ options.cutoutPercentage = 50;
719
+ }
720
+
721
+ if ("legend" in chart.options) {
722
+ hideLegend(options, chart.options.legend);
723
+ }
724
+
725
+ if (chart.options.title) {
726
+ setTitle(options, chart.options.title);
727
+ }
728
+
729
+ options = merge(options, chart.options.library || {});
730
+ setFormatOptions(chart, options, "pie");
731
+
732
+ var labels = [];
733
+ var values = [];
734
+ for (var i = 0; i < chart.data.length; i++) {
735
+ var point = chart.data[i];
736
+ labels.push(point[0]);
737
+ values.push(point[1]);
738
+ }
739
+
740
+ var dataset = {
741
+ data: values,
742
+ backgroundColor: chart.options.colors || defaultColors
743
+ };
744
+ dataset = merge(dataset, chart.options.dataset || {});
745
+
746
+ var data = {
747
+ labels: labels,
748
+ datasets: [dataset]
749
+ };
750
+
751
+ this.drawChart(chart, "pie", data, options);
752
+ };
753
+
754
+ defaultExport.prototype.renderColumnChart = function renderColumnChart (chart, chartType) {
755
+ var options;
756
+ if (chartType === "bar") {
757
+ options = jsOptionsFunc(merge(baseOptions, defaultOptions), hideLegend, setTitle, setBarMin, setBarMax, setStacked, setXtitle, setYtitle)(chart, chart.options);
758
+ } else {
759
+ options = jsOptions(chart, chart.options);
760
+ }
761
+ setFormatOptions(chart, options, chartType);
762
+ var data = createDataTable(chart, options, "column");
763
+ if (chartType !== "bar") {
764
+ setLabelSize(chart, data, options);
765
+ }
766
+ this.drawChart(chart, (chartType === "bar" ? "horizontalBar" : "bar"), data, options);
767
+ };
768
+
769
+ defaultExport.prototype.renderAreaChart = function renderAreaChart (chart) {
770
+ this.renderLineChart(chart, "area");
771
+ };
772
+
773
+ defaultExport.prototype.renderBarChart = function renderBarChart (chart) {
774
+ this.renderColumnChart(chart, "bar");
775
+ };
776
+
777
+ defaultExport.prototype.renderScatterChart = function renderScatterChart (chart, chartType) {
778
+ chartType = chartType || "scatter";
779
+
780
+ var options = jsOptions(chart, chart.options);
781
+ setFormatOptions(chart, options, chartType);
782
+
783
+ if (!("showLines" in options)) {
784
+ options.showLines = false;
785
+ }
786
+
787
+ var data = createDataTable(chart, options, chartType);
788
+
789
+ options.scales.xAxes[0].type = "linear";
790
+ options.scales.xAxes[0].position = "bottom";
791
+
792
+ this.drawChart(chart, chartType, data, options);
793
+ };
794
+
795
+ defaultExport.prototype.renderBubbleChart = function renderBubbleChart (chart) {
796
+ this.renderScatterChart(chart, "bubble");
797
+ };
798
+
799
+ defaultExport.prototype.destroy = function destroy (chart) {
800
+ if (chart.chart) {
801
+ chart.chart.destroy();
802
+ }
803
+ };
804
+
805
+ defaultExport.prototype.drawChart = function drawChart (chart, type, data, options) {
806
+ this.destroy(chart);
807
+
808
+ var chartOptions = {
809
+ type: type,
810
+ data: data,
811
+ options: options
812
+ };
813
+
814
+ if (chart.options.code) {
815
+ window.console.log("new Chart(ctx, " + JSON.stringify(chartOptions) + ");");
816
+ }
817
+
818
+ chart.element.innerHTML = "<canvas></canvas>";
819
+ var ctx = chart.element.getElementsByTagName("CANVAS")[0];
820
+ chart.chart = new this.library(ctx, chartOptions);
821
+ };
822
+
823
+ var defaultOptions$1 = {
824
+ chart: {},
825
+ xAxis: {
826
+ title: {
827
+ text: null
828
+ },
829
+ labels: {
830
+ style: {
831
+ fontSize: "12px"
832
+ }
833
+ }
834
+ },
835
+ yAxis: {
836
+ title: {
837
+ text: null
838
+ },
839
+ labels: {
840
+ style: {
841
+ fontSize: "12px"
842
+ }
843
+ }
844
+ },
845
+ title: {
846
+ text: null
847
+ },
848
+ credits: {
849
+ enabled: false
850
+ },
851
+ legend: {
852
+ borderWidth: 0
853
+ },
854
+ tooltip: {
855
+ style: {
856
+ fontSize: "12px"
857
+ }
858
+ },
859
+ plotOptions: {
860
+ areaspline: {},
861
+ series: {
862
+ marker: {}
863
+ }
864
+ }
865
+ };
866
+
867
+ var hideLegend$1 = function (options, legend, hideLegend) {
868
+ if (legend !== undefined) {
869
+ options.legend.enabled = !!legend;
870
+ if (legend && legend !== true) {
871
+ if (legend === "top" || legend === "bottom") {
872
+ options.legend.verticalAlign = legend;
873
+ } else {
874
+ options.legend.layout = "vertical";
875
+ options.legend.verticalAlign = "middle";
876
+ options.legend.align = legend;
877
+ }
878
+ }
879
+ } else if (hideLegend) {
880
+ options.legend.enabled = false;
881
+ }
882
+ };
883
+
884
+ var setTitle$1 = function (options, title) {
885
+ options.title.text = title;
886
+ };
887
+
888
+ var setMin$1 = function (options, min) {
889
+ options.yAxis.min = min;
890
+ };
891
+
892
+ var setMax$1 = function (options, max) {
893
+ options.yAxis.max = max;
894
+ };
895
+
896
+ var setStacked$1 = function (options, stacked) {
897
+ options.plotOptions.series.stacking = stacked ? (stacked === true ? "normal" : stacked) : null;
898
+ };
899
+
900
+ var setXtitle$1 = function (options, title) {
901
+ options.xAxis.title.text = title;
902
+ };
903
+
904
+ var setYtitle$1 = function (options, title) {
905
+ options.yAxis.title.text = title;
906
+ };
907
+
908
+ var jsOptions$1 = jsOptionsFunc(defaultOptions$1, hideLegend$1, setTitle$1, setMin$1, setMax$1, setStacked$1, setXtitle$1, setYtitle$1);
909
+
910
+ var setFormatOptions$1 = function(chart, options, chartType) {
911
+ var formatOptions = {
912
+ prefix: chart.options.prefix,
913
+ suffix: chart.options.suffix,
914
+ thousands: chart.options.thousands,
915
+ decimal: chart.options.decimal
916
+ };
917
+
918
+ if (chartType !== "pie" && !options.yAxis.labels.formatter) {
919
+ options.yAxis.labels.formatter = function () {
920
+ return formatValue("", this.value, formatOptions);
921
+ };
922
+ }
923
+
924
+ if (!options.tooltip.pointFormatter) {
925
+ options.tooltip.pointFormatter = function () {
926
+ return '<span style="color:' + this.color + '>\u25CF</span> ' + formatValue(this.series.name + ': <b>', this.y, formatOptions) + '</b><br/>';
927
+ };
928
+ }
929
+ };
930
+
931
+ var defaultExport$1 = function defaultExport(library) {
932
+ this.name = "highcharts";
933
+ this.library = library;
934
+ };
935
+
936
+ defaultExport$1.prototype.renderLineChart = function renderLineChart (chart, chartType) {
937
+ chartType = chartType || "spline";
938
+ var chartOptions = {};
939
+ if (chartType === "areaspline") {
940
+ chartOptions = {
941
+ plotOptions: {
942
+ areaspline: {
943
+ stacking: "normal"
944
+ },
945
+ area: {
946
+ stacking: "normal"
947
+ },
948
+ series: {
949
+ marker: {
950
+ enabled: false
951
+ }
952
+ }
953
+ }
954
+ };
955
+ }
956
+
957
+ if (chart.options.curve === false) {
958
+ if (chartType === "areaspline") {
959
+ chartType = "area";
960
+ } else if (chartType === "spline") {
961
+ chartType = "line";
962
+ }
963
+ }
964
+
965
+ var options = jsOptions$1(chart, chart.options, chartOptions), data, i, j;
966
+ options.xAxis.type = chart.xtype === "string" ? "category" : (chart.xtype === "number" ? "linear" : "datetime");
967
+ if (!options.chart.type) {
968
+ options.chart.type = chartType;
969
+ }
970
+ setFormatOptions$1(chart, options, chartType);
971
+
972
+ var series = chart.data;
973
+ for (i = 0; i < series.length; i++) {
974
+ series[i].name = series[i].name || "Value";
975
+ data = series[i].data;
976
+ if (chart.xtype === "datetime") {
977
+ for (j = 0; j < data.length; j++) {
978
+ data[j][0] = data[j][0].getTime();
979
+ }
980
+ }
981
+ series[i].marker = {symbol: "circle"};
982
+ if (chart.options.points === false) {
983
+ series[i].marker.enabled = false;
984
+ }
985
+ }
986
+
987
+ this.drawChart(chart, series, options);
988
+ };
989
+
990
+ defaultExport$1.prototype.renderScatterChart = function renderScatterChart (chart) {
991
+ var options = jsOptions$1(chart, chart.options, {});
992
+ options.chart.type = "scatter";
993
+ this.drawChart(chart, chart.data, options);
994
+ };
995
+
996
+ defaultExport$1.prototype.renderPieChart = function renderPieChart (chart) {
997
+ var chartOptions = merge(defaultOptions$1, {});
998
+
999
+ if (chart.options.colors) {
1000
+ chartOptions.colors = chart.options.colors;
1001
+ }
1002
+ if (chart.options.donut) {
1003
+ chartOptions.plotOptions = {pie: {innerSize: "50%"}};
1004
+ }
1005
+
1006
+ if ("legend" in chart.options) {
1007
+ hideLegend$1(chartOptions, chart.options.legend);
1008
+ }
1009
+
1010
+ if (chart.options.title) {
1011
+ setTitle$1(chartOptions, chart.options.title);
1012
+ }
1013
+
1014
+ var options = merge(chartOptions, chart.options.library || {});
1015
+ setFormatOptions$1(chart, options, "pie");
1016
+ var series = [{
1017
+ type: "pie",
1018
+ name: chart.options.label || "Value",
1019
+ data: chart.data
1020
+ }];
1021
+
1022
+ this.drawChart(chart, series, options);
1023
+ };
1024
+
1025
+ defaultExport$1.prototype.renderColumnChart = function renderColumnChart (chart, chartType) {
1026
+ chartType = chartType || "column";
1027
+ var series = chart.data;
1028
+ var options = jsOptions$1(chart, chart.options), i, j, s, d, rows = [], categories = [];
1029
+ options.chart.type = chartType;
1030
+ setFormatOptions$1(chart, options, chartType);
1031
+
1032
+ for (i = 0; i < series.length; i++) {
1033
+ s = series[i];
1034
+
1035
+ for (j = 0; j < s.data.length; j++) {
1036
+ d = s.data[j];
1037
+ if (!rows[d[0]]) {
1038
+ rows[d[0]] = new Array(series.length);
1039
+ categories.push(d[0]);
1040
+ }
1041
+ rows[d[0]][i] = d[1];
1042
+ }
1043
+ }
1044
+
1045
+ if (chart.xtype === "number") {
1046
+ categories.sort(sortByNumber);
1047
+ }
1048
+
1049
+ options.xAxis.categories = categories;
1050
+
1051
+ var newSeries = [], d2;
1052
+ for (i = 0; i < series.length; i++) {
1053
+ d = [];
1054
+ for (j = 0; j < categories.length; j++) {
1055
+ d.push(rows[categories[j]][i] || 0);
1056
+ }
1057
+
1058
+ d2 = {
1059
+ name: series[i].name || "Value",
1060
+ data: d
1061
+ };
1062
+ if (series[i].stack) {
1063
+ d2.stack = series[i].stack;
1064
+ }
1065
+
1066
+ newSeries.push(d2);
1067
+ }
1068
+
1069
+ this.drawChart(chart, newSeries, options);
1070
+ };
1071
+
1072
+ defaultExport$1.prototype.renderBarChart = function renderBarChart (chart) {
1073
+ this.renderColumnChart(chart, "bar");
1074
+ };
1075
+
1076
+ defaultExport$1.prototype.renderAreaChart = function renderAreaChart (chart) {
1077
+ this.renderLineChart(chart, "areaspline");
1078
+ };
1079
+
1080
+ defaultExport$1.prototype.destroy = function destroy (chart) {
1081
+ if (chart.chart) {
1082
+ chart.chart.destroy();
1083
+ }
1084
+ };
1085
+
1086
+ defaultExport$1.prototype.drawChart = function drawChart (chart, data, options) {
1087
+ this.destroy(chart);
1088
+
1089
+ options.chart.renderTo = chart.element.id;
1090
+ options.series = data;
1091
+
1092
+ if (chart.options.code) {
1093
+ window.console.log("new Highcharts.Chart(" + JSON.stringify(options) + ");");
1094
+ }
1095
+
1096
+ chart.chart = new this.library.Chart(options);
1097
+ };
1098
+
1099
+ var loaded = {};
1100
+ var callbacks = [];
1101
+
1102
+ // Set chart options
1103
+ var defaultOptions$2 = {
1104
+ chartArea: {},
1105
+ fontName: "'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif",
1106
+ pointSize: 6,
1107
+ legend: {
1108
+ textStyle: {
1109
+ fontSize: 12,
1110
+ color: "#444"
1111
+ },
1112
+ alignment: "center",
1113
+ position: "right"
1114
+ },
1115
+ curveType: "function",
1116
+ hAxis: {
1117
+ textStyle: {
1118
+ color: "#666",
1119
+ fontSize: 12
1120
+ },
1121
+ titleTextStyle: {},
1122
+ gridlines: {
1123
+ color: "transparent"
1124
+ },
1125
+ baselineColor: "#ccc",
1126
+ viewWindow: {}
1127
+ },
1128
+ vAxis: {
1129
+ textStyle: {
1130
+ color: "#666",
1131
+ fontSize: 12
1132
+ },
1133
+ titleTextStyle: {},
1134
+ baselineColor: "#ccc",
1135
+ viewWindow: {}
1136
+ },
1137
+ tooltip: {
1138
+ textStyle: {
1139
+ color: "#666",
1140
+ fontSize: 12
1141
+ }
1142
+ }
1143
+ };
1144
+
1145
+ var hideLegend$2 = function (options, legend, hideLegend) {
1146
+ if (legend !== undefined) {
1147
+ var position;
1148
+ if (!legend) {
1149
+ position = "none";
1150
+ } else if (legend === true) {
1151
+ position = "right";
1152
+ } else {
1153
+ position = legend;
1154
+ }
1155
+ options.legend.position = position;
1156
+ } else if (hideLegend) {
1157
+ options.legend.position = "none";
1158
+ }
1159
+ };
1160
+
1161
+ var setTitle$2 = function (options, title) {
1162
+ options.title = title;
1163
+ options.titleTextStyle = {color: "#333", fontSize: "20px"};
1164
+ };
1165
+
1166
+ var setMin$2 = function (options, min) {
1167
+ options.vAxis.viewWindow.min = min;
1168
+ };
1169
+
1170
+ var setMax$2 = function (options, max) {
1171
+ options.vAxis.viewWindow.max = max;
1172
+ };
1173
+
1174
+ var setBarMin$1 = function (options, min) {
1175
+ options.hAxis.viewWindow.min = min;
1176
+ };
1177
+
1178
+ var setBarMax$1 = function (options, max) {
1179
+ options.hAxis.viewWindow.max = max;
1180
+ };
1181
+
1182
+ var setStacked$2 = function (options, stacked) {
1183
+ options.isStacked = stacked ? stacked : false;
1184
+ };
1185
+
1186
+ var setXtitle$2 = function (options, title) {
1187
+ options.hAxis.title = title;
1188
+ options.hAxis.titleTextStyle.italic = false;
1189
+ };
1190
+
1191
+ var setYtitle$2 = function (options, title) {
1192
+ options.vAxis.title = title;
1193
+ options.vAxis.titleTextStyle.italic = false;
1194
+ };
1195
+
1196
+ var jsOptions$2 = jsOptionsFunc(defaultOptions$2, hideLegend$2, setTitle$2, setMin$2, setMax$2, setStacked$2, setXtitle$2, setYtitle$2);
1197
+
1198
+ var resize = function (callback) {
1199
+ if (window.attachEvent) {
1200
+ window.attachEvent("onresize", callback);
1201
+ } else if (window.addEventListener) {
1202
+ window.addEventListener("resize", callback, true);
1203
+ }
1204
+ callback();
1205
+ };
1206
+
1207
+ var defaultExport$2 = function defaultExport(library) {
1208
+ this.name = "google";
1209
+ this.library = library;
1210
+ };
1211
+
1212
+ defaultExport$2.prototype.renderLineChart = function renderLineChart (chart) {
1213
+ var this$1 = this;
1214
+
1215
+ this.waitForLoaded(chart, function () {
1216
+ var chartOptions = {};
1217
+
1218
+ if (chart.options.curve === false) {
1219
+ chartOptions.curveType = "none";
1220
+ }
1221
+
1222
+ if (chart.options.points === false) {
1223
+ chartOptions.pointSize = 0;
1224
+ }
1225
+
1226
+ var options = jsOptions$2(chart, chart.options, chartOptions);
1227
+ var data = this$1.createDataTable(chart.data, chart.xtype);
1228
+
1229
+ this$1.drawChart(chart, "LineChart", data, options);
1230
+ });
1231
+ };
1232
+
1233
+ defaultExport$2.prototype.renderPieChart = function renderPieChart (chart) {
1234
+ var this$1 = this;
1235
+
1236
+ this.waitForLoaded(chart, function () {
1237
+ var chartOptions = {
1238
+ chartArea: {
1239
+ top: "10%",
1240
+ height: "80%"
1241
+ },
1242
+ legend: {}
1243
+ };
1244
+ if (chart.options.colors) {
1245
+ chartOptions.colors = chart.options.colors;
1246
+ }
1247
+ if (chart.options.donut) {
1248
+ chartOptions.pieHole = 0.5;
1249
+ }
1250
+ if ("legend" in chart.options) {
1251
+ hideLegend$2(chartOptions, chart.options.legend);
1252
+ }
1253
+ if (chart.options.title) {
1254
+ setTitle$2(chartOptions, chart.options.title);
1255
+ }
1256
+ var options = merge(merge(defaultOptions$2, chartOptions), chart.options.library || {});
1257
+
1258
+ var data = new this$1.library.visualization.DataTable();
1259
+ data.addColumn("string", "");
1260
+ data.addColumn("number", "Value");
1261
+ data.addRows(chart.data);
1262
+
1263
+ this$1.drawChart(chart, "PieChart", data, options);
1264
+ });
1265
+ };
1266
+
1267
+ defaultExport$2.prototype.renderColumnChart = function renderColumnChart (chart) {
1268
+ var this$1 = this;
1269
+
1270
+ this.waitForLoaded(chart, function () {
1271
+ var options = jsOptions$2(chart, chart.options);
1272
+ var data = this$1.createDataTable(chart.data, chart.xtype);
1273
+
1274
+ this$1.drawChart(chart, "ColumnChart", data, options);
1275
+ });
1276
+ };
1277
+
1278
+ defaultExport$2.prototype.renderBarChart = function renderBarChart (chart) {
1279
+ var this$1 = this;
1280
+
1281
+ this.waitForLoaded(chart, function () {
1282
+ var chartOptions = {
1283
+ hAxis: {
1284
+ gridlines: {
1285
+ color: "#ccc"
1286
+ }
1287
+ }
1288
+ };
1289
+ var options = jsOptionsFunc(defaultOptions$2, hideLegend$2, setTitle$2, setBarMin$1, setBarMax$1, setStacked$2, setXtitle$2, setYtitle$2)(chart, chart.options, chartOptions);
1290
+ var data = this$1.createDataTable(chart.data, chart.xtype);
1291
+
1292
+ this$1.drawChart(chart, "BarChart", data, options);
1293
+ });
1294
+ };
1295
+
1296
+ defaultExport$2.prototype.renderAreaChart = function renderAreaChart (chart) {
1297
+ var this$1 = this;
1298
+
1299
+ this.waitForLoaded(chart, function () {
1300
+ var chartOptions = {
1301
+ isStacked: true,
1302
+ pointSize: 0,
1303
+ areaOpacity: 0.5
1304
+ };
1305
+
1306
+ var options = jsOptions$2(chart, chart.options, chartOptions);
1307
+ var data = this$1.createDataTable(chart.data, chart.xtype);
1308
+
1309
+ this$1.drawChart(chart, "AreaChart", data, options);
1310
+ });
1311
+ };
1312
+
1313
+ defaultExport$2.prototype.renderGeoChart = function renderGeoChart (chart) {
1314
+ var this$1 = this;
1315
+
1316
+ this.waitForLoaded(chart, function () {
1317
+ var chartOptions = {
1318
+ legend: "none",
1319
+ colorAxis: {
1320
+ colors: chart.options.colors || ["#f6c7b6", "#ce502d"]
1321
+ }
1322
+ };
1323
+ var options = merge(merge(defaultOptions$2, chartOptions), chart.options.library || {});
1324
+
1325
+ var data = new this$1.library.visualization.DataTable();
1326
+ data.addColumn("string", "");
1327
+ data.addColumn("number", chart.options.label || "Value");
1328
+ data.addRows(chart.data);
1329
+
1330
+ this$1.drawChart(chart, "GeoChart", data, options);
1331
+ });
1332
+ };
1333
+
1334
+ defaultExport$2.prototype.renderScatterChart = function renderScatterChart (chart) {
1335
+ var this$1 = this;
1336
+
1337
+ this.waitForLoaded(chart, function () {
1338
+ var chartOptions = {};
1339
+ var options = jsOptions$2(chart, chart.options, chartOptions);
1340
+
1341
+ var series = chart.data, rows2 = [], i, j, data, d;
1342
+ for (i = 0; i < series.length; i++) {
1343
+ series[i].name = series[i].name || "Value";
1344
+ d = series[i].data;
1345
+ for (j = 0; j < d.length; j++) {
1346
+ var row = new Array(series.length + 1);
1347
+ row[0] = d[j][0];
1348
+ row[i + 1] = d[j][1];
1349
+ rows2.push(row);
1350
+ }
1351
+ }
1352
+
1353
+ data = new this$1.library.visualization.DataTable();
1354
+ data.addColumn("number", "");
1355
+ for (i = 0; i < series.length; i++) {
1356
+ data.addColumn("number", series[i].name);
1357
+ }
1358
+ data.addRows(rows2);
1359
+
1360
+ this$1.drawChart(chart, "ScatterChart", data, options);
1361
+ });
1362
+ };
1363
+
1364
+ defaultExport$2.prototype.renderTimeline = function renderTimeline (chart) {
1365
+ var this$1 = this;
1366
+
1367
+ this.waitForLoaded(chart, "timeline", function () {
1368
+ var chartOptions = {
1369
+ legend: "none"
1370
+ };
1371
+
1372
+ if (chart.options.colors) {
1373
+ chartOptions.colors = chart.options.colors;
1374
+ }
1375
+ var options = merge(merge(defaultOptions$2, chartOptions), chart.options.library || {});
1376
+
1377
+ var data = new this$1.library.visualization.DataTable();
1378
+ data.addColumn({type: "string", id: "Name"});
1379
+ data.addColumn({type: "date", id: "Start"});
1380
+ data.addColumn({type: "date", id: "End"});
1381
+ data.addRows(chart.data);
1382
+
1383
+ chart.element.style.lineHeight = "normal";
1384
+
1385
+ this$1.drawChart(chart, "Timeline", data, options);
1386
+ });
1387
+ };
1388
+
1389
+ defaultExport$2.prototype.destroy = function destroy (chart) {
1390
+ if (chart.chart) {
1391
+ chart.chart.clearChart();
1392
+ }
1393
+ };
1394
+
1395
+ defaultExport$2.prototype.drawChart = function drawChart (chart, type, data, options) {
1396
+ this.destroy(chart);
1397
+
1398
+ if (chart.options.code) {
1399
+ window.console.log("var data = new google.visualization.DataTable(" + data.toJSON() + ");\nvar chart = new google.visualization." + type + "(element);\nchart.draw(data, " + JSON.stringify(options) + ");");
1400
+ }
1401
+
1402
+ chart.chart = new this.library.visualization[type](chart.element);
1403
+ resize(function () {
1404
+ chart.chart.draw(data, options);
1405
+ });
1406
+ };
1407
+
1408
+ defaultExport$2.prototype.waitForLoaded = function waitForLoaded (chart, pack, callback) {
1409
+ var this$1 = this;
1410
+
1411
+ if (!callback) {
1412
+ callback = pack;
1413
+ pack = "corechart";
1414
+ }
1415
+
1416
+ callbacks.push({pack: pack, callback: callback});
1417
+
1418
+ if (loaded[pack]) {
1419
+ this.runCallbacks();
1420
+ } else {
1421
+ loaded[pack] = true;
1422
+
1423
+ // https://groups.google.com/forum/#!topic/google-visualization-api/fMKJcyA2yyI
1424
+ var loadOptions = {
1425
+ packages: [pack],
1426
+ callback: function () { this$1.runCallbacks(); }
1427
+ };
1428
+ var config = chart.__config();
1429
+ if (config.language) {
1430
+ loadOptions.language = config.language;
1431
+ }
1432
+ if (pack === "corechart" && config.mapsApiKey) {
1433
+ loadOptions.mapsApiKey = config.mapsApiKey;
1434
+ }
1435
+
1436
+ this.library.charts.load("current", loadOptions);
1437
+ }
1438
+ };
1439
+
1440
+ defaultExport$2.prototype.runCallbacks = function runCallbacks () {
1441
+ var this$1 = this;
1442
+
1443
+ var cb, call;
1444
+ for (var i = 0; i < callbacks.length; i++) {
1445
+ cb = callbacks[i];
1446
+ call = this$1.library.visualization && ((cb.pack === "corechart" && this$1.library.visualization.LineChart) || (cb.pack === "timeline" && this$1.library.visualization.Timeline));
1447
+ if (call) {
1448
+ cb.callback();
1449
+ callbacks.splice(i, 1);
1450
+ i--;
1451
+ }
1452
+ }
1453
+ };
1454
+
1455
+ // cant use object as key
1456
+ defaultExport$2.prototype.createDataTable = function createDataTable (series, columnType) {
1457
+ var i, j, s, d, key, rows = [], sortedLabels = [];
1458
+ for (i = 0; i < series.length; i++) {
1459
+ s = series[i];
1460
+ series[i].name = series[i].name || "Value";
1461
+
1462
+ for (j = 0; j < s.data.length; j++) {
1463
+ d = s.data[j];
1464
+ key = (columnType === "datetime") ? d[0].getTime() : d[0];
1465
+ if (!rows[key]) {
1466
+ rows[key] = new Array(series.length);
1467
+ sortedLabels.push(key);
1468
+ }
1469
+ rows[key][i] = toFloat(d[1]);
1470
+ }
1471
+ }
1472
+
1473
+ var rows2 = [];
1474
+ var day = true;
1475
+ var value;
1476
+ for (j = 0; j < sortedLabels.length; j++) {
1477
+ i = sortedLabels[j];
1478
+ if (columnType === "datetime") {
1479
+ value = new Date(toFloat(i));
1480
+ day = day && isDay(value);
1481
+ } else if (columnType === "number") {
1482
+ value = toFloat(i);
1483
+ } else {
1484
+ value = i;
1485
+ }
1486
+ rows2.push([value].concat(rows[i]));
1487
+ }
1488
+ if (columnType === "datetime") {
1489
+ rows2.sort(sortByTime);
1490
+ } else if (columnType === "number") {
1491
+ rows2.sort(sortByNumberSeries);
1492
+
1493
+ for (i = 0; i < rows2.length; i++) {
1494
+ rows2[i][0] = toStr(rows2[i][0]);
1495
+ }
1496
+
1497
+ columnType = "string";
1498
+ }
1499
+
1500
+ // create datatable
1501
+ var data = new this.library.visualization.DataTable();
1502
+ columnType = columnType === "datetime" && day ? "date" : columnType;
1503
+ data.addColumn(columnType, "");
1504
+ for (i = 0; i < series.length; i++) {
1505
+ data.addColumn("number", series[i].name);
1506
+ }
1507
+ data.addRows(rows2);
1508
+
1509
+ return data;
1510
+ };
1511
+
1512
+ var pendingRequests = [], runningRequests = 0, maxRequests = 4;
1513
+
1514
+ function pushRequest(url, success, error) {
1515
+ pendingRequests.push([url, success, error]);
1516
+ runNext();
1517
+ }
1518
+
1519
+ function runNext() {
1520
+ if (runningRequests < maxRequests) {
1521
+ var request = pendingRequests.shift();
1522
+ if (request) {
1523
+ runningRequests++;
1524
+ getJSON(request[0], request[1], request[2]);
1525
+ runNext();
1526
+ }
1527
+ }
1528
+ }
1529
+
1530
+ function requestComplete() {
1531
+ runningRequests--;
1532
+ runNext();
1533
+ }
1534
+
1535
+ function getJSON(url, success, error) {
1536
+ ajaxCall(url, success, function (jqXHR, textStatus, errorThrown) {
1537
+ var message = (typeof errorThrown === "string") ? errorThrown : errorThrown.message;
1538
+ error(message);
1539
+ });
1540
+ }
1541
+
1542
+ function ajaxCall(url, success, error) {
1543
+ var $ = window.jQuery || window.Zepto || window.$;
1544
+
1545
+ if ($) {
1546
+ $.ajax({
1547
+ dataType: "json",
1548
+ url: url,
1549
+ success: success,
1550
+ error: error,
1551
+ complete: requestComplete
1552
+ });
1553
+ } else {
1554
+ var xhr = new XMLHttpRequest();
1555
+ xhr.open("GET", url, true);
1556
+ xhr.setRequestHeader("Content-Type", "application/json");
1557
+ xhr.onload = function () {
1558
+ requestComplete();
1559
+ if (xhr.status === 200) {
1560
+ success(JSON.parse(xhr.responseText), xhr.statusText, xhr);
1561
+ } else {
1562
+ error(xhr, "error", xhr.statusText);
1563
+ }
1564
+ };
1565
+ xhr.send();
1566
+ }
1567
+ }
1568
+
1569
+ var config = {};
1570
+ var adapters = [];
1571
+
1572
+ // helpers
1573
+
1574
+ function setText(element, text) {
1575
+ if (document.body.innerText) {
1576
+ element.innerText = text;
1577
+ } else {
1578
+ element.textContent = text;
1579
+ }
1580
+ }
1581
+
1582
+ function chartError(element, message) {
1583
+ setText(element, "Error Loading Chart: " + message);
1584
+ element.style.color = "#ff0000";
1585
+ }
1586
+
1587
+ function errorCatcher(chart) {
1588
+ try {
1589
+ chart.__render();
1590
+ } catch (err) {
1591
+ chartError(chart.element, err.message);
1592
+ throw err;
1593
+ }
1594
+ }
1595
+
1596
+ //TODO
1597
+ // function getJSON(element, url, success) {
1598
+ // ajaxCall(url, success, function (jqXHR, textStatus, errorThrown) {
1599
+ // // PATCH_BEGIN
1600
+ // var message = jqXHR.getResponseHeader("X-Status-Reason");
1601
+ // if (jqXHR.status === 413) {
1602
+ // message = message || "Request Entity Too Large";
1603
+ // }
1604
+ // message = message || ((typeof errorThrown === "string") ? errorThrown : errorThrown.message);
1605
+ // // PATCH_END
1606
+ // chartError(element, message);
1607
+ // });
1608
+ // }
1609
+
1610
+ function fetchDataSource(chart, dataSource) {
1611
+ if (typeof dataSource === "string") {
1612
+ pushRequest(dataSource, function (data) {
1613
+ chart.rawData = data;
1614
+ errorCatcher(chart);
1615
+ }, function (message) {
1616
+ chartError(chart.element, message);
1617
+ });
1618
+ } else {
1619
+ chart.rawData = dataSource;
1620
+ errorCatcher(chart);
1621
+ }
1622
+ }
1623
+
1624
+ function addDownloadButton(chart) {
1625
+ var element = chart.element;
1626
+ var link = document.createElement("a");
1627
+ link.download = chart.options.download === true ? "chart.png" : chart.options.download; // https://caniuse.com/download
1628
+ link.style.position = "absolute";
1629
+ link.style.top = "20px";
1630
+ link.style.right = "20px";
1631
+ link.style.zIndex = 1000;
1632
+ link.style.lineHeight = "20px";
1633
+ link.target = "_blank"; // for safari
1634
+ var image = document.createElement("img");
1635
+ image.alt = "Download";
1636
+ image.style.border = "none";
1637
+ // icon from font-awesome
1638
+ // http://fa2png.io/
1639
+ image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABCFBMVEUAAADMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMywEsqxAAAAV3RSTlMAAQIDBggJCgsMDQ4PERQaHB0eISIjJCouLzE0OTo/QUJHSUpLTU5PUllhYmltcHh5foWLjI+SlaCio6atr7S1t7m6vsHHyM7R2tze5Obo7fHz9ff5+/1hlxK2AAAA30lEQVQYGUXBhVYCQQBA0TdYWAt2d3d3YWAHyur7/z9xgD16Lw0DW+XKx+1GgX+FRzM3HWQWrHl5N/oapW5RPe0PkBu+UYeICvozTWZVK23Ao04B79oJrOsJDOoxkZoQPWgX29pHpCZEk7rEvQYiNSFq1UMqvlCjJkRBS1R8hb00Vb/TajtBL7nTHE1X1vyMQF732dQhyF2o6SAwrzP06iUQzvwsArlnzcOdrgBhJyHa1QOgO9U1GsKuvjUTjavliZYQ8nNPapG6sap/3nrIdJ6bOWzmX/fy0XVpfzZP3S8OJT3g9EEiJwAAAABJRU5ErkJggg==";
1640
+ link.appendChild(image);
1641
+ element.style.position = "relative";
1642
+
1643
+ chart.__downloadAttached = true;
1644
+
1645
+ // mouseenter
1646
+ chart.__enterEvent = addEvent(element, "mouseover", function(e) {
1647
+ var related = e.relatedTarget;
1648
+ // check download option again to ensure it wasn't changed
1649
+ if ((!related || (related !== this && !childOf(this, related))) && chart.options.download) {
1650
+ link.href = chart.toImage();
1651
+ element.appendChild(link);
1652
+ }
1653
+ });
1654
+
1655
+ // mouseleave
1656
+ chart.__leaveEvent = addEvent(element, "mouseout", function(e) {
1657
+ var related = e.relatedTarget;
1658
+ if (!related || (related !== this && !childOf(this, related))) {
1659
+ if (link.parentNode) {
1660
+ link.parentNode.removeChild(link);
1661
+ }
1662
+ }
1663
+ });
1664
+ }
1665
+
1666
+ // https://stackoverflow.com/questions/10149963/adding-event-listener-cross-browser
1667
+ function addEvent(elem, event, fn) {
1668
+ if (elem.addEventListener) {
1669
+ elem.addEventListener(event, fn, false);
1670
+ return fn;
1671
+ } else {
1672
+ var fn2 = function() {
1673
+ // set the this pointer same as addEventListener when fn is called
1674
+ return(fn.call(elem, window.event));
1675
+ };
1676
+ elem.attachEvent("on" + event, fn2);
1677
+ return fn2;
1678
+ }
1679
+ }
1680
+
1681
+ function removeEvent(elem, event, fn) {
1682
+ if (elem.removeEventListener) {
1683
+ elem.removeEventListener(event, fn, false);
1684
+ } else {
1685
+ elem.detachEvent("on" + event, fn);
1686
+ }
1687
+ }
1688
+
1689
+ // https://gist.github.com/shawnbot/4166283
1690
+ function childOf(p, c) {
1691
+ if (p === c) { return false; }
1692
+ while (c && c !== p) { c = c.parentNode; }
1693
+ return c === p;
1694
+ }
1695
+
1696
+ function getAdapterType(library) {
1697
+ if (library) {
1698
+ if (library.product === "Highcharts") {
1699
+ return defaultExport$1;
1700
+ } else if (library.charts) {
1701
+ return defaultExport$2;
1702
+ } else if (isFunction(library)) {
1703
+ return defaultExport;
1704
+ }
1705
+ }
1706
+ throw new Error("Unknown adapter");
1707
+ }
1708
+
1709
+ function addAdapter(library) {
1710
+ var adapterType = getAdapterType(library);
1711
+ var adapter = new adapterType(library);
1712
+
1713
+ if (adapters.indexOf(adapter) === -1) {
1714
+ adapters.push(adapter);
1715
+ }
1716
+ }
1717
+
1718
+ function loadAdapters() {
1719
+ if ("Chart" in window) {
1720
+ addAdapter(window.Chart);
1721
+ }
1722
+
1723
+ if ("Highcharts" in window) {
1724
+ addAdapter(window.Highcharts);
1725
+ }
1726
+
1727
+ if (window.google && window.google.charts) {
1728
+ addAdapter(window.google);
1729
+ }
1730
+ }
1731
+
1732
+ function dataEmpty(data, chartType) {
1733
+ if (chartType === "PieChart" || chartType === "GeoChart" || chartType === "Timeline") {
1734
+ return data.length === 0;
1735
+ } else {
1736
+ for (var i = 0; i < data.length; i++) {
1737
+ if (data[i].data.length > 0) {
1738
+ return false;
1739
+ }
1740
+ }
1741
+ return true;
1742
+ }
1743
+ }
1744
+
1745
+ function renderChart(chartType, chart) {
1746
+ if (chart.options.messages && chart.options.messages.empty && dataEmpty(chart.data, chartType)) {
1747
+ setText(chart.element, chart.options.messages.empty);
1748
+ } else {
1749
+ callAdapter(chartType, chart);
1750
+ if (chart.options.download && !chart.__downloadAttached && chart.adapter === "chartjs") {
1751
+ addDownloadButton(chart);
1752
+ }
1753
+ }
1754
+ }
1755
+
1756
+ // TODO remove chartType if cross-browser way
1757
+ // to get the name of the chart class
1758
+ function callAdapter(chartType, chart) {
1759
+ var i, adapter, fnName, adapterName;
1760
+ fnName = "render" + chartType;
1761
+ adapterName = chart.options.adapter;
1762
+
1763
+ loadAdapters();
1764
+
1765
+ for (i = 0; i < adapters.length; i++) {
1766
+ adapter = adapters[i];
1767
+ if ((!adapterName || adapterName === adapter.name) && isFunction(adapter[fnName])) {
1768
+ chart.adapter = adapter.name;
1769
+ chart.__adapterObject = adapter;
1770
+ return adapter[fnName](chart);
1771
+ }
1772
+ }
1773
+
1774
+ if (adapters.length > 0) {
1775
+ throw new Error("No charting library found for " + chartType);
1776
+ } else {
1777
+ throw new Error("No charting libraries found - be sure to include one before your charts");
1778
+ }
1779
+ }
1780
+
1781
+ // process data
1782
+
1783
+ var toFormattedKey = function (key, keyType) {
1784
+ if (keyType === "number") {
1785
+ key = toFloat(key);
1786
+ } else if (keyType === "datetime") {
1787
+ key = toDate(key);
1788
+ } else {
1789
+ key = toStr(key);
1790
+ }
1791
+ return key;
1792
+ };
1793
+
1794
+ var formatSeriesData = function (data, keyType) {
1795
+ var r = [], key, j;
1796
+ for (j = 0; j < data.length; j++) {
1797
+ if (keyType === "bubble") {
1798
+ r.push([toFloat(data[j][0]), toFloat(data[j][1]), toFloat(data[j][2])]);
1799
+ } else {
1800
+ key = toFormattedKey(data[j][0], keyType);
1801
+ r.push([key, toFloat(data[j][1])]);
1802
+ }
1803
+ }
1804
+ if (keyType === "datetime") {
1805
+ r.sort(sortByTime);
1806
+ } else if (keyType === "number") {
1807
+ r.sort(sortByNumberSeries);
1808
+ }
1809
+ return r;
1810
+ };
1811
+
1812
+ function detectXType(series, noDatetime) {
1813
+ if (detectXTypeWithFunction(series, isNumber)) {
1814
+ return "number";
1815
+ } else if (!noDatetime && detectXTypeWithFunction(series, isDate)) {
1816
+ return "datetime";
1817
+ } else {
1818
+ return "string";
1819
+ }
1820
+ }
1821
+
1822
+ function detectXTypeWithFunction(series, func) {
1823
+ var i, j, data;
1824
+ for (i = 0; i < series.length; i++) {
1825
+ data = toArr(series[i].data);
1826
+ for (j = 0; j < data.length; j++) {
1827
+ if (!func(data[j][0])) {
1828
+ return false;
1829
+ }
1830
+ }
1831
+ }
1832
+ return true;
1833
+ }
1834
+
1835
+ // creates a shallow copy of each element of the array
1836
+ // elements are expected to be objects
1837
+ function copySeries(series) {
1838
+ var newSeries = [], i, j;
1839
+ for (i = 0; i < series.length; i++) {
1840
+ var copy = {};
1841
+ for (j in series[i]) {
1842
+ if (series[i].hasOwnProperty(j)) {
1843
+ copy[j] = series[i][j];
1844
+ }
1845
+ }
1846
+ newSeries.push(copy);
1847
+ }
1848
+ return newSeries;
1849
+ }
1850
+
1851
+ function processSeries(chart, keyType, noDatetime) {
1852
+ var i;
1853
+
1854
+ var opts = chart.options;
1855
+ var series = chart.rawData;
1856
+
1857
+ // see if one series or multiple
1858
+ if (!isArray(series) || typeof series[0] !== "object" || isArray(series[0])) {
1859
+ series = [{name: opts.label, data: series}];
1860
+ chart.hideLegend = true;
1861
+ } else {
1862
+ chart.hideLegend = false;
1863
+ }
1864
+
1865
+ chart.xtype = keyType ? keyType : (opts.discrete ? "string" : detectXType(series, noDatetime));
1866
+
1867
+ // right format
1868
+ series = copySeries(series);
1869
+ for (i = 0; i < series.length; i++) {
1870
+ series[i].data = formatSeriesData(toArr(series[i].data), chart.xtype);
1871
+ }
1872
+
1873
+ return series;
1874
+ }
1875
+
1876
+ function processSimple(chart) {
1877
+ var perfectData = toArr(chart.rawData), i;
1878
+ for (i = 0; i < perfectData.length; i++) {
1879
+ perfectData[i] = [toStr(perfectData[i][0]), toFloat(perfectData[i][1])];
1880
+ }
1881
+ return perfectData;
1882
+ }
1883
+
1884
+ // define classes
1885
+
1886
+ var Chart = function Chart(element, dataSource, options) {
1887
+ var elementId;
1888
+ if (typeof element === "string") {
1889
+ elementId = element;
1890
+ element = document.getElementById(element);
1891
+ if (!element) {
1892
+ throw new Error("No element with id " + elementId);
1893
+ }
1894
+ }
1895
+ this.element = element;
1896
+ this.options = merge(Chartkick.options, options || {});
1897
+ this.dataSource = dataSource;
1898
+
1899
+ Chartkick.charts[element.id] = this;
1900
+
1901
+ fetchDataSource(this, dataSource);
1902
+
1903
+ if (this.options.refresh) {
1904
+ this.startRefresh();
1905
+ }
1906
+ };
1907
+
1908
+ Chart.prototype.getElement = function getElement () {
1909
+ return this.element;
1910
+ };
1911
+
1912
+ Chart.prototype.getDataSource = function getDataSource () {
1913
+ return this.dataSource;
1914
+ };
1915
+
1916
+ Chart.prototype.getData = function getData () {
1917
+ return this.data;
1918
+ };
1919
+
1920
+ Chart.prototype.getOptions = function getOptions () {
1921
+ return this.options;
1922
+ };
1923
+
1924
+ Chart.prototype.getChartObject = function getChartObject () {
1925
+ return this.chart;
1926
+ };
1927
+
1928
+ Chart.prototype.getAdapter = function getAdapter () {
1929
+ return this.adapter;
1930
+ };
1931
+
1932
+ Chart.prototype.updateData = function updateData (dataSource, options) {
1933
+ this.dataSource = dataSource;
1934
+ if (options) {
1935
+ this.__updateOptions(options);
1936
+ }
1937
+ fetchDataSource(this, dataSource);
1938
+ };
1939
+
1940
+ Chart.prototype.setOptions = function setOptions (options) {
1941
+ this.__updateOptions(options);
1942
+ this.redraw();
1943
+ };
1944
+
1945
+ Chart.prototype.redraw = function redraw () {
1946
+ fetchDataSource(this, this.rawData);
1947
+ };
1948
+
1949
+ Chart.prototype.refreshData = function refreshData () {
1950
+ if (typeof this.dataSource === "string") {
1951
+ // prevent browser from caching
1952
+ var sep = this.dataSource.indexOf("?") === -1 ? "?" : "&";
1953
+ var url = this.dataSource + sep + "_=" + (new Date()).getTime();
1954
+ fetchDataSource(this, url);
1955
+ }
1956
+ };
1957
+
1958
+ Chart.prototype.startRefresh = function startRefresh () {
1959
+ var this$1 = this;
1960
+
1961
+ var refresh = this.options.refresh;
1962
+
1963
+ if (!this.intervalId) {
1964
+ if (refresh) {
1965
+ this.intervalId = setInterval( function () {
1966
+ this$1.refreshData();
1967
+ }, refresh * 1000);
1968
+ } else {
1969
+ throw new Error("No refresh interval");
1970
+ }
1971
+ }
1972
+ };
1973
+
1974
+ Chart.prototype.stopRefresh = function stopRefresh () {
1975
+ if (this.intervalId) {
1976
+ clearInterval(this.intervalId);
1977
+ this.intervalId = null;
1978
+ }
1979
+ };
1980
+
1981
+ Chart.prototype.toImage = function toImage () {
1982
+ if (this.adapter === "chartjs") {
1983
+ return this.chart.toBase64Image();
1984
+ } else {
1985
+ return null;
1986
+ }
1987
+ };
1988
+
1989
+ Chart.prototype.destroy = function destroy () {
1990
+ if (this.__adapterObject) {
1991
+ this.__adapterObject.destroy(this);
1992
+ }
1993
+
1994
+ if (this.__enterEvent) {
1995
+ removeEvent(this.element, "mouseover", this.__enterEvent);
1996
+ }
1997
+
1998
+ if (this.__leaveEvent) {
1999
+ removeEvent(this.element, "mouseout", this.__leaveEvent);
2000
+ }
2001
+ };
2002
+
2003
+ Chart.prototype.__updateOptions = function __updateOptions (options) {
2004
+ var updateRefresh = options.refresh && options.refresh !== this.options.refresh;
2005
+ this.options = merge(Chartkick.options, options);
2006
+ if (updateRefresh) {
2007
+ this.stopRefresh();
2008
+ this.startRefresh();
2009
+ }
2010
+ };
2011
+
2012
+ Chart.prototype.__render = function __render () {
2013
+ this.data = this.__processData();
2014
+ renderChart(this.__chartName(), this);
2015
+ };
2016
+
2017
+ Chart.prototype.__config = function __config () {
2018
+ return config;
2019
+ };
2020
+
2021
+ var LineChart = (function (Chart) {
2022
+ function LineChart () {
2023
+ Chart.apply(this, arguments);
2024
+ }
2025
+
2026
+ if ( Chart ) LineChart.__proto__ = Chart;
2027
+ LineChart.prototype = Object.create( Chart && Chart.prototype );
2028
+ LineChart.prototype.constructor = LineChart;
2029
+
2030
+ LineChart.prototype.__processData = function __processData () {
2031
+ return processSeries(this);
2032
+ };
2033
+
2034
+ LineChart.prototype.__chartName = function __chartName () {
2035
+ return "LineChart";
2036
+ };
2037
+
2038
+ return LineChart;
2039
+ }(Chart));
2040
+
2041
+ var PieChart = (function (Chart) {
2042
+ function PieChart () {
2043
+ Chart.apply(this, arguments);
2044
+ }
2045
+
2046
+ if ( Chart ) PieChart.__proto__ = Chart;
2047
+ PieChart.prototype = Object.create( Chart && Chart.prototype );
2048
+ PieChart.prototype.constructor = PieChart;
2049
+
2050
+ PieChart.prototype.__processData = function __processData () {
2051
+ return processSimple(this);
2052
+ };
2053
+
2054
+ PieChart.prototype.__chartName = function __chartName () {
2055
+ return "PieChart";
2056
+ };
2057
+
2058
+ return PieChart;
2059
+ }(Chart));
2060
+
2061
+ var ColumnChart = (function (Chart) {
2062
+ function ColumnChart () {
2063
+ Chart.apply(this, arguments);
2064
+ }
2065
+
2066
+ if ( Chart ) ColumnChart.__proto__ = Chart;
2067
+ ColumnChart.prototype = Object.create( Chart && Chart.prototype );
2068
+ ColumnChart.prototype.constructor = ColumnChart;
2069
+
2070
+ ColumnChart.prototype.__processData = function __processData () {
2071
+ return processSeries(this, null, true);
2072
+ };
2073
+
2074
+ ColumnChart.prototype.__chartName = function __chartName () {
2075
+ return "ColumnChart";
2076
+ };
2077
+
2078
+ return ColumnChart;
2079
+ }(Chart));
2080
+
2081
+ var BarChart = (function (Chart) {
2082
+ function BarChart () {
2083
+ Chart.apply(this, arguments);
2084
+ }
2085
+
2086
+ if ( Chart ) BarChart.__proto__ = Chart;
2087
+ BarChart.prototype = Object.create( Chart && Chart.prototype );
2088
+ BarChart.prototype.constructor = BarChart;
2089
+
2090
+ BarChart.prototype.__processData = function __processData () {
2091
+ return processSeries(this, null, true);
2092
+ };
2093
+
2094
+ BarChart.prototype.__chartName = function __chartName () {
2095
+ return "BarChart";
2096
+ };
2097
+
2098
+ return BarChart;
2099
+ }(Chart));
2100
+
2101
+ var AreaChart = (function (Chart) {
2102
+ function AreaChart () {
2103
+ Chart.apply(this, arguments);
2104
+ }
2105
+
2106
+ if ( Chart ) AreaChart.__proto__ = Chart;
2107
+ AreaChart.prototype = Object.create( Chart && Chart.prototype );
2108
+ AreaChart.prototype.constructor = AreaChart;
2109
+
2110
+ AreaChart.prototype.__processData = function __processData () {
2111
+ return processSeries(this);
2112
+ };
2113
+
2114
+ AreaChart.prototype.__chartName = function __chartName () {
2115
+ return "AreaChart";
2116
+ };
2117
+
2118
+ return AreaChart;
2119
+ }(Chart));
2120
+
2121
+ var GeoChart = (function (Chart) {
2122
+ function GeoChart () {
2123
+ Chart.apply(this, arguments);
2124
+ }
2125
+
2126
+ if ( Chart ) GeoChart.__proto__ = Chart;
2127
+ GeoChart.prototype = Object.create( Chart && Chart.prototype );
2128
+ GeoChart.prototype.constructor = GeoChart;
2129
+
2130
+ GeoChart.prototype.__processData = function __processData () {
2131
+ return processSimple(this);
2132
+ };
2133
+
2134
+ GeoChart.prototype.__chartName = function __chartName () {
2135
+ return "GeoChart";
2136
+ };
2137
+
2138
+ return GeoChart;
2139
+ }(Chart));
2140
+
2141
+ var ScatterChart = (function (Chart) {
2142
+ function ScatterChart () {
2143
+ Chart.apply(this, arguments);
2144
+ }
2145
+
2146
+ if ( Chart ) ScatterChart.__proto__ = Chart;
2147
+ ScatterChart.prototype = Object.create( Chart && Chart.prototype );
2148
+ ScatterChart.prototype.constructor = ScatterChart;
2149
+
2150
+ ScatterChart.prototype.__processData = function __processData () {
2151
+ return processSeries(this, "number");
2152
+ };
2153
+
2154
+ ScatterChart.prototype.__chartName = function __chartName () {
2155
+ return "ScatterChart";
2156
+ };
2157
+
2158
+ return ScatterChart;
2159
+ }(Chart));
2160
+
2161
+ var BubbleChart = (function (Chart) {
2162
+ function BubbleChart () {
2163
+ Chart.apply(this, arguments);
2164
+ }
2165
+
2166
+ if ( Chart ) BubbleChart.__proto__ = Chart;
2167
+ BubbleChart.prototype = Object.create( Chart && Chart.prototype );
2168
+ BubbleChart.prototype.constructor = BubbleChart;
2169
+
2170
+ BubbleChart.prototype.__processData = function __processData () {
2171
+ return processSeries(this, "bubble");
2172
+ };
2173
+
2174
+ BubbleChart.prototype.__chartName = function __chartName () {
2175
+ return "BubbleChart";
2176
+ };
2177
+
2178
+ return BubbleChart;
2179
+ }(Chart));
2180
+
2181
+ var Timeline = (function (Chart) {
2182
+ function Timeline () {
2183
+ Chart.apply(this, arguments);
2184
+ }
2185
+
2186
+ if ( Chart ) Timeline.__proto__ = Chart;
2187
+ Timeline.prototype = Object.create( Chart && Chart.prototype );
2188
+ Timeline.prototype.constructor = Timeline;
2189
+
2190
+ Timeline.prototype.__processData = function __processData () {
2191
+ var i, data = this.rawData;
2192
+ for (i = 0; i < data.length; i++) {
2193
+ data[i][1] = toDate(data[i][1]);
2194
+ data[i][2] = toDate(data[i][2]);
2195
+ }
2196
+ return data;
2197
+ };
2198
+
2199
+ Timeline.prototype.__chartName = function __chartName () {
2200
+ return "Timeline";
2201
+ };
2202
+
2203
+ return Timeline;
2204
+ }(Chart));
2205
+
2206
+ var Chartkick = {
2207
+ LineChart: LineChart,
2208
+ PieChart: PieChart,
2209
+ ColumnChart: ColumnChart,
2210
+ BarChart: BarChart,
2211
+ AreaChart: AreaChart,
2212
+ GeoChart: GeoChart,
2213
+ ScatterChart: ScatterChart,
2214
+ BubbleChart: BubbleChart,
2215
+ Timeline: Timeline,
2216
+ charts: {},
2217
+ configure: function (options) {
2218
+ for (var key in options) {
2219
+ if (options.hasOwnProperty(key)) {
2220
+ config[key] = options[key];
2221
+ }
2222
+ }
2223
+ },
2224
+ eachChart: function (callback) {
2225
+ for (var chartId in Chartkick.charts) {
2226
+ if (Chartkick.charts.hasOwnProperty(chartId)) {
2227
+ callback(Chartkick.charts[chartId]);
2228
+ }
2229
+ }
2230
+ },
2231
+ config: config,
2232
+ options: {},
2233
+ adapters: adapters,
2234
+ addAdapter: addAdapter
2235
+ };
2236
+
2237
+ return Chartkick;
2238
+
2239
+ })));