baidu_ueditor_rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +14 -0
  3. data/Gemfile.lock +88 -0
  4. data/bin/rails +8 -0
  5. data/vendor/assets/javascripts/ueditor/dialogs/anchor/anchor.html +40 -0
  6. data/vendor/assets/javascripts/ueditor/dialogs/attachment/attachment.css +130 -0
  7. data/vendor/assets/javascripts/ueditor/dialogs/attachment/attachment.html +128 -0
  8. data/vendor/assets/javascripts/ueditor/dialogs/attachment/callbacks.js +166 -0
  9. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_chm.gif +0 -0
  10. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
  11. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
  12. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
  13. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
  14. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
  15. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
  16. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
  17. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
  18. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
  19. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
  20. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
  21. data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeMaps.js +29 -0
  22. data/vendor/assets/javascripts/ueditor/dialogs/background/background.css +25 -0
  23. data/vendor/assets/javascripts/ueditor/dialogs/background/background.html +56 -0
  24. data/vendor/assets/javascripts/ueditor/dialogs/background/background.js +251 -0
  25. data/vendor/assets/javascripts/ueditor/dialogs/charts/chart.config.js +65 -0
  26. data/vendor/assets/javascripts/ueditor/dialogs/charts/charts.css +165 -0
  27. data/vendor/assets/javascripts/ueditor/dialogs/charts/charts.html +89 -0
  28. data/vendor/assets/javascripts/ueditor/dialogs/charts/charts.js +519 -0
  29. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts0.png +0 -0
  30. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts1.png +0 -0
  31. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts2.png +0 -0
  32. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts3.png +0 -0
  33. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts4.png +0 -0
  34. data/vendor/assets/javascripts/ueditor/dialogs/charts/images/charts5.png +0 -0
  35. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.css +43 -0
  36. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.html +54 -0
  37. data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.js +186 -0
  38. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/0.gif +0 -0
  39. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/bface.gif +0 -0
  40. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/cface.gif +0 -0
  41. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/fface.gif +0 -0
  42. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
  43. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
  44. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/tface.gif +0 -0
  45. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/wface.gif +0 -0
  46. data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/yface.gif +0 -0
  47. data/vendor/assets/javascripts/ueditor/dialogs/gmap/gmap.html +89 -0
  48. data/vendor/assets/javascripts/ueditor/dialogs/help/help.css +7 -0
  49. data/vendor/assets/javascripts/ueditor/dialogs/help/help.html +82 -0
  50. data/vendor/assets/javascripts/ueditor/dialogs/help/help.js +56 -0
  51. data/vendor/assets/javascripts/ueditor/dialogs/image/image.css +69 -0
  52. data/vendor/assets/javascripts/ueditor/dialogs/image/image.html +257 -0
  53. data/vendor/assets/javascripts/ueditor/dialogs/image/image.js +713 -0
  54. data/vendor/assets/javascripts/ueditor/dialogs/image/imageUploader.swf +0 -0
  55. data/vendor/assets/javascripts/ueditor/dialogs/image/images/center_focus.jpg +0 -0
  56. data/vendor/assets/javascripts/ueditor/dialogs/image/images/left_focus.jpg +0 -0
  57. data/vendor/assets/javascripts/ueditor/dialogs/image/images/none_focus.jpg +0 -0
  58. data/vendor/assets/javascripts/ueditor/dialogs/image/images/right_focus.jpg +0 -0
  59. data/vendor/assets/javascripts/ueditor/dialogs/insertframe/insertframe.html +98 -0
  60. data/vendor/assets/javascripts/ueditor/dialogs/internal.js +81 -0
  61. data/vendor/assets/javascripts/ueditor/dialogs/link/link.html +126 -0
  62. data/vendor/assets/javascripts/ueditor/dialogs/map/map.html +135 -0
  63. data/vendor/assets/javascripts/ueditor/dialogs/map/show.html +118 -0
  64. data/vendor/assets/javascripts/ueditor/dialogs/music/music.css +30 -0
  65. data/vendor/assets/javascripts/ueditor/dialogs/music/music.html +32 -0
  66. data/vendor/assets/javascripts/ueditor/dialogs/music/music.js +192 -0
  67. data/vendor/assets/javascripts/ueditor/dialogs/preview/preview.html +40 -0
  68. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/addimg.png +0 -0
  69. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/brush.png +0 -0
  70. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/delimg.png +0 -0
  71. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/delimgH.png +0 -0
  72. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/empty.png +0 -0
  73. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/emptyH.png +0 -0
  74. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/eraser.png +0 -0
  75. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/redo.png +0 -0
  76. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/redoH.png +0 -0
  77. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/scale.png +0 -0
  78. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/scaleH.png +0 -0
  79. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/size.png +0 -0
  80. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/undo.png +0 -0
  81. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/images/undoH.png +0 -0
  82. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/scrawl.css +72 -0
  83. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/scrawl.html +95 -0
  84. data/vendor/assets/javascripts/ueditor/dialogs/scrawl/scrawl.js +655 -0
  85. data/vendor/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.html +102 -0
  86. data/vendor/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.js +164 -0
  87. data/vendor/assets/javascripts/ueditor/dialogs/snapscreen/snapscreen.html +58 -0
  88. data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.html +21 -0
  89. data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.js +57 -0
  90. data/vendor/assets/javascripts/ueditor/dialogs/table/dragicon.png +0 -0
  91. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.css +84 -0
  92. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.html +64 -0
  93. data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.js +237 -0
  94. data/vendor/assets/javascripts/ueditor/dialogs/table/edittd.html +61 -0
  95. data/vendor/assets/javascripts/ueditor/dialogs/table/edittip.html +33 -0
  96. data/vendor/assets/javascripts/ueditor/dialogs/tangram.js +1495 -0
  97. data/vendor/assets/javascripts/ueditor/dialogs/template/config.js +42 -0
  98. data/vendor/assets/javascripts/ueditor/dialogs/template/images/bg.gif +0 -0
  99. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre0.png +0 -0
  100. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre1.png +0 -0
  101. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre2.png +0 -0
  102. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre3.png +0 -0
  103. data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre4.png +0 -0
  104. data/vendor/assets/javascripts/ueditor/dialogs/template/template.css +18 -0
  105. data/vendor/assets/javascripts/ueditor/dialogs/template/template.html +26 -0
  106. data/vendor/assets/javascripts/ueditor/dialogs/template/template.js +53 -0
  107. data/vendor/assets/javascripts/ueditor/dialogs/video/callbacks.js +166 -0
  108. data/vendor/assets/javascripts/ueditor/dialogs/video/images/center_focus.jpg +0 -0
  109. data/vendor/assets/javascripts/ueditor/dialogs/video/images/left_focus.jpg +0 -0
  110. data/vendor/assets/javascripts/ueditor/dialogs/video/images/none_focus.jpg +0 -0
  111. data/vendor/assets/javascripts/ueditor/dialogs/video/images/right_focus.jpg +0 -0
  112. data/vendor/assets/javascripts/ueditor/dialogs/video/video.css +150 -0
  113. data/vendor/assets/javascripts/ueditor/dialogs/video/video.html +95 -0
  114. data/vendor/assets/javascripts/ueditor/dialogs/video/video.js +471 -0
  115. data/vendor/assets/javascripts/ueditor/dialogs/webapp/webapp.html +53 -0
  116. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/fClipboard_ueditor.swf +0 -0
  117. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/imageUploader.swf +0 -0
  118. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/wordimage.html +104 -0
  119. data/vendor/assets/javascripts/ueditor/dialogs/wordimage/wordimage.js +158 -0
  120. data/vendor/assets/javascripts/ueditor/index.html +175 -0
  121. data/vendor/assets/javascripts/ueditor/lang/en/en.js +638 -0
  122. data/vendor/assets/javascripts/ueditor/lang/en/images/addimage.png +0 -0
  123. data/vendor/assets/javascripts/ueditor/lang/en/images/alldeletebtnhoverskin.png +0 -0
  124. data/vendor/assets/javascripts/ueditor/lang/en/images/alldeletebtnupskin.png +0 -0
  125. data/vendor/assets/javascripts/ueditor/lang/en/images/background.png +0 -0
  126. data/vendor/assets/javascripts/ueditor/lang/en/images/button.png +0 -0
  127. data/vendor/assets/javascripts/ueditor/lang/en/images/copy.png +0 -0
  128. data/vendor/assets/javascripts/ueditor/lang/en/images/deletedisable.png +0 -0
  129. data/vendor/assets/javascripts/ueditor/lang/en/images/deleteenable.png +0 -0
  130. data/vendor/assets/javascripts/ueditor/lang/en/images/imglabel.png +0 -0
  131. data/vendor/assets/javascripts/ueditor/lang/en/images/listbackground.png +0 -0
  132. data/vendor/assets/javascripts/ueditor/lang/en/images/localimage.png +0 -0
  133. data/vendor/assets/javascripts/ueditor/lang/en/images/music.png +0 -0
  134. data/vendor/assets/javascripts/ueditor/lang/en/images/rotateleftdisable.png +0 -0
  135. data/vendor/assets/javascripts/ueditor/lang/en/images/rotateleftenable.png +0 -0
  136. data/vendor/assets/javascripts/ueditor/lang/en/images/rotaterightdisable.png +0 -0
  137. data/vendor/assets/javascripts/ueditor/lang/en/images/rotaterightenable.png +0 -0
  138. data/vendor/assets/javascripts/ueditor/lang/en/images/upload.png +0 -0
  139. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/copy.png +0 -0
  140. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/imglabel.png +0 -0
  141. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/localimage.png +0 -0
  142. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/music.png +0 -0
  143. data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/upload.png +0 -0
  144. data/vendor/assets/javascripts/ueditor/lang/zh-cn/zh-cn.js +605 -0
  145. data/vendor/assets/javascripts/ueditor/themes/default/css/ueditor.css +1823 -0
  146. data/vendor/assets/javascripts/ueditor/themes/default/css/ueditor.min.css +8 -0
  147. data/vendor/assets/javascripts/ueditor/themes/default/dialogbase.css +100 -0
  148. data/vendor/assets/javascripts/ueditor/themes/default/images/anchor.gif +0 -0
  149. data/vendor/assets/javascripts/ueditor/themes/default/images/arrow.png +0 -0
  150. data/vendor/assets/javascripts/ueditor/themes/default/images/arrow_down.png +0 -0
  151. data/vendor/assets/javascripts/ueditor/themes/default/images/arrow_up.png +0 -0
  152. data/vendor/assets/javascripts/ueditor/themes/default/images/button-bg.gif +0 -0
  153. data/vendor/assets/javascripts/ueditor/themes/default/images/cancelbutton.gif +0 -0
  154. data/vendor/assets/javascripts/ueditor/themes/default/images/charts.png +0 -0
  155. data/vendor/assets/javascripts/ueditor/themes/default/images/cursor_h.gif +0 -0
  156. data/vendor/assets/javascripts/ueditor/themes/default/images/cursor_h.png +0 -0
  157. data/vendor/assets/javascripts/ueditor/themes/default/images/cursor_v.gif +0 -0
  158. data/vendor/assets/javascripts/ueditor/themes/default/images/cursor_v.png +0 -0
  159. data/vendor/assets/javascripts/ueditor/themes/default/images/dialog-title-bg.png +0 -0
  160. data/vendor/assets/javascripts/ueditor/themes/default/images/filescan.png +0 -0
  161. data/vendor/assets/javascripts/ueditor/themes/default/images/highlighted.gif +0 -0
  162. data/vendor/assets/javascripts/ueditor/themes/default/images/icons-all.gif +0 -0
  163. data/vendor/assets/javascripts/ueditor/themes/default/images/icons.gif +0 -0
  164. data/vendor/assets/javascripts/ueditor/themes/default/images/icons.png +0 -0
  165. data/vendor/assets/javascripts/ueditor/themes/default/images/lock.gif +0 -0
  166. data/vendor/assets/javascripts/ueditor/themes/default/images/neweditor-tab-bg.png +0 -0
  167. data/vendor/assets/javascripts/ueditor/themes/default/images/pagebreak.gif +0 -0
  168. data/vendor/assets/javascripts/ueditor/themes/default/images/scale.png +0 -0
  169. data/vendor/assets/javascripts/ueditor/themes/default/images/sortable.png +0 -0
  170. data/vendor/assets/javascripts/ueditor/themes/default/images/spacer.gif +0 -0
  171. data/vendor/assets/javascripts/ueditor/themes/default/images/sparator_v.png +0 -0
  172. data/vendor/assets/javascripts/ueditor/themes/default/images/table-cell-align.png +0 -0
  173. data/vendor/assets/javascripts/ueditor/themes/default/images/tangram-colorpicker.png +0 -0
  174. data/vendor/assets/javascripts/ueditor/themes/default/images/toolbar_bg.png +0 -0
  175. data/vendor/assets/javascripts/ueditor/themes/default/images/unhighlighted.gif +0 -0
  176. data/vendor/assets/javascripts/ueditor/themes/default/images/upload.png +0 -0
  177. data/vendor/assets/javascripts/ueditor/themes/default/images/videologo.gif +0 -0
  178. data/vendor/assets/javascripts/ueditor/themes/default/images/word.gif +0 -0
  179. data/vendor/assets/javascripts/ueditor/themes/default/images/wordpaste.png +0 -0
  180. data/vendor/assets/javascripts/ueditor/themes/iframe.css +1 -0
  181. data/vendor/assets/javascripts/ueditor/third-party/SyntaxHighlighter/shCore.js +3655 -0
  182. data/vendor/assets/javascripts/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css +1 -0
  183. data/vendor/assets/javascripts/ueditor/third-party/codemirror/codemirror.css +104 -0
  184. data/vendor/assets/javascripts/ueditor/third-party/codemirror/codemirror.js +3581 -0
  185. data/vendor/assets/javascripts/ueditor/third-party/highcharts/adapters/mootools-adapter.js +13 -0
  186. data/vendor/assets/javascripts/ueditor/third-party/highcharts/adapters/mootools-adapter.src.js +313 -0
  187. data/vendor/assets/javascripts/ueditor/third-party/highcharts/adapters/prototype-adapter.js +15 -0
  188. data/vendor/assets/javascripts/ueditor/third-party/highcharts/adapters/prototype-adapter.src.js +316 -0
  189. data/vendor/assets/javascripts/ueditor/third-party/highcharts/adapters/standalone-framework.js +17 -0
  190. data/vendor/assets/javascripts/ueditor/third-party/highcharts/adapters/standalone-framework.src.js +583 -0
  191. data/vendor/assets/javascripts/ueditor/third-party/highcharts/highcharts-more.js +50 -0
  192. data/vendor/assets/javascripts/ueditor/third-party/highcharts/highcharts-more.src.js +2430 -0
  193. data/vendor/assets/javascripts/ueditor/third-party/highcharts/highcharts.js +283 -0
  194. data/vendor/assets/javascripts/ueditor/third-party/highcharts/highcharts.src.js +16974 -0
  195. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/annotations.js +7 -0
  196. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/annotations.src.js +401 -0
  197. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/canvas-tools.js +133 -0
  198. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/canvas-tools.src.js +3113 -0
  199. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/data.js +17 -0
  200. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/data.src.js +582 -0
  201. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/drilldown.js +11 -0
  202. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/drilldown.src.js +447 -0
  203. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/exporting.js +22 -0
  204. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/exporting.src.js +709 -0
  205. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/funnel.js +12 -0
  206. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/funnel.src.js +289 -0
  207. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/heatmap.js +1 -0
  208. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/heatmap.src.js +53 -0
  209. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/map.js +27 -0
  210. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/map.src.js +1002 -0
  211. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/no-data-to-display.js +12 -0
  212. data/vendor/assets/javascripts/ueditor/third-party/highcharts/modules/no-data-to-display.src.js +128 -0
  213. data/vendor/assets/javascripts/ueditor/third-party/highcharts/themes/dark-blue.js +254 -0
  214. data/vendor/assets/javascripts/ueditor/third-party/highcharts/themes/dark-green.js +255 -0
  215. data/vendor/assets/javascripts/ueditor/third-party/highcharts/themes/gray.js +257 -0
  216. data/vendor/assets/javascripts/ueditor/third-party/highcharts/themes/grid.js +103 -0
  217. data/vendor/assets/javascripts/ueditor/third-party/highcharts/themes/skies.js +89 -0
  218. data/vendor/assets/javascripts/ueditor/third-party/jquery-1.10.2.min.js +6 -0
  219. data/vendor/assets/javascripts/ueditor/third-party/snapscreen/UEditorSnapscreen.exe +0 -0
  220. data/vendor/assets/javascripts/ueditor/third-party/swfupload/fileprogress.js +215 -0
  221. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.cookies.js +53 -0
  222. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.js +1132 -0
  223. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.proxy.js +96 -0
  224. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.queue.js +98 -0
  225. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.speed.js +346 -0
  226. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.swf +0 -0
  227. data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload_fp9.swf +0 -0
  228. data/vendor/assets/javascripts/ueditor/third-party/video-js/font/vjs.eot +0 -0
  229. data/vendor/assets/javascripts/ueditor/third-party/video-js/font/vjs.svg +65 -0
  230. data/vendor/assets/javascripts/ueditor/third-party/video-js/font/vjs.ttf +0 -0
  231. data/vendor/assets/javascripts/ueditor/third-party/video-js/font/vjs.woff +0 -0
  232. data/vendor/assets/javascripts/ueditor/third-party/video-js/video-js.css +766 -0
  233. data/vendor/assets/javascripts/ueditor/third-party/video-js/video-js.min.css +5 -0
  234. data/vendor/assets/javascripts/ueditor/third-party/video-js/video-js.swf +0 -0
  235. data/vendor/assets/javascripts/ueditor/third-party/video-js/video.dev.js +7108 -0
  236. data/vendor/assets/javascripts/ueditor/third-party/video-js/video.js +129 -0
  237. data/vendor/assets/javascripts/ueditor/ueditor.all.js +27535 -0
  238. data/vendor/assets/javascripts/ueditor/ueditor.all.min.js +664 -0
  239. data/vendor/assets/javascripts/ueditor/ueditor.config.js +452 -0
  240. data/vendor/assets/javascripts/ueditor/ueditor.parse.js +1015 -0
  241. data/vendor/assets/javascripts/ueditor/ueditor.parse.min.js +28 -0
  242. metadata +241 -1
