ezii-os 1.1.0 → 2.0.1

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