compass-jquery-plugin 0.3.2.8 → 0.3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (542) hide show
  1. data/README.md +24 -6
  2. data/VERSION.yml +3 -3
  3. data/lib/jquery/gridify/grid_column.rb +6 -6
  4. data/lib/jquery/gridify/grid_options.rb +4 -4
  5. data/lib/jquery/mark_it_up.rb +2 -0
  6. data/lib/jquery/mobile.rb +0 -1
  7. data/templates/dynatree/jquery.dynatree.js +2896 -2880
  8. data/templates/dynatree/jquery.dynatree.min.js +55 -54
  9. data/templates/dynatree/jquery/dynatree/aero.scss +4 -2
  10. data/templates/dynatree/jquery/dynatree/aqua.scss +4 -2
  11. data/templates/dynatree/jquery/dynatree/crystal.scss +4 -2
  12. data/templates/dynatree/jquery/dynatree/xp.scss +5 -3
  13. data/templates/emulators/emulators/bb.playbook.landscape.png +0 -0
  14. data/templates/emulators/emulators/bb.playbook.landscape.scss +18 -0
  15. data/templates/emulators/emulators/bb.playbook.portrait.png +0 -0
  16. data/templates/emulators/emulators/bb.playbook.portrait.scss +18 -0
  17. data/templates/emulators/emulators/{blackberry.torch.landscape.png → bb.torch.landscape.png} +0 -0
  18. data/templates/emulators/emulators/{blackberry.torch.landscape.scss → bb.torch.landscape.scss} +1 -3
  19. data/templates/emulators/emulators/{blackberry.torch.portrait.png → bb.torch.portrait.png} +0 -0
  20. data/templates/emulators/emulators/{blackberry.torch.portrait.scss → bb.torch.portrait.scss} +1 -3
  21. data/templates/emulators/emulators/galaxy.ace.landscape.png +0 -0
  22. data/templates/emulators/emulators/galaxy.ace.landscape.scss +18 -0
  23. data/templates/emulators/emulators/galaxy.ace.portrait.png +0 -0
  24. data/templates/emulators/emulators/galaxy.ace.portrait.scss +18 -0
  25. data/templates/emulators/emulators/galaxy.s.landscape.scss +0 -2
  26. data/templates/emulators/emulators/galaxy.s.portrait.scss +0 -2
  27. data/templates/emulators/emulators/galaxy.s2.landscape.scss +0 -2
  28. data/templates/emulators/emulators/galaxy.s2.portrait.scss +0 -2
  29. data/templates/emulators/emulators/galaxy.tab.10.1.landscape.scss +0 -2
  30. data/templates/emulators/emulators/galaxy.tab.10.1.portrait.scss +0 -2
  31. data/templates/emulators/emulators/galaxy.tab.7.landscape.scss +0 -2
  32. data/templates/emulators/emulators/galaxy.tab.7.portrait.scss +0 -2
  33. data/templates/emulators/emulators/galaxy.tab.8.9.landscape.scss +0 -2
  34. data/templates/emulators/emulators/galaxy.tab.8.9.portrait.scss +0 -2
  35. data/templates/emulators/emulators/htc.sensation.landscape.png +0 -0
  36. data/templates/emulators/emulators/htc.sensation.landscape.scss +18 -0
  37. data/templates/emulators/emulators/htc.sensation.portrait.png +0 -0
  38. data/templates/emulators/emulators/htc.sensation.portrait.scss +18 -0
  39. data/templates/emulators/emulators/ipad.landscape.scss +0 -2
  40. data/templates/emulators/emulators/ipad.portrait.scss +0 -2
  41. data/templates/emulators/emulators/iphone.3.landscape.scss +0 -2
  42. data/templates/emulators/emulators/iphone.3.portrait.scss +0 -2
  43. data/templates/emulators/emulators/{iphone.4.landscape .scss → iphone.4.landscape.scss} +0 -2
  44. data/templates/emulators/emulators/iphone.4.portrait.scss +0 -2
  45. data/templates/emulators/emulators/palm.pre.2.landscape.scss +0 -2
  46. data/templates/emulators/emulators/palm.pre.2.portrait.scss +0 -2
  47. data/templates/emulators/manifest.rb +17 -5
  48. data/templates/graphics/highcharts/dark-blue.js +159 -159
  49. data/templates/graphics/highcharts/dark-green.js +159 -159
  50. data/templates/graphics/highcharts/gray.js +154 -154
  51. data/templates/graphics/highcharts/grid.js +84 -84
  52. data/templates/graphics/highcharts/highslide-config.js +2 -2
  53. data/templates/graphics/highcharts/highslide-full.js +3310 -3310
  54. data/templates/graphics/highcharts/skies.js +72 -72
  55. data/templates/graphics/jquery.ganttView.js +1550 -1550
  56. data/templates/graphics/jquery.highcharts.js +11277 -11285
  57. data/templates/graphics/jquery.sparkline.js +1072 -1072
  58. data/templates/ical/jquery.ical.js +7637 -7637
  59. data/templates/ical/jquery/ical.print.scss +3 -3
  60. data/templates/jqgrid/i18n/jqgrid/locale-ar.js +127 -127
  61. data/templates/jqgrid/i18n/jqgrid/locale-bg.js +131 -131
  62. data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +131 -131
  63. data/templates/jqgrid/i18n/jqgrid/locale-cat.js +128 -128
  64. data/templates/jqgrid/i18n/jqgrid/locale-cn.js +132 -132
  65. data/templates/jqgrid/i18n/jqgrid/locale-cs.js +129 -129
  66. data/templates/jqgrid/i18n/jqgrid/locale-da.js +128 -128
  67. data/templates/jqgrid/i18n/jqgrid/locale-de.js +134 -134
  68. data/templates/jqgrid/i18n/jqgrid/locale-el.js +127 -127
  69. data/templates/jqgrid/i18n/jqgrid/locale-en.js +128 -128
  70. data/templates/jqgrid/i18n/jqgrid/locale-es.js +129 -129
  71. data/templates/jqgrid/i18n/jqgrid/locale-fa.js +141 -141
  72. data/templates/jqgrid/i18n/jqgrid/locale-fi.js +128 -128
  73. data/templates/jqgrid/i18n/jqgrid/locale-fr.js +127 -127
  74. data/templates/jqgrid/i18n/jqgrid/locale-gl.js +127 -127
  75. data/templates/jqgrid/i18n/jqgrid/locale-he.js +128 -128
  76. data/templates/jqgrid/i18n/jqgrid/locale-hu.js +128 -128
  77. data/templates/jqgrid/i18n/jqgrid/locale-is.js +127 -127
  78. data/templates/jqgrid/i18n/jqgrid/locale-it.js +6 -6
  79. data/templates/jqgrid/i18n/jqgrid/locale-ja.js +153 -153
  80. data/templates/jqgrid/i18n/jqgrid/locale-lt.js +128 -128
  81. data/templates/jqgrid/i18n/jqgrid/locale-mne.js +134 -0
  82. data/templates/jqgrid/i18n/jqgrid/locale-mne.min.js +7 -0
  83. data/templates/jqgrid/i18n/jqgrid/locale-nl.js +145 -145
  84. data/templates/jqgrid/i18n/jqgrid/locale-no.js +12 -12
  85. data/templates/jqgrid/i18n/jqgrid/locale-pl.js +128 -128
  86. data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +128 -128
  87. data/templates/jqgrid/i18n/jqgrid/locale-pt.js +126 -126
  88. data/templates/jqgrid/i18n/jqgrid/locale-ro.js +140 -140
  89. data/templates/jqgrid/i18n/jqgrid/locale-ru.js +128 -128
  90. data/templates/jqgrid/i18n/jqgrid/locale-sk.js +128 -128
  91. data/templates/jqgrid/i18n/jqgrid/locale-sr.js +128 -128
  92. data/templates/jqgrid/i18n/jqgrid/locale-sv.js +128 -128
  93. data/templates/jqgrid/i18n/jqgrid/locale-tr.js +127 -127
  94. data/templates/jqgrid/i18n/jqgrid/locale-ua.js +128 -128
  95. data/templates/jqgrid/jquery.jqGrid.js +13477 -13443
  96. data/templates/jqgrid/jquery.jqGrid.min.js +292 -287
  97. data/templates/jqgrid/jquery/jqGrid.scss +13 -12
  98. data/templates/jqgrid/manifest.rb +2 -0
  99. data/templates/jqtouch/jquery.jqtouch.js +9601 -9556
  100. data/templates/jqtouch/jquery.jqtouch.min.js +3 -3
  101. data/templates/jqtouch/jquery/touch/default.scss +2 -2
  102. data/templates/jqtouch/jquery/touch/jqt.scss +2 -2
  103. data/templates/jqtouch/jquery/touch/jqtouch.scss +26 -5
  104. data/templates/jquery/amplify.store.js +211 -211
  105. data/templates/jquery/config/initializers/jquery.rb +2 -0
  106. data/templates/jquery/history.adapter.jquery.js +42 -36
  107. data/templates/jquery/history.html4.js +563 -563
  108. data/templates/jquery/history.html4.min.js +5 -5
  109. data/templates/jquery/history.js +1721 -1694
  110. data/templates/jquery/history.min.js +28 -27
  111. data/templates/jquery/i18n/jquery.ui/datepicker-af.js +20 -20
  112. data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.js +18 -18
  113. data/templates/jquery/i18n/jquery.ui/datepicker-ar.js +19 -19
  114. data/templates/jquery/i18n/jquery.ui/datepicker-az.js +20 -20
  115. data/templates/jquery/i18n/jquery.ui/datepicker-bg.js +21 -21
  116. data/templates/jquery/i18n/jquery.ui/datepicker-bs.js +20 -20
  117. data/templates/jquery/i18n/jquery.ui/datepicker-ca.js +19 -19
  118. data/templates/jquery/i18n/jquery.ui/datepicker-cs.js +20 -20
  119. data/templates/jquery/i18n/jquery.ui/datepicker-da.js +20 -20
  120. data/templates/jquery/i18n/jquery.ui/datepicker-de.js +20 -20
  121. data/templates/jquery/i18n/jquery.ui/datepicker-el.js +20 -20
  122. data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.js +19 -19
  123. data/templates/jquery/i18n/jquery.ui/datepicker-en-GB.js +20 -20
  124. data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.js +19 -19
  125. data/templates/jquery/i18n/jquery.ui/datepicker-eo.js +20 -20
  126. data/templates/jquery/i18n/jquery.ui/datepicker-es.js +19 -19
  127. data/templates/jquery/i18n/jquery.ui/datepicker-et.js +20 -20
  128. data/templates/jquery/i18n/jquery.ui/datepicker-eu.js +20 -20
  129. data/templates/jquery/i18n/jquery.ui/datepicker-fa.js +19 -19
  130. data/templates/jquery/i18n/jquery.ui/datepicker-fi.js +19 -19
  131. data/templates/jquery/i18n/jquery.ui/datepicker-fo.js +20 -20
  132. data/templates/jquery/i18n/jquery.ui/datepicker-fr-CH.js +20 -20
  133. data/templates/jquery/i18n/jquery.ui/datepicker-fr.js +20 -20
  134. data/templates/jquery/i18n/jquery.ui/datepicker-gl.js +19 -19
  135. data/templates/jquery/i18n/jquery.ui/datepicker-he.js +20 -20
  136. data/templates/jquery/i18n/jquery.ui/datepicker-hr.js +20 -20
  137. data/templates/jquery/i18n/jquery.ui/datepicker-hu.js +19 -19
  138. data/templates/jquery/i18n/jquery.ui/datepicker-hy.js +19 -19
  139. data/templates/jquery/i18n/jquery.ui/datepicker-id.js +19 -19
  140. data/templates/jquery/i18n/jquery.ui/datepicker-is.js +19 -19
  141. data/templates/jquery/i18n/jquery.ui/datepicker-it.js +19 -19
  142. data/templates/jquery/i18n/jquery.ui/datepicker-ja.js +20 -20
  143. data/templates/jquery/i18n/jquery.ui/datepicker-ko.js +19 -19
  144. data/templates/jquery/i18n/jquery.ui/datepicker-kz.js +19 -19
  145. data/templates/jquery/i18n/jquery.ui/datepicker-lt.js +19 -19
  146. data/templates/jquery/i18n/jquery.ui/datepicker-lv.js +19 -19
  147. data/templates/jquery/i18n/jquery.ui/datepicker-ml.js +20 -20
  148. data/templates/jquery/i18n/jquery.ui/datepicker-ms.js +19 -19
  149. data/templates/jquery/i18n/jquery.ui/datepicker-nl.js +20 -20
  150. data/templates/jquery/i18n/jquery.ui/datepicker-nl.min.js +1 -1
  151. data/templates/jquery/i18n/jquery.ui/datepicker-no.js +18 -18
  152. data/templates/jquery/i18n/jquery.ui/datepicker-pl.js +19 -19
  153. data/templates/jquery/i18n/jquery.ui/datepicker-pt-BR.js +19 -19
  154. data/templates/jquery/i18n/jquery.ui/datepicker-pt.js +19 -19
  155. data/templates/jquery/i18n/jquery.ui/datepicker-rm.js +17 -17
  156. data/templates/jquery/i18n/jquery.ui/datepicker-ro.js +20 -20
  157. data/templates/jquery/i18n/jquery.ui/datepicker-ru.js +19 -19
  158. data/templates/jquery/i18n/jquery.ui/datepicker-sk.js +19 -19
  159. data/templates/jquery/i18n/jquery.ui/datepicker-sk.min.js +1 -1
  160. data/templates/jquery/i18n/jquery.ui/datepicker-sl.js +19 -19
  161. data/templates/jquery/i18n/jquery.ui/datepicker-sq.js +20 -20
  162. data/templates/jquery/i18n/jquery.ui/datepicker-sr-SR.js +20 -20
  163. data/templates/jquery/i18n/jquery.ui/datepicker-sr.js +20 -20
  164. data/templates/jquery/i18n/jquery.ui/datepicker-sv.js +20 -20
  165. data/templates/jquery/i18n/jquery.ui/datepicker-ta.js +20 -20
  166. data/templates/jquery/i18n/jquery.ui/datepicker-th.js +20 -20
  167. data/templates/jquery/i18n/jquery.ui/datepicker-tj.js +19 -19
  168. data/templates/jquery/i18n/jquery.ui/datepicker-tr.js +19 -19
  169. data/templates/jquery/i18n/jquery.ui/datepicker-uk.js +19 -19
  170. data/templates/jquery/i18n/jquery.ui/datepicker-vi.js +20 -20
  171. data/templates/jquery/i18n/jquery.ui/datepicker-zh-CN.js +19 -19
  172. data/templates/jquery/i18n/jquery.ui/datepicker-zh-HK.js +19 -19
  173. data/templates/jquery/i18n/jquery.ui/datepicker-zh-TW.js +20 -20
  174. data/templates/jquery/jquery-ui.js +11913 -11882
  175. data/templates/jquery/jquery-ui.min.js +340 -339
  176. data/templates/jquery/jquery.bgiframe.js +27 -27
  177. data/templates/jquery/jquery.contextMenu.js +202 -202
  178. data/templates/jquery/jquery.cookie.js +26 -26
  179. data/templates/jquery/jquery.dotimeout.js +227 -227
  180. data/templates/jquery/jquery.dst.js +89 -89
  181. data/templates/jquery/jquery.easing.js +226 -0
  182. data/templates/jquery/jquery.easing.min.js +8 -0
  183. data/templates/jquery/jquery.farbtastic.js +294 -294
  184. data/templates/jquery/jquery.flashMessages.js +14 -14
  185. data/templates/jquery/jquery.form.js +761 -761
  186. data/templates/jquery/jquery.haml.js +247 -247
  187. data/templates/jquery/jquery.hotkeys.js +79 -79
  188. data/templates/jquery/jquery.js +1490 -928
  189. data/templates/jquery/jquery.layout.js +2454 -2454
  190. data/templates/jquery/jquery.mediahelpers.js +216 -0
  191. data/templates/jquery/jquery.mediahelpers.min.js +3 -0
  192. data/templates/jquery/jquery.min.js +177 -166
  193. data/templates/jquery/jquery.mousewheel.js +57 -57
  194. data/templates/jquery/jquery.offline.js +171 -171
  195. data/templates/jquery/jquery.pngFix.js +72 -72
  196. data/templates/jquery/jquery.rails.js +145 -145
  197. data/templates/jquery/jquery.replacetext.js +80 -80
  198. data/templates/jquery/jquery.themeswitchertool.js +195 -195
  199. data/templates/jquery/jquery.tmpl.js +460 -460
  200. data/templates/jquery/jquery.tmplPlus.js +78 -78
  201. data/templates/jquery/jquery.tokeninput.js +480 -475
  202. data/templates/jquery/jquery/ui/_theme.scss +14 -14
  203. data/templates/jquery/jquery/ui/black-tie/ui-icons_4ca300_256x240.png +0 -0
  204. data/templates/jquery/jquery/ui/black-tie/ui-icons_bbbbbb_256x240.png +0 -0
  205. data/templates/jquery/jquery/ui/black-tie/ui-icons_ededed_256x240.png +0 -0
  206. data/templates/jquery/jquery/ui/black-tie/ui-icons_ffcf29_256x240.png +0 -0
  207. data/templates/jquery/jquery/ui/vader/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  208. data/templates/jquery/jquery/ui/vader/ui-icons_bbbbbb_256x240.png +0 -0
  209. data/templates/jquery/jquery/ui/vader/ui-icons_c98000_256x240.png +0 -0
  210. data/templates/jquery/jquery/ui/vader/ui-icons_f29a00_256x240.png +0 -0
  211. data/templates/jquery/json.js +66 -66
  212. data/templates/jquery/json2.js +177 -177
  213. data/templates/jquery/manifest.rb +4 -0
  214. data/templates/jstree/jquery.jstree.js +5918 -5918
  215. data/templates/markitup/app/views/shared/_mark_it_up.parsed.preview.blue.html.haml +9 -0
  216. data/templates/markitup/app/views/shared/_mark_it_up.parsed.preview.html.haml +9 -0
  217. data/templates/markitup/app/views/shared/_mark_it_up.preview.blue.html.haml +8 -0
  218. data/templates/markitup/app/views/shared/_mark_it_up.preview.html.haml +8 -0
  219. data/templates/markitup/config/initializers/mark_it_up.rb +40 -0
  220. data/templates/markitup/jquery.markitup.js +586 -0
  221. data/templates/markitup/jquery.markitup.min.js +1 -0
  222. data/templates/markitup/jquery/markitup/preview/body.blue.png +0 -0
  223. data/templates/markitup/jquery/markitup/preview/bullet.blue.png +0 -0
  224. data/templates/markitup/jquery/markitup/preview/preview.blue.scss +58 -0
  225. data/templates/markitup/jquery/markitup/preview/preview.scss +7 -0
  226. data/templates/markitup/jquery/markitup/sets/bbcode.scss +34 -0
  227. data/templates/markitup/jquery/markitup/sets/bbcode/bold.png +0 -0
  228. data/templates/markitup/jquery/markitup/sets/bbcode/clean.png +0 -0
  229. data/templates/markitup/jquery/markitup/sets/bbcode/code.png +0 -0
  230. data/templates/markitup/jquery/markitup/sets/bbcode/fonts.png +0 -0
  231. data/templates/markitup/jquery/markitup/sets/bbcode/italic.png +0 -0
  232. data/templates/markitup/jquery/markitup/sets/bbcode/link.png +0 -0
  233. data/templates/markitup/jquery/markitup/sets/bbcode/list-bullet.png +0 -0
  234. data/templates/markitup/jquery/markitup/sets/bbcode/list-item.png +0 -0
  235. data/templates/markitup/jquery/markitup/sets/bbcode/list-numeric.png +0 -0
  236. data/templates/markitup/jquery/markitup/sets/bbcode/picture.png +0 -0
  237. data/templates/markitup/jquery/markitup/sets/bbcode/preview.png +0 -0
  238. data/templates/markitup/jquery/markitup/sets/bbcode/quotes.png +0 -0
  239. data/templates/markitup/jquery/markitup/sets/bbcode/stroke.png +0 -0
  240. data/templates/markitup/jquery/markitup/sets/bbcode/underline.png +0 -0
  241. data/templates/markitup/jquery/markitup/sets/css.scss +54 -0
  242. data/templates/markitup/jquery/markitup/sets/css/bold.png +0 -0
  243. data/templates/markitup/jquery/markitup/sets/css/css.png +0 -0
  244. data/templates/markitup/jquery/markitup/sets/css/italic.png +0 -0
  245. data/templates/markitup/jquery/markitup/sets/css/picture.png +0 -0
  246. data/templates/markitup/jquery/markitup/sets/css/stroke.png +0 -0
  247. data/templates/markitup/jquery/markitup/sets/css/tag.png +0 -0
  248. data/templates/markitup/jquery/markitup/sets/css/text_align_center.png +0 -0
  249. data/templates/markitup/jquery/markitup/sets/css/text_align_justify.png +0 -0
  250. data/templates/markitup/jquery/markitup/sets/css/text_align_left.png +0 -0
  251. data/templates/markitup/jquery/markitup/sets/css/text_align_right.png +0 -0
  252. data/templates/markitup/jquery/markitup/sets/css/text_indent.png +0 -0
  253. data/templates/markitup/jquery/markitup/sets/css/text_letterspacing.png +0 -0
  254. data/templates/markitup/jquery/markitup/sets/css/text_linespacing.png +0 -0
  255. data/templates/markitup/jquery/markitup/sets/css/text_lowercase.png +0 -0
  256. data/templates/markitup/jquery/markitup/sets/css/text_padding_bottom.png +0 -0
  257. data/templates/markitup/jquery/markitup/sets/css/text_padding_left.png +0 -0
  258. data/templates/markitup/jquery/markitup/sets/css/text_padding_right.png +0 -0
  259. data/templates/markitup/jquery/markitup/sets/css/text_padding_top.png +0 -0
  260. data/templates/markitup/jquery/markitup/sets/css/text_uppercase.png +0 -0
  261. data/templates/markitup/jquery/markitup/sets/default.scss +22 -0
  262. data/templates/markitup/jquery/markitup/sets/default/bold.png +0 -0
  263. data/templates/markitup/jquery/markitup/sets/default/clean.png +0 -0
  264. data/templates/markitup/jquery/markitup/sets/default/image.png +0 -0
  265. data/templates/markitup/jquery/markitup/sets/default/italic.png +0 -0
  266. data/templates/markitup/jquery/markitup/sets/default/link.png +0 -0
  267. data/templates/markitup/jquery/markitup/sets/default/picture.png +0 -0
  268. data/templates/markitup/jquery/markitup/sets/default/preview.png +0 -0
  269. data/templates/markitup/jquery/markitup/sets/default/stroke.png +0 -0
  270. data/templates/markitup/jquery/markitup/sets/dotclear.scss +38 -0
  271. data/templates/markitup/jquery/markitup/sets/dotclear/bold.png +0 -0
  272. data/templates/markitup/jquery/markitup/sets/dotclear/code.png +0 -0
  273. data/templates/markitup/jquery/markitup/sets/dotclear/h1.png +0 -0
  274. data/templates/markitup/jquery/markitup/sets/dotclear/h2.png +0 -0
  275. data/templates/markitup/jquery/markitup/sets/dotclear/h3.png +0 -0
  276. data/templates/markitup/jquery/markitup/sets/dotclear/h4.png +0 -0
  277. data/templates/markitup/jquery/markitup/sets/dotclear/h5.png +0 -0
  278. data/templates/markitup/jquery/markitup/sets/dotclear/h6.png +0 -0
  279. data/templates/markitup/jquery/markitup/sets/dotclear/italic.png +0 -0
  280. data/templates/markitup/jquery/markitup/sets/dotclear/link.png +0 -0
  281. data/templates/markitup/jquery/markitup/sets/dotclear/list-bullet.png +0 -0
  282. data/templates/markitup/jquery/markitup/sets/dotclear/list-numeric.png +0 -0
  283. data/templates/markitup/jquery/markitup/sets/dotclear/picture.png +0 -0
  284. data/templates/markitup/jquery/markitup/sets/dotclear/preview.png +0 -0
  285. data/templates/markitup/jquery/markitup/sets/dotclear/quotes.png +0 -0
  286. data/templates/markitup/jquery/markitup/sets/dotclear/stroke.png +0 -0
  287. data/templates/markitup/jquery/markitup/sets/dotclear/url.png +0 -0
  288. data/templates/markitup/jquery/markitup/sets/html.scss +42 -0
  289. data/templates/markitup/jquery/markitup/sets/html/bold.png +0 -0
  290. data/templates/markitup/jquery/markitup/sets/html/clean.png +0 -0
  291. data/templates/markitup/jquery/markitup/sets/html/h1.png +0 -0
  292. data/templates/markitup/jquery/markitup/sets/html/h2.png +0 -0
  293. data/templates/markitup/jquery/markitup/sets/html/h3.png +0 -0
  294. data/templates/markitup/jquery/markitup/sets/html/h4.png +0 -0
  295. data/templates/markitup/jquery/markitup/sets/html/h5.png +0 -0
  296. data/templates/markitup/jquery/markitup/sets/html/h6.png +0 -0
  297. data/templates/markitup/jquery/markitup/sets/html/image.png +0 -0
  298. data/templates/markitup/jquery/markitup/sets/html/italic.png +0 -0
  299. data/templates/markitup/jquery/markitup/sets/html/link.png +0 -0
  300. data/templates/markitup/jquery/markitup/sets/html/list-bullet.png +0 -0
  301. data/templates/markitup/jquery/markitup/sets/html/list-item.png +0 -0
  302. data/templates/markitup/jquery/markitup/sets/html/list-numeric.png +0 -0
  303. data/templates/markitup/jquery/markitup/sets/html/paragraph.png +0 -0
  304. data/templates/markitup/jquery/markitup/sets/html/picture.png +0 -0
  305. data/templates/markitup/jquery/markitup/sets/html/preview.png +0 -0
  306. data/templates/markitup/jquery/markitup/sets/html/stroke.png +0 -0
  307. data/templates/markitup/jquery/markitup/sets/markdown.scss +38 -0
  308. data/templates/markitup/jquery/markitup/sets/markdown/bold.png +0 -0
  309. data/templates/markitup/jquery/markitup/sets/markdown/code.png +0 -0
  310. data/templates/markitup/jquery/markitup/sets/markdown/h1.png +0 -0
  311. data/templates/markitup/jquery/markitup/sets/markdown/h2.png +0 -0
  312. data/templates/markitup/jquery/markitup/sets/markdown/h3.png +0 -0
  313. data/templates/markitup/jquery/markitup/sets/markdown/h4.png +0 -0
  314. data/templates/markitup/jquery/markitup/sets/markdown/h5.png +0 -0
  315. data/templates/markitup/jquery/markitup/sets/markdown/h6.png +0 -0
  316. data/templates/markitup/jquery/markitup/sets/markdown/italic.png +0 -0
  317. data/templates/markitup/jquery/markitup/sets/markdown/link.png +0 -0
  318. data/templates/markitup/jquery/markitup/sets/markdown/list-bullet.png +0 -0
  319. data/templates/markitup/jquery/markitup/sets/markdown/list-numeric.png +0 -0
  320. data/templates/markitup/jquery/markitup/sets/markdown/picture.png +0 -0
  321. data/templates/markitup/jquery/markitup/sets/markdown/preview.png +0 -0
  322. data/templates/markitup/jquery/markitup/sets/markdown/quotes.png +0 -0
  323. data/templates/markitup/jquery/markitup/sets/markmin.scss +38 -0
  324. data/templates/markitup/jquery/markitup/sets/markmin/bold.png +0 -0
  325. data/templates/markitup/jquery/markitup/sets/markmin/code.png +0 -0
  326. data/templates/markitup/jquery/markitup/sets/markmin/h1.png +0 -0
  327. data/templates/markitup/jquery/markitup/sets/markmin/h2.png +0 -0
  328. data/templates/markitup/jquery/markitup/sets/markmin/h3.png +0 -0
  329. data/templates/markitup/jquery/markitup/sets/markmin/h4.png +0 -0
  330. data/templates/markitup/jquery/markitup/sets/markmin/h5.png +0 -0
  331. data/templates/markitup/jquery/markitup/sets/markmin/h6.png +0 -0
  332. data/templates/markitup/jquery/markitup/sets/markmin/italic.png +0 -0
  333. data/templates/markitup/jquery/markitup/sets/markmin/link.png +0 -0
  334. data/templates/markitup/jquery/markitup/sets/markmin/list-bullet.png +0 -0
  335. data/templates/markitup/jquery/markitup/sets/markmin/list-numeric.png +0 -0
  336. data/templates/markitup/jquery/markitup/sets/markmin/picture.png +0 -0
  337. data/templates/markitup/jquery/markitup/sets/markmin/preview.png +0 -0
  338. data/templates/markitup/jquery/markitup/sets/markmin/quotes.png +0 -0
  339. data/templates/markitup/jquery/markitup/sets/rest.scss +38 -0
  340. data/templates/markitup/jquery/markitup/sets/rest/bold.png +0 -0
  341. data/templates/markitup/jquery/markitup/sets/rest/code.png +0 -0
  342. data/templates/markitup/jquery/markitup/sets/rest/h1.png +0 -0
  343. data/templates/markitup/jquery/markitup/sets/rest/h2.png +0 -0
  344. data/templates/markitup/jquery/markitup/sets/rest/h3.png +0 -0
  345. data/templates/markitup/jquery/markitup/sets/rest/h4.png +0 -0
  346. data/templates/markitup/jquery/markitup/sets/rest/h5.png +0 -0
  347. data/templates/markitup/jquery/markitup/sets/rest/italic.png +0 -0
  348. data/templates/markitup/jquery/markitup/sets/rest/link.png +0 -0
  349. data/templates/markitup/jquery/markitup/sets/rest/list-bullet.png +0 -0
  350. data/templates/markitup/jquery/markitup/sets/rest/list-numeric.png +0 -0
  351. data/templates/markitup/jquery/markitup/sets/rest/picture.png +0 -0
  352. data/templates/markitup/jquery/markitup/sets/rest/preview.png +0 -0
  353. data/templates/markitup/jquery/markitup/sets/rest/quotes.png +0 -0
  354. data/templates/markitup/jquery/markitup/sets/textile.scss +44 -0
  355. data/templates/markitup/jquery/markitup/sets/textile/bold.png +0 -0
  356. data/templates/markitup/jquery/markitup/sets/textile/code.png +0 -0
  357. data/templates/markitup/jquery/markitup/sets/textile/h1.png +0 -0
  358. data/templates/markitup/jquery/markitup/sets/textile/h2.png +0 -0
  359. data/templates/markitup/jquery/markitup/sets/textile/h3.png +0 -0
  360. data/templates/markitup/jquery/markitup/sets/textile/h4.png +0 -0
  361. data/templates/markitup/jquery/markitup/sets/textile/h5.png +0 -0
  362. data/templates/markitup/jquery/markitup/sets/textile/h6.png +0 -0
  363. data/templates/markitup/jquery/markitup/sets/textile/italic.png +0 -0
  364. data/templates/markitup/jquery/markitup/sets/textile/link.png +0 -0
  365. data/templates/markitup/jquery/markitup/sets/textile/list-bullet.png +0 -0
  366. data/templates/markitup/jquery/markitup/sets/textile/list-numeric.png +0 -0
  367. data/templates/markitup/jquery/markitup/sets/textile/paragraph.png +0 -0
  368. data/templates/markitup/jquery/markitup/sets/textile/picture.png +0 -0
  369. data/templates/markitup/jquery/markitup/sets/textile/preview.png +0 -0
  370. data/templates/markitup/jquery/markitup/sets/textile/quotes.png +0 -0
  371. data/templates/markitup/jquery/markitup/sets/textile/stroke.png +0 -0
  372. data/templates/markitup/jquery/markitup/sets/textile/table.png +0 -0
  373. data/templates/markitup/jquery/markitup/sets/texy.scss +40 -0
  374. data/templates/markitup/jquery/markitup/sets/texy/bold.png +0 -0
  375. data/templates/markitup/jquery/markitup/sets/texy/code.png +0 -0
  376. data/templates/markitup/jquery/markitup/sets/texy/disconnect.png +0 -0
  377. data/templates/markitup/jquery/markitup/sets/texy/h1.png +0 -0
  378. data/templates/markitup/jquery/markitup/sets/texy/h2.png +0 -0
  379. data/templates/markitup/jquery/markitup/sets/texy/h3.png +0 -0
  380. data/templates/markitup/jquery/markitup/sets/texy/h4.png +0 -0
  381. data/templates/markitup/jquery/markitup/sets/texy/h5.png +0 -0
  382. data/templates/markitup/jquery/markitup/sets/texy/h6.png +0 -0
  383. data/templates/markitup/jquery/markitup/sets/texy/italic.png +0 -0
  384. data/templates/markitup/jquery/markitup/sets/texy/link.png +0 -0
  385. data/templates/markitup/jquery/markitup/sets/texy/list-bullet.png +0 -0
  386. data/templates/markitup/jquery/markitup/sets/texy/list-numeric.png +0 -0
  387. data/templates/markitup/jquery/markitup/sets/texy/page_white_code.png +0 -0
  388. data/templates/markitup/jquery/markitup/sets/texy/picture.png +0 -0
  389. data/templates/markitup/jquery/markitup/sets/texy/preview.png +0 -0
  390. data/templates/markitup/jquery/markitup/sets/texy/quotes.png +0 -0
  391. data/templates/markitup/jquery/markitup/sets/texy/stroke.png +0 -0
  392. data/templates/markitup/jquery/markitup/sets/txt2tags.scss +44 -0
  393. data/templates/markitup/jquery/markitup/sets/txt2tags/bold.png +0 -0
  394. data/templates/markitup/jquery/markitup/sets/txt2tags/code.png +0 -0
  395. data/templates/markitup/jquery/markitup/sets/txt2tags/disconnect.png +0 -0
  396. data/templates/markitup/jquery/markitup/sets/txt2tags/h1.png +0 -0
  397. data/templates/markitup/jquery/markitup/sets/txt2tags/h2.png +0 -0
  398. data/templates/markitup/jquery/markitup/sets/txt2tags/h3.png +0 -0
  399. data/templates/markitup/jquery/markitup/sets/txt2tags/h4.png +0 -0
  400. data/templates/markitup/jquery/markitup/sets/txt2tags/h5.png +0 -0
  401. data/templates/markitup/jquery/markitup/sets/txt2tags/italic.png +0 -0
  402. data/templates/markitup/jquery/markitup/sets/txt2tags/link.png +0 -0
  403. data/templates/markitup/jquery/markitup/sets/txt2tags/list-bullet.png +0 -0
  404. data/templates/markitup/jquery/markitup/sets/txt2tags/list-numeric.png +0 -0
  405. data/templates/markitup/jquery/markitup/sets/txt2tags/picture.png +0 -0
  406. data/templates/markitup/jquery/markitup/sets/txt2tags/preview.png +0 -0
  407. data/templates/markitup/jquery/markitup/sets/txt2tags/quotes.png +0 -0
  408. data/templates/markitup/jquery/markitup/sets/txt2tags/stroke.png +0 -0
  409. data/templates/markitup/jquery/markitup/sets/txt2tags/underline.png +0 -0
  410. data/templates/markitup/jquery/markitup/sets/wiki.scss +42 -0
  411. data/templates/markitup/jquery/markitup/sets/wiki/bold.png +0 -0
  412. data/templates/markitup/jquery/markitup/sets/wiki/code.png +0 -0
  413. data/templates/markitup/jquery/markitup/sets/wiki/h1.png +0 -0
  414. data/templates/markitup/jquery/markitup/sets/wiki/h2.png +0 -0
  415. data/templates/markitup/jquery/markitup/sets/wiki/h3.png +0 -0
  416. data/templates/markitup/jquery/markitup/sets/wiki/h4.png +0 -0
  417. data/templates/markitup/jquery/markitup/sets/wiki/h5.png +0 -0
  418. data/templates/markitup/jquery/markitup/sets/wiki/h6.png +0 -0
  419. data/templates/markitup/jquery/markitup/sets/wiki/italic.png +0 -0
  420. data/templates/markitup/jquery/markitup/sets/wiki/link.png +0 -0
  421. data/templates/markitup/jquery/markitup/sets/wiki/list-bullet.png +0 -0
  422. data/templates/markitup/jquery/markitup/sets/wiki/list-numeric.png +0 -0
  423. data/templates/markitup/jquery/markitup/sets/wiki/picture.png +0 -0
  424. data/templates/markitup/jquery/markitup/sets/wiki/preview.png +0 -0
  425. data/templates/markitup/jquery/markitup/sets/wiki/quotes.png +0 -0
  426. data/templates/markitup/jquery/markitup/sets/wiki/stroke.png +0 -0
  427. data/templates/markitup/jquery/markitup/sets/wiki/table.png +0 -0
  428. data/templates/markitup/jquery/markitup/sets/wiki/url.png +0 -0
  429. data/templates/markitup/jquery/markitup/sets/xbbcode.scss +42 -0
  430. data/templates/markitup/jquery/markitup/sets/xbbcode/bold.png +0 -0
  431. data/templates/markitup/jquery/markitup/sets/xbbcode/clean.png +0 -0
  432. data/templates/markitup/jquery/markitup/sets/xbbcode/h1.png +0 -0
  433. data/templates/markitup/jquery/markitup/sets/xbbcode/h2.png +0 -0
  434. data/templates/markitup/jquery/markitup/sets/xbbcode/h3.png +0 -0
  435. data/templates/markitup/jquery/markitup/sets/xbbcode/h4.png +0 -0
  436. data/templates/markitup/jquery/markitup/sets/xbbcode/h5.png +0 -0
  437. data/templates/markitup/jquery/markitup/sets/xbbcode/h6.png +0 -0
  438. data/templates/markitup/jquery/markitup/sets/xbbcode/image.png +0 -0
  439. data/templates/markitup/jquery/markitup/sets/xbbcode/italic.png +0 -0
  440. data/templates/markitup/jquery/markitup/sets/xbbcode/link.png +0 -0
  441. data/templates/markitup/jquery/markitup/sets/xbbcode/list-bullet.png +0 -0
  442. data/templates/markitup/jquery/markitup/sets/xbbcode/list-item.png +0 -0
  443. data/templates/markitup/jquery/markitup/sets/xbbcode/list-numeric.png +0 -0
  444. data/templates/markitup/jquery/markitup/sets/xbbcode/paragraph.png +0 -0
  445. data/templates/markitup/jquery/markitup/sets/xbbcode/picture.png +0 -0
  446. data/templates/markitup/jquery/markitup/sets/xbbcode/preview.png +0 -0
  447. data/templates/markitup/jquery/markitup/sets/xbbcode/stroke.png +0 -0
  448. data/templates/markitup/jquery/markitup/skins/aqua.scss +136 -0
  449. data/templates/markitup/jquery/markitup/skins/aqua/bg-container-white.png +0 -0
  450. data/templates/markitup/jquery/markitup/skins/aqua/bg-container.png +0 -0
  451. data/templates/markitup/jquery/markitup/skins/aqua/bg-footer-white.png +0 -0
  452. data/templates/markitup/jquery/markitup/skins/aqua/bg-footer.png +0 -0
  453. data/templates/markitup/jquery/markitup/skins/aqua/bg-header-white.png +0 -0
  454. data/templates/markitup/jquery/markitup/skins/aqua/bg-header.png +0 -0
  455. data/templates/markitup/jquery/markitup/skins/aqua/handle.png +0 -0
  456. data/templates/markitup/jquery/markitup/skins/aqua/menu.png +0 -0
  457. data/templates/markitup/jquery/markitup/skins/aqua/spacer.gif +0 -0
  458. data/templates/markitup/jquery/markitup/skins/aqua/submenu.png +0 -0
  459. data/templates/markitup/jquery/markitup/skins/jtageditor.scss +141 -0
  460. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-container.png +0 -0
  461. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor-bbcode.png +0 -0
  462. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor-dotclear.png +0 -0
  463. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor-html.png +0 -0
  464. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor-markdown.png +0 -0
  465. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor-textile.png +0 -0
  466. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor-wiki.png +0 -0
  467. data/templates/markitup/jquery/markitup/skins/jtageditor/bg-editor.png +0 -0
  468. data/templates/markitup/jquery/markitup/skins/jtageditor/handle.png +0 -0
  469. data/templates/markitup/jquery/markitup/skins/jtageditor/menu.png +0 -0
  470. data/templates/markitup/jquery/markitup/skins/jtageditor/submenu.png +0 -0
  471. data/templates/markitup/jquery/markitup/skins/live.scss +135 -0
  472. data/templates/markitup/jquery/markitup/skins/live/bg-container.png +0 -0
  473. data/templates/markitup/jquery/markitup/skins/live/bg-footer.png +0 -0
  474. data/templates/markitup/jquery/markitup/skins/live/bg-header.png +0 -0
  475. data/templates/markitup/jquery/markitup/skins/live/editor.png +0 -0
  476. data/templates/markitup/jquery/markitup/skins/live/handle.png +0 -0
  477. data/templates/markitup/jquery/markitup/skins/live/menu.png +0 -0
  478. data/templates/markitup/jquery/markitup/skins/live/submenu.png +0 -0
  479. data/templates/markitup/jquery/markitup/skins/markitup.scss +150 -0
  480. data/templates/markitup/jquery/markitup/skins/markitup/bg-container.png +0 -0
  481. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-bbcode.png +0 -0
  482. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-dotclear.png +0 -0
  483. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-html.png +0 -0
  484. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-json.png +0 -0
  485. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-markdown.png +0 -0
  486. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-textile.png +0 -0
  487. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-wiki.png +0 -0
  488. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor-xml.png +0 -0
  489. data/templates/markitup/jquery/markitup/skins/markitup/bg-editor.png +0 -0
  490. data/templates/markitup/jquery/markitup/skins/markitup/handle.png +0 -0
  491. data/templates/markitup/jquery/markitup/skins/markitup/menu.png +0 -0
  492. data/templates/markitup/jquery/markitup/skins/markitup/submenu.png +0 -0
  493. data/templates/markitup/jquery/markitup/skins/simple.scss +117 -0
  494. data/templates/markitup/jquery/markitup/skins/simple/handle.png +0 -0
  495. data/templates/markitup/jquery/markitup/skins/simple/menu.png +0 -0
  496. data/templates/markitup/jquery/markitup/skins/simple/submenu.png +0 -0
  497. data/templates/markitup/manifest.rb +311 -0
  498. data/templates/markitup/markitup/jquery.markitup.set.bbcode.js +40 -0
  499. data/templates/markitup/markitup/jquery.markitup.set.bbcode.min.js +3 -0
  500. data/templates/markitup/markitup/jquery.markitup.set.css.js +53 -0
  501. data/templates/markitup/markitup/jquery.markitup.set.css.min.js +5 -0
  502. data/templates/markitup/markitup/jquery.markitup.set.default.js +30 -0
  503. data/templates/markitup/markitup/jquery.markitup.set.default.min.js +2 -0
  504. data/templates/markitup/markitup/jquery.markitup.set.dotclear.js +38 -0
  505. data/templates/markitup/markitup/jquery.markitup.set.dotclear.min.js +3 -0
  506. data/templates/markitup/markitup/jquery.markitup.set.html.js +40 -0
  507. data/templates/markitup/markitup/jquery.markitup.set.html.min.js +4 -0
  508. data/templates/markitup/markitup/jquery.markitup.set.markdown.js +53 -0
  509. data/templates/markitup/markitup/jquery.markitup.set.markdown.min.js +3 -0
  510. data/templates/markitup/markitup/jquery.markitup.set.markmin.js +50 -0
  511. data/templates/markitup/markitup/jquery.markitup.set.markmin.min.js +3 -0
  512. data/templates/markitup/markitup/jquery.markitup.set.rest.js +52 -0
  513. data/templates/markitup/markitup/jquery.markitup.set.rest.min.js +3 -0
  514. data/templates/markitup/markitup/jquery.markitup.set.textile.js +58 -0
  515. data/templates/markitup/markitup/jquery.markitup.set.textile.min.js +4 -0
  516. data/templates/markitup/markitup/jquery.markitup.set.texy.js +52 -0
  517. data/templates/markitup/markitup/jquery.markitup.set.texy.min.js +4 -0
  518. data/templates/markitup/markitup/jquery.markitup.set.txt2tags.js +42 -0
  519. data/templates/markitup/markitup/jquery.markitup.set.txt2tags.min.js +3 -0
  520. data/templates/markitup/markitup/jquery.markitup.set.wiki.js +61 -0
  521. data/templates/markitup/markitup/jquery.markitup.set.wiki.min.js +4 -0
  522. data/templates/markitup/markitup/jquery.markitup.set.xbbcode.js +36 -0
  523. data/templates/markitup/markitup/jquery.markitup.set.xbbcode.min.js +4 -0
  524. data/templates/mobile/config/initializers/mobile.rb +2 -0
  525. data/templates/mobile/jquery.mobile.js +4545 -4454
  526. data/templates/mobile/jquery.mobile.min.js +16 -7
  527. data/templates/mobile/jquery/mobile/960.fluid.scss +191 -0
  528. data/templates/mobile/jquery/mobile/960.scss +213 -0
  529. data/templates/mobile/jquery/mobile/_base.scss +37 -20
  530. data/templates/mobile/jquery/mobile/default.scss +48 -56
  531. data/templates/mobile/jquery/mobile/valencia.scss +43 -44
  532. data/templates/mobile/manifest.rb +2 -0
  533. data/templates/ribbon/jquery.ribbon.js +195 -195
  534. data/templates/ribbon/jquery.ribbon.min.js +1 -1
  535. data/templates/ribbon/jquery/ribbon/office.scss +12 -12
  536. data/templates/ribbon/jquery/ribbon/windows7.scss +12 -12
  537. data/templates/secret_sauce/secret_sauce.js +8 -8
  538. data/templates/tools/flowplayer.js +897 -897
  539. data/templates/tools/jquery.tools.js +3647 -3647
  540. data/templates/tools/jquery.tools.min.js +47 -47
  541. data/templates/tools/swfobject.js +760 -760
  542. metadata +350 -22
@@ -170,1130 +170,1130 @@
170
170
 
171
171
  (function($) {
172
172
 
173
- /*
174
- * Default configuration settings
175
- */
176
- var defaults = {
177
- // Settings common to most/all chart types
178
- common: {
179
- type : 'line',
180
- lineColor : '#00f',
181
- fillColor : '#cdf',
182
- defaultPixelsPerValue : 3,
183
- width : 'auto',
184
- height : 'auto',
185
- composite : false,
186
- tagValuesAttribute: 'values',
187
- tagOptionsPrefix: 'spark',
188
- enableTagOptions: false
189
- },
190
- // Defaults for line charts
191
- line: {
192
- spotColor : '#f80',
193
- spotRadius : 1.5,
194
- minSpotColor : '#f80',
195
- maxSpotColor : '#f80',
196
- lineWidth: 1,
197
- normalRangeMin : undefined,
198
- normalRangeMax : undefined,
199
- normalRangeColor : '#ccc',
200
- drawNormalOnTop: false,
201
- chartRangeMin : undefined,
202
- chartRangeMax : undefined,
203
- chartRangeMinX : undefined,
204
- chartRangeMaxX : undefined
205
- },
206
- // Defaults for bar charts
207
- bar: {
208
- barColor : '#00f',
209
- negBarColor : '#f44',
210
- zeroColor: undefined,
211
- nullColor: undefined,
212
- zeroAxis : undefined,
213
- barWidth : 4,
214
- barSpacing : 1,
215
- chartRangeMax: undefined,
216
- chartRangeMin: undefined,
217
- chartRangeClip: false,
218
- colorMap : undefined
219
- },
220
- // Defaults for tristate charts
221
- tristate: {
222
- barWidth : 4,
223
- barSpacing : 1,
224
- posBarColor: '#6f6',
225
- negBarColor : '#f44',
226
- zeroBarColor : '#999',
227
- colorMap : {}
228
- },
229
- // Defaults for discrete charts
230
- discrete: {
231
- lineHeight: 'auto',
232
- thresholdColor: undefined,
233
- thresholdValue : 0,
234
- chartRangeMax: undefined,
235
- chartRangeMin: undefined,
236
- chartRangeClip: false
237
- },
238
- // Defaults for bullet charts
239
- bullet: {
240
- targetColor : 'red',
241
- targetWidth : 3, // width of the target bar in pixels
242
- performanceColor : 'blue',
243
- rangeColors : ['#D3DAFE', '#A8B6FF', '#7F94FF' ],
244
- base : undefined // set this to a number to change the base start number
245
- },
246
- // Defaults for pie charts
247
- pie: {
248
- sliceColors : ['#f00', '#0f0', '#00f']
249
- },
250
- // Defaults for box plots
251
- box: {
252
- raw: false,
253
- boxLineColor: 'black',
254
- boxFillColor: '#cdf',
255
- whiskerColor: 'black',
256
- outlierLineColor: '#333',
257
- outlierFillColor: 'white',
258
- medianColor: 'red',
259
- showOutliers: true,
260
- outlierIQR: 1.5,
261
- spotRadius: 1.5,
262
- target: undefined,
263
- targetColor: '#4a2',
264
- chartRangeMax: undefined,
265
- chartRangeMin: undefined
266
- }
267
- };
173
+ /*
174
+ * Default configuration settings
175
+ */
176
+ var defaults = {
177
+ // Settings common to most/all chart types
178
+ common: {
179
+ type : 'line',
180
+ lineColor : '#00f',
181
+ fillColor : '#cdf',
182
+ defaultPixelsPerValue : 3,
183
+ width : 'auto',
184
+ height : 'auto',
185
+ composite : false,
186
+ tagValuesAttribute: 'values',
187
+ tagOptionsPrefix: 'spark',
188
+ enableTagOptions: false
189
+ },
190
+ // Defaults for line charts
191
+ line: {
192
+ spotColor : '#f80',
193
+ spotRadius : 1.5,
194
+ minSpotColor : '#f80',
195
+ maxSpotColor : '#f80',
196
+ lineWidth: 1,
197
+ normalRangeMin : undefined,
198
+ normalRangeMax : undefined,
199
+ normalRangeColor : '#ccc',
200
+ drawNormalOnTop: false,
201
+ chartRangeMin : undefined,
202
+ chartRangeMax : undefined,
203
+ chartRangeMinX : undefined,
204
+ chartRangeMaxX : undefined
205
+ },
206
+ // Defaults for bar charts
207
+ bar: {
208
+ barColor : '#00f',
209
+ negBarColor : '#f44',
210
+ zeroColor: undefined,
211
+ nullColor: undefined,
212
+ zeroAxis : undefined,
213
+ barWidth : 4,
214
+ barSpacing : 1,
215
+ chartRangeMax: undefined,
216
+ chartRangeMin: undefined,
217
+ chartRangeClip: false,
218
+ colorMap : undefined
219
+ },
220
+ // Defaults for tristate charts
221
+ tristate: {
222
+ barWidth : 4,
223
+ barSpacing : 1,
224
+ posBarColor: '#6f6',
225
+ negBarColor : '#f44',
226
+ zeroBarColor : '#999',
227
+ colorMap : {}
228
+ },
229
+ // Defaults for discrete charts
230
+ discrete: {
231
+ lineHeight: 'auto',
232
+ thresholdColor: undefined,
233
+ thresholdValue : 0,
234
+ chartRangeMax: undefined,
235
+ chartRangeMin: undefined,
236
+ chartRangeClip: false
237
+ },
238
+ // Defaults for bullet charts
239
+ bullet: {
240
+ targetColor : 'red',
241
+ targetWidth : 3, // width of the target bar in pixels
242
+ performanceColor : 'blue',
243
+ rangeColors : ['#D3DAFE', '#A8B6FF', '#7F94FF' ],
244
+ base : undefined // set this to a number to change the base start number
245
+ },
246
+ // Defaults for pie charts
247
+ pie: {
248
+ sliceColors : ['#f00', '#0f0', '#00f']
249
+ },
250
+ // Defaults for box plots
251
+ box: {
252
+ raw: false,
253
+ boxLineColor: 'black',
254
+ boxFillColor: '#cdf',
255
+ whiskerColor: 'black',
256
+ outlierLineColor: '#333',
257
+ outlierFillColor: 'white',
258
+ medianColor: 'red',
259
+ showOutliers: true,
260
+ outlierIQR: 1.5,
261
+ spotRadius: 1.5,
262
+ target: undefined,
263
+ targetColor: '#4a2',
264
+ chartRangeMax: undefined,
265
+ chartRangeMin: undefined
266
+ }
267
+ };
268
268
 
269
- // Provide a cross-browser interface to a few simple drawing primitives
270
- var VCanvas_base, VCanvas_canvas, VCanvas_vml;
271
- $.fn.simpledraw = function(width, height, use_existing) {
272
- if (use_existing && this[0].VCanvas) {
273
- return this[0].VCanvas;
274
- }
275
- if (width === undefined) {
276
- width = $(this).innerWidth();
277
- }
278
- if (height === undefined) {
279
- height = $(this).innerHeight();
280
- }
281
- if ($.browser.hasCanvas) {
282
- return new VCanvas_canvas(width, height, this);
283
- } else if ($.browser.msie) {
284
- return new VCanvas_vml(width, height, this);
269
+ // Provide a cross-browser interface to a few simple drawing primitives
270
+ var VCanvas_base, VCanvas_canvas, VCanvas_vml;
271
+ $.fn.simpledraw = function(width, height, use_existing) {
272
+ if (use_existing && this[0].VCanvas) {
273
+ return this[0].VCanvas;
274
+ }
275
+ if (width === undefined) {
276
+ width = $(this).innerWidth();
277
+ }
278
+ if (height === undefined) {
279
+ height = $(this).innerHeight();
280
+ }
281
+ if ($.browser.hasCanvas) {
282
+ return new VCanvas_canvas(width, height, this);
283
+ } else if ($.browser.msie) {
284
+ return new VCanvas_vml(width, height, this);
285
+ } else {
286
+ return false;
287
+ }
288
+ };
289
+
290
+ var pending = [];
291
+
292
+
293
+ $.fn.sparkline = function(uservalues, userOptions) {
294
+ return this.each(function() {
295
+ var options = new $.fn.sparkline.options(this, userOptions);
296
+ var render = function() {
297
+ var values, width, height;
298
+ if (uservalues === 'html' || uservalues === undefined) {
299
+ var vals = this.getAttribute(options.get('tagValuesAttribute'));
300
+ if (vals === undefined || vals === null) {
301
+ vals = $(this).html();
302
+ }
303
+ values = vals.replace(/(^\s*<!--)|(-->\s*$)|\s+/g, '').split(',');
285
304
  } else {
286
- return false;
305
+ values = uservalues;
287
306
  }
288
- };
289
-
290
- var pending = [];
291
-
292
-
293
- $.fn.sparkline = function(uservalues, userOptions) {
294
- return this.each(function() {
295
- var options = new $.fn.sparkline.options(this, userOptions);
296
- var render = function() {
297
- var values, width, height;
298
- if (uservalues === 'html' || uservalues === undefined) {
299
- var vals = this.getAttribute(options.get('tagValuesAttribute'));
300
- if (vals === undefined || vals === null) {
301
- vals = $(this).html();
302
- }
303
- values = vals.replace(/(^\s*<!--)|(-->\s*$)|\s+/g, '').split(',');
304
- } else {
305
- values = uservalues;
306
- }
307
-
308
- width = options.get('width') == 'auto' ? values.length * options.get('defaultPixelsPerValue') : options.get('width');
309
- if (options.get('height') == 'auto') {
310
- if (!options.get('composite') || !this.VCanvas) {
311
- // must be a better way to get the line height
312
- var tmp = document.createElement('span');
313
- tmp.innerHTML = 'a';
314
- $(this).html(tmp);
315
- height = $(tmp).innerHeight();
316
- $(tmp).remove();
317
- }
318
- } else {
319
- height = options.get('height');
320
- }
321
-
322
- $.fn.sparkline[options.get('type')].call(this, values, options, width, height);
323
- };
324
- // jQuery 1.3.0 completely changed the meaning of :hidden :-/
325
- if (($(this).html() && $(this).is(':hidden')) || ($.fn.jquery < "1.3.0" && $(this).parents().is(':hidden')) || !$(this).parents('body').length) {
326
- pending.push([this, render]);
327
- } else {
328
- render.call(this);
329
- }
330
- });
331
- };
332
-
333
- $.fn.sparkline.defaults = defaults;
334
-
335
307
 
336
- $.sparkline_display_visible = function() {
337
- for (var i = pending.length - 1; i >= 0; i--) {
338
- var el = pending[i][0];
339
- if ($(el).is(':visible') && !$(el).parents().is(':hidden')) {
340
- pending[i][1].call(el);
341
- pending.splice(i, 1);
342
- }
343
- }
344
- };
345
-
346
-
347
- /**
348
- * User option handler
349
- */
350
- var UNSET_OPTION = {};
351
- var normalizeValue = function(val) {
352
- switch (val) {
353
- case 'undefined':
354
- val = undefined;
355
- break;
356
- case 'null':
357
- val = null;
358
- break;
359
- case 'true':
360
- val = true;
361
- break;
362
- case 'false':
363
- val = false;
364
- break;
365
- default:
366
- var nf = parseFloat(val);
367
- if (val == nf) {
368
- val = nf;
369
- }
370
- }
371
- return val;
372
- };
373
- $.fn.sparkline.options = function(tag, userOptions) {
374
- var extendedOptions;
375
- this.userOptions = userOptions = userOptions || {};
376
- this.tag = tag;
377
- this.tagValCache = {};
378
- var defaults = $.fn.sparkline.defaults;
379
- var base = defaults.common;
380
- this.tagOptionsPrefix = userOptions.enableTagOptions && (userOptions.tagOptionsPrefix || base.tagOptionsPrefix);
381
-
382
- var tagOptionType = this.getTagSetting('type');
383
- if (tagOptionType === UNSET_OPTION) {
384
- extendedOptions = defaults[userOptions.type || base.type];
308
+ width = options.get('width') == 'auto' ? values.length * options.get('defaultPixelsPerValue') : options.get('width');
309
+ if (options.get('height') == 'auto') {
310
+ if (!options.get('composite') || !this.VCanvas) {
311
+ // must be a better way to get the line height
312
+ var tmp = document.createElement('span');
313
+ tmp.innerHTML = 'a';
314
+ $(this).html(tmp);
315
+ height = $(tmp).innerHeight();
316
+ $(tmp).remove();
317
+ }
385
318
  } else {
386
- extendedOptions = defaults[tagOptionType];
319
+ height = options.get('height');
387
320
  }
388
- this.mergedOptions = $.extend({}, base, extendedOptions, userOptions);
389
- };
390
-
391
321
 
392
- $.fn.sparkline.options.prototype.getTagSetting = function(key) {
393
- var val, i, prefix = this.tagOptionsPrefix;
394
- if (prefix === false || prefix === undefined) {
395
- return UNSET_OPTION;
396
- }
397
- if (this.tagValCache.hasOwnProperty(key)) {
398
- val = this.tagValCache.key;
399
- } else {
400
- val = this.tag.getAttribute(prefix + key);
401
- if (val === undefined || val === null) {
402
- val = UNSET_OPTION;
403
- } else if (val.substr(0, 1) == '[') {
404
- val = val.substr(1, val.length - 2).split(',');
405
- for (i = val.length; i--;) {
406
- val[i] = normalizeValue(val[i].replace(/(^\s*)|(\s*$)/g, ''));
407
- }
408
- } else if (val.substr(0, 1) == '{') {
409
- var pairs = val.substr(1, val.length - 2).split(',');
410
- val = {};
411
- for (i = pairs.length; i--;) {
412
- var keyval = pairs[i].split(':', 2);
413
- val[keyval[0].replace(/(^\s*)|(\s*$)/g, '')] = normalizeValue(keyval[1].replace(/(^\s*)|(\s*$)/g, ''));
414
- }
415
- } else {
416
- val = normalizeValue(val);
417
- }
418
- this.tagValCache.key = val;
419
- }
420
- return val;
421
- };
322
+ $.fn.sparkline[options.get('type')].call(this, values, options, width, height);
323
+ };
324
+ // jQuery 1.3.0 completely changed the meaning of :hidden :-/
325
+ if (($(this).html() && $(this).is(':hidden')) || ($.fn.jquery < "1.3.0" && $(this).parents().is(':hidden')) || !$(this).parents('body').length) {
326
+ pending.push([this, render]);
327
+ } else {
328
+ render.call(this);
329
+ }
330
+ });
331
+ };
422
332
 
423
- $.fn.sparkline.options.prototype.get = function(key) {
424
- var tagOption = this.getTagSetting(key);
425
- if (tagOption !== UNSET_OPTION) {
426
- return tagOption;
427
- }
428
- return this.mergedOptions[key];
429
- };
430
-
431
-
432
- /**
433
- * Line charts
434
- */
435
- $.fn.sparkline.line = function(values, options, width, height) {
436
- var xvalues = [], yvalues = [], yminmax = [];
437
- for (var i = 0; i < values.length; i++) {
438
- var val = values[i];
439
- var isstr = typeof(values[i]) == 'string';
440
- var isarray = typeof(values[i]) == 'object' && values[i] instanceof Array;
441
- var sp = isstr && values[i].split(':');
442
- if (isstr && sp.length == 2) { // x:y
443
- xvalues.push(Number(sp[0]));
444
- yvalues.push(Number(sp[1]));
445
- yminmax.push(Number(sp[1]));
446
- } else if (isarray) {
447
- xvalues.push(val[0]);
448
- yvalues.push(val[1]);
449
- yminmax.push(val[1]);
450
- } else {
451
- xvalues.push(i);
452
- if (values[i] === null || values[i] == 'null') {
453
- yvalues.push(null);
454
- } else {
455
- yvalues.push(Number(val));
456
- yminmax.push(Number(val));
457
- }
458
- }
459
- }
460
- if (options.get('xvalues')) {
461
- xvalues = options.get('xvalues');
462
- }
333
+ $.fn.sparkline.defaults = defaults;
463
334
 
464
- var maxy = Math.max.apply(Math, yminmax);
465
- var maxyval = maxy;
466
- var miny = Math.min.apply(Math, yminmax);
467
- var minyval = miny;
468
335
 
469
- var maxx = Math.max.apply(Math, xvalues);
470
- var minx = Math.min.apply(Math, xvalues);
336
+ $.sparkline_display_visible = function() {
337
+ for (var i = pending.length - 1; i >= 0; i--) {
338
+ var el = pending[i][0];
339
+ if ($(el).is(':visible') && !$(el).parents().is(':hidden')) {
340
+ pending[i][1].call(el);
341
+ pending.splice(i, 1);
342
+ }
343
+ }
344
+ };
345
+
346
+
347
+ /**
348
+ * User option handler
349
+ */
350
+ var UNSET_OPTION = {};
351
+ var normalizeValue = function(val) {
352
+ switch (val) {
353
+ case 'undefined':
354
+ val = undefined;
355
+ break;
356
+ case 'null':
357
+ val = null;
358
+ break;
359
+ case 'true':
360
+ val = true;
361
+ break;
362
+ case 'false':
363
+ val = false;
364
+ break;
365
+ default:
366
+ var nf = parseFloat(val);
367
+ if (val == nf) {
368
+ val = nf;
369
+ }
370
+ }
371
+ return val;
372
+ };
373
+ $.fn.sparkline.options = function(tag, userOptions) {
374
+ var extendedOptions;
375
+ this.userOptions = userOptions = userOptions || {};
376
+ this.tag = tag;
377
+ this.tagValCache = {};
378
+ var defaults = $.fn.sparkline.defaults;
379
+ var base = defaults.common;
380
+ this.tagOptionsPrefix = userOptions.enableTagOptions && (userOptions.tagOptionsPrefix || base.tagOptionsPrefix);
381
+
382
+ var tagOptionType = this.getTagSetting('type');
383
+ if (tagOptionType === UNSET_OPTION) {
384
+ extendedOptions = defaults[userOptions.type || base.type];
385
+ } else {
386
+ extendedOptions = defaults[tagOptionType];
387
+ }
388
+ this.mergedOptions = $.extend({}, base, extendedOptions, userOptions);
389
+ };
471
390
 
472
- var normalRangeMin = options.get('normalRangeMin');
473
- var normalRangeMax = options.get('normalRangeMax');
474
391
 
475
- if (normalRangeMin !== undefined) {
476
- if (normalRangeMin < miny) {
477
- miny = normalRangeMin;
478
- }
479
- if (normalRangeMax > maxy) {
480
- maxy = normalRangeMax;
481
- }
482
- }
483
- if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < miny)) {
484
- miny = options.get('chartRangeMin');
485
- }
486
- if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > maxy)) {
487
- maxy = options.get('chartRangeMax');
488
- }
489
- if (options.get('chartRangeMinX') !== undefined && (options.get('chartRangeClipX') || options.get('chartRangeMinX') < minx)) {
490
- minx = options.get('chartRangeMinX');
392
+ $.fn.sparkline.options.prototype.getTagSetting = function(key) {
393
+ var val, i, prefix = this.tagOptionsPrefix;
394
+ if (prefix === false || prefix === undefined) {
395
+ return UNSET_OPTION;
396
+ }
397
+ if (this.tagValCache.hasOwnProperty(key)) {
398
+ val = this.tagValCache.key;
399
+ } else {
400
+ val = this.tag.getAttribute(prefix + key);
401
+ if (val === undefined || val === null) {
402
+ val = UNSET_OPTION;
403
+ } else if (val.substr(0, 1) == '[') {
404
+ val = val.substr(1, val.length - 2).split(',');
405
+ for (i = val.length; i--;) {
406
+ val[i] = normalizeValue(val[i].replace(/(^\s*)|(\s*$)/g, ''));
491
407
  }
492
- if (options.get('chartRangeMaxX') !== undefined && (options.get('chartRangeClipX') || options.get('chartRangeMaxX') > maxx)) {
493
- maxx = options.get('chartRangeMaxX');
408
+ } else if (val.substr(0, 1) == '{') {
409
+ var pairs = val.substr(1, val.length - 2).split(',');
410
+ val = {};
411
+ for (i = pairs.length; i--;) {
412
+ var keyval = pairs[i].split(':', 2);
413
+ val[keyval[0].replace(/(^\s*)|(\s*$)/g, '')] = normalizeValue(keyval[1].replace(/(^\s*)|(\s*$)/g, ''));
494
414
  }
495
- var rangex = maxx - minx === 0 ? 1 : maxx - minx;
496
- var rangey = maxy - miny === 0 ? 1 : maxy - miny;
497
- var vl = yvalues.length - 1;
415
+ } else {
416
+ val = normalizeValue(val);
417
+ }
418
+ this.tagValCache.key = val;
419
+ }
420
+ return val;
421
+ };
498
422
 
499
- if (vl < 1) {
500
- this.innerHTML = '';
501
- return;
423
+ $.fn.sparkline.options.prototype.get = function(key) {
424
+ var tagOption = this.getTagSetting(key);
425
+ if (tagOption !== UNSET_OPTION) {
426
+ return tagOption;
427
+ }
428
+ return this.mergedOptions[key];
429
+ };
430
+
431
+
432
+ /**
433
+ * Line charts
434
+ */
435
+ $.fn.sparkline.line = function(values, options, width, height) {
436
+ var xvalues = [], yvalues = [], yminmax = [];
437
+ for (var i = 0; i < values.length; i++) {
438
+ var val = values[i];
439
+ var isstr = typeof(values[i]) == 'string';
440
+ var isarray = typeof(values[i]) == 'object' && values[i] instanceof Array;
441
+ var sp = isstr && values[i].split(':');
442
+ if (isstr && sp.length == 2) { // x:y
443
+ xvalues.push(Number(sp[0]));
444
+ yvalues.push(Number(sp[1]));
445
+ yminmax.push(Number(sp[1]));
446
+ } else if (isarray) {
447
+ xvalues.push(val[0]);
448
+ yvalues.push(val[1]);
449
+ yminmax.push(val[1]);
450
+ } else {
451
+ xvalues.push(i);
452
+ if (values[i] === null || values[i] == 'null') {
453
+ yvalues.push(null);
454
+ } else {
455
+ yvalues.push(Number(val));
456
+ yminmax.push(Number(val));
502
457
  }
458
+ }
459
+ }
460
+ if (options.get('xvalues')) {
461
+ xvalues = options.get('xvalues');
462
+ }
503
463
 
504
- var target = $(this).simpledraw(width, height, options.get('composite'));
505
- if (target) {
506
- var canvas_width = target.pixel_width;
507
- var canvas_height = target.pixel_height;
508
- var canvas_top = 0;
509
- var canvas_left = 0;
510
-
511
- var spotRadius = options.get('spotRadius');
512
- if (spotRadius && (canvas_width < (spotRadius * 4) || canvas_height < (spotRadius * 4))) {
513
- spotRadius = 0;
514
- }
515
- if (spotRadius) {
516
- // adjust the canvas size as required so that spots will fit
517
- if (options.get('minSpotColor') || (options.get('spotColor') && yvalues[vl] == miny)) {
518
- canvas_height -= Math.ceil(spotRadius);
519
- }
520
- if (options.get('maxSpotColor') || (options.get('spotColor') && yvalues[vl] == maxy)) {
521
- canvas_height -= Math.ceil(spotRadius);
522
- canvas_top += Math.ceil(spotRadius);
523
- }
524
- if (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[0] == miny || yvalues[0] == maxy)) {
525
- canvas_left += Math.ceil(spotRadius);
526
- canvas_width -= Math.ceil(spotRadius);
527
- }
528
- if (options.get('spotColor') || (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[vl] == miny || yvalues[vl] == maxy))) {
529
- canvas_width -= Math.ceil(spotRadius);
530
- }
531
- }
532
-
464
+ var maxy = Math.max.apply(Math, yminmax);
465
+ var maxyval = maxy;
466
+ var miny = Math.min.apply(Math, yminmax);
467
+ var minyval = miny;
533
468
 
534
- canvas_height--;
469
+ var maxx = Math.max.apply(Math, xvalues);
470
+ var minx = Math.min.apply(Math, xvalues);
535
471
 
536
- var drawNormalRange = function() {
537
- if (normalRangeMin !== undefined) {
538
- var ytop = canvas_top + Math.round(canvas_height - (canvas_height * ((normalRangeMax - miny) / rangey)));
539
- var height = Math.round((canvas_height * (normalRangeMax - normalRangeMin)) / rangey);
540
- target.drawRect(canvas_left, ytop, canvas_width, height, undefined, options.get('normalRangeColor'));
541
- }
542
- };
472
+ var normalRangeMin = options.get('normalRangeMin');
473
+ var normalRangeMax = options.get('normalRangeMax');
543
474
 
544
- if (!options.get('drawNormalOnTop')) {
545
- drawNormalRange();
546
- }
547
-
548
- var path = [];
549
- var paths = [path];
550
- var x, y, vlen = yvalues.length;
551
- for (i = 0; i < vlen; i++) {
552
- x = xvalues[i];
553
- y = yvalues[i];
554
- if (y === null) {
555
- if (i) {
556
- if (yvalues[i - 1] !== null) {
557
- path = [];
558
- paths.push(path);
559
- }
560
- }
561
- } else {
562
- if (y < miny) {
563
- y = miny;
564
- }
565
- if (y > maxy) {
566
- y = maxy;
567
- }
568
- if (!path.length) {
569
- // previous value was null
570
- path.push([canvas_left + Math.round((x - minx) * (canvas_width / rangex)), canvas_top + canvas_height]);
571
- }
572
- path.push([canvas_left + Math.round((x - minx) * (canvas_width / rangex)), canvas_top + Math.round(canvas_height - (canvas_height * ((y - miny) / rangey)))]);
573
- }
574
- }
575
- var lineshapes = [];
576
- var fillshapes = [];
577
- var plen = paths.length;
578
- for (i = 0; i < plen; i++) {
579
- path = paths[i];
580
- if (!path.length) {
581
- continue; // last value was null
582
- }
583
- if (options.get('fillColor')) {
584
- path.push([path[path.length - 1][0], canvas_top + canvas_height - 1]);
585
- fillshapes.push(path.slice(0));
586
- path.pop();
587
- }
588
- // if there's only a single point in this path, then we want to display it as a vertical line
589
- // which means we keep path[0] as is
590
- if (path.length > 2) {
591
- // else we want the first value
592
- path[0] = [ path[0][0], path[1][1] ];
593
- }
594
- lineshapes.push(path);
595
- }
475
+ if (normalRangeMin !== undefined) {
476
+ if (normalRangeMin < miny) {
477
+ miny = normalRangeMin;
478
+ }
479
+ if (normalRangeMax > maxy) {
480
+ maxy = normalRangeMax;
481
+ }
482
+ }
483
+ if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < miny)) {
484
+ miny = options.get('chartRangeMin');
485
+ }
486
+ if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > maxy)) {
487
+ maxy = options.get('chartRangeMax');
488
+ }
489
+ if (options.get('chartRangeMinX') !== undefined && (options.get('chartRangeClipX') || options.get('chartRangeMinX') < minx)) {
490
+ minx = options.get('chartRangeMinX');
491
+ }
492
+ if (options.get('chartRangeMaxX') !== undefined && (options.get('chartRangeClipX') || options.get('chartRangeMaxX') > maxx)) {
493
+ maxx = options.get('chartRangeMaxX');
494
+ }
495
+ var rangex = maxx - minx === 0 ? 1 : maxx - minx;
496
+ var rangey = maxy - miny === 0 ? 1 : maxy - miny;
497
+ var vl = yvalues.length - 1;
596
498
 
597
- // draw the fill first, then optionally the normal range, then the line on top of that
598
- plen = fillshapes.length;
599
- for (i = 0; i < plen; i++) {
600
- target.drawShape(fillshapes[i], undefined, options.get('fillColor'));
601
- }
499
+ if (vl < 1) {
500
+ this.innerHTML = '';
501
+ return;
502
+ }
602
503
 
603
- if (options.get('drawNormalOnTop')) {
604
- drawNormalRange();
605
- }
504
+ var target = $(this).simpledraw(width, height, options.get('composite'));
505
+ if (target) {
506
+ var canvas_width = target.pixel_width;
507
+ var canvas_height = target.pixel_height;
508
+ var canvas_top = 0;
509
+ var canvas_left = 0;
510
+
511
+ var spotRadius = options.get('spotRadius');
512
+ if (spotRadius && (canvas_width < (spotRadius * 4) || canvas_height < (spotRadius * 4))) {
513
+ spotRadius = 0;
514
+ }
515
+ if (spotRadius) {
516
+ // adjust the canvas size as required so that spots will fit
517
+ if (options.get('minSpotColor') || (options.get('spotColor') && yvalues[vl] == miny)) {
518
+ canvas_height -= Math.ceil(spotRadius);
519
+ }
520
+ if (options.get('maxSpotColor') || (options.get('spotColor') && yvalues[vl] == maxy)) {
521
+ canvas_height -= Math.ceil(spotRadius);
522
+ canvas_top += Math.ceil(spotRadius);
523
+ }
524
+ if (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[0] == miny || yvalues[0] == maxy)) {
525
+ canvas_left += Math.ceil(spotRadius);
526
+ canvas_width -= Math.ceil(spotRadius);
527
+ }
528
+ if (options.get('spotColor') || (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[vl] == miny || yvalues[vl] == maxy))) {
529
+ canvas_width -= Math.ceil(spotRadius);
530
+ }
531
+ }
606
532
 
607
- plen = lineshapes.length;
608
- for (i = 0; i < plen; i++) {
609
- target.drawShape(lineshapes[i], options.get('lineColor'), undefined, options.get('lineWidth'));
610
- }
611
533
 
612
- if (spotRadius && options.get('spotColor')) {
613
- target.drawCircle(canvas_left + Math.round(xvalues[xvalues.length - 1] * (canvas_width / rangex)), canvas_top + Math.round(canvas_height - (canvas_height * ((yvalues[vl] - miny) / rangey))), spotRadius, undefined, options.get('spotColor'));
614
- }
615
- if (maxy != minyval) {
616
- if (spotRadius && options.get('minSpotColor')) {
617
- x = xvalues[$.inArray(minyval, yvalues)];
618
- target.drawCircle(canvas_left + Math.round((x - minx) * (canvas_width / rangex)), canvas_top + Math.round(canvas_height - (canvas_height * ((minyval - miny) / rangey))), spotRadius, undefined, options.get('minSpotColor'));
619
- }
620
- if (spotRadius && options.get('maxSpotColor')) {
621
- x = xvalues[$.inArray(maxyval, yvalues)];
622
- target.drawCircle(canvas_left + Math.round((x - minx) * (canvas_width / rangex)), canvas_top + Math.round(canvas_height - (canvas_height * ((maxyval - miny) / rangey))), spotRadius, undefined, options.get('maxSpotColor'));
623
- }
624
- }
534
+ canvas_height--;
625
535
 
626
- } else {
627
- // Remove the tag contents if sparklines aren't supported
628
- this.innerHTML = '';
536
+ var drawNormalRange = function() {
537
+ if (normalRangeMin !== undefined) {
538
+ var ytop = canvas_top + Math.round(canvas_height - (canvas_height * ((normalRangeMax - miny) / rangey)));
539
+ var height = Math.round((canvas_height * (normalRangeMax - normalRangeMin)) / rangey);
540
+ target.drawRect(canvas_left, ytop, canvas_width, height, undefined, options.get('normalRangeColor'));
629
541
  }
630
- };
631
-
632
-
633
- /**
634
- * Bar charts
635
- */
636
- $.fn.sparkline.bar = function(values, options, width, height) {
637
- width = (values.length * options.get('barWidth')) + ((values.length - 1) * options.get('barSpacing'));
638
- var num_values = [];
639
- for (var i = 0, vlen = values.length; i < vlen; i++) {
640
- if (values[i] == 'null' || values[i] === null) {
641
- values[i] = null;
642
- } else {
643
- values[i] = Number(values[i]);
644
- num_values.push(Number(values[i]));
542
+ };
543
+
544
+ if (!options.get('drawNormalOnTop')) {
545
+ drawNormalRange();
546
+ }
547
+
548
+ var path = [];
549
+ var paths = [path];
550
+ var x, y, vlen = yvalues.length;
551
+ for (i = 0; i < vlen; i++) {
552
+ x = xvalues[i];
553
+ y = yvalues[i];
554
+ if (y === null) {
555
+ if (i) {
556
+ if (yvalues[i - 1] !== null) {
557
+ path = [];
558
+ paths.push(path);
645
559
  }
560
+ }
561
+ } else {
562
+ if (y < miny) {
563
+ y = miny;
564
+ }
565
+ if (y > maxy) {
566
+ y = maxy;
567
+ }
568
+ if (!path.length) {
569
+ // previous value was null
570
+ path.push([canvas_left + Math.round((x - minx) * (canvas_width / rangex)), canvas_top + canvas_height]);
571
+ }
572
+ path.push([canvas_left + Math.round((x - minx) * (canvas_width / rangex)), canvas_top + Math.round(canvas_height - (canvas_height * ((y - miny) / rangey)))]);
646
573
  }
647
- var max = Math.max.apply(Math, num_values),
648
- min = Math.min.apply(Math, num_values);
649
- if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < min)) {
650
- min = options.get('chartRangeMin');
574
+ }
575
+ var lineshapes = [];
576
+ var fillshapes = [];
577
+ var plen = paths.length;
578
+ for (i = 0; i < plen; i++) {
579
+ path = paths[i];
580
+ if (!path.length) {
581
+ continue; // last value was null
651
582
  }
652
- if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > max)) {
653
- max = options.get('chartRangeMax');
583
+ if (options.get('fillColor')) {
584
+ path.push([path[path.length - 1][0], canvas_top + canvas_height - 1]);
585
+ fillshapes.push(path.slice(0));
586
+ path.pop();
654
587
  }
655
- var zeroAxis = options.get('zeroAxis');
656
- if (zeroAxis === undefined) {
657
- zeroAxis = min < 0;
588
+ // if there's only a single point in this path, then we want to display it as a vertical line
589
+ // which means we keep path[0] as is
590
+ if (path.length > 2) {
591
+ // else we want the first value
592
+ path[0] = [ path[0][0], path[1][1] ];
658
593
  }
659
- var range = max - min === 0 ? 1 : max - min;
660
-
661
- var colorMapByIndex, colorMapByValue;
662
- if ($.isArray(options.get('colorMap'))) {
663
- colorMapByIndex = options.get('colorMap');
664
- colorMapByValue = null;
665
- } else {
666
- colorMapByIndex = null;
667
- colorMapByValue = options.get('colorMap');
594
+ lineshapes.push(path);
595
+ }
596
+
597
+ // draw the fill first, then optionally the normal range, then the line on top of that
598
+ plen = fillshapes.length;
599
+ for (i = 0; i < plen; i++) {
600
+ target.drawShape(fillshapes[i], undefined, options.get('fillColor'));
601
+ }
602
+
603
+ if (options.get('drawNormalOnTop')) {
604
+ drawNormalRange();
605
+ }
606
+
607
+ plen = lineshapes.length;
608
+ for (i = 0; i < plen; i++) {
609
+ target.drawShape(lineshapes[i], options.get('lineColor'), undefined, options.get('lineWidth'));
610
+ }
611
+
612
+ if (spotRadius && options.get('spotColor')) {
613
+ target.drawCircle(canvas_left + Math.round(xvalues[xvalues.length - 1] * (canvas_width / rangex)), canvas_top + Math.round(canvas_height - (canvas_height * ((yvalues[vl] - miny) / rangey))), spotRadius, undefined, options.get('spotColor'));
614
+ }
615
+ if (maxy != minyval) {
616
+ if (spotRadius && options.get('minSpotColor')) {
617
+ x = xvalues[$.inArray(minyval, yvalues)];
618
+ target.drawCircle(canvas_left + Math.round((x - minx) * (canvas_width / rangex)), canvas_top + Math.round(canvas_height - (canvas_height * ((minyval - miny) / rangey))), spotRadius, undefined, options.get('minSpotColor'));
668
619
  }
669
-
670
- var target = $(this).simpledraw(width, height, options.get('composite'));
671
- if (target) {
672
- var color,
673
- canvas_height = target.pixel_height,
674
- yzero = min < 0 && zeroAxis ? canvas_height - Math.round(canvas_height * (Math.abs(min) / range)) - 1 : canvas_height - 1;
675
-
676
- for (i = values.length; i--;) {
677
- var x = i * (options.get('barWidth') + options.get('barSpacing')),
678
- y,
679
- val = values[i];
680
- if (val === null) {
681
- if (options.get('nullColor')) {
682
- color = options.get('nullColor');
683
- val = (zeroAxis && min < 0) ? 0 : min;
684
- height = 1;
685
- y = (zeroAxis && min < 0) ? yzero : canvas_height - height;
686
- } else {
687
- continue;
688
- }
689
- } else {
690
- if (val < min) {
691
- val = min;
692
- }
693
- if (val > max) {
694
- val = max;
695
- }
696
- color = (val < 0) ? options.get('negBarColor') : options.get('barColor');
697
- if (zeroAxis && min < 0) {
698
- height = Math.round(canvas_height * ((Math.abs(val) / range))) + 1;
699
- y = (val < 0) ? yzero : yzero - height;
700
- } else {
701
- height = Math.round(canvas_height * ((val - min) / range)) + 1;
702
- y = canvas_height - height;
703
- }
704
- if (val === 0 && options.get('zeroColor') !== undefined) {
705
- color = options.get('zeroColor');
706
- }
707
- if (colorMapByValue && colorMapByValue[val]) {
708
- color = colorMapByValue[val];
709
- } else if (colorMapByIndex && colorMapByIndex.length > i) {
710
- color = colorMapByIndex[i];
711
- }
712
- if (color === null) {
713
- continue;
714
- }
715
- }
716
- target.drawRect(x, y, options.get('barWidth') - 1, height - 1, color, color);
717
- }
718
- } else {
719
- // Remove the tag contents if sparklines aren't supported
720
- this.innerHTML = '';
620
+ if (spotRadius && options.get('maxSpotColor')) {
621
+ x = xvalues[$.inArray(maxyval, yvalues)];
622
+ target.drawCircle(canvas_left + Math.round((x - minx) * (canvas_width / rangex)), canvas_top + Math.round(canvas_height - (canvas_height * ((maxyval - miny) / rangey))), spotRadius, undefined, options.get('maxSpotColor'));
721
623
  }
722
- };
624
+ }
723
625
 
626
+ } else {
627
+ // Remove the tag contents if sparklines aren't supported
628
+ this.innerHTML = '';
629
+ }
630
+ };
631
+
632
+
633
+ /**
634
+ * Bar charts
635
+ */
636
+ $.fn.sparkline.bar = function(values, options, width, height) {
637
+ width = (values.length * options.get('barWidth')) + ((values.length - 1) * options.get('barSpacing'));
638
+ var num_values = [];
639
+ for (var i = 0, vlen = values.length; i < vlen; i++) {
640
+ if (values[i] == 'null' || values[i] === null) {
641
+ values[i] = null;
642
+ } else {
643
+ values[i] = Number(values[i]);
644
+ num_values.push(Number(values[i]));
645
+ }
646
+ }
647
+ var max = Math.max.apply(Math, num_values),
648
+ min = Math.min.apply(Math, num_values);
649
+ if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < min)) {
650
+ min = options.get('chartRangeMin');
651
+ }
652
+ if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > max)) {
653
+ max = options.get('chartRangeMax');
654
+ }
655
+ var zeroAxis = options.get('zeroAxis');
656
+ if (zeroAxis === undefined) {
657
+ zeroAxis = min < 0;
658
+ }
659
+ var range = max - min === 0 ? 1 : max - min;
660
+
661
+ var colorMapByIndex, colorMapByValue;
662
+ if ($.isArray(options.get('colorMap'))) {
663
+ colorMapByIndex = options.get('colorMap');
664
+ colorMapByValue = null;
665
+ } else {
666
+ colorMapByIndex = null;
667
+ colorMapByValue = options.get('colorMap');
668
+ }
724
669
 
725
- /**
726
- * Tristate charts
727
- */
728
- $.fn.sparkline.tristate = function(values, options, width, height) {
729
- values = $.map(values, Number);
730
- width = (values.length * options.get('barWidth')) + ((values.length - 1) * options.get('barSpacing'));
731
-
732
- var colorMapByIndex, colorMapByValue;
733
- if ($.isArray(options.get('colorMap'))) {
734
- colorMapByIndex = options.get('colorMap');
735
- colorMapByValue = null;
670
+ var target = $(this).simpledraw(width, height, options.get('composite'));
671
+ if (target) {
672
+ var color,
673
+ canvas_height = target.pixel_height,
674
+ yzero = min < 0 && zeroAxis ? canvas_height - Math.round(canvas_height * (Math.abs(min) / range)) - 1 : canvas_height - 1;
675
+
676
+ for (i = values.length; i--;) {
677
+ var x = i * (options.get('barWidth') + options.get('barSpacing')),
678
+ y,
679
+ val = values[i];
680
+ if (val === null) {
681
+ if (options.get('nullColor')) {
682
+ color = options.get('nullColor');
683
+ val = (zeroAxis && min < 0) ? 0 : min;
684
+ height = 1;
685
+ y = (zeroAxis && min < 0) ? yzero : canvas_height - height;
686
+ } else {
687
+ continue;
688
+ }
736
689
  } else {
737
- colorMapByIndex = null;
738
- colorMapByValue = options.get('colorMap');
690
+ if (val < min) {
691
+ val = min;
692
+ }
693
+ if (val > max) {
694
+ val = max;
695
+ }
696
+ color = (val < 0) ? options.get('negBarColor') : options.get('barColor');
697
+ if (zeroAxis && min < 0) {
698
+ height = Math.round(canvas_height * ((Math.abs(val) / range))) + 1;
699
+ y = (val < 0) ? yzero : yzero - height;
700
+ } else {
701
+ height = Math.round(canvas_height * ((val - min) / range)) + 1;
702
+ y = canvas_height - height;
703
+ }
704
+ if (val === 0 && options.get('zeroColor') !== undefined) {
705
+ color = options.get('zeroColor');
706
+ }
707
+ if (colorMapByValue && colorMapByValue[val]) {
708
+ color = colorMapByValue[val];
709
+ } else if (colorMapByIndex && colorMapByIndex.length > i) {
710
+ color = colorMapByIndex[i];
711
+ }
712
+ if (color === null) {
713
+ continue;
714
+ }
739
715
  }
716
+ target.drawRect(x, y, options.get('barWidth') - 1, height - 1, color, color);
717
+ }
718
+ } else {
719
+ // Remove the tag contents if sparklines aren't supported
720
+ this.innerHTML = '';
721
+ }
722
+ };
723
+
724
+
725
+ /**
726
+ * Tristate charts
727
+ */
728
+ $.fn.sparkline.tristate = function(values, options, width, height) {
729
+ values = $.map(values, Number);
730
+ width = (values.length * options.get('barWidth')) + ((values.length - 1) * options.get('barSpacing'));
731
+
732
+ var colorMapByIndex, colorMapByValue;
733
+ if ($.isArray(options.get('colorMap'))) {
734
+ colorMapByIndex = options.get('colorMap');
735
+ colorMapByValue = null;
736
+ } else {
737
+ colorMapByIndex = null;
738
+ colorMapByValue = options.get('colorMap');
739
+ }
740
740
 
741
- var target = $(this).simpledraw(width, height, options.get('composite'));
742
- if (target) {
743
- var canvas_height = target.pixel_height,
744
- half_height = Math.round(canvas_height / 2);
745
-
746
- for (var i = values.length; i--;) {
747
- var x = i * (options.get('barWidth') + options.get('barSpacing')),
748
- y, color;
749
- if (values[i] < 0) {
750
- y = half_height;
751
- height = half_height - 1;
752
- color = options.get('negBarColor');
753
- } else if (values[i] > 0) {
754
- y = 0;
755
- height = half_height - 1;
756
- color = options.get('posBarColor');
757
- } else {
758
- y = half_height - 1;
759
- height = 2;
760
- color = options.get('zeroBarColor');
761
- }
762
- if (colorMapByValue && colorMapByValue[values[i]]) {
763
- color = colorMapByValue[values[i]];
764
- } else if (colorMapByIndex && colorMapByIndex.length > i) {
765
- color = colorMapByIndex[i];
766
- }
767
- if (color === null) {
768
- continue;
769
- }
770
- target.drawRect(x, y, options.get('barWidth') - 1, height - 1, color, color);
771
- }
741
+ var target = $(this).simpledraw(width, height, options.get('composite'));
742
+ if (target) {
743
+ var canvas_height = target.pixel_height,
744
+ half_height = Math.round(canvas_height / 2);
745
+
746
+ for (var i = values.length; i--;) {
747
+ var x = i * (options.get('barWidth') + options.get('barSpacing')),
748
+ y, color;
749
+ if (values[i] < 0) {
750
+ y = half_height;
751
+ height = half_height - 1;
752
+ color = options.get('negBarColor');
753
+ } else if (values[i] > 0) {
754
+ y = 0;
755
+ height = half_height - 1;
756
+ color = options.get('posBarColor');
772
757
  } else {
773
- // Remove the tag contents if sparklines aren't supported
774
- this.innerHTML = '';
758
+ y = half_height - 1;
759
+ height = 2;
760
+ color = options.get('zeroBarColor');
775
761
  }
776
- };
777
-
778
-
779
- /**
780
- * Discrete charts
781
- */
782
- $.fn.sparkline.discrete = function(values, options, width, height) {
783
- values = $.map(values, Number);
784
- width = options.get('width') == 'auto' ? values.length * 2 : width;
785
- var interval = Math.floor(width / values.length);
786
-
787
- var target = $(this).simpledraw(width, height, options.get('composite'));
788
- if (target) {
789
- var canvas_height = target.pixel_height,
790
- line_height = options.get('lineHeight') == 'auto' ? Math.round(canvas_height * 0.3) : options.get('lineHeight'),
791
- pheight = canvas_height - line_height,
792
- min = Math.min.apply(Math, values),
793
- max = Math.max.apply(Math, values);
794
- if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < min)) {
795
- min = options.get('chartRangeMin');
796
- }
797
- if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > max)) {
798
- max = options.get('chartRangeMax');
799
- }
800
- var range = max - min;
801
-
802
- for (var i = values.length; i--;) {
803
- var val = values[i];
804
- if (val < min) {
805
- val = min;
806
- }
807
- if (val > max) {
808
- val = max;
809
- }
810
- var x = (i * interval),
811
- ytop = Math.round(pheight - pheight * ((val - min) / range));
812
- target.drawLine(x, ytop, x, ytop + line_height, (options.get('thresholdColor') && val < options.get('thresholdValue')) ? options.get('thresholdColor') : options.get('lineColor'));
813
- }
814
- } else {
815
- // Remove the tag contents if sparklines aren't supported
816
- this.innerHTML = '';
762
+ if (colorMapByValue && colorMapByValue[values[i]]) {
763
+ color = colorMapByValue[values[i]];
764
+ } else if (colorMapByIndex && colorMapByIndex.length > i) {
765
+ color = colorMapByIndex[i];
817
766
  }
818
-
819
- };
820
-
821
-
822
- /**
823
- * Bullet charts
824
- */
825
- $.fn.sparkline.bullet = function(values, options, width, height) {
826
- values = $.map(values, Number);
827
- // target, performance, range1, range2, range3
828
-
829
- width = options.get('width') == 'auto' ? '4.0em' : width;
830
-
831
- var target = $(this).simpledraw(width, height, options.get('composite'));
832
- if (target && values.length > 1) {
833
- var canvas_width = target.pixel_width - Math.ceil(options.get('targetWidth') / 2),
834
- canvas_height = target.pixel_height,
835
- min = Math.min.apply(Math, values),
836
- max = Math.max.apply(Math, values);
837
-
838
- if (options.get('base') === undefined) {
839
- min = min < 0 ? min : 0;
840
- } else {
841
- min = options.get('base');
842
- }
843
- var range = max - min;
844
-
845
- // draw range values
846
- for (var i = 2, vlen = values.length; i < vlen; i++) {
847
- var rangeval = values[i],
848
- rangewidth = Math.round(canvas_width * ((rangeval - min) / range));
849
- target.drawRect(0, 0, rangewidth - 1, canvas_height - 1, options.get('rangeColors')[i - 2], options.get('rangeColors')[i - 2]);
850
- }
851
-
852
- // draw the performance bar
853
- var perfval = values[1],
854
- perfwidth = Math.round(canvas_width * ((perfval - min) / range));
855
- target.drawRect(0, Math.round(canvas_height * 0.3), perfwidth - 1, Math.round(canvas_height * 0.4) - 1, options.get('performanceColor'), options.get('performanceColor'));
856
-
857
- // draw the target line
858
- var targetval = values[0],
859
- x = Math.round(canvas_width * ((targetval - min) / range) - (options.get('targetWidth') / 2)),
860
- targettop = Math.round(canvas_height * 0.10),
861
- targetheight = canvas_height - (targettop * 2);
862
- target.drawRect(x, targettop, options.get('targetWidth') - 1, targetheight - 1, options.get('targetColor'), options.get('targetColor'));
863
- } else {
864
- // Remove the tag contents if sparklines aren't supported
865
- this.innerHTML = '';
767
+ if (color === null) {
768
+ continue;
866
769
  }
867
- };
868
-
869
-
870
- /**
871
- * Pie charts
872
- */
873
- $.fn.sparkline.pie = function(values, options, width, height) {
874
- values = $.map(values, Number);
875
- width = options.get('width') == 'auto' ? height : width;
876
-
877
- var target = $(this).simpledraw(width, height, options.get('composite'));
878
- if (target && values.length > 1) {
879
- var canvas_width = target.pixel_width,
880
- canvas_height = target.pixel_height,
881
- radius = Math.floor(Math.min(canvas_width, canvas_height) / 2),
882
- total = 0,
883
- next = 0,
884
- circle = 2 * Math.PI;
885
-
886
- for (var i = values.length; i--;) {
887
- total += values[i];
888
- }
889
-
890
- if (options.get('offset')) {
891
- next += (2 * Math.PI) * (options.get('offset') / 360);
892
- }
893
- var vlen = values.length;
894
- for (i = 0; i < vlen; i++) {
895
- var start = next;
896
- var end = next;
897
- if (total > 0) { // avoid divide by zero
898
- end = next + (circle * (values[i] / total));
899
- }
900
- target.drawPieSlice(radius, radius, radius, start, end, undefined, options.get('sliceColors')[i % options.get('sliceColors').length]);
901
- next = end;
902
- }
770
+ target.drawRect(x, y, options.get('barWidth') - 1, height - 1, color, color);
771
+ }
772
+ } else {
773
+ // Remove the tag contents if sparklines aren't supported
774
+ this.innerHTML = '';
775
+ }
776
+ };
777
+
778
+
779
+ /**
780
+ * Discrete charts
781
+ */
782
+ $.fn.sparkline.discrete = function(values, options, width, height) {
783
+ values = $.map(values, Number);
784
+ width = options.get('width') == 'auto' ? values.length * 2 : width;
785
+ var interval = Math.floor(width / values.length);
786
+
787
+ var target = $(this).simpledraw(width, height, options.get('composite'));
788
+ if (target) {
789
+ var canvas_height = target.pixel_height,
790
+ line_height = options.get('lineHeight') == 'auto' ? Math.round(canvas_height * 0.3) : options.get('lineHeight'),
791
+ pheight = canvas_height - line_height,
792
+ min = Math.min.apply(Math, values),
793
+ max = Math.max.apply(Math, values);
794
+ if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < min)) {
795
+ min = options.get('chartRangeMin');
796
+ }
797
+ if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > max)) {
798
+ max = options.get('chartRangeMax');
799
+ }
800
+ var range = max - min;
801
+
802
+ for (var i = values.length; i--;) {
803
+ var val = values[i];
804
+ if (val < min) {
805
+ val = min;
903
806
  }
904
- };
905
-
906
-
907
- /**
908
- * Box plots
909
- */
910
- var quartile = function(values, q) {
911
- if (q == 2) {
912
- var vl2 = Math.floor(values.length / 2);
913
- return values.length % 2 ? values[vl2] : (values[vl2] + values[vl2 + 1]) / 2;
914
- } else {
915
- var vl4 = Math.floor(values.length / 4);
916
- return values.length % 2 ? (values[vl4 * q] + values[vl4 * q + 1]) / 2 : values[vl4 * q];
807
+ if (val > max) {
808
+ val = max;
917
809
  }
918
- };
919
-
920
- $.fn.sparkline.box = function(values, options, width, height) {
921
- values = $.map(values, Number);
922
- width = options.get('width') == 'auto' ? '4.0em' : width;
923
-
924
- var minvalue = options.get('chartRangeMin') === undefined ? Math.min.apply(Math, values) : options.get('chartRangeMin'),
925
- maxvalue = options.get('chartRangeMax') === undefined ? Math.max.apply(Math, values) : options.get('chartRangeMax'),
926
- target = $(this).simpledraw(width, height, options.get('composite')),
927
- vlen = values.length,
928
- lwhisker, loutlier, q1, q2, q3, rwhisker, routlier;
929
-
930
- if (target && values.length > 1) {
931
- var canvas_width = target.pixel_width,
932
- canvas_height = target.pixel_height;
933
- if (options.get('raw')) {
934
- if (options.get('showOutliers') && values.length > 5) {
935
- loutlier = values[0];
936
- lwhisker = values[1];
937
- q1 = values[2];
938
- q2 = values[3];
939
- q3 = values[4];
940
- rwhisker = values[5];
941
- routlier = values[6];
942
- } else {
943
- lwhisker = values[0];
944
- q1 = values[1];
945
- q2 = values[2];
946
- q3 = values[3];
947
- rwhisker = values[4];
948
- }
949
- } else {
950
- values.sort(function(a, b) {
951
- return a - b;
952
- });
953
- q1 = quartile(values, 1);
954
- q2 = quartile(values, 2);
955
- q3 = quartile(values, 3);
956
- var iqr = q3 - q1;
957
- if (options.get('showOutliers')) {
958
- lwhisker = undefined;
959
- rwhisker = undefined;
960
- for (var i = 0; i < vlen; i++) {
961
- if (lwhisker === undefined && values[i] > q1 - (iqr * options.get('outlierIQR'))) {
962
- lwhisker = values[i];
963
- }
964
- if (values[i] < q3 + (iqr * options.get('outlierIQR'))) {
965
- rwhisker = values[i];
966
- }
967
- }
968
- loutlier = values[0];
969
- routlier = values[vlen - 1];
970
- } else {
971
- lwhisker = values[0];
972
- rwhisker = values[vlen - 1];
973
- }
974
- }
975
-
976
- var unitsize = canvas_width / (maxvalue - minvalue + 1),
977
- canvas_left = 0;
978
- if (options.get('showOutliers')) {
979
- canvas_left = Math.ceil(options.get('spotRadius'));
980
- canvas_width -= 2 * Math.ceil(options.get('spotRadius'));
981
- unitsize = canvas_width / (maxvalue - minvalue + 1);
982
- if (loutlier < lwhisker) {
983
- target.drawCircle((loutlier - minvalue) * unitsize + canvas_left, canvas_height / 2, options.get('spotRadius'), options.get('outlierLineColor'), options.get('outlierFillColor'));
984
- }
985
- if (routlier > rwhisker) {
986
- target.drawCircle((routlier - minvalue) * unitsize + canvas_left, canvas_height / 2, options.get('spotRadius'), options.get('outlierLineColor'), options.get('outlierFillColor'));
987
- }
988
- }
810
+ var x = (i * interval),
811
+ ytop = Math.round(pheight - pheight * ((val - min) / range));
812
+ target.drawLine(x, ytop, x, ytop + line_height, (options.get('thresholdColor') && val < options.get('thresholdValue')) ? options.get('thresholdColor') : options.get('lineColor'));
813
+ }
814
+ } else {
815
+ // Remove the tag contents if sparklines aren't supported
816
+ this.innerHTML = '';
817
+ }
989
818
 
990
- // box
991
- target.drawRect(
992
- Math.round((q1 - minvalue) * unitsize + canvas_left),
993
- Math.round(canvas_height * 0.1),
994
- Math.round((q3 - q1) * unitsize),
995
- Math.round(canvas_height * 0.8),
996
- options.get('boxLineColor'),
997
- options.get('boxFillColor'));
998
- // left whisker
999
- target.drawLine(
1000
- Math.round((lwhisker - minvalue) * unitsize + canvas_left),
1001
- Math.round(canvas_height / 2),
1002
- Math.round((q1 - minvalue) * unitsize + canvas_left),
1003
- Math.round(canvas_height / 2),
1004
- options.get('lineColor'));
1005
- target.drawLine(
1006
- Math.round((lwhisker - minvalue) * unitsize + canvas_left),
1007
- Math.round(canvas_height / 4),
1008
- Math.round((lwhisker - minvalue) * unitsize + canvas_left),
1009
- Math.round(canvas_height - canvas_height / 4),
1010
- options.get('whiskerColor'));
1011
- // right whisker
1012
- target.drawLine(Math.round((rwhisker - minvalue) * unitsize + canvas_left),
1013
- Math.round(canvas_height / 2),
1014
- Math.round((q3 - minvalue) * unitsize + canvas_left),
1015
- Math.round(canvas_height / 2),
1016
- options.get('lineColor'));
1017
- target.drawLine(
1018
- Math.round((rwhisker - minvalue) * unitsize + canvas_left),
1019
- Math.round(canvas_height / 4),
1020
- Math.round((rwhisker - minvalue) * unitsize + canvas_left),
1021
- Math.round(canvas_height - canvas_height / 4),
1022
- options.get('whiskerColor'));
1023
- // median line
1024
- target.drawLine(
1025
- Math.round((q2 - minvalue) * unitsize + canvas_left),
1026
- Math.round(canvas_height * 0.1),
1027
- Math.round((q2 - minvalue) * unitsize + canvas_left),
1028
- Math.round(canvas_height * 0.9),
1029
- options.get('medianColor'));
1030
- if (options.get('target')) {
1031
- var size = Math.ceil(options.get('spotRadius'));
1032
- target.drawLine(
1033
- Math.round((options.get('target') - minvalue) * unitsize + canvas_left),
1034
- Math.round((canvas_height / 2) - size),
1035
- Math.round((options.get('target') - minvalue) * unitsize + canvas_left),
1036
- Math.round((canvas_height / 2) + size),
1037
- options.get('targetColor'));
1038
- target.drawLine(
1039
- Math.round((options.get('target') - minvalue) * unitsize + canvas_left - size),
1040
- Math.round(canvas_height / 2),
1041
- Math.round((options.get('target') - minvalue) * unitsize + canvas_left + size),
1042
- Math.round(canvas_height / 2),
1043
- options.get('targetColor'));
1044
- }
1045
- } else {
1046
- // Remove the tag contents if sparklines aren't supported
1047
- this.innerHTML = '';
819
+ };
820
+
821
+
822
+ /**
823
+ * Bullet charts
824
+ */
825
+ $.fn.sparkline.bullet = function(values, options, width, height) {
826
+ values = $.map(values, Number);
827
+ // target, performance, range1, range2, range3
828
+
829
+ width = options.get('width') == 'auto' ? '4.0em' : width;
830
+
831
+ var target = $(this).simpledraw(width, height, options.get('composite'));
832
+ if (target && values.length > 1) {
833
+ var canvas_width = target.pixel_width - Math.ceil(options.get('targetWidth') / 2),
834
+ canvas_height = target.pixel_height,
835
+ min = Math.min.apply(Math, values),
836
+ max = Math.max.apply(Math, values);
837
+
838
+ if (options.get('base') === undefined) {
839
+ min = min < 0 ? min : 0;
840
+ } else {
841
+ min = options.get('base');
842
+ }
843
+ var range = max - min;
844
+
845
+ // draw range values
846
+ for (var i = 2, vlen = values.length; i < vlen; i++) {
847
+ var rangeval = values[i],
848
+ rangewidth = Math.round(canvas_width * ((rangeval - min) / range));
849
+ target.drawRect(0, 0, rangewidth - 1, canvas_height - 1, options.get('rangeColors')[i - 2], options.get('rangeColors')[i - 2]);
850
+ }
851
+
852
+ // draw the performance bar
853
+ var perfval = values[1],
854
+ perfwidth = Math.round(canvas_width * ((perfval - min) / range));
855
+ target.drawRect(0, Math.round(canvas_height * 0.3), perfwidth - 1, Math.round(canvas_height * 0.4) - 1, options.get('performanceColor'), options.get('performanceColor'));
856
+
857
+ // draw the target line
858
+ var targetval = values[0],
859
+ x = Math.round(canvas_width * ((targetval - min) / range) - (options.get('targetWidth') / 2)),
860
+ targettop = Math.round(canvas_height * 0.10),
861
+ targetheight = canvas_height - (targettop * 2);
862
+ target.drawRect(x, targettop, options.get('targetWidth') - 1, targetheight - 1, options.get('targetColor'), options.get('targetColor'));
863
+ } else {
864
+ // Remove the tag contents if sparklines aren't supported
865
+ this.innerHTML = '';
866
+ }
867
+ };
868
+
869
+
870
+ /**
871
+ * Pie charts
872
+ */
873
+ $.fn.sparkline.pie = function(values, options, width, height) {
874
+ values = $.map(values, Number);
875
+ width = options.get('width') == 'auto' ? height : width;
876
+
877
+ var target = $(this).simpledraw(width, height, options.get('composite'));
878
+ if (target && values.length > 1) {
879
+ var canvas_width = target.pixel_width,
880
+ canvas_height = target.pixel_height,
881
+ radius = Math.floor(Math.min(canvas_width, canvas_height) / 2),
882
+ total = 0,
883
+ next = 0,
884
+ circle = 2 * Math.PI;
885
+
886
+ for (var i = values.length; i--;) {
887
+ total += values[i];
888
+ }
889
+
890
+ if (options.get('offset')) {
891
+ next += (2 * Math.PI) * (options.get('offset') / 360);
892
+ }
893
+ var vlen = values.length;
894
+ for (i = 0; i < vlen; i++) {
895
+ var start = next;
896
+ var end = next;
897
+ if (total > 0) { // avoid divide by zero
898
+ end = next + (circle * (values[i] / total));
1048
899
  }
1049
- };
1050
-
1051
-
1052
- // Setup a very simple "virtual canvas" to make drawing the few shapes we need easier
1053
- // This is accessible as $(foo).simpledraw()
1054
-
1055
- if ($.browser.msie && !document.namespaces.v) {
1056
- document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', '#default#VML');
900
+ target.drawPieSlice(radius, radius, radius, start, end, undefined, options.get('sliceColors')[i % options.get('sliceColors').length]);
901
+ next = end;
902
+ }
1057
903
  }
1058
-
1059
- if ($.browser.hasCanvas === undefined) {
1060
- var t = document.createElement('canvas');
1061
- $.browser.hasCanvas = t.getContext !== undefined;
904
+ };
905
+
906
+
907
+ /**
908
+ * Box plots
909
+ */
910
+ var quartile = function(values, q) {
911
+ if (q == 2) {
912
+ var vl2 = Math.floor(values.length / 2);
913
+ return values.length % 2 ? values[vl2] : (values[vl2] + values[vl2 + 1]) / 2;
914
+ } else {
915
+ var vl4 = Math.floor(values.length / 4);
916
+ return values.length % 2 ? (values[vl4 * q] + values[vl4 * q + 1]) / 2 : values[vl4 * q];
1062
917
  }
1063
-
1064
- VCanvas_base = function(width, height, target) {
1065
- };
1066
-
1067
- VCanvas_base.prototype = {
1068
- init : function(width, height, target) {
1069
- this.width = width;
1070
- this.height = height;
1071
- this.target = target;
1072
- if (target[0]) {
1073
- target = target[0];
1074
- }
1075
- target.VCanvas = this;
1076
- },
1077
-
1078
- drawShape : function(path, lineColor, fillColor, lineWidth) {
1079
- alert('drawShape not implemented');
1080
- },
1081
-
1082
- drawLine : function(x1, y1, x2, y2, lineColor, lineWidth) {
1083
- return this.drawShape([
1084
- [x1,y1],
1085
- [x2,y2]
1086
- ], lineColor, lineWidth);
1087
- },
1088
-
1089
- drawCircle : function(x, y, radius, lineColor, fillColor) {
1090
- alert('drawCircle not implemented');
1091
- },
1092
-
1093
- drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
1094
- alert('drawPieSlice not implemented');
1095
- },
1096
-
1097
- drawRect : function(x, y, width, height, lineColor, fillColor) {
1098
- alert('drawRect not implemented');
1099
- },
1100
-
1101
- getElement : function() {
1102
- return this.canvas;
1103
- },
1104
-
1105
- _insert : function(el, target) {
1106
- $(target).html(el);
918
+ };
919
+
920
+ $.fn.sparkline.box = function(values, options, width, height) {
921
+ values = $.map(values, Number);
922
+ width = options.get('width') == 'auto' ? '4.0em' : width;
923
+
924
+ var minvalue = options.get('chartRangeMin') === undefined ? Math.min.apply(Math, values) : options.get('chartRangeMin'),
925
+ maxvalue = options.get('chartRangeMax') === undefined ? Math.max.apply(Math, values) : options.get('chartRangeMax'),
926
+ target = $(this).simpledraw(width, height, options.get('composite')),
927
+ vlen = values.length,
928
+ lwhisker, loutlier, q1, q2, q3, rwhisker, routlier;
929
+
930
+ if (target && values.length > 1) {
931
+ var canvas_width = target.pixel_width,
932
+ canvas_height = target.pixel_height;
933
+ if (options.get('raw')) {
934
+ if (options.get('showOutliers') && values.length > 5) {
935
+ loutlier = values[0];
936
+ lwhisker = values[1];
937
+ q1 = values[2];
938
+ q2 = values[3];
939
+ q3 = values[4];
940
+ rwhisker = values[5];
941
+ routlier = values[6];
942
+ } else {
943
+ lwhisker = values[0];
944
+ q1 = values[1];
945
+ q2 = values[2];
946
+ q3 = values[3];
947
+ rwhisker = values[4];
1107
948
  }
1108
- };
1109
-
1110
- VCanvas_canvas = function(width, height, target) {
1111
- return this.init(width, height, target);
1112
- };
1113
-
1114
- VCanvas_canvas.prototype = $.extend(new VCanvas_base(), {
1115
- _super : VCanvas_base.prototype,
1116
-
1117
- init : function(width, height, target) {
1118
- this._super.init(width, height, target);
1119
- this.canvas = document.createElement('canvas');
1120
- if (target[0]) {
1121
- target = target[0];
1122
- }
1123
- target.VCanvas = this;
1124
- $(this.canvas).css({ display:'inline-block', width:width, height:height, verticalAlign:'top' });
1125
- this._insert(this.canvas, target);
1126
- this.pixel_height = $(this.canvas).height();
1127
- this.pixel_width = $(this.canvas).width();
1128
- this.canvas.width = this.pixel_width;
1129
- this.canvas.height = this.pixel_height;
1130
- $(this.canvas).css({width: this.pixel_width, height: this.pixel_height});
1131
- },
1132
-
1133
- _getContext : function(lineColor, fillColor, lineWidth) {
1134
- var context = this.canvas.getContext('2d');
1135
- if (lineColor !== undefined) {
1136
- context.strokeStyle = lineColor;
1137
- }
1138
- context.lineWidth = lineWidth === undefined ? 1 : lineWidth;
1139
- if (fillColor !== undefined) {
1140
- context.fillStyle = fillColor;
1141
- }
1142
- return context;
1143
- },
1144
-
1145
- drawShape : function(path, lineColor, fillColor, lineWidth) {
1146
- var context = this._getContext(lineColor, fillColor, lineWidth);
1147
- context.beginPath();
1148
- context.moveTo(path[0][0] + 0.5, path[0][1] + 0.5);
1149
- for (var i = 1, plen = path.length; i < plen; i++) {
1150
- context.lineTo(path[i][0] + 0.5, path[i][1] + 0.5); // the 0.5 offset gives us crisp pixel-width lines
1151
- }
1152
- if (lineColor !== undefined) {
1153
- context.stroke();
1154
- }
1155
- if (fillColor !== undefined) {
1156
- context.fill();
1157
- }
1158
- },
1159
-
1160
- drawCircle : function(x, y, radius, lineColor, fillColor) {
1161
- var context = this._getContext(lineColor, fillColor);
1162
- context.beginPath();
1163
- context.arc(x, y, radius, 0, 2 * Math.PI, false);
1164
- if (lineColor !== undefined) {
1165
- context.stroke();
1166
- }
1167
- if (fillColor !== undefined) {
1168
- context.fill();
1169
- }
1170
- },
1171
-
1172
- drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
1173
- var context = this._getContext(lineColor, fillColor);
1174
- context.beginPath();
1175
- context.moveTo(x, y);
1176
- context.arc(x, y, radius, startAngle, endAngle, false);
1177
- context.lineTo(x, y);
1178
- context.closePath();
1179
- if (lineColor !== undefined) {
1180
- context.stroke();
949
+ } else {
950
+ values.sort(function(a, b) {
951
+ return a - b;
952
+ });
953
+ q1 = quartile(values, 1);
954
+ q2 = quartile(values, 2);
955
+ q3 = quartile(values, 3);
956
+ var iqr = q3 - q1;
957
+ if (options.get('showOutliers')) {
958
+ lwhisker = undefined;
959
+ rwhisker = undefined;
960
+ for (var i = 0; i < vlen; i++) {
961
+ if (lwhisker === undefined && values[i] > q1 - (iqr * options.get('outlierIQR'))) {
962
+ lwhisker = values[i];
1181
963
  }
1182
- if (fillColor) {
1183
- context.fill();
964
+ if (values[i] < q3 + (iqr * options.get('outlierIQR'))) {
965
+ rwhisker = values[i];
1184
966
  }
1185
- },
1186
-
1187
- drawRect : function(x, y, width, height, lineColor, fillColor) {
1188
- return this.drawShape([
1189
- [x,y],
1190
- [x + width, y],
1191
- [x + width, y + height],
1192
- [x, y + height],
1193
- [x, y]
1194
- ], lineColor, fillColor);
967
+ }
968
+ loutlier = values[0];
969
+ routlier = values[vlen - 1];
970
+ } else {
971
+ lwhisker = values[0];
972
+ rwhisker = values[vlen - 1];
1195
973
  }
1196
-
1197
- });
1198
-
1199
- VCanvas_vml = function(width, height, target) {
1200
- return this.init(width, height, target);
1201
- };
1202
-
1203
- VCanvas_vml.prototype = $.extend(new VCanvas_base(), {
1204
- _super : VCanvas_base.prototype,
1205
-
1206
- init : function(width, height, target) {
1207
- this._super.init(width, height, target);
1208
- if (target[0]) {
1209
- target = target[0];
1210
- }
1211
- target.VCanvas = this;
1212
- this.canvas = document.createElement('span');
1213
- $(this.canvas).css({ display:'inline-block', position: 'relative', overflow:'hidden', width:width, height:height, margin:'0px', padding:'0px', verticalAlign: 'top'});
1214
- this._insert(this.canvas, target);
1215
- this.pixel_height = $(this.canvas).height();
1216
- this.pixel_width = $(this.canvas).width();
1217
- this.canvas.width = this.pixel_width;
1218
- this.canvas.height = this.pixel_height;
1219
- var groupel = '<v:group coordorigin="0 0" coordsize="' + this.pixel_width + ' ' + this.pixel_height + '"' +
1220
- ' style="position:absolute;top:0;left:0;width:' + this.pixel_width + 'px;height=' + this.pixel_height + 'px;"></v:group>';
1221
- this.canvas.insertAdjacentHTML('beforeEnd', groupel);
1222
- this.group = $(this.canvas).children()[0];
1223
- },
1224
-
1225
- drawShape : function(path, lineColor, fillColor, lineWidth) {
1226
- var vpath = [];
1227
- for (var i = 0, plen = path.length; i < plen; i++) {
1228
- vpath[i] = '' + (path[i][0]) + ',' + (path[i][1]);
1229
- }
1230
- var initial = vpath.splice(0, 1);
1231
- lineWidth = lineWidth === undefined ? 1 : lineWidth;
1232
- var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="' + lineWidth + '" strokeColor="' + lineColor + '" ';
1233
- var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" ';
1234
- var closed = vpath[0] == vpath[vpath.length - 1] ? 'x ' : '';
1235
- var vel = '<v:shape coordorigin="0 0" coordsize="' + this.pixel_width + ' ' + this.pixel_height + '" ' +
1236
- stroke +
1237
- fill +
1238
- ' style="position:absolute;left:0px;top:0px;height:' + this.pixel_height + 'px;width:' + this.pixel_width + 'px;padding:0px;margin:0px;" ' +
1239
- ' path="m ' + initial + ' l ' + vpath.join(', ') + ' ' + closed + 'e">' +
1240
- ' </v:shape>';
1241
- this.group.insertAdjacentHTML('beforeEnd', vel);
1242
- },
1243
-
1244
- drawCircle : function(x, y, radius, lineColor, fillColor) {
1245
- x -= radius + 1;
1246
- y -= radius + 1;
1247
- var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="' + lineColor + '" ';
1248
- var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" ';
1249
- var vel = '<v:oval ' +
1250
- stroke +
1251
- fill +
1252
- ' style="position:absolute;top:' + y + 'px; left:' + x + 'px; width:' + (radius * 2) + 'px; height:' + (radius * 2) + 'px"></v:oval>';
1253
- this.group.insertAdjacentHTML('beforeEnd', vel);
1254
-
1255
- },
1256
-
1257
- drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
1258
- if (startAngle == endAngle) {
1259
- return; // VML seems to have problem when start angle equals end angle.
1260
- }
1261
- if ((endAngle - startAngle) == (2 * Math.PI)) {
1262
- startAngle = 0.0; // VML seems to have a problem when drawing a full circle that doesn't start 0
1263
- endAngle = (2 * Math.PI);
1264
- }
1265
-
1266
- var startx = x + Math.round(Math.cos(startAngle) * radius);
1267
- var starty = y + Math.round(Math.sin(startAngle) * radius);
1268
- var endx = x + Math.round(Math.cos(endAngle) * radius);
1269
- var endy = y + Math.round(Math.sin(endAngle) * radius);
1270
-
1271
- // Prevent very small slices from being mistaken as a whole pie
1272
- if (startx == endx && starty == endy && (endAngle - startAngle) < Math.PI) {
1273
- return;
1274
- }
1275
-
1276
- var vpath = [ x - radius, y - radius, x + radius, y + radius, startx, starty, endx, endy ];
1277
- var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="' + lineColor + '" ';
1278
- var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" ';
1279
- var vel = '<v:shape coordorigin="0 0" coordsize="' + this.pixel_width + ' ' + this.pixel_height + '" ' +
1280
- stroke +
1281
- fill +
1282
- ' style="position:absolute;left:0px;top:0px;height:' + this.pixel_height + 'px;width:' + this.pixel_width + 'px;padding:0px;margin:0px;" ' +
1283
- ' path="m ' + x + ',' + y + ' wa ' + vpath.join(', ') + ' x e">' +
1284
- ' </v:shape>';
1285
- this.group.insertAdjacentHTML('beforeEnd', vel);
1286
- },
1287
-
1288
- drawRect : function(x, y, width, height, lineColor, fillColor) {
1289
- return this.drawShape([
1290
- [x, y],
1291
- [x, y + height],
1292
- [x + width, y + height],
1293
- [x + width, y],
1294
- [x, y]
1295
- ], lineColor, fillColor);
974
+ }
975
+
976
+ var unitsize = canvas_width / (maxvalue - minvalue + 1),
977
+ canvas_left = 0;
978
+ if (options.get('showOutliers')) {
979
+ canvas_left = Math.ceil(options.get('spotRadius'));
980
+ canvas_width -= 2 * Math.ceil(options.get('spotRadius'));
981
+ unitsize = canvas_width / (maxvalue - minvalue + 1);
982
+ if (loutlier < lwhisker) {
983
+ target.drawCircle((loutlier - minvalue) * unitsize + canvas_left, canvas_height / 2, options.get('spotRadius'), options.get('outlierLineColor'), options.get('outlierFillColor'));
1296
984
  }
1297
- });
985
+ if (routlier > rwhisker) {
986
+ target.drawCircle((routlier - minvalue) * unitsize + canvas_left, canvas_height / 2, options.get('spotRadius'), options.get('outlierLineColor'), options.get('outlierFillColor'));
987
+ }
988
+ }
989
+
990
+ // box
991
+ target.drawRect(
992
+ Math.round((q1 - minvalue) * unitsize + canvas_left),
993
+ Math.round(canvas_height * 0.1),
994
+ Math.round((q3 - q1) * unitsize),
995
+ Math.round(canvas_height * 0.8),
996
+ options.get('boxLineColor'),
997
+ options.get('boxFillColor'));
998
+ // left whisker
999
+ target.drawLine(
1000
+ Math.round((lwhisker - minvalue) * unitsize + canvas_left),
1001
+ Math.round(canvas_height / 2),
1002
+ Math.round((q1 - minvalue) * unitsize + canvas_left),
1003
+ Math.round(canvas_height / 2),
1004
+ options.get('lineColor'));
1005
+ target.drawLine(
1006
+ Math.round((lwhisker - minvalue) * unitsize + canvas_left),
1007
+ Math.round(canvas_height / 4),
1008
+ Math.round((lwhisker - minvalue) * unitsize + canvas_left),
1009
+ Math.round(canvas_height - canvas_height / 4),
1010
+ options.get('whiskerColor'));
1011
+ // right whisker
1012
+ target.drawLine(Math.round((rwhisker - minvalue) * unitsize + canvas_left),
1013
+ Math.round(canvas_height / 2),
1014
+ Math.round((q3 - minvalue) * unitsize + canvas_left),
1015
+ Math.round(canvas_height / 2),
1016
+ options.get('lineColor'));
1017
+ target.drawLine(
1018
+ Math.round((rwhisker - minvalue) * unitsize + canvas_left),
1019
+ Math.round(canvas_height / 4),
1020
+ Math.round((rwhisker - minvalue) * unitsize + canvas_left),
1021
+ Math.round(canvas_height - canvas_height / 4),
1022
+ options.get('whiskerColor'));
1023
+ // median line
1024
+ target.drawLine(
1025
+ Math.round((q2 - minvalue) * unitsize + canvas_left),
1026
+ Math.round(canvas_height * 0.1),
1027
+ Math.round((q2 - minvalue) * unitsize + canvas_left),
1028
+ Math.round(canvas_height * 0.9),
1029
+ options.get('medianColor'));
1030
+ if (options.get('target')) {
1031
+ var size = Math.ceil(options.get('spotRadius'));
1032
+ target.drawLine(
1033
+ Math.round((options.get('target') - minvalue) * unitsize + canvas_left),
1034
+ Math.round((canvas_height / 2) - size),
1035
+ Math.round((options.get('target') - minvalue) * unitsize + canvas_left),
1036
+ Math.round((canvas_height / 2) + size),
1037
+ options.get('targetColor'));
1038
+ target.drawLine(
1039
+ Math.round((options.get('target') - minvalue) * unitsize + canvas_left - size),
1040
+ Math.round(canvas_height / 2),
1041
+ Math.round((options.get('target') - minvalue) * unitsize + canvas_left + size),
1042
+ Math.round(canvas_height / 2),
1043
+ options.get('targetColor'));
1044
+ }
1045
+ } else {
1046
+ // Remove the tag contents if sparklines aren't supported
1047
+ this.innerHTML = '';
1048
+ }
1049
+ };
1050
+
1051
+
1052
+ // Setup a very simple "virtual canvas" to make drawing the few shapes we need easier
1053
+ // This is accessible as $(foo).simpledraw()
1054
+
1055
+ if ($.browser.msie && !document.namespaces.v) {
1056
+ document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', '#default#VML');
1057
+ }
1058
+
1059
+ if ($.browser.hasCanvas === undefined) {
1060
+ var t = document.createElement('canvas');
1061
+ $.browser.hasCanvas = t.getContext !== undefined;
1062
+ }
1063
+
1064
+ VCanvas_base = function(width, height, target) {
1065
+ };
1066
+
1067
+ VCanvas_base.prototype = {
1068
+ init : function(width, height, target) {
1069
+ this.width = width;
1070
+ this.height = height;
1071
+ this.target = target;
1072
+ if (target[0]) {
1073
+ target = target[0];
1074
+ }
1075
+ target.VCanvas = this;
1076
+ },
1077
+
1078
+ drawShape : function(path, lineColor, fillColor, lineWidth) {
1079
+ alert('drawShape not implemented');
1080
+ },
1081
+
1082
+ drawLine : function(x1, y1, x2, y2, lineColor, lineWidth) {
1083
+ return this.drawShape([
1084
+ [x1,y1],
1085
+ [x2,y2]
1086
+ ], lineColor, lineWidth);
1087
+ },
1088
+
1089
+ drawCircle : function(x, y, radius, lineColor, fillColor) {
1090
+ alert('drawCircle not implemented');
1091
+ },
1092
+
1093
+ drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
1094
+ alert('drawPieSlice not implemented');
1095
+ },
1096
+
1097
+ drawRect : function(x, y, width, height, lineColor, fillColor) {
1098
+ alert('drawRect not implemented');
1099
+ },
1100
+
1101
+ getElement : function() {
1102
+ return this.canvas;
1103
+ },
1104
+
1105
+ _insert : function(el, target) {
1106
+ $(target).html(el);
1107
+ }
1108
+ };
1109
+
1110
+ VCanvas_canvas = function(width, height, target) {
1111
+ return this.init(width, height, target);
1112
+ };
1113
+
1114
+ VCanvas_canvas.prototype = $.extend(new VCanvas_base(), {
1115
+ _super : VCanvas_base.prototype,
1116
+
1117
+ init : function(width, height, target) {
1118
+ this._super.init(width, height, target);
1119
+ this.canvas = document.createElement('canvas');
1120
+ if (target[0]) {
1121
+ target = target[0];
1122
+ }
1123
+ target.VCanvas = this;
1124
+ $(this.canvas).css({ display:'inline-block', width:width, height:height, verticalAlign:'top' });
1125
+ this._insert(this.canvas, target);
1126
+ this.pixel_height = $(this.canvas).height();
1127
+ this.pixel_width = $(this.canvas).width();
1128
+ this.canvas.width = this.pixel_width;
1129
+ this.canvas.height = this.pixel_height;
1130
+ $(this.canvas).css({width: this.pixel_width, height: this.pixel_height});
1131
+ },
1132
+
1133
+ _getContext : function(lineColor, fillColor, lineWidth) {
1134
+ var context = this.canvas.getContext('2d');
1135
+ if (lineColor !== undefined) {
1136
+ context.strokeStyle = lineColor;
1137
+ }
1138
+ context.lineWidth = lineWidth === undefined ? 1 : lineWidth;
1139
+ if (fillColor !== undefined) {
1140
+ context.fillStyle = fillColor;
1141
+ }
1142
+ return context;
1143
+ },
1144
+
1145
+ drawShape : function(path, lineColor, fillColor, lineWidth) {
1146
+ var context = this._getContext(lineColor, fillColor, lineWidth);
1147
+ context.beginPath();
1148
+ context.moveTo(path[0][0] + 0.5, path[0][1] + 0.5);
1149
+ for (var i = 1, plen = path.length; i < plen; i++) {
1150
+ context.lineTo(path[i][0] + 0.5, path[i][1] + 0.5); // the 0.5 offset gives us crisp pixel-width lines
1151
+ }
1152
+ if (lineColor !== undefined) {
1153
+ context.stroke();
1154
+ }
1155
+ if (fillColor !== undefined) {
1156
+ context.fill();
1157
+ }
1158
+ },
1159
+
1160
+ drawCircle : function(x, y, radius, lineColor, fillColor) {
1161
+ var context = this._getContext(lineColor, fillColor);
1162
+ context.beginPath();
1163
+ context.arc(x, y, radius, 0, 2 * Math.PI, false);
1164
+ if (lineColor !== undefined) {
1165
+ context.stroke();
1166
+ }
1167
+ if (fillColor !== undefined) {
1168
+ context.fill();
1169
+ }
1170
+ },
1171
+
1172
+ drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
1173
+ var context = this._getContext(lineColor, fillColor);
1174
+ context.beginPath();
1175
+ context.moveTo(x, y);
1176
+ context.arc(x, y, radius, startAngle, endAngle, false);
1177
+ context.lineTo(x, y);
1178
+ context.closePath();
1179
+ if (lineColor !== undefined) {
1180
+ context.stroke();
1181
+ }
1182
+ if (fillColor) {
1183
+ context.fill();
1184
+ }
1185
+ },
1186
+
1187
+ drawRect : function(x, y, width, height, lineColor, fillColor) {
1188
+ return this.drawShape([
1189
+ [x,y],
1190
+ [x + width, y],
1191
+ [x + width, y + height],
1192
+ [x, y + height],
1193
+ [x, y]
1194
+ ], lineColor, fillColor);
1195
+ }
1196
+
1197
+ });
1198
+
1199
+ VCanvas_vml = function(width, height, target) {
1200
+ return this.init(width, height, target);
1201
+ };
1202
+
1203
+ VCanvas_vml.prototype = $.extend(new VCanvas_base(), {
1204
+ _super : VCanvas_base.prototype,
1205
+
1206
+ init : function(width, height, target) {
1207
+ this._super.init(width, height, target);
1208
+ if (target[0]) {
1209
+ target = target[0];
1210
+ }
1211
+ target.VCanvas = this;
1212
+ this.canvas = document.createElement('span');
1213
+ $(this.canvas).css({ display:'inline-block', position: 'relative', overflow:'hidden', width:width, height:height, margin:'0px', padding:'0px', verticalAlign: 'top'});
1214
+ this._insert(this.canvas, target);
1215
+ this.pixel_height = $(this.canvas).height();
1216
+ this.pixel_width = $(this.canvas).width();
1217
+ this.canvas.width = this.pixel_width;
1218
+ this.canvas.height = this.pixel_height;
1219
+ var groupel = '<v:group coordorigin="0 0" coordsize="' + this.pixel_width + ' ' + this.pixel_height + '"' +
1220
+ ' style="position:absolute;top:0;left:0;width:' + this.pixel_width + 'px;height=' + this.pixel_height + 'px;"></v:group>';
1221
+ this.canvas.insertAdjacentHTML('beforeEnd', groupel);
1222
+ this.group = $(this.canvas).children()[0];
1223
+ },
1224
+
1225
+ drawShape : function(path, lineColor, fillColor, lineWidth) {
1226
+ var vpath = [];
1227
+ for (var i = 0, plen = path.length; i < plen; i++) {
1228
+ vpath[i] = '' + (path[i][0]) + ',' + (path[i][1]);
1229
+ }
1230
+ var initial = vpath.splice(0, 1);
1231
+ lineWidth = lineWidth === undefined ? 1 : lineWidth;
1232
+ var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="' + lineWidth + '" strokeColor="' + lineColor + '" ';
1233
+ var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" ';
1234
+ var closed = vpath[0] == vpath[vpath.length - 1] ? 'x ' : '';
1235
+ var vel = '<v:shape coordorigin="0 0" coordsize="' + this.pixel_width + ' ' + this.pixel_height + '" ' +
1236
+ stroke +
1237
+ fill +
1238
+ ' style="position:absolute;left:0px;top:0px;height:' + this.pixel_height + 'px;width:' + this.pixel_width + 'px;padding:0px;margin:0px;" ' +
1239
+ ' path="m ' + initial + ' l ' + vpath.join(', ') + ' ' + closed + 'e">' +
1240
+ ' </v:shape>';
1241
+ this.group.insertAdjacentHTML('beforeEnd', vel);
1242
+ },
1243
+
1244
+ drawCircle : function(x, y, radius, lineColor, fillColor) {
1245
+ x -= radius + 1;
1246
+ y -= radius + 1;
1247
+ var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="' + lineColor + '" ';
1248
+ var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" ';
1249
+ var vel = '<v:oval ' +
1250
+ stroke +
1251
+ fill +
1252
+ ' style="position:absolute;top:' + y + 'px; left:' + x + 'px; width:' + (radius * 2) + 'px; height:' + (radius * 2) + 'px"></v:oval>';
1253
+ this.group.insertAdjacentHTML('beforeEnd', vel);
1254
+
1255
+ },
1256
+
1257
+ drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
1258
+ if (startAngle == endAngle) {
1259
+ return; // VML seems to have problem when start angle equals end angle.
1260
+ }
1261
+ if ((endAngle - startAngle) == (2 * Math.PI)) {
1262
+ startAngle = 0.0; // VML seems to have a problem when drawing a full circle that doesn't start 0
1263
+ endAngle = (2 * Math.PI);
1264
+ }
1265
+
1266
+ var startx = x + Math.round(Math.cos(startAngle) * radius);
1267
+ var starty = y + Math.round(Math.sin(startAngle) * radius);
1268
+ var endx = x + Math.round(Math.cos(endAngle) * radius);
1269
+ var endy = y + Math.round(Math.sin(endAngle) * radius);
1270
+
1271
+ // Prevent very small slices from being mistaken as a whole pie
1272
+ if (startx == endx && starty == endy && (endAngle - startAngle) < Math.PI) {
1273
+ return;
1274
+ }
1275
+
1276
+ var vpath = [ x - radius, y - radius, x + radius, y + radius, startx, starty, endx, endy ];
1277
+ var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="' + lineColor + '" ';
1278
+ var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" ';
1279
+ var vel = '<v:shape coordorigin="0 0" coordsize="' + this.pixel_width + ' ' + this.pixel_height + '" ' +
1280
+ stroke +
1281
+ fill +
1282
+ ' style="position:absolute;left:0px;top:0px;height:' + this.pixel_height + 'px;width:' + this.pixel_width + 'px;padding:0px;margin:0px;" ' +
1283
+ ' path="m ' + x + ',' + y + ' wa ' + vpath.join(', ') + ' x e">' +
1284
+ ' </v:shape>';
1285
+ this.group.insertAdjacentHTML('beforeEnd', vel);
1286
+ },
1287
+
1288
+ drawRect : function(x, y, width, height, lineColor, fillColor) {
1289
+ return this.drawShape([
1290
+ [x, y],
1291
+ [x, y + height],
1292
+ [x + width, y + height],
1293
+ [x + width, y],
1294
+ [x, y]
1295
+ ], lineColor, fillColor);
1296
+ }
1297
+ });
1298
1298
 
1299
1299
  })(jQuery);