@@ -0,0 +1,12 @@
1
+ /*
2
+
3
+ Highcharts funnel module, Beta
4
+
5
+ (c) 2010-2012 Torstein Hønsi
6
+
7
+ License: www.highcharts.com/license
8
+ */
9
+ (function(d){var u=d.getOptions().plotOptions,p=d.seriesTypes,D=d.merge,z=function(){},A=d.each;u.funnel=D(u.pie,{center:["50%","50%"],width:"90%",neckWidth:"30%",height:"100%",neckHeight:"25%",dataLabels:{connectorWidth:1,connectorColor:"#606060"},size:!0,states:{select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}}});p.funnel=d.extendClass(p.pie,{type:"funnel",animate:z,translate:function(){var a=function(k,a){return/%$/.test(k)?a*parseInt(k,10)/100:parseInt(k,10)},g=0,e=this.chart,f=e.plotWidth,
10
+ e=e.plotHeight,h=0,c=this.options,C=c.center,b=a(C[0],f),d=a(C[0],e),p=a(c.width,f),i,q,j=a(c.height,e),r=a(c.neckWidth,f),s=a(c.neckHeight,e),v=j-s,a=this.data,w,x,u=c.dataLabels.position==="left"?1:0,y,m,B,n,l,t,o;this.getWidthAt=q=function(k){return k>j-s||j===s?r:r+(p-r)*((j-s-k)/(j-s))};this.getX=function(k,a){return b+(a?-1:1)*(q(k)/2+c.dataLabels.distance)};this.center=[b,d,j];this.centerX=b;A(a,function(a){g+=a.y});A(a,function(a){o=null;x=g?a.y/g:0;m=d-j/2+h*j;l=m+x*j;i=q(m);y=b-i/2;B=y+
11
+ i;i=q(l);n=b-i/2;t=n+i;m>v?(y=n=b-r/2,B=t=b+r/2):l>v&&(o=l,i=q(v),n=b-i/2,t=n+i,l=v);w=["M",y,m,"L",B,m,t,l];o&&w.push(t,o,n,o);w.push(n,l,"Z");a.shapeType="path";a.shapeArgs={d:w};a.percentage=x*100;a.plotX=b;a.plotY=(m+(o||l))/2;a.tooltipPos=[b,a.plotY];a.slice=z;a.half=u;h+=x});this.setTooltipPoints()},drawPoints:function(){var a=this,g=a.options,e=a.chart.renderer;A(a.data,function(f){var h=f.graphic,c=f.shapeArgs;h?h.animate(c):f.graphic=e.path(c).attr({fill:f.color,stroke:g.borderColor,"stroke-width":g.borderWidth}).add(a.group)})},
12
+ sortByAngle:z,drawDataLabels:function(){var a=this.data,g=this.options.dataLabels.distance,e,f,h,c=a.length,d,b;for(this.center[2]-=2*g;c--;)h=a[c],f=(e=h.half)?1:-1,b=h.plotY,d=this.getX(b,e),h.labelPos=[0,b,d+(g-5)*f,b,d+g*f,b,e?"right":"left",0];p.pie.prototype.drawDataLabels.call(this)}})})(Highcharts);
@@ -0,0 +1,289 @@
1
+ /**
2
+ * @license
3
+ * Highcharts funnel module, Beta
4
+ *
5
+ * (c) 2010-2012 Torstein Hønsi
6
+ *
7
+ * License: www.highcharts.com/license
8
+ */
9
+
10
+ /*global Highcharts */
11
+ (function (Highcharts) {
12
+
13
+ 'use strict';
14
+
15
+ // create shortcuts
16
+ var defaultOptions = Highcharts.getOptions(),
17
+ defaultPlotOptions = defaultOptions.plotOptions,
18
+ seriesTypes = Highcharts.seriesTypes,
19
+ merge = Highcharts.merge,
20
+ noop = function () {},
21
+ each = Highcharts.each;
22
+
23
+ // set default options
24
+ defaultPlotOptions.funnel = merge(defaultPlotOptions.pie, {
25
+ center: ['50%', '50%'],
26
+ width: '90%',
27
+ neckWidth: '30%',
28
+ height: '100%',
29
+ neckHeight: '25%',
30
+
31
+ dataLabels: {
32
+ //position: 'right',
33
+ connectorWidth: 1,
34
+ connectorColor: '#606060'
35
+ },
36
+ size: true, // to avoid adapting to data label size in Pie.drawDataLabels
37
+ states: {
38
+ select: {
39
+ color: '#C0C0C0',
40
+ borderColor: '#000000',
41
+ shadow: false
42
+ }
43
+ }
44
+ });
45
+
46
+
47
+ seriesTypes.funnel = Highcharts.extendClass(seriesTypes.pie, {
48
+
49
+ type: 'funnel',
50
+ animate: noop,
51
+
52
+ /**
53
+ * Overrides the pie translate method
54
+ */
55
+ translate: function () {
56
+
57
+ var
58
+ // Get positions - either an integer or a percentage string must be given
59
+ getLength = function (length, relativeTo) {
60
+ return (/%$/).test(length) ?
61
+ relativeTo * parseInt(length, 10) / 100 :
62
+ parseInt(length, 10);
63
+ },
64
+
65
+ sum = 0,
66
+ series = this,
67
+ chart = series.chart,
68
+ plotWidth = chart.plotWidth,
69
+ plotHeight = chart.plotHeight,
70
+ cumulative = 0, // start at top
71
+ options = series.options,
72
+ center = options.center,
73
+ centerX = getLength(center[0], plotWidth),
74
+ centerY = getLength(center[0], plotHeight),
75
+ width = getLength(options.width, plotWidth),
76
+ tempWidth,
77
+ getWidthAt,
78
+ height = getLength(options.height, plotHeight),
79
+ neckWidth = getLength(options.neckWidth, plotWidth),
80
+ neckHeight = getLength(options.neckHeight, plotHeight),
81
+ neckY = height - neckHeight,
82
+ data = series.data,
83
+ path,
84
+ fraction,
85
+ half = options.dataLabels.position === 'left' ? 1 : 0,
86
+
87
+ x1,
88
+ y1,
89
+ x2,
90
+ x3,
91
+ y3,
92
+ x4,
93
+ y5;
94
+
95
+ // Return the width at a specific y coordinate
96
+ series.getWidthAt = getWidthAt = function (y) {
97
+ return y > height - neckHeight || height === neckHeight ?
98
+ neckWidth :
99
+ neckWidth + (width - neckWidth) * ((height - neckHeight - y) / (height - neckHeight));
100
+ };
101
+ series.getX = function (y, half) {
102
+ return centerX + (half ? -1 : 1) * ((getWidthAt(y) / 2) + options.dataLabels.distance);
103
+ };
104
+
105
+ // Expose
106
+ series.center = [centerX, centerY, height];
107
+ series.centerX = centerX;
108
+
109
+ /*
110
+ * Individual point coordinate naming:
111
+ *
112
+ * x1,y1 _________________ x2,y1
113
+ * \ /
114
+ * \ /
115
+ * \ /
116
+ * \ /
117
+ * \ /
118
+ * x3,y3 _________ x4,y3
119
+ *
120
+ * Additional for the base of the neck:
121
+ *
122
+ * | |
123
+ * | |
124
+ * | |
125
+ * x3,y5 _________ x4,y5
126
+ */
127
+
128
+
129
+
130
+
131
+ // get the total sum
132
+ each(data, function (point) {
133
+ sum += point.y;
134
+ });
135
+
136
+ each(data, function (point) {
137
+ // set start and end positions
138
+ y5 = null;
139
+ fraction = sum ? point.y / sum : 0;
140
+ y1 = centerY - height / 2 + cumulative * height;
141
+ y3 = y1 + fraction * height;
142
+ //tempWidth = neckWidth + (width - neckWidth) * ((height - neckHeight - y1) / (height - neckHeight));
143
+ tempWidth = getWidthAt(y1);
144
+ x1 = centerX - tempWidth / 2;
145
+ x2 = x1 + tempWidth;
146
+ tempWidth = getWidthAt(y3);
147
+ x3 = centerX - tempWidth / 2;
148
+ x4 = x3 + tempWidth;
149
+
150
+ // the entire point is within the neck
151
+ if (y1 > neckY) {
152
+ x1 = x3 = centerX - neckWidth / 2;
153
+ x2 = x4 = centerX + neckWidth / 2;
154
+
155
+ // the base of the neck
156
+ } else if (y3 > neckY) {
157
+ y5 = y3;
158
+
159
+ tempWidth = getWidthAt(neckY);
160
+ x3 = centerX - tempWidth / 2;
161
+ x4 = x3 + tempWidth;
162
+
163
+ y3 = neckY;
164
+ }
165
+
166
+ // save the path
167
+ path = [
168
+ 'M',
169
+ x1, y1,
170
+ 'L',
171
+ x2, y1,
172
+ x4, y3
173
+ ];
174
+ if (y5) {
175
+ path.push(x4, y5, x3, y5);
176
+ }
177
+ path.push(x3, y3, 'Z');
178
+
179
+ // prepare for using shared dr
180
+ point.shapeType = 'path';
181
+ point.shapeArgs = { d: path };
182
+
183
+
184
+ // for tooltips and data labels
185
+ point.percentage = fraction * 100;
186
+ point.plotX = centerX;
187
+ point.plotY = (y1 + (y5 || y3)) / 2;
188
+
189
+ // Placement of tooltips and data labels
190
+ point.tooltipPos = [
191
+ centerX,
192
+ point.plotY
193
+ ];
194
+
195
+ // Slice is a noop on funnel points
196
+ point.slice = noop;
197
+
198
+ // Mimicking pie data label placement logic
199
+ point.half = half;
200
+
201
+ cumulative += fraction;
202
+ });
203
+
204
+
205
+ series.setTooltipPoints();
206
+ },
207
+ /**
208
+ * Draw a single point (wedge)
209
+ * @param {Object} point The point object
210
+ * @param {Object} color The color of the point
211
+ * @param {Number} brightness The brightness relative to the color
212
+ */
213
+ drawPoints: function () {
214
+ var series = this,
215
+ options = series.options,
216
+ chart = series.chart,
217
+ renderer = chart.renderer;
218
+
219
+ each(series.data, function (point) {
220
+
221
+ var graphic = point.graphic,
222
+ shapeArgs = point.shapeArgs;
223
+
224
+ if (!graphic) { // Create the shapes
225
+ point.graphic = renderer.path(shapeArgs).
226
+ attr({
227
+ fill: point.color,
228
+ stroke: options.borderColor,
229
+ 'stroke-width': options.borderWidth
230
+ }).
231
+ add(series.group);
232
+
233
+ } else { // Update the shapes
234
+ graphic.animate(shapeArgs);
235
+ }
236
+ });
237
+ },
238
+
239
+ /**
240
+ * Funnel items don't have angles (#2289)
241
+ */
242
+ sortByAngle: noop,
243
+
244
+ /**
245
+ * Extend the pie data label method
246
+ */
247
+ drawDataLabels: function () {
248
+ var data = this.data,
249
+ labelDistance = this.options.dataLabels.distance,
250
+ leftSide,
251
+ sign,
252
+ point,
253
+ i = data.length,
254
+ x,
255
+ y;
256
+
257
+ // In the original pie label anticollision logic, the slots are distributed
258
+ // from one labelDistance above to one labelDistance below the pie. In funnels
259
+ // we don't want this.
260
+ this.center[2] -= 2 * labelDistance;
261
+
262
+ // Set the label position array for each point.
263
+ while (i--) {
264
+ point = data[i];
265
+ leftSide = point.half;
266
+ sign = leftSide ? 1 : -1;
267
+ y = point.plotY;
268
+ x = this.getX(y, leftSide);
269
+
270
+ // set the anchor point for data labels
271
+ point.labelPos = [
272
+ 0, // first break of connector
273
+ y, // a/a
274
+ x + (labelDistance - 5) * sign, // second break, right outside point shape
275
+ y, // a/a
276
+ x + labelDistance * sign, // landing point for connector
277
+ y, // a/a
278
+ leftSide ? 'right' : 'left', // alignment
279
+ 0 // center angle
280
+ ];
281
+ }
282
+
283
+ seriesTypes.pie.prototype.drawDataLabels.call(this);
284
+ }
285
+
286
+ });
287
+
288
+
289
+ }(Highcharts));
@@ -0,0 +1 @@
1
+ (function(b){var k=b.seriesTypes,l=b.each;k.heatmap=b.extendClass(k.map,{colorKey:"z",useMapGeometry:!1,pointArrayMap:["y","z"],translate:function(){var c=this,b=c.options,i=Number.MAX_VALUE,j=Number.MIN_VALUE;c.generatePoints();l(c.data,function(a){var e=a.x,f=a.y,d=a.z,g=(b.colsize||1)/2,h=(b.rowsize||1)/2;a.path=["M",e-g,f-h,"L",e+g,f-h,"L",e+g,f+h,"L",e-g,f+h,"Z"];a.shapeType="path";a.shapeArgs={d:c.translatePath(a.path)};typeof d==="number"&&(d>j?j=d:d<i&&(i=d))});c.translateColors(i,j)},getBox:function(){}})})(Highcharts);
@@ -0,0 +1,53 @@
1
+ (function (Highcharts) {
2
+ var seriesTypes = Highcharts.seriesTypes,
3
+ each = Highcharts.each;
4
+
5
+ seriesTypes.heatmap = Highcharts.extendClass(seriesTypes.map, {
6
+ colorKey: 'z',
7
+ useMapGeometry: false,
8
+ pointArrayMap: ['y', 'z'],
9
+ translate: function () {
10
+ var series = this,
11
+ options = series.options,
12
+ dataMin = Number.MAX_VALUE,
13
+ dataMax = Number.MIN_VALUE;
14
+
15
+ series.generatePoints();
16
+
17
+ each(series.data, function (point) {
18
+ var x = point.x,
19
+ y = point.y,
20
+ value = point.z,
21
+ xPad = (options.colsize || 1) / 2,
22
+ yPad = (options.rowsize || 1) / 2;
23
+
24
+ point.path = [
25
+ 'M', x - xPad, y - yPad,
26
+ 'L', x + xPad, y - yPad,
27
+ 'L', x + xPad, y + yPad,
28
+ 'L', x - xPad, y + yPad,
29
+ 'Z'
30
+ ];
31
+
32
+ point.shapeType = 'path';
33
+ point.shapeArgs = {
34
+ d: series.translatePath(point.path)
35
+ };
36
+
37
+ if (typeof value === 'number') {
38
+ if (value > dataMax) {
39
+ dataMax = value;
40
+ } else if (value < dataMin) {
41
+ dataMin = value;
42
+ }
43
+ }
44
+ });
45
+
46
+ series.translateColors(dataMin, dataMax);
47
+ },
48
+
49
+ getBox: function () {}
50
+
51
+ });
52
+
53
+ }(Highcharts));
@@ -0,0 +1,27 @@
1
+ /*
2
+ Map plugin v0.1 for Highcharts
3
+
4
+ (c) 2011-2013 Torstein Hønsi
5
+
6
+ License: www.highcharts.com/license
7
+ */
8
+ (function(g){function x(a,b,c){for(var d=4,e=[];d--;)e[d]=Math.round(b.rgba[d]+(a.rgba[d]-b.rgba[d])*(1-c));return"rgba("+e.join(",")+")"}var r=g.Axis,y=g.Chart,s=g.Point,z=g.Pointer,l=g.each,v=g.extend,p=g.merge,n=g.pick,A=g.numberFormat,B=g.getOptions(),k=g.seriesTypes,q=B.plotOptions,t=g.wrap,u=g.Color,w=function(){};B.mapNavigation={buttonOptions:{align:"right",verticalAlign:"bottom",x:0,width:18,height:18,style:{fontSize:"15px",fontWeight:"bold",textAlign:"center"}},buttons:{zoomIn:{onclick:function(){this.mapZoom(0.5)},
9
+ text:"+",y:-32},zoomOut:{onclick:function(){this.mapZoom(2)},text:"-",y:0}}};g.splitPath=function(a){var b,a=a.replace(/([A-Za-z])/g," $1 "),a=a.replace(/^\s*/,"").replace(/\s*$/,""),a=a.split(/[ ,]+/);for(b=0;b<a.length;b++)/[a-zA-Z]/.test(a[b])||(a[b]=parseFloat(a[b]));return a};g.maps={};t(r.prototype,"getSeriesExtremes",function(a){var b=this.isXAxis,c,d,e=[];l(this.series,function(a,b){if(a.useMapGeometry)e[b]=a.xData,a.xData=[]});a.call(this);c=n(this.dataMin,Number.MAX_VALUE);d=n(this.dataMax,
10
+ Number.MIN_VALUE);l(this.series,function(a,i){if(a.useMapGeometry)c=Math.min(c,a[b?"minX":"minY"]),d=Math.max(d,a[b?"maxX":"maxY"]),a.xData=e[i]});this.dataMin=c;this.dataMax=d});t(r.prototype,"setAxisTranslation",function(a){var b=this.chart,c=b.plotWidth/b.plotHeight,d=this.isXAxis,e=b.xAxis[0];a.call(this);if(b.options.chart.type==="map"&&!d&&e.transA!==void 0)this.transA=e.transA=Math.min(this.transA,e.transA),a=(e.max-e.min)/(this.max-this.min),e=a>c?this:e,c=(e.max-e.min)*e.transA,e.minPixelPadding=
11
+ (e.len-c)/2});t(y.prototype,"render",function(a){var b=this,c=b.options.mapNavigation;a.call(b);b.renderMapNavigation();c.zoomOnDoubleClick&&g.addEvent(b.container,"dblclick",function(a){b.pointer.onContainerDblClick(a)});c.zoomOnMouseWheel&&g.addEvent(b.container,document.onmousewheel===void 0?"DOMMouseScroll":"mousewheel",function(a){b.pointer.onContainerMouseWheel(a)})});v(z.prototype,{onContainerDblClick:function(a){var b=this.chart,a=this.normalize(a);b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-
12
+ b.plotTop)&&b.mapZoom(0.5,b.xAxis[0].toValue(a.chartX),b.yAxis[0].toValue(a.chartY))},onContainerMouseWheel:function(a){var b=this.chart,c,a=this.normalize(a);c=a.detail||-(a.wheelDelta/120);b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)&&b.mapZoom(c>0?2:0.5,b.xAxis[0].toValue(a.chartX),b.yAxis[0].toValue(a.chartY))}});t(z.prototype,"init",function(a,b,c){a.call(this,b,c);if(c.mapNavigation.enableTouchZoom)this.pinchX=this.pinchHor=this.pinchY=this.pinchVert=!0});v(y.prototype,{renderMapNavigation:function(){var a=
13
+ this,b=this.options.mapNavigation,c=b.buttons,d,e,f,i=function(){this.handler.call(a)};if(b.enableButtons)for(d in c)if(c.hasOwnProperty(d))f=p(b.buttonOptions,c[d]),e=a.renderer.button(f.text,0,0,i).attr({width:f.width,height:f.height}).css(f.style).add(),e.handler=f.onclick,e.align(v(f,{width:e.width,height:e.height}),null,"spacingBox")},fitToBox:function(a,b){l([["x","width"],["y","height"]],function(c){var d=c[0],c=c[1];a[d]+a[c]>b[d]+b[c]&&(a[c]>b[c]?(a[c]=b[c],a[d]=b[d]):a[d]=b[d]+b[c]-a[c]);
14
+ a[c]>b[c]&&(a[c]=b[c]);a[d]<b[d]&&(a[d]=b[d])});return a},mapZoom:function(a,b,c){if(!this.isMapZooming){var d=this,e=d.xAxis[0],f=e.max-e.min,i=n(b,e.min+f/2),b=f*a,f=d.yAxis[0],h=f.max-f.min,c=n(c,f.min+h/2);a*=h;i-=b/2;h=c-a/2;c=n(d.options.chart.animation,!0);b=d.fitToBox({x:i,y:h,width:b,height:a},{x:e.dataMin,y:f.dataMin,width:e.dataMax-e.dataMin,height:f.dataMax-f.dataMin});e.setExtremes(b.x,b.x+b.width,!1);f.setExtremes(b.y,b.y+b.height,!1);if(e=c?c.duration||500:0)d.isMapZooming=!0,setTimeout(function(){d.isMapZooming=
15
+ !1},e);d.redraw()}}});q.map=p(q.scatter,{animation:!1,nullColor:"#F8F8F8",borderColor:"silver",borderWidth:1,marker:null,stickyTracking:!1,dataLabels:{verticalAlign:"middle"},turboThreshold:0,tooltip:{followPointer:!0,pointFormat:"{point.name}: {point.y}<br/>"},states:{normal:{animation:!0}}});r=g.extendClass(s,{applyOptions:function(a,b){var c=s.prototype.applyOptions.call(this,a,b);if(c.path&&typeof c.path==="string")c.path=c.options.path=g.splitPath(c.path);return c},onMouseOver:function(){clearTimeout(this.colorInterval);
16
+ s.prototype.onMouseOver.call(this)},onMouseOut:function(){var a=this,b=+new Date,c=u(a.options.color),d=u(a.pointAttr.hover.fill),e=a.series.options.states.normal.animation,f=e&&(e.duration||500);if(f&&c.rgba.length===4&&d.rgba.length===4)delete a.pointAttr[""].fill,clearTimeout(a.colorInterval),a.colorInterval=setInterval(function(){var e=(new Date-b)/f,h=a.graphic;e>1&&(e=1);h&&h.attr("fill",x(d,c,e));e>=1&&clearTimeout(a.colorInterval)},13);s.prototype.onMouseOut.call(a)}});k.map=g.extendClass(k.scatter,
17
+ {type:"map",pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},colorKey:"y",pointClass:r,trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:w,supportsDrilldown:!0,getExtremesFromAll:!0,useMapGeometry:!0,init:function(a){var b=this,c=a.options.legend.valueDecimals,d=[],e,f,i,h,j,o,m;o=a.options.legend.layout==="horizontal";g.Series.prototype.init.apply(this,arguments);j=b.options.colorRange;if(h=b.options.valueRanges)l(h,function(a){f=a.from;i=a.to;e=
18
+ "";f===void 0?e="< ":i===void 0&&(e="> ");f!==void 0&&(e+=A(f,c));f!==void 0&&i!==void 0&&(e+=" - ");i!==void 0&&(e+=A(i,c));d.push(g.extend({chart:b.chart,name:e,options:{},drawLegendSymbol:k.area.prototype.drawLegendSymbol,visible:!0,setState:function(){},setVisible:function(){}},a))}),b.legendItems=d;else if(j)f=j.from,i=j.to,h=j.fromLabel,j=j.toLabel,m=o?[0,0,1,0]:[0,1,0,0],o||(o=h,h=j,j=o),o={linearGradient:{x1:m[0],y1:m[1],x2:m[2],y2:m[3]},stops:[[0,f],[1,i]]},d=[{chart:b.chart,options:{},fromLabel:h,
19
+ toLabel:j,color:o,drawLegendSymbol:this.drawLegendSymbolGradient,visible:!0,setState:function(){},setVisible:function(){}}],b.legendItems=d},drawLegendSymbol:k.area.prototype.drawLegendSymbol,drawLegendSymbolGradient:function(a,b){var c=a.options.symbolPadding,d=n(a.options.padding,8),e,f,i=this.chart.renderer.fontMetrics(a.options.itemStyle.fontSize).h,h=a.options.layout==="horizontal",j;j=n(a.options.rectangleLength,200);h?(e=-(c/2),f=0):(e=-j+a.baseline-c/2,f=d+i);b.fromText=this.chart.renderer.text(b.fromLabel,
20
+ f,e).attr({zIndex:2}).add(b.legendGroup);f=b.fromText.getBBox();b.legendSymbol=this.chart.renderer.rect(h?f.x+f.width+c:f.x-i-c,f.y,h?j:i,h?i:j,2).attr({zIndex:1}).add(b.legendGroup);j=b.legendSymbol.getBBox();b.toText=this.chart.renderer.text(b.toLabel,j.x+j.width+c,h?e:j.y+j.height-c).attr({zIndex:2}).add(b.legendGroup);e=b.toText.getBBox();h?(a.offsetWidth=f.width+j.width+e.width+c*2+d,a.itemY=i+d):(a.offsetWidth=Math.max(f.width,e.width)+c+j.width+d,a.itemY=j.height+d,a.itemX=c)},getBox:function(a){var b=
21
+ Number.MIN_VALUE,c=Number.MAX_VALUE,d=Number.MIN_VALUE,e=Number.MAX_VALUE;l(a||this.options.data,function(a){for(var i=a.path,h=i.length,j=!1,g=Number.MIN_VALUE,m=Number.MAX_VALUE,k=Number.MIN_VALUE,l=Number.MAX_VALUE;h--;)typeof i[h]==="number"&&!isNaN(i[h])&&(j?(g=Math.max(g,i[h]),m=Math.min(m,i[h])):(k=Math.max(k,i[h]),l=Math.min(l,i[h])),j=!j);a._maxX=g;a._minX=m;a._maxY=k;a._minY=l;b=Math.max(b,g);c=Math.min(c,m);d=Math.max(d,k);e=Math.min(e,l)});this.minY=e;this.maxY=d;this.minX=c;this.maxX=
22
+ b},translatePath:function(a){var b=!1,c=this.xAxis,d=this.yAxis,e,a=[].concat(a);for(e=a.length;e--;)typeof a[e]==="number"&&(a[e]=b?Math.round(c.translate(a[e])):Math.round(d.len-d.translate(a[e])),b=!b);return a},setData:function(){g.Series.prototype.setData.apply(this,arguments);this.getBox()},translate:function(){var a=this,b=Number.MAX_VALUE,c=Number.MIN_VALUE;a.generatePoints();l(a.data,function(d){d.shapeType="path";d.shapeArgs={d:a.translatePath(d.path)};if(typeof d.y==="number")if(d.y>c)c=
23
+ d.y;else if(d.y<b)b=d.y});a.translateColors(b,c)},translateColors:function(a,b){var c=this.options,d=c.valueRanges,e=c.colorRange,f=this.colorKey,i,h;e&&(i=u(e.from),h=u(e.to));l(this.data,function(g){var k=g[f],m,l,n;if(d)for(n=d.length;n--;){if(m=d[n],i=m.from,h=m.to,(i===void 0||k>=i)&&(h===void 0||k<=h)){l=m.color;break}}else e&&k!==void 0&&(m=1-(b-k)/(b-a),l=k===null?c.nullColor:x(i,h,m));if(l)g.color=null,g.options.color=l})},drawGraph:w,drawDataLabels:w,drawPoints:function(){var a=this.xAxis,
24
+ b=this.yAxis,c=this.colorKey;l(this.data,function(a){a.plotY=1;if(a[c]===null)a[c]=0,a.isNull=!0});k.column.prototype.drawPoints.apply(this);l(this.data,function(d){var e=d.dataLabels,f=a.toPixels(d._minX,!0),g=a.toPixels(d._maxX,!0),h=b.toPixels(d._minY,!0),j=b.toPixels(d._maxY,!0);d.plotX=Math.round(f+(g-f)*n(e&&e.anchorX,0.5));d.plotY=Math.round(h+(j-h)*n(e&&e.anchorY,0.5));d.isNull&&(d[c]=null)});g.Series.prototype.drawDataLabels.call(this)},animateDrilldown:function(a){var b=this.chart.plotBox,
25
+ c=this.chart.drilldownLevels[this.chart.drilldownLevels.length-1],d=c.bBox,e=this.chart.options.drilldown.animation;if(!a)a=Math.min(d.width/b.width,d.height/b.height),c.shapeArgs={scaleX:a,scaleY:a,translateX:d.x,translateY:d.y},l(this.points,function(a){a.graphic.attr(c.shapeArgs).animate({scaleX:1,scaleY:1,translateX:0,translateY:0},e)}),delete this.animate},animateDrillupFrom:function(a){k.column.prototype.animateDrillupFrom.call(this,a)},animateDrillupTo:function(a){k.column.prototype.animateDrillupTo.call(this,
26
+ a)}});q.mapline=p(q.map,{lineWidth:1,backgroundColor:"none"});k.mapline=g.extendClass(k.map,{type:"mapline",pointAttrToOptions:{stroke:"color","stroke-width":"lineWidth",fill:"backgroundColor"},drawLegendSymbol:k.line.prototype.drawLegendSymbol});q.mappoint=p(q.scatter,{dataLabels:{enabled:!0,format:"{point.name}",color:"black",style:{textShadow:"0 0 5px white"}}});k.mappoint=g.extendClass(k.scatter,{type:"mappoint"});g.Map=function(a,b){var c={endOnTick:!1,gridLineWidth:0,labels:{enabled:!1},lineWidth:0,
27
+ minPadding:0,maxPadding:0,startOnTick:!1,tickWidth:0,title:null},d;d=a.series;a.series=null;a=p({chart:{type:"map",panning:"xy"},xAxis:c,yAxis:p(c,{reversed:!0})},a,{chart:{inverted:!1}});a.series=d;return new g.Chart(a,b)}})(Highcharts);
@@ -0,0 +1,1002 @@
1
+ /**
2
+ * @license Map plugin v0.1 for Highcharts
3
+ *
4
+ * (c) 2011-2013 Torstein Hønsi
5
+ *
6
+ * License: www.highcharts.com/license
7
+ */
8
+
9
+ /*
10
+ * See www.highcharts.com/studies/world-map.htm for use case.
11
+ *
12
+ * To do:
13
+ * - Optimize long variable names and alias adapter methods and Highcharts namespace variables
14
+ * - Zoom and pan GUI
15
+ */
16
+ (function (Highcharts) {
17
+ var UNDEFINED,
18
+ Axis = Highcharts.Axis,
19
+ Chart = Highcharts.Chart,
20
+ Point = Highcharts.Point,
21
+ Pointer = Highcharts.Pointer,
22
+ each = Highcharts.each,
23
+ extend = Highcharts.extend,
24
+ merge = Highcharts.merge,
25
+ pick = Highcharts.pick,
26
+ numberFormat = Highcharts.numberFormat,
27
+ defaultOptions = Highcharts.getOptions(),
28
+ seriesTypes = Highcharts.seriesTypes,
29
+ plotOptions = defaultOptions.plotOptions,
30
+ wrap = Highcharts.wrap,
31
+ Color = Highcharts.Color,
32
+ noop = function () {};
33
+
34
+
35
+
36
+ /*
37
+ * Return an intermediate color between two colors, according to pos where 0
38
+ * is the from color and 1 is the to color
39
+ */
40
+ function tweenColors(from, to, pos) {
41
+ var i = 4,
42
+ rgba = [];
43
+
44
+ while (i--) {
45
+ rgba[i] = Math.round(
46
+ to.rgba[i] + (from.rgba[i] - to.rgba[i]) * (1 - pos)
47
+ );
48
+ }
49
+ return 'rgba(' + rgba.join(',') + ')';
50
+ }
51
+
52
+ // Set the default map navigation options
53
+ defaultOptions.mapNavigation = {
54
+ buttonOptions: {
55
+ align: 'right',
56
+ verticalAlign: 'bottom',
57
+ x: 0,
58
+ width: 18,
59
+ height: 18,
60
+ style: {
61
+ fontSize: '15px',
62
+ fontWeight: 'bold',
63
+ textAlign: 'center'
64
+ }
65
+ },
66
+ buttons: {
67
+ zoomIn: {
68
+ onclick: function () {
69
+ this.mapZoom(0.5);
70
+ },
71
+ text: '+',
72
+ y: -32
73
+ },
74
+ zoomOut: {
75
+ onclick: function () {
76
+ this.mapZoom(2);
77
+ },
78
+ text: '-',
79
+ y: 0
80
+ }
81
+ }
82
+ // enableButtons: false,
83
+ // enableTouchZoom: false,
84
+ // zoomOnDoubleClick: false,
85
+ // zoomOnMouseWheel: false
86
+
87
+ };
88
+
89
+ /**
90
+ * Utility for reading SVG paths directly.
91
+ */
92
+ Highcharts.splitPath = function (path) {
93
+ var i;
94
+
95
+ // Move letters apart
96
+ path = path.replace(/([A-Za-z])/g, ' $1 ');
97
+ // Trim
98
+ path = path.replace(/^\s*/, "").replace(/\s*$/, "");
99
+
100
+ // Split on spaces and commas
101
+ path = path.split(/[ ,]+/);
102
+
103
+ // Parse numbers
104
+ for (i = 0; i < path.length; i++) {
105
+ if (!/[a-zA-Z]/.test(path[i])) {
106
+ path[i] = parseFloat(path[i]);
107
+ }
108
+ }
109
+ return path;
110
+ };
111
+
112
+ // A placeholder for map definitions
113
+ Highcharts.maps = {};
114
+
115
+ /**
116
+ * Override to use the extreme coordinates from the SVG shape, not the
117
+ * data values
118
+ */
119
+ wrap(Axis.prototype, 'getSeriesExtremes', function (proceed) {
120
+ var isXAxis = this.isXAxis,
121
+ dataMin,
122
+ dataMax,
123
+ xData = [];
124
+
125
+ // Remove the xData array and cache it locally so that the proceed method doesn't use it
126
+ each(this.series, function (series, i) {
127
+ if (series.useMapGeometry) {
128
+ xData[i] = series.xData;
129
+ series.xData = [];
130
+ }
131
+ });
132
+
133
+ // Call base to reach normal cartesian series (like mappoint)
134
+ proceed.call(this);
135
+
136
+ // Run extremes logic for map and mapline
137
+ dataMin = pick(this.dataMin, Number.MAX_VALUE);
138
+ dataMax = pick(this.dataMax, Number.MIN_VALUE);
139
+ each(this.series, function (series, i) {
140
+ if (series.useMapGeometry) {
141
+ dataMin = Math.min(dataMin, series[isXAxis ? 'minX' : 'minY']);
142
+ dataMax = Math.max(dataMax, series[isXAxis ? 'maxX' : 'maxY']);
143
+ series.xData = xData[i]; // Reset xData array
144
+ }
145
+ });
146
+
147
+ this.dataMin = dataMin;
148
+ this.dataMax = dataMax;
149
+ });
150
+
151
+ /**
152
+ * Override axis translation to make sure the aspect ratio is always kept
153
+ */
154
+ wrap(Axis.prototype, 'setAxisTranslation', function (proceed) {
155
+ var chart = this.chart,
156
+ mapRatio,
157
+ plotRatio = chart.plotWidth / chart.plotHeight,
158
+ isXAxis = this.isXAxis,
159
+ adjustedAxisLength,
160
+ xAxis = chart.xAxis[0],
161
+ padAxis;
162
+
163
+ // Run the parent method
164
+ proceed.call(this);
165
+
166
+ // On Y axis, handle both
167
+ if (chart.options.chart.type === 'map' && !isXAxis && xAxis.transA !== UNDEFINED) {
168
+
169
+ // Use the same translation for both axes
170
+ this.transA = xAxis.transA = Math.min(this.transA, xAxis.transA);
171
+
172
+ mapRatio = (xAxis.max - xAxis.min) / (this.max - this.min);
173
+
174
+ // What axis to pad to put the map in the middle
175
+ padAxis = mapRatio > plotRatio ? this : xAxis;
176
+
177
+ // Pad it
178
+ adjustedAxisLength = (padAxis.max - padAxis.min) * padAxis.transA;
179
+ padAxis.minPixelPadding = (padAxis.len - adjustedAxisLength) / 2;
180
+ }
181
+ });
182
+
183
+
184
+ //--- Start zooming and panning features
185
+
186
+ wrap(Chart.prototype, 'render', function (proceed) {
187
+ var chart = this,
188
+ mapNavigation = chart.options.mapNavigation;
189
+
190
+ proceed.call(chart);
191
+
192
+ // Render the plus and minus buttons
193
+ chart.renderMapNavigation();
194
+
195
+ // Add the double click event
196
+ if (mapNavigation.zoomOnDoubleClick) {
197
+ Highcharts.addEvent(chart.container, 'dblclick', function (e) {
198
+ chart.pointer.onContainerDblClick(e);
199
+ });
200
+ }
201
+
202
+ // Add the mousewheel event
203
+ if (mapNavigation.zoomOnMouseWheel) {
204
+ Highcharts.addEvent(chart.container, document.onmousewheel === undefined ? 'DOMMouseScroll' : 'mousewheel', function (e) {
205
+ chart.pointer.onContainerMouseWheel(e);
206
+ });
207
+ }
208
+ });
209
+
210
+ // Extend the Pointer
211
+ extend(Pointer.prototype, {
212
+
213
+ /**
214
+ * The event handler for the doubleclick event
215
+ */
216
+ onContainerDblClick: function (e) {
217
+ var chart = this.chart;
218
+
219
+ e = this.normalize(e);
220
+
221
+ if (chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) {
222
+ chart.mapZoom(
223
+ 0.5,
224
+ chart.xAxis[0].toValue(e.chartX),
225
+ chart.yAxis[0].toValue(e.chartY)
226
+ );
227
+ }
228
+ },
229
+
230
+ /**
231
+ * The event handler for the mouse scroll event
232
+ */
233
+ onContainerMouseWheel: function (e) {
234
+ var chart = this.chart,
235
+ delta;
236
+
237
+ e = this.normalize(e);
238
+
239
+ // Firefox uses e.detail, WebKit and IE uses wheelDelta
240
+ delta = e.detail || -(e.wheelDelta / 120);
241
+ if (chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) {
242
+ chart.mapZoom(
243
+ delta > 0 ? 2 : 0.5,
244
+ chart.xAxis[0].toValue(e.chartX),
245
+ chart.yAxis[0].toValue(e.chartY)
246
+ );
247
+ }
248
+ }
249
+ });
250
+ // Implement the pinchType option
251
+ wrap(Pointer.prototype, 'init', function (proceed, chart, options) {
252
+
253
+ proceed.call(this, chart, options);
254
+
255
+ // Pinch status
256
+ if (options.mapNavigation.enableTouchZoom) {
257
+ this.pinchX = this.pinchHor =
258
+ this.pinchY = this.pinchVert = true;
259
+ }
260
+ });
261
+
262
+ // Add events to the Chart object itself
263
+ extend(Chart.prototype, {
264
+ renderMapNavigation: function () {
265
+ var chart = this,
266
+ options = this.options.mapNavigation,
267
+ buttons = options.buttons,
268
+ n,
269
+ button,
270
+ buttonOptions,
271
+ outerHandler = function () {
272
+ this.handler.call(chart);
273
+ };
274
+
275
+ if (options.enableButtons) {
276
+ for (n in buttons) {
277
+ if (buttons.hasOwnProperty(n)) {
278
+ buttonOptions = merge(options.buttonOptions, buttons[n]);
279
+
280
+ button = chart.renderer.button(buttonOptions.text, 0, 0, outerHandler)
281
+ .attr({
282
+ width: buttonOptions.width,
283
+ height: buttonOptions.height
284
+ })
285
+ .css(buttonOptions.style)
286
+ .add();
287
+ button.handler = buttonOptions.onclick;
288
+ button.align(extend(buttonOptions, { width: button.width, height: button.height }), null, 'spacingBox');
289
+ }
290
+ }
291
+ }
292
+ },
293
+
294
+ /**
295
+ * Fit an inner box to an outer. If the inner box overflows left or right, align it to the sides of the
296
+ * outer. If it overflows both sides, fit it within the outer. This is a pattern that occurs more places
297
+ * in Highcharts, perhaps it should be elevated to a common utility function.
298
+ */
299
+ fitToBox: function (inner, outer) {
300
+ each([['x', 'width'], ['y', 'height']], function (dim) {
301
+ var pos = dim[0],
302
+ size = dim[1];
303
+ if (inner[pos] + inner[size] > outer[pos] + outer[size]) { // right overflow
304
+ if (inner[size] > outer[size]) { // the general size is greater, fit fully to outer
305
+ inner[size] = outer[size];
306
+ inner[pos] = outer[pos];
307
+ } else { // align right
308
+ inner[pos] = outer[pos] + outer[size] - inner[size];
309
+ }
310
+ }
311
+ if (inner[size] > outer[size]) {
312
+ inner[size] = outer[size];
313
+ }
314
+ if (inner[pos] < outer[pos]) {
315
+ inner[pos] = outer[pos];
316
+ }
317
+
318
+ });
319
+
320
+ return inner;
321
+ },
322
+
323
+ /**
324
+ * Zoom the map in or out by a certain amount. Less than 1 zooms in, greater than 1 zooms out.
325
+ */
326
+ mapZoom: function (howMuch, centerXArg, centerYArg) {
327
+
328
+ if (this.isMapZooming) {
329
+ return;
330
+ }
331
+
332
+ var chart = this,
333
+ xAxis = chart.xAxis[0],
334
+ xRange = xAxis.max - xAxis.min,
335
+ centerX = pick(centerXArg, xAxis.min + xRange / 2),
336
+ newXRange = xRange * howMuch,
337
+ yAxis = chart.yAxis[0],
338
+ yRange = yAxis.max - yAxis.min,
339
+ centerY = pick(centerYArg, yAxis.min + yRange / 2),
340
+ newYRange = yRange * howMuch,
341
+ newXMin = centerX - newXRange / 2,
342
+ newYMin = centerY - newYRange / 2,
343
+ animation = pick(chart.options.chart.animation, true),
344
+ delay,
345
+ newExt = chart.fitToBox({
346
+ x: newXMin,
347
+ y: newYMin,
348
+ width: newXRange,
349
+ height: newYRange
350
+ }, {
351
+ x: xAxis.dataMin,
352
+ y: yAxis.dataMin,
353
+ width: xAxis.dataMax - xAxis.dataMin,
354
+ height: yAxis.dataMax - yAxis.dataMin
355
+ });
356
+
357
+ xAxis.setExtremes(newExt.x, newExt.x + newExt.width, false);
358
+ yAxis.setExtremes(newExt.y, newExt.y + newExt.height, false);
359
+
360
+ // Prevent zooming until this one is finished animating
361
+ delay = animation ? animation.duration || 500 : 0;
362
+ if (delay) {
363
+ chart.isMapZooming = true;
364
+ setTimeout(function () {
365
+ chart.isMapZooming = false;
366
+ }, delay);
367
+ }
368
+
369
+ chart.redraw();
370
+ }
371
+ });
372
+
373
+ /**
374
+ * Extend the default options with map options
375
+ */
376
+ plotOptions.map = merge(plotOptions.scatter, {
377
+ animation: false, // makes the complex shapes slow
378
+ nullColor: '#F8F8F8',
379
+ borderColor: 'silver',
380
+ borderWidth: 1,
381
+ marker: null,
382
+ stickyTracking: false,
383
+ dataLabels: {
384
+ verticalAlign: 'middle'
385
+ },
386
+ turboThreshold: 0,
387
+ tooltip: {
388
+ followPointer: true,
389
+ pointFormat: '{point.name}: {point.y}<br/>'
390
+ },
391
+ states: {
392
+ normal: {
393
+ animation: true
394
+ }
395
+ }
396
+ });
397
+
398
+ var MapAreaPoint = Highcharts.extendClass(Point, {
399
+ /**
400
+ * Extend the Point object to split paths
401
+ */
402
+ applyOptions: function (options, x) {
403
+
404
+ var point = Point.prototype.applyOptions.call(this, options, x);
405
+
406
+ if (point.path && typeof point.path === 'string') {
407
+ point.path = point.options.path = Highcharts.splitPath(point.path);
408
+ }
409
+
410
+ return point;
411
+ },
412
+ /**
413
+ * Stop the fade-out
414
+ */
415
+ onMouseOver: function () {
416
+ clearTimeout(this.colorInterval);
417
+ Point.prototype.onMouseOver.call(this);
418
+ },
419
+ /**
420
+ * Custom animation for tweening out the colors. Animation reduces blinking when hovering
421
+ * over islands and coast lines. We run a custom implementation of animation becuase we
422
+ * need to be able to run this independently from other animations like zoom redraw. Also,
423
+ * adding color animation to the adapters would introduce almost the same amount of code.
424
+ */
425
+ onMouseOut: function () {
426
+ var point = this,
427
+ start = +new Date(),
428
+ normalColor = Color(point.options.color),
429
+ hoverColor = Color(point.pointAttr.hover.fill),
430
+ animation = point.series.options.states.normal.animation,
431
+ duration = animation && (animation.duration || 500);
432
+
433
+ if (duration && normalColor.rgba.length === 4 && hoverColor.rgba.length === 4) {
434
+ delete point.pointAttr[''].fill; // avoid resetting it in Point.setState
435
+
436
+ clearTimeout(point.colorInterval);
437
+ point.colorInterval = setInterval(function () {
438
+ var pos = (new Date() - start) / duration,
439
+ graphic = point.graphic;
440
+ if (pos > 1) {
441
+ pos = 1;
442
+ }
443
+ if (graphic) {
444
+ graphic.attr('fill', tweenColors(hoverColor, normalColor, pos));
445
+ }
446
+ if (pos >= 1) {
447
+ clearTimeout(point.colorInterval);
448
+ }
449
+ }, 13);
450
+ }
451
+ Point.prototype.onMouseOut.call(point);
452
+ }
453
+ });
454
+
455
+ /**
456
+ * Add the series type
457
+ */
458
+ seriesTypes.map = Highcharts.extendClass(seriesTypes.scatter, {
459
+ type: 'map',
460
+ pointAttrToOptions: { // mapping between SVG attributes and the corresponding options
461
+ stroke: 'borderColor',
462
+ 'stroke-width': 'borderWidth',
463
+ fill: 'color'
464
+ },
465
+ colorKey: 'y',
466
+ pointClass: MapAreaPoint,
467
+ trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'],
468
+ getSymbol: noop,
469
+ supportsDrilldown: true,
470
+ getExtremesFromAll: true,
471
+ useMapGeometry: true, // get axis extremes from paths, not values
472
+ init: function (chart) {
473
+ var series = this,
474
+ valueDecimals = chart.options.legend.valueDecimals,
475
+ legendItems = [],
476
+ name,
477
+ from,
478
+ to,
479
+ fromLabel,
480
+ toLabel,
481
+ colorRange,
482
+ valueRanges,
483
+ gradientColor,
484
+ grad,
485
+ tmpLabel,
486
+ horizontal = chart.options.legend.layout === 'horizontal';
487
+
488
+
489
+ Highcharts.Series.prototype.init.apply(this, arguments);
490
+ colorRange = series.options.colorRange;
491
+ valueRanges = series.options.valueRanges;
492
+
493
+ if (valueRanges) {
494
+ each(valueRanges, function (range) {
495
+ from = range.from;
496
+ to = range.to;
497
+
498
+ // Assemble the default name. This can be overridden by legend.options.labelFormatter
499
+ name = '';
500
+ if (from === UNDEFINED) {
501
+ name = '< ';
502
+ } else if (to === UNDEFINED) {
503
+ name = '> ';
504
+ }
505
+ if (from !== UNDEFINED) {
506
+ name += numberFormat(from, valueDecimals);
507
+ }
508
+ if (from !== UNDEFINED && to !== UNDEFINED) {
509
+ name += ' - ';
510
+ }
511
+ if (to !== UNDEFINED) {
512
+ name += numberFormat(to, valueDecimals);
513
+ }
514
+
515
+ // Add a mock object to the legend items
516
+ legendItems.push(Highcharts.extend({
517
+ chart: series.chart,
518
+ name: name,
519
+ options: {},
520
+ drawLegendSymbol: seriesTypes.area.prototype.drawLegendSymbol,
521
+ visible: true,
522
+ setState: function () {},
523
+ setVisible: function () {}
524
+ }, range));
525
+ });
526
+ series.legendItems = legendItems;
527
+
528
+ } else if (colorRange) {
529
+
530
+ from = colorRange.from;
531
+ to = colorRange.to;
532
+ fromLabel = colorRange.fromLabel;
533
+ toLabel = colorRange.toLabel;
534
+
535
+ // Flips linearGradient variables and label text.
536
+ grad = horizontal ? [0, 0, 1, 0] : [0, 1, 0, 0];
537
+ if (!horizontal) {
538
+ tmpLabel = fromLabel;
539
+ fromLabel = toLabel;
540
+ toLabel = tmpLabel;
541
+ }
542
+
543
+ // Creates color gradient.
544
+ gradientColor = {
545
+ linearGradient: { x1: grad[0], y1: grad[1], x2: grad[2], y2: grad[3] },
546
+ stops:
547
+ [
548
+ [0, from],
549
+ [1, to]
550
+ ]
551
+ };
552
+
553
+ // Add a mock object to the legend items.
554
+ legendItems = [{
555
+ chart: series.chart,
556
+ options: {},
557
+ fromLabel: fromLabel,
558
+ toLabel: toLabel,
559
+ color: gradientColor,
560
+ drawLegendSymbol: this.drawLegendSymbolGradient,
561
+ visible: true,
562
+ setState: function () {},
563
+ setVisible: function () {}
564
+ }];
565
+
566
+ series.legendItems = legendItems;
567
+ }
568
+ },
569
+
570
+ /**
571
+ * If neither valueRanges nor colorRanges are defined, use basic area symbol.
572
+ */
573
+ drawLegendSymbol: seriesTypes.area.prototype.drawLegendSymbol,
574
+
575
+ /**
576
+ * Gets the series' symbol in the legend and extended legend with more information.
577
+ *
578
+ * @param {Object} legend The legend object
579
+ * @param {Object} item The series (this) or point
580
+ */
581
+ drawLegendSymbolGradient: function (legend, item) {
582
+ var spacing = legend.options.symbolPadding,
583
+ padding = pick(legend.options.padding, 8),
584
+ positionY,
585
+ positionX,
586
+ gradientSize = this.chart.renderer.fontMetrics(legend.options.itemStyle.fontSize).h,
587
+ horizontal = legend.options.layout === 'horizontal',
588
+ box1,
589
+ box2,
590
+ box3,
591
+ rectangleLength = pick(legend.options.rectangleLength, 200);
592
+
593
+ // Set local variables based on option.
594
+ if (horizontal) {
595
+ positionY = -(spacing / 2);
596
+ positionX = 0;
597
+ } else {
598
+ positionY = -rectangleLength + legend.baseline - (spacing / 2);
599
+ positionX = padding + gradientSize;
600
+ }
601
+
602
+ // Creates the from text.
603
+ item.fromText = this.chart.renderer.text(
604
+ item.fromLabel, // Text.
605
+ positionX, // Lower left x.
606
+ positionY // Lower left y.
607
+ ).attr({
608
+ zIndex: 2
609
+ }).add(item.legendGroup);
610
+ box1 = item.fromText.getBBox();
611
+
612
+ // Creates legend symbol.
613
+ // Ternary changes variables based on option.
614
+ item.legendSymbol = this.chart.renderer.rect(
615
+ horizontal ? box1.x + box1.width + spacing : box1.x - gradientSize - spacing, // Upper left x.
616
+ box1.y, // Upper left y.
617
+ horizontal ? rectangleLength : gradientSize, // Width.
618
+ horizontal ? gradientSize : rectangleLength, // Height.
619
+ 2 // Corner radius.
620
+ ).attr({
621
+ zIndex: 1
622
+ }).add(item.legendGroup);
623
+ box2 = item.legendSymbol.getBBox();
624
+
625
+ // Creates the to text.
626
+ // Vertical coordinate changed based on option.
627
+ item.toText = this.chart.renderer.text(
628
+ item.toLabel,
629
+ box2.x + box2.width + spacing,
630
+ horizontal ? positionY : box2.y + box2.height - spacing
631
+ ).attr({
632
+ zIndex: 2
633
+ }).add(item.legendGroup);
634
+ box3 = item.toText.getBBox();
635
+
636
+ // Changes legend box settings based on option.
637
+ if (horizontal) {
638
+ legend.offsetWidth = box1.width + box2.width + box3.width + (spacing * 2) + padding;
639
+ legend.itemY = gradientSize + padding;
640
+ } else {
641
+ legend.offsetWidth = Math.max(box1.width, box3.width) + (spacing) + box2.width + padding;
642
+ legend.itemY = box2.height + padding;
643
+ legend.itemX = spacing;
644
+ }
645
+ },
646
+
647
+ /**
648
+ * Get the bounding box of all paths in the map combined.
649
+ */
650
+ getBox: function (paths) {
651
+ var maxX = Number.MIN_VALUE,
652
+ minX = Number.MAX_VALUE,
653
+ maxY = Number.MIN_VALUE,
654
+ minY = Number.MAX_VALUE;
655
+
656
+
657
+ // Find the bounding box
658
+ each(paths || this.options.data, function (point) {
659
+ var path = point.path,
660
+ i = path.length,
661
+ even = false, // while loop reads from the end
662
+ pointMaxX = Number.MIN_VALUE,
663
+ pointMinX = Number.MAX_VALUE,
664
+ pointMaxY = Number.MIN_VALUE,
665
+ pointMinY = Number.MAX_VALUE;
666
+
667
+ while (i--) {
668
+ if (typeof path[i] === 'number' && !isNaN(path[i])) {
669
+ if (even) { // even = x
670
+ pointMaxX = Math.max(pointMaxX, path[i]);
671
+ pointMinX = Math.min(pointMinX, path[i]);
672
+ } else { // odd = Y
673
+ pointMaxY = Math.max(pointMaxY, path[i]);
674
+ pointMinY = Math.min(pointMinY, path[i]);
675
+ }
676
+ even = !even;
677
+ }
678
+ }
679
+ // Cache point bounding box for use to position data labels
680
+ point._maxX = pointMaxX;
681
+ point._minX = pointMinX;
682
+ point._maxY = pointMaxY;
683
+ point._minY = pointMinY;
684
+
685
+ maxX = Math.max(maxX, pointMaxX);
686
+ minX = Math.min(minX, pointMinX);
687
+ maxY = Math.max(maxY, pointMaxY);
688
+ minY = Math.min(minY, pointMinY);
689
+ });
690
+ this.minY = minY;
691
+ this.maxY = maxY;
692
+ this.minX = minX;
693
+ this.maxX = maxX;
694
+
695
+ },
696
+
697
+
698
+
699
+ /**
700
+ * Translate the path so that it automatically fits into the plot area box
701
+ * @param {Object} path
702
+ */
703
+ translatePath: function (path) {
704
+
705
+ var series = this,
706
+ even = false, // while loop reads from the end
707
+ xAxis = series.xAxis,
708
+ yAxis = series.yAxis,
709
+ i;
710
+
711
+ // Preserve the original
712
+ path = [].concat(path);
713
+
714
+ // Do the translation
715
+ i = path.length;
716
+ while (i--) {
717
+ if (typeof path[i] === 'number') {
718
+ if (even) { // even = x
719
+ path[i] = Math.round(xAxis.translate(path[i]));
720
+ } else { // odd = Y
721
+ path[i] = Math.round(yAxis.len - yAxis.translate(path[i]));
722
+ }
723
+ even = !even;
724
+ }
725
+ }
726
+ return path;
727
+ },
728
+
729
+ setData: function () {
730
+ Highcharts.Series.prototype.setData.apply(this, arguments);
731
+ this.getBox();
732
+ },
733
+
734
+ /**
735
+ * Add the path option for data points. Find the max value for color calculation.
736
+ */
737
+ translate: function () {
738
+ var series = this,
739
+ dataMin = Number.MAX_VALUE,
740
+ dataMax = Number.MIN_VALUE;
741
+
742
+ series.generatePoints();
743
+
744
+ each(series.data, function (point) {
745
+
746
+ point.shapeType = 'path';
747
+ point.shapeArgs = {
748
+ d: series.translatePath(point.path)
749
+ };
750
+
751
+ // TODO: do point colors in drawPoints instead of point.init
752
+ if (typeof point.y === 'number') {
753
+ if (point.y > dataMax) {
754
+ dataMax = point.y;
755
+ } else if (point.y < dataMin) {
756
+ dataMin = point.y;
757
+ }
758
+ }
759
+ });
760
+
761
+ series.translateColors(dataMin, dataMax);
762
+ },
763
+
764
+ /**
765
+ * In choropleth maps, the color is a result of the value, so this needs translation too
766
+ */
767
+ translateColors: function (dataMin, dataMax) {
768
+
769
+ var seriesOptions = this.options,
770
+ valueRanges = seriesOptions.valueRanges,
771
+ colorRange = seriesOptions.colorRange,
772
+ colorKey = this.colorKey,
773
+ from,
774
+ to;
775
+
776
+ if (colorRange) {
777
+ from = Color(colorRange.from);
778
+ to = Color(colorRange.to);
779
+ }
780
+
781
+ each(this.data, function (point) {
782
+ var value = point[colorKey],
783
+ range,
784
+ color,
785
+ i,
786
+ pos;
787
+
788
+ if (valueRanges) {
789
+ i = valueRanges.length;
790
+ while (i--) {
791
+ range = valueRanges[i];
792
+ from = range.from;
793
+ to = range.to;
794
+ if ((from === UNDEFINED || value >= from) && (to === UNDEFINED || value <= to)) {
795
+ color = range.color;
796
+ break;
797
+ }
798
+
799
+ }
800
+ } else if (colorRange && value !== undefined) {
801
+
802
+ pos = 1 - ((dataMax - value) / (dataMax - dataMin));
803
+ color = value === null ? seriesOptions.nullColor : tweenColors(from, to, pos);
804
+ }
805
+
806
+ if (color) {
807
+ point.color = null; // reset from previous drilldowns, use of the same data options
808
+ point.options.color = color;
809
+ }
810
+ });
811
+ },
812
+
813
+ drawGraph: noop,
814
+
815
+ /**
816
+ * We need the points' bounding boxes in order to draw the data labels, so
817
+ * we skip it now and call if from drawPoints instead.
818
+ */
819
+ drawDataLabels: noop,
820
+
821
+ /**
822
+ * Use the drawPoints method of column, that is able to handle simple shapeArgs.
823
+ * Extend it by assigning the tooltip position.
824
+ */
825
+ drawPoints: function () {
826
+ var series = this,
827
+ xAxis = series.xAxis,
828
+ yAxis = series.yAxis,
829
+ colorKey = series.colorKey;
830
+
831
+ // Make points pass test in drawing
832
+ each(series.data, function (point) {
833
+ point.plotY = 1; // pass null test in column.drawPoints
834
+ if (point[colorKey] === null) {
835
+ point[colorKey] = 0;
836
+ point.isNull = true;
837
+ }
838
+ });
839
+
840
+ // Draw them
841
+ seriesTypes.column.prototype.drawPoints.apply(series);
842
+
843
+ each(series.data, function (point) {
844
+
845
+ var dataLabels = point.dataLabels,
846
+ minX = xAxis.toPixels(point._minX, true),
847
+ maxX = xAxis.toPixels(point._maxX, true),
848
+ minY = yAxis.toPixels(point._minY, true),
849
+ maxY = yAxis.toPixels(point._maxY, true);
850
+
851
+ point.plotX = Math.round(minX + (maxX - minX) * pick(dataLabels && dataLabels.anchorX, 0.5));
852
+ point.plotY = Math.round(minY + (maxY - minY) * pick(dataLabels && dataLabels.anchorY, 0.5));
853
+
854
+
855
+ // Reset escaped null points
856
+ if (point.isNull) {
857
+ point[colorKey] = null;
858
+ }
859
+ });
860
+
861
+ // Now draw the data labels
862
+ Highcharts.Series.prototype.drawDataLabels.call(series);
863
+
864
+ },
865
+
866
+ /**
867
+ * Animate in the new series from the clicked point in the old series.
868
+ * Depends on the drilldown.js module
869
+ */
870
+ animateDrilldown: function (init) {
871
+ var toBox = this.chart.plotBox,
872
+ level = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1],
873
+ fromBox = level.bBox,
874
+ animationOptions = this.chart.options.drilldown.animation,
875
+ scale;
876
+
877
+ if (!init) {
878
+
879
+ scale = Math.min(fromBox.width / toBox.width, fromBox.height / toBox.height);
880
+ level.shapeArgs = {
881
+ scaleX: scale,
882
+ scaleY: scale,
883
+ translateX: fromBox.x,
884
+ translateY: fromBox.y
885
+ };
886
+
887
+ // TODO: Animate this.group instead
888
+ each(this.points, function (point) {
889
+
890
+ point.graphic
891
+ .attr(level.shapeArgs)
892
+ .animate({
893
+ scaleX: 1,
894
+ scaleY: 1,
895
+ translateX: 0,
896
+ translateY: 0
897
+ }, animationOptions);
898
+
899
+ });
900
+
901
+ delete this.animate;
902
+ }
903
+
904
+ },
905
+
906
+ /**
907
+ * When drilling up, pull out the individual point graphics from the lower series
908
+ * and animate them into the origin point in the upper series.
909
+ */
910
+ animateDrillupFrom: function (level) {
911
+ seriesTypes.column.prototype.animateDrillupFrom.call(this, level);
912
+ },
913
+
914
+
915
+ /**
916
+ * When drilling up, keep the upper series invisible until the lower series has
917
+ * moved into place
918
+ */
919
+ animateDrillupTo: function (init) {
920
+ seriesTypes.column.prototype.animateDrillupTo.call(this, init);
921
+ }
922
+ });
923
+
924
+
925
+ // The mapline series type
926
+ plotOptions.mapline = merge(plotOptions.map, {
927
+ lineWidth: 1,
928
+ backgroundColor: 'none'
929
+ });
930
+ seriesTypes.mapline = Highcharts.extendClass(seriesTypes.map, {
931
+ type: 'mapline',
932
+ pointAttrToOptions: { // mapping between SVG attributes and the corresponding options
933
+ stroke: 'color',
934
+ 'stroke-width': 'lineWidth',
935
+ fill: 'backgroundColor'
936
+ },
937
+ drawLegendSymbol: seriesTypes.line.prototype.drawLegendSymbol
938
+ });
939
+
940
+ // The mappoint series type
941
+ plotOptions.mappoint = merge(plotOptions.scatter, {
942
+ dataLabels: {
943
+ enabled: true,
944
+ format: '{point.name}',
945
+ color: 'black',
946
+ style: {
947
+ textShadow: '0 0 5px white'
948
+ }
949
+ }
950
+ });
951
+ seriesTypes.mappoint = Highcharts.extendClass(seriesTypes.scatter, {
952
+ type: 'mappoint'
953
+ });
954
+
955
+
956
+
957
+ /**
958
+ * A wrapper for Chart with all the default values for a Map
959
+ */
960
+ Highcharts.Map = function (options, callback) {
961
+
962
+ var hiddenAxis = {
963
+ endOnTick: false,
964
+ gridLineWidth: 0,
965
+ labels: {
966
+ enabled: false
967
+ },
968
+ lineWidth: 0,
969
+ minPadding: 0,
970
+ maxPadding: 0,
971
+ startOnTick: false,
972
+ tickWidth: 0,
973
+ title: null
974
+ },
975
+ seriesOptions;
976
+
977
+ // Don't merge the data
978
+ seriesOptions = options.series;
979
+ options.series = null;
980
+
981
+ options = merge({
982
+ chart: {
983
+ type: 'map',
984
+ panning: 'xy'
985
+ },
986
+ xAxis: hiddenAxis,
987
+ yAxis: merge(hiddenAxis, { reversed: true })
988
+ },
989
+ options, // user's options
990
+
991
+ { // forced options
992
+ chart: {
993
+ inverted: false
994
+ }
995
+ });
996
+
997
+ options.series = seriesOptions;
998
+
999
+
1000
+ return new Highcharts.Chart(options, callback);
1001
+ };
1002
+ }(Highcharts));