reportbuilder 1.2.5 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (392) hide show
  1. data.tar.gz.sig +0 -0
  2. data/History.txt +6 -0
  3. data/Manifest.txt +377 -0
  4. data/data/flot/API.txt +1024 -0
  5. data/data/flot/FAQ.txt +71 -0
  6. data/data/flot/LICENSE.txt +22 -0
  7. data/data/flot/Makefile +15 -0
  8. data/data/flot/NEWS.txt +340 -0
  9. data/data/flot/PLUGINS.txt +105 -0
  10. data/data/flot/README.txt +81 -0
  11. data/data/flot/examples/ajax.html +143 -0
  12. data/data/flot/examples/annotating.html +75 -0
  13. data/data/flot/examples/arrow-down.gif +0 -0
  14. data/data/flot/examples/arrow-left.gif +0 -0
  15. data/data/flot/examples/arrow-right.gif +0 -0
  16. data/data/flot/examples/arrow-up.gif +0 -0
  17. data/data/flot/examples/basic.html +38 -0
  18. data/data/flot/examples/data-eu-gdp-growth-1.json +4 -0
  19. data/data/flot/examples/data-eu-gdp-growth-2.json +4 -0
  20. data/data/flot/examples/data-eu-gdp-growth-3.json +4 -0
  21. data/data/flot/examples/data-eu-gdp-growth-4.json +4 -0
  22. data/data/flot/examples/data-eu-gdp-growth-5.json +4 -0
  23. data/data/flot/examples/data-eu-gdp-growth.json +4 -0
  24. data/data/flot/examples/data-japan-gdp-growth.json +4 -0
  25. data/data/flot/examples/data-usa-gdp-growth.json +4 -0
  26. data/data/flot/examples/dual-axis.html +39 -0
  27. data/data/flot/examples/graph-types.html +75 -0
  28. data/data/flot/examples/hs-2004-27-a-large_web.jpg +0 -0
  29. data/data/flot/examples/image.html +45 -0
  30. data/data/flot/examples/index.html +43 -0
  31. data/data/flot/examples/interacting.html +93 -0
  32. data/data/flot/examples/layout.css +6 -0
  33. data/data/flot/examples/navigate.html +118 -0
  34. data/data/flot/examples/selection.html +114 -0
  35. data/data/flot/examples/setting-options.html +65 -0
  36. data/data/flot/examples/stacking.html +77 -0
  37. data/data/flot/examples/thresholding.html +54 -0
  38. data/data/flot/examples/time.html +71 -0
  39. data/data/flot/examples/tracking.html +95 -0
  40. data/data/flot/examples/turning-series.html +98 -0
  41. data/data/flot/examples/visitors.html +90 -0
  42. data/data/flot/examples/zooming.html +98 -0
  43. data/data/flot/excanvas.js +1427 -0
  44. data/data/flot/excanvas.min.js +1 -0
  45. data/data/flot/jquery.colorhelpers.js +174 -0
  46. data/data/flot/jquery.colorhelpers.min.js +1 -0
  47. data/data/flot/jquery.flot.crosshair.js +156 -0
  48. data/data/flot/jquery.flot.crosshair.min.js +1 -0
  49. data/data/flot/jquery.flot.image.js +237 -0
  50. data/data/flot/jquery.flot.image.min.js +1 -0
  51. data/data/flot/jquery.flot.js +2119 -0
  52. data/data/flot/jquery.flot.min.js +1 -0
  53. data/data/flot/jquery.flot.navigate.js +272 -0
  54. data/data/flot/jquery.flot.navigate.min.js +1 -0
  55. data/data/flot/jquery.flot.selection.js +299 -0
  56. data/data/flot/jquery.flot.selection.min.js +1 -0
  57. data/data/flot/jquery.flot.stack.js +152 -0
  58. data/data/flot/jquery.flot.stack.min.js +1 -0
  59. data/data/flot/jquery.flot.threshold.js +103 -0
  60. data/data/flot/jquery.flot.threshold.min.js +1 -0
  61. data/data/flot/jquery.js +4376 -0
  62. data/data/flot/jquery.min.js +19 -0
  63. data/data/jqplot/MIT-LICENSE.txt +21 -0
  64. data/data/jqplot/README.txt +73 -0
  65. data/data/jqplot/changes.txt +261 -0
  66. data/data/jqplot/copyright.txt +33 -0
  67. data/data/jqplot/docs/files/MIT-LICENSE-txt.html +39 -0
  68. data/data/jqplot/docs/files/changes-txt.html +39 -0
  69. data/data/jqplot/docs/files/gpl-2-0-txt.html +39 -0
  70. data/data/jqplot/docs/files/images/background.jpg +0 -0
  71. data/data/jqplot/docs/files/images/basicline.png +0 -0
  72. data/data/jqplot/docs/files/images/basiclogaxis.png +0 -0
  73. data/data/jqplot/docs/files/images/basiclogoptions.png +0 -0
  74. data/data/jqplot/docs/files/images/basicoptions.png +0 -0
  75. data/data/jqplot/docs/files/images/dualaxis.png +0 -0
  76. data/data/jqplot/docs/files/images/logo.jpg +0 -0
  77. data/data/jqplot/docs/files/images/navdocs.png +0 -0
  78. data/data/jqplot/docs/files/images/navdocsover.png +0 -0
  79. data/data/jqplot/docs/files/images/navdownload.png +0 -0
  80. data/data/jqplot/docs/files/images/navdownloadover.png +0 -0
  81. data/data/jqplot/docs/files/images/navexamples.png +0 -0
  82. data/data/jqplot/docs/files/images/navexamplesover.png +0 -0
  83. data/data/jqplot/docs/files/images/navhome.png +0 -0
  84. data/data/jqplot/docs/files/images/navhomeover.png +0 -0
  85. data/data/jqplot/docs/files/images/new.png +0 -0
  86. data/data/jqplot/docs/files/images/sample3.png +0 -0
  87. data/data/jqplot/docs/files/images/samplesm.png +0 -0
  88. data/data/jqplot/docs/files/jqPlotCssStyling-txt.html +39 -0
  89. data/data/jqplot/docs/files/jqPlotOptions-txt.html +292 -0
  90. data/data/jqplot/docs/files/jqplot-axisLabelRenderer-js.html +47 -0
  91. data/data/jqplot/docs/files/jqplot-axisTickRenderer-js.html +69 -0
  92. data/data/jqplot/docs/files/jqplot-canvasGridRenderer-js.html +39 -0
  93. data/data/jqplot/docs/files/jqplot-core-js.html +353 -0
  94. data/data/jqplot/docs/files/jqplot-divTitleRenderer-js.html +39 -0
  95. data/data/jqplot/docs/files/jqplot-lineRenderer-js.html +53 -0
  96. data/data/jqplot/docs/files/jqplot-linearAxisRenderer-js.html +39 -0
  97. data/data/jqplot/docs/files/jqplot-markerRenderer-js.html +65 -0
  98. data/data/jqplot/docs/files/jqplot-shadowRenderer-js.html +61 -0
  99. data/data/jqplot/docs/files/jqplot-shapeRenderer-js.html +63 -0
  100. data/data/jqplot/docs/files/jqplot-themeEngine-js.html +190 -0
  101. data/data/jqplot/docs/files/optionsTutorial-txt.html +119 -0
  102. data/data/jqplot/docs/files/plugins/jqplot-BezierCurveRenderer-js.html +45 -0
  103. data/data/jqplot/docs/files/plugins/jqplot-barRenderer-js.html +67 -0
  104. data/data/jqplot/docs/files/plugins/jqplot-blockRenderer-js.html +53 -0
  105. data/data/jqplot/docs/files/plugins/jqplot-bubbleRenderer-js.html +71 -0
  106. data/data/jqplot/docs/files/plugins/jqplot-canvasAxisLabelRenderer-js.html +63 -0
  107. data/data/jqplot/docs/files/plugins/jqplot-canvasAxisTickRenderer-js.html +79 -0
  108. data/data/jqplot/docs/files/plugins/jqplot-categoryAxisRenderer-js.html +46 -0
  109. data/data/jqplot/docs/files/plugins/jqplot-cursor-js.html +91 -0
  110. data/data/jqplot/docs/files/plugins/jqplot-dateAxisRenderer-js.html +93 -0
  111. data/data/jqplot/docs/files/plugins/jqplot-donutRenderer-js.html +98 -0
  112. data/data/jqplot/docs/files/plugins/jqplot-dragable-js.html +45 -0
  113. data/data/jqplot/docs/files/plugins/jqplot-enhancedLegendRenderer-js.html +49 -0
  114. data/data/jqplot/docs/files/plugins/jqplot-funnelRenderer-js.html +87 -0
  115. data/data/jqplot/docs/files/plugins/jqplot-highlighter-js.html +80 -0
  116. data/data/jqplot/docs/files/plugins/jqplot-logAxisRenderer-js.html +45 -0
  117. data/data/jqplot/docs/files/plugins/jqplot-mekkoAxisRenderer-js.html +49 -0
  118. data/data/jqplot/docs/files/plugins/jqplot-mekkoRenderer-js.html +62 -0
  119. data/data/jqplot/docs/files/plugins/jqplot-meterGaugeRenderer-js.html +103 -0
  120. data/data/jqplot/docs/files/plugins/jqplot-ohlcRenderer-js.html +65 -0
  121. data/data/jqplot/docs/files/plugins/jqplot-pieRenderer-js.html +93 -0
  122. data/data/jqplot/docs/files/plugins/jqplot-pointLabels-js.html +72 -0
  123. data/data/jqplot/docs/files/plugins/jqplot-trendline-js.html +67 -0
  124. data/data/jqplot/docs/files/usage-txt.html +58 -0
  125. data/data/jqplot/docs/index.html +1 -0
  126. data/data/jqplot/docs/index/Classes.html +58 -0
  127. data/data/jqplot/docs/index/Files.html +34 -0
  128. data/data/jqplot/docs/index/Functions.html +66 -0
  129. data/data/jqplot/docs/index/General.html +46 -0
  130. data/data/jqplot/docs/index/General2.html +46 -0
  131. data/data/jqplot/docs/index/General3.html +46 -0
  132. data/data/jqplot/docs/index/General4.html +50 -0
  133. data/data/jqplot/docs/index/General5.html +34 -0
  134. data/data/jqplot/docs/index/General6.html +58 -0
  135. data/data/jqplot/docs/index/Hooks.html +46 -0
  136. data/data/jqplot/docs/index/Properties.html +50 -0
  137. data/data/jqplot/docs/index/Properties2.html +50 -0
  138. data/data/jqplot/docs/index/Properties3.html +50 -0
  139. data/data/jqplot/docs/index/Properties4.html +34 -0
  140. data/data/jqplot/docs/index/Properties5.html +58 -0
  141. data/data/jqplot/docs/javascript/main.js +836 -0
  142. data/data/jqplot/docs/javascript/searchdata.js +182 -0
  143. data/data/jqplot/docs/search/ClassesA.html +20 -0
  144. data/data/jqplot/docs/search/ClassesG.html +20 -0
  145. data/data/jqplot/docs/search/ClassesJ.html +20 -0
  146. data/data/jqplot/docs/search/ClassesL.html +20 -0
  147. data/data/jqplot/docs/search/ClassesS.html +20 -0
  148. data/data/jqplot/docs/search/ClassesSymbols.html +20 -0
  149. data/data/jqplot/docs/search/ClassesT.html +20 -0
  150. data/data/jqplot/docs/search/FilesJ.html +20 -0
  151. data/data/jqplot/docs/search/FunctionsC.html +20 -0
  152. data/data/jqplot/docs/search/FunctionsD.html +20 -0
  153. data/data/jqplot/docs/search/FunctionsG.html +20 -0
  154. data/data/jqplot/docs/search/FunctionsI.html +20 -0
  155. data/data/jqplot/docs/search/FunctionsM.html +20 -0
  156. data/data/jqplot/docs/search/FunctionsN.html +20 -0
  157. data/data/jqplot/docs/search/FunctionsR.html +20 -0
  158. data/data/jqplot/docs/search/FunctionsS.html +20 -0
  159. data/data/jqplot/docs/search/FunctionsZ.html +20 -0
  160. data/data/jqplot/docs/search/GeneralA.html +20 -0
  161. data/data/jqplot/docs/search/GeneralB.html +20 -0
  162. data/data/jqplot/docs/search/GeneralC.html +20 -0
  163. data/data/jqplot/docs/search/GeneralD.html +20 -0
  164. data/data/jqplot/docs/search/GeneralE.html +20 -0
  165. data/data/jqplot/docs/search/GeneralF.html +20 -0
  166. data/data/jqplot/docs/search/GeneralG.html +20 -0
  167. data/data/jqplot/docs/search/GeneralH.html +20 -0
  168. data/data/jqplot/docs/search/GeneralI.html +20 -0
  169. data/data/jqplot/docs/search/GeneralJ.html +20 -0
  170. data/data/jqplot/docs/search/GeneralL.html +20 -0
  171. data/data/jqplot/docs/search/GeneralM.html +20 -0
  172. data/data/jqplot/docs/search/GeneralN.html +20 -0
  173. data/data/jqplot/docs/search/GeneralO.html +20 -0
  174. data/data/jqplot/docs/search/GeneralP.html +20 -0
  175. data/data/jqplot/docs/search/GeneralR.html +20 -0
  176. data/data/jqplot/docs/search/GeneralS.html +20 -0
  177. data/data/jqplot/docs/search/GeneralSymbols.html +20 -0
  178. data/data/jqplot/docs/search/GeneralT.html +20 -0
  179. data/data/jqplot/docs/search/GeneralU.html +20 -0
  180. data/data/jqplot/docs/search/GeneralV.html +20 -0
  181. data/data/jqplot/docs/search/GeneralW.html +20 -0
  182. data/data/jqplot/docs/search/GeneralX.html +20 -0
  183. data/data/jqplot/docs/search/GeneralY.html +20 -0
  184. data/data/jqplot/docs/search/GeneralZ.html +20 -0
  185. data/data/jqplot/docs/search/HooksA.html +20 -0
  186. data/data/jqplot/docs/search/HooksE.html +20 -0
  187. data/data/jqplot/docs/search/HooksJ.html +20 -0
  188. data/data/jqplot/docs/search/HooksP.html +20 -0
  189. data/data/jqplot/docs/search/NoResults.html +15 -0
  190. data/data/jqplot/docs/search/PropertiesA.html +20 -0
  191. data/data/jqplot/docs/search/PropertiesB.html +20 -0
  192. data/data/jqplot/docs/search/PropertiesC.html +20 -0
  193. data/data/jqplot/docs/search/PropertiesD.html +20 -0
  194. data/data/jqplot/docs/search/PropertiesE.html +20 -0
  195. data/data/jqplot/docs/search/PropertiesF.html +20 -0
  196. data/data/jqplot/docs/search/PropertiesG.html +20 -0
  197. data/data/jqplot/docs/search/PropertiesH.html +20 -0
  198. data/data/jqplot/docs/search/PropertiesI.html +20 -0
  199. data/data/jqplot/docs/search/PropertiesL.html +20 -0
  200. data/data/jqplot/docs/search/PropertiesM.html +20 -0
  201. data/data/jqplot/docs/search/PropertiesN.html +20 -0
  202. data/data/jqplot/docs/search/PropertiesO.html +20 -0
  203. data/data/jqplot/docs/search/PropertiesP.html +20 -0
  204. data/data/jqplot/docs/search/PropertiesR.html +20 -0
  205. data/data/jqplot/docs/search/PropertiesS.html +20 -0
  206. data/data/jqplot/docs/search/PropertiesT.html +20 -0
  207. data/data/jqplot/docs/search/PropertiesU.html +20 -0
  208. data/data/jqplot/docs/search/PropertiesV.html +20 -0
  209. data/data/jqplot/docs/search/PropertiesW.html +20 -0
  210. data/data/jqplot/docs/search/PropertiesX.html +20 -0
  211. data/data/jqplot/docs/search/PropertiesY.html +20 -0
  212. data/data/jqplot/docs/search/PropertiesZ.html +20 -0
  213. data/data/jqplot/docs/styles/1.css +767 -0
  214. data/data/jqplot/docs/styles/2.css +174 -0
  215. data/data/jqplot/docs/styles/main.css +2 -0
  216. data/data/jqplot/examples/.htaccess +1 -0
  217. data/data/jqplot/examples/OHLC.html +333 -0
  218. data/data/jqplot/examples/OHLC2.html +193 -0
  219. data/data/jqplot/examples/area.html +107 -0
  220. data/data/jqplot/examples/axisLabel.html +117 -0
  221. data/data/jqplot/examples/axisLabelsRotatedText.html +131 -0
  222. data/data/jqplot/examples/axisLabelsRotatedText2.html +155 -0
  223. data/data/jqplot/examples/barLinePieStack.html +198 -0
  224. data/data/jqplot/examples/barMissingValues.html +64 -0
  225. data/data/jqplot/examples/barTest.html +283 -0
  226. data/data/jqplot/examples/barTest2.html +74 -0
  227. data/data/jqplot/examples/bezierCurve.html +96 -0
  228. data/data/jqplot/examples/blockPlot.html +149 -0
  229. data/data/jqplot/examples/bubbleChart2.html +253 -0
  230. data/data/jqplot/examples/bubblechart.html +69 -0
  231. data/data/jqplot/examples/catchError.html +53 -0
  232. data/data/jqplot/examples/categoryHorizontalBar.html +81 -0
  233. data/data/jqplot/examples/categoryVsLinearAxes.html +74 -0
  234. data/data/jqplot/examples/chartInTable.html +33 -0
  235. data/data/jqplot/examples/customHighlighterCursorTrendline.html +72 -0
  236. data/data/jqplot/examples/customPieTests.html +73 -0
  237. data/data/jqplot/examples/dataLabels.html +192 -0
  238. data/data/jqplot/examples/dataTracking.html +91 -0
  239. data/data/jqplot/examples/donutTest.html +89 -0
  240. data/data/jqplot/examples/donutTest.js +96 -0
  241. data/data/jqplot/examples/examples.css +19 -0
  242. data/data/jqplot/examples/fillToZero.html +126 -0
  243. data/data/jqplot/examples/filledLine.html +78 -0
  244. data/data/jqplot/examples/filledLineCategoryAxis.html +80 -0
  245. data/data/jqplot/examples/funnelTest.html +82 -0
  246. data/data/jqplot/examples/funnelTest.js +74 -0
  247. data/data/jqplot/examples/gridCustomization.html +56 -0
  248. data/data/jqplot/examples/hiddenPlot.html +216 -0
  249. data/data/jqplot/examples/highlighter.html +95 -0
  250. data/data/jqplot/examples/highlighter2.html +63 -0
  251. data/data/jqplot/examples/horizontalLine.html +51 -0
  252. data/data/jqplot/examples/intticks.html +178 -0
  253. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  254. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  255. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  256. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  257. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  258. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  259. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  260. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  261. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  262. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  263. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  264. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  265. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  266. data/data/jqplot/examples/jquery-ui/css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  267. data/data/jqplot/examples/jquery-ui/css/ui-lightness/jquery-ui-1.8.1.custom.css +486 -0
  268. data/data/jqplot/examples/jquery-ui/js/jquery-1.4.2.min.js +154 -0
  269. data/data/jqplot/examples/jquery-ui/js/jquery-ui-1.8.1.custom.min.js +756 -0
  270. data/data/jqplot/examples/legendLabels.html +205 -0
  271. data/data/jqplot/examples/legendLabels2.html +228 -0
  272. data/data/jqplot/examples/liz.zip +0 -0
  273. data/data/jqplot/examples/markerStyles.html +44 -0
  274. data/data/jqplot/examples/mekkoChart.html +217 -0
  275. data/data/jqplot/examples/meterGauge.html +132 -0
  276. data/data/jqplot/examples/meterGauge2.html +158 -0
  277. data/data/jqplot/examples/minMaxLines.html +61 -0
  278. data/data/jqplot/examples/missingValues.html +119 -0
  279. data/data/jqplot/examples/multiAxesRotatedText.html +70 -0
  280. data/data/jqplot/examples/multipleBarColors.html +149 -0
  281. data/data/jqplot/examples/multipleLines.html +47 -0
  282. data/data/jqplot/examples/multipleYAxes.html +85 -0
  283. data/data/jqplot/examples/nav.inc +35 -0
  284. data/data/jqplot/examples/pieTest.html +77 -0
  285. data/data/jqplot/examples/pieTest2.html +87 -0
  286. data/data/jqplot/examples/pieTest2.js +80 -0
  287. data/data/jqplot/examples/pieTest3.html +100 -0
  288. data/data/jqplot/examples/pointLabels.html +94 -0
  289. data/data/jqplot/examples/pointLabels2.html +47 -0
  290. data/data/jqplot/examples/prefix.html +90 -0
  291. data/data/jqplot/examples/resizablePlot.html +150 -0
  292. data/data/jqplot/examples/rotatedTickLabels.html +61 -0
  293. data/data/jqplot/examples/rotatedTickLabelsZoom.html +68 -0
  294. data/data/jqplot/examples/seriesCanvasReorder.html +93 -0
  295. data/data/jqplot/examples/seriesUpdate.html +123 -0
  296. data/data/jqplot/examples/shadowTests.html +133 -0
  297. data/data/jqplot/examples/singlePoint.html +70 -0
  298. data/data/jqplot/examples/sparkLine.html +48 -0
  299. data/data/jqplot/examples/stackedBar2.html +104 -0
  300. data/data/jqplot/examples/stackedBar3.html +76 -0
  301. data/data/jqplot/examples/stackedBarCategoryVsLinearAxes.html +121 -0
  302. data/data/jqplot/examples/stackedCategoryAxis.html +89 -0
  303. data/data/jqplot/examples/stackedFilledLine.html +77 -0
  304. data/data/jqplot/examples/stackedLine.html +56 -0
  305. data/data/jqplot/examples/test2.html +64 -0
  306. data/data/jqplot/examples/theming.html +483 -0
  307. data/data/jqplot/examples/trendlineDragableCustomization.html +79 -0
  308. data/data/jqplot/examples/verticalLine.html +52 -0
  309. data/data/jqplot/examples/waterfall.html +135 -0
  310. data/data/jqplot/examples/zoom1.html +125 -0
  311. data/data/jqplot/examples/zoom2.html +73 -0
  312. data/data/jqplot/examples/zoom3.html +69 -0
  313. data/data/jqplot/examples/zoomOptions.html +101 -0
  314. data/data/jqplot/examples/zoomProxy.html +108 -0
  315. data/data/jqplot/excanvas.js +1416 -0
  316. data/data/jqplot/excanvas.min.js +35 -0
  317. data/data/jqplot/gpl-2.0.txt +280 -0
  318. data/data/jqplot/jqPlotCssStyling.txt +53 -0
  319. data/data/jqplot/jqPlotOptions.txt +276 -0
  320. data/data/jqplot/jquery-1.4.1.min.js +152 -0
  321. data/data/jqplot/jquery-1.4.2.min.js +154 -0
  322. data/data/jqplot/jquery.jqplot.css +212 -0
  323. data/data/jqplot/jquery.jqplot.js +7004 -0
  324. data/data/jqplot/jquery.jqplot.min.css +1 -0
  325. data/data/jqplot/jquery.jqplot.min.js +34 -0
  326. data/data/jqplot/optionsTutorial.txt +239 -0
  327. data/data/jqplot/plugins/jqplot.BezierCurveRenderer.js +300 -0
  328. data/data/jqplot/plugins/jqplot.BezierCurveRenderer.min.js +34 -0
  329. data/data/jqplot/plugins/jqplot.barRenderer.js +629 -0
  330. data/data/jqplot/plugins/jqplot.barRenderer.min.js +34 -0
  331. data/data/jqplot/plugins/jqplot.blockRenderer.js +221 -0
  332. data/data/jqplot/plugins/jqplot.blockRenderer.min.js +34 -0
  333. data/data/jqplot/plugins/jqplot.bubbleRenderer.js +724 -0
  334. data/data/jqplot/plugins/jqplot.bubbleRenderer.min.js +34 -0
  335. data/data/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js +187 -0
  336. data/data/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js +34 -0
  337. data/data/jqplot/plugins/jqplot.canvasAxisTickRenderer.js +226 -0
  338. data/data/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js +34 -0
  339. data/data/jqplot/plugins/jqplot.canvasTextRenderer.js +408 -0
  340. data/data/jqplot/plugins/jqplot.canvasTextRenderer.min.js +34 -0
  341. data/data/jqplot/plugins/jqplot.categoryAxisRenderer.js +630 -0
  342. data/data/jqplot/plugins/jqplot.categoryAxisRenderer.min.js +34 -0
  343. data/data/jqplot/plugins/jqplot.cursor.js +952 -0
  344. data/data/jqplot/plugins/jqplot.cursor.min.js +34 -0
  345. data/data/jqplot/plugins/jqplot.dateAxisRenderer.js +313 -0
  346. data/data/jqplot/plugins/jqplot.dateAxisRenderer.min.js +34 -0
  347. data/data/jqplot/plugins/jqplot.donutRenderer.js +876 -0
  348. data/data/jqplot/plugins/jqplot.donutRenderer.min.js +34 -0
  349. data/data/jqplot/plugins/jqplot.dragable.js +206 -0
  350. data/data/jqplot/plugins/jqplot.dragable.min.js +34 -0
  351. data/data/jqplot/plugins/jqplot.enhancedLegendRenderer.js +186 -0
  352. data/data/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js +34 -0
  353. data/data/jqplot/plugins/jqplot.funnelRenderer.js +918 -0
  354. data/data/jqplot/plugins/jqplot.funnelRenderer.min.js +34 -0
  355. data/data/jqplot/plugins/jqplot.highlighter.js +374 -0
  356. data/data/jqplot/plugins/jqplot.highlighter.min.js +34 -0
  357. data/data/jqplot/plugins/jqplot.logAxisRenderer.js +434 -0
  358. data/data/jqplot/plugins/jqplot.logAxisRenderer.min.js +34 -0
  359. data/data/jqplot/plugins/jqplot.mekkoAxisRenderer.js +595 -0
  360. data/data/jqplot/plugins/jqplot.mekkoAxisRenderer.min.js +34 -0
  361. data/data/jqplot/plugins/jqplot.mekkoRenderer.js +419 -0
  362. data/data/jqplot/plugins/jqplot.mekkoRenderer.min.js +34 -0
  363. data/data/jqplot/plugins/jqplot.meterGaugeRenderer.js +1112 -0
  364. data/data/jqplot/plugins/jqplot.meterGaugeRenderer.min.js +34 -0
  365. data/data/jqplot/plugins/jqplot.ohlcRenderer.js +343 -0
  366. data/data/jqplot/plugins/jqplot.ohlcRenderer.min.js +34 -0
  367. data/data/jqplot/plugins/jqplot.pieRenderer.js +749 -0
  368. data/data/jqplot/plugins/jqplot.pieRenderer.min.js +34 -0
  369. data/data/jqplot/plugins/jqplot.pointLabels.js +325 -0
  370. data/data/jqplot/plugins/jqplot.pointLabels.min.js +34 -0
  371. data/data/jqplot/plugins/jqplot.trendline.js +208 -0
  372. data/data/jqplot/plugins/jqplot.trendline.min.js +34 -0
  373. data/data/jqplot/usage.txt +119 -0
  374. data/examples/graph.rb +17 -0
  375. data/lib/reportbuilder.rb +21 -2
  376. data/lib/reportbuilder/builder.rb +31 -3
  377. data/lib/reportbuilder/builder/html.rb +39 -5
  378. data/lib/reportbuilder/graph.rb +252 -0
  379. data/lib/reportbuilder/graph/html_flot.rb +149 -0
  380. data/lib/reportbuilder/graph/html_jqplot.rb +145 -0
  381. data/lib/reportbuilder/image.rb +178 -78
  382. data/lib/reportbuilder/table/rtfbuilder.rb +2 -2
  383. data/test/helper_test.rb +6 -7
  384. data/test/test_graph.rb +44 -0
  385. data/test/test_graph_html_flot.rb +36 -0
  386. data/test/test_graph_html_jqplot.rb +36 -0
  387. data/test/test_html.rb +4 -7
  388. data/test/test_image.rb +35 -7
  389. data/test/test_reportbuilder.rb +4 -6
  390. data/test/test_table.rb +0 -2
  391. metadata +402 -7
  392. metadata.gz.sig +4 -2
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright (c) 2009 - 2010 Chris Leonello
3
+ * jqPlot is currently available for use in all personal or commercial projects
4
+ * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
5
+ * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
6
+ * choose the license that best suits your project and use it accordingly.
7
+ *
8
+ * Although not required, the author would appreciate an email letting him
9
+ * know of any substantial use of jqPlot. You can reach the author at:
10
+ * chris at jqplot or see http://www.jqplot.com/info.php .
11
+ *
12
+ * If you are feeling kind and generous, consider supporting the project by
13
+ * making a donation at: http://www.jqplot.com/donate.php .
14
+ *
15
+ * jqPlot includes date instance methods and printf/sprintf functions by other authors:
16
+ *
17
+ * Date instance methods contained in jqplot.dateMethods.js:
18
+ *
19
+ * author Ken Snyder (ken d snyder at gmail dot com)
20
+ * date 2008-09-10
21
+ * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
22
+ * license Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
23
+ *
24
+ * JavaScript printf/sprintf functions contained in jqplot.sprintf.js:
25
+ *
26
+ * version 2007.04.27
27
+ * author Ash Searle
28
+ * http://hexmen.com/blog/2007/03/printf-sprintf/
29
+ * http://hexmen.com/js/sprintf.js
30
+ * The author (Ash Searle) has placed this code in the public domain:
31
+ * "This code is unrestricted: you are free to use it however you like."
32
+ *
33
+ */
34
+ (function(c){c.jqplot.MeterGaugeRenderer=function(){c.jqplot.LineRenderer.call(this)};c.jqplot.MeterGaugeRenderer.prototype=new c.jqplot.LineRenderer();c.jqplot.MeterGaugeRenderer.prototype.constructor=c.jqplot.MeterGaugeRenderer;c.jqplot.MeterGaugeRenderer.prototype.init=function(e){this.diameter=null;this.padding=null;this.shadowOffset=2;this.shadowAlpha=0.07;this.shadowDepth=4;this.background="#efefef";this.ringColor="#BBC6D0";this.needleColor="#C3D3E5";this.tickColor="989898";this.ringWidth=null;this.min;this.max;this.ticks=[];this.showTicks=true;this.showTickLabels=true;this.label=null;this.labelHeightAdjust=0;this.labelPosition="inside";this.intervals=[];this.intervalColors=["#4bb2c5","#EAA228","#c5b47f","#579575","#839557","#958c12","#953579","#4b5de4","#d8b83f","#ff5800","#0085cc","#c747a3","#cddf54","#FBD178","#26B4E3","#bd70c7"];this.intervalInnerRadius=null;this.intervalOuterRadius=null;this.tickRenderer=c.jqplot.MeterGaugeTickRenderer;this.tickPositions=[1,2,2.5,5,10];this.tickSpacing=30;this.numberMinorTicks=null;this.hubRadius=null;this.tickPadding=null;this.needleThickness=null;this.needlePad=6;this.pegNeedle=true;c.extend(true,this,e);this.type=null;this.numberTicks=null;this.tickInterval=null;this.span=180;if(this.type=="circular"){this.semiCircular=false}else{if(this.type!="circular"){this.semiCircular=true}else{this.semiCircular=(this.span<=180)?true:false}}this._tickPoints=[];this._labelElm=null;this.startAngle=(90+(360-this.span)/2)*Math.PI/180;this.endAngle=(90-(360-this.span)/2)*Math.PI/180;this.setmin=!!(this.min==null);this.setmax=!!(this.max==null);if(this.intervals.length){if(this.intervals[0].length==null||this.intervals.length==1){for(var f=0;f<this.intervals.length;f++){this.intervals[f]=[this.intervals[f],this.intervals[f],this.intervalColors[f]]}}else{if(this.intervals[0].length==2){for(f=0;f<this.intervals.length;f++){this.intervals[f]=[this.intervals[f][0],this.intervals[f][1],this.intervalColors[f]]}}}}if(this.ticks.length){if(this.ticks[0].length==null||this.ticks[0].length==1){for(var f=0;f<this.ticks.length;f++){this.ticks[f]=[this.ticks[f],this.ticks[f]]}}this.min=(this.min==null)?this.ticks[0][0]:this.min;this.max=(this.max==null)?this.ticks[this.ticks.length-1][0]:this.max;this.setmin=false;this.setmax=false;this.numberTicks=this.ticks.length;this.tickInterval=this.ticks[1][0]-this.ticks[0][0];this.tickFactor=Math.floor(parseFloat((Math.log(this.tickInterval)/Math.log(10)).toFixed(11)));this.numberMinorTicks=b(this.tickPositions,this.tickInterval,this.tickFactor);if(!this.numberMinorTicks){this.numberMinorTicks=b(this.tickPositions,this.tickInterval,this.tickFactor-1)}if(!this.numberMinorTicks){this.numberMinorTicks=1}}else{if(this.intervals.length){this.min=(this.min==null)?0:this.min;this.setmin=false;if(this.max==null){if(this.intervals[this.intervals.length-1][0]>=this.data[0][1]){this.max=this.intervals[this.intervals.length-1][0];this.setmax=false}}else{this.setmax=false}}else{this.min=(this.min==null)?0:this.min;this.setmin=false;if(this.max==null){this.max=this.data[0][1]*1.25;this.setmax=true}else{this.setmax=false}}}};c.jqplot.MeterGaugeRenderer.prototype.setGridData=function(j){var f=[];var k=[];var e=this.startAngle;for(var h=0;h<this.data.length;h++){f.push(this.data[h][1]);k.push([this.data[h][0]]);if(h>0){f[h]+=f[h-1]}}var g=Math.PI*2/f[f.length-1];for(var h=0;h<f.length;h++){k[h][1]=f[h]*g}this.gridData=k};c.jqplot.MeterGaugeRenderer.prototype.makeGridData=function(j,k){var f=[];var l=[];var e=this.startAngle;for(var h=0;h<j.length;h++){f.push(j[h][1]);l.push([j[h][0]]);if(h>0){f[h]+=f[h-1]}}var g=Math.PI*2/f[f.length-1];for(var h=0;h<f.length;h++){l[h][1]=f[h]*g}return l};function b(h,f,g){var e;for(i=h.length-1;i>=0;i--){e=f/(h[i]*Math.pow(10,g));if(e==4||e==5){return e-1}}return null}c.jqplot.MeterGaugeRenderer.prototype.draw=function(V,ay,am){var X;var aF=(am!=undefined)?am:{};var ag=0;var af=0;var ap=1;if(am.legendInfo&&am.legendInfo.placement=="inside"){var aC=am.legendInfo;switch(aC.location){case"nw":ag=aC.width+aC.xoffset;break;case"w":ag=aC.width+aC.xoffset;break;case"sw":ag=aC.width+aC.xoffset;break;case"ne":ag=aC.width+aC.xoffset;ap=-1;break;case"e":ag=aC.width+aC.xoffset;ap=-1;break;case"se":ag=aC.width+aC.xoffset;ap=-1;break;case"n":af=aC.height+aC.yoffset;break;case"s":af=aC.height+aC.yoffset;ap=-1;break;default:break}}if(this.label){this._labelElem=c('<div class="jqplot-meterGauge-label" style="position:absolute;">'+this.label+"</div>");this.canvas._elem.after(this._labelElem)}var k=(aF.shadow!=undefined)?aF.shadow:this.shadow;var L=(aF.showLine!=undefined)?aF.showLine:this.showLine;var H=(aF.fill!=undefined)?aF.fill:this.fill;var J=V.canvas.width;var Q=V.canvas.height;if(this.padding==null){this.padding=Math.round(Math.min(J,Q)/30)}var O=J-ag-2*this.padding;var Z=Q-af-2*this.padding;if(this.labelPosition=="bottom"&&this.label){Z-=this._labelElem.outerHeight(true)}var K=Math.min(O,Z);var ab=K;if(!this.diameter){if(this.semiCircular){if(O>=2*Z){if(!this.ringWidth){this.ringWidth=2*Z/35}this.needleThickness=this.needleThickness||2+Math.pow(this.ringWidth,0.8);this.innerPad=this.ringWidth/2+this.needleThickness/2+this.needlePad;this.diameter=2*(Z-2*this.innerPad)}else{if(!this.ringWidth){this.ringWidth=O/35}this.needleThickness=this.needleThickness||2+Math.pow(this.ringWidth,0.8);this.innerPad=this.ringWidth/2+this.needleThickness/2+this.needlePad;this.diameter=O-2*this.innerPad}this._center=[(J-ap*ag)/2+ap*ag,(Q+ap*af-this.padding-this.ringWidth-this.innerPad)]}else{if(!this.ringWidth){this.ringWidth=ab/35}this.needleThickness=this.needleThickness||2+Math.pow(this.ringWidth,0.8);this.innerPad=0;this.diameter=ab-this.ringWidth;this._center=[(J-ap*ag)/2+ap*ag,(Q-ap*af)/2+ap*af]}}if(this._labelElem&&this.labelPosition=="bottom"){this._center[1]-=this._labelElem.outerHeight(true)}this._radius=this.diameter/2;this.tickSpacing=6000/this.diameter;if(!this.hubRadius){this.hubRadius=this.diameter/18}this.shadowOffset=0.5+this.ringWidth/9;this.shadowWidth=this.ringWidth*1;this.tickPadding=3+Math.pow(this.diameter/20,0.7);this.tickOuterRadius=this._radius-this.ringWidth/2-this.tickPadding;this.tickLength=(this.showTicks)?this._radius/13:0;if(this.ticks.length==0){var z=this.max,aE=this.min,p=this.setmax,aB=this.setmin,aq=(z-aE)*this.tickSpacing/this.span;var ar=Math.floor(parseFloat((Math.log(aq)/Math.log(10)).toFixed(11)));var al=(aq/Math.pow(10,ar));(al>2&&al<=2.5)?al=2.5:al=Math.ceil(al);var R=this.tickPositions;var aw,ai;for(X=0;X<R.length;X++){if(al==R[X]||X&&R[X-1]<al&&al<R[X]){aq=R[X]*Math.pow(10,ar);aw=X}}for(X=0;X<R.length;X++){if(al==R[X]||X&&R[X-1]<al&&al<R[X]){aq=R[X]*Math.pow(10,ar);ai=Math.ceil((z-aE)/aq)}}if(p&&aB){var aI=(aE>0)?aE-aE%aq:aE-aE%aq-aq;if(!this.forceZero){var C=Math.min(aE-aI,0.8*aq);var n=Math.floor(C/R[aw]);if(n>1){aI=aI+R[aw]*(n-1);if(parseInt(aI,10)!=aI&&parseInt(aI-R[aw],10)==aI-R[aw]){aI=aI-R[aw]}}}if(aE==aI){aE-=aq}else{if(aE-aI>0.23*aq){aE=aI}else{aE=aI-aq;ai+=1}}ai+=1;var D=aE+(ai-1)*aq;if(z>=D){D+=aq;ai+=1}if(D-z<0.23*aq){D+=aq;ai+=1}this.max=z=D;this.min=aE;this.tickInterval=aq;this.numberTicks=ai;var M;for(X=0;X<ai;X++){M=parseFloat((aE+X*aq).toFixed(11));this.ticks.push([M,M])}this.max=this.ticks[ai-1][1];this.tickFactor=ar;this.numberMinorTicks=b(this.tickPositions,this.tickInterval,this.tickFactor);if(!this.numberMinorTicks){this.numberMinorTicks=b(this.tickPositions,this.tickInterval,this.tickFactor-1)}}else{if(p){var D=aE+(ai-1)*aq;if(z>=D){z=D+aq;ai+=1}else{z=D}this.tickInterval=this.tickInterval||aq;this.numberTicks=this.numberTicks||ai;var M;for(X=0;X<this.numberTicks;X++){M=parseFloat((aE+X*this.tickInterval).toFixed(11));this.ticks.push([M,M])}this.max=this.ticks[this.numberTicks-1][1];this.tickFactor=ar;this.numberMinorTicks=b(this.tickPositions,this.tickInterval,this.tickFactor);if(!this.numberMinorTicks){this.numberMinorTicks=b(this.tickPositions,this.tickInterval,this.tickFactor-1)}}}if(!p&&!aB){var N=this.max-this.min;ar=Math.floor(parseFloat((Math.log(N)/Math.log(10)).toFixed(11)))-1;var aG=[5,6,4,7,3],T,B;for(X=0;X<aG.length;X++){T=N/(aG[X]-1)/Math.pow(10,ar);if(T==parseInt(T,10)){this.numberTicks=aG[X];this.tickInterval=N/(this.numberTicks-1);this.tickFactor=ar+1;break}}var M;for(X=0;X<this.numberTicks;X++){M=parseFloat((this.min+X*this.tickInterval).toFixed(11));this.ticks.push([M,M])}this.numberMinorTicks=b(this.tickPositions,this.tickInterval,this.tickFactor);if(!this.numberMinorTicks){this.numberMinorTicks=b(this.tickPositions,this.tickInterval,this.tickFactor-1)}if(!this.numberMinorTicks){this.numberMinorTicks=1}}}var S=this._radius,aA=this.startAngle,g=this.endAngle,G=Math.PI,e=Math.PI/2;if(this.semiCircular){var x=Math.atan(this.innerPad/S),aa=this.outerStartAngle=aA-x,ax=this.outerEndAngle=g+x,A=this.hubStartAngle=aA-Math.atan(this.innerPad/this.hubRadius*2),ad=this.hubEndAngle=g+Math.atan(this.innerPad/this.hubRadius*2);V.save();V.translate(this._center[0],this._center[1]);V.lineJoin="round";V.lineCap="round";V.save();V.beginPath();V.fillStyle=this.background;V.arc(0,0,S,aa,ax,false);V.closePath();V.fill();V.restore();var ah="rgba(0,0,0,"+this.shadowAlpha+")";V.save();for(var X=0;X<this.shadowDepth;X++){V.translate(this.shadowOffset*Math.cos(this.shadowAngle/180*Math.PI),this.shadowOffset*Math.sin(this.shadowAngle/180*Math.PI));V.beginPath();V.strokeStyle=ah;V.lineWidth=this.shadowWidth;V.arc(0,0,S,aa,ax,false);V.closePath();V.stroke()}V.restore();V.save();var av=parseInt((this.shadowDepth+1)/2,10);for(var X=0;X<av;X++){V.translate(this.shadowOffset*Math.cos(this.shadowAngle/180*Math.PI),this.shadowOffset*Math.sin(this.shadowAngle/180*Math.PI));V.beginPath();V.fillStyle=ah;V.arc(0,0,this.hubRadius,A,ad,false);V.closePath();V.fill()}V.restore();V.save();V.beginPath();V.strokeStyle=this.ringColor;V.lineWidth=this.ringWidth;V.arc(0,0,S,aa,ax,false);V.closePath();V.stroke();V.restore();V.save();V.beginPath();V.fillStyle=this.ringColor;V.arc(0,0,this.hubRadius,A,ad,false);V.closePath();V.fill();V.restore();if(this.showTicks){V.save();var f=this.tickOuterRadius,an=this.tickLength,u=an/2,E=this.numberMinorTicks,ak=this.span*Math.PI/180/(this.ticks.length-1),o=ak/(E+1);for(X=0;X<this.ticks.length;X++){V.beginPath();V.lineWidth=1.5+this.diameter/360;V.strokeStyle=this.ringColor;var ac=ak*X+aA;V.moveTo(-f*Math.cos(ak*X+aA),f*Math.sin(ak*X+aA));V.lineTo(-(f-an)*Math.cos(ak*X+aA),(f-an)*Math.sin(ak*X+aA));this._tickPoints.push([(f-an)*Math.cos(ak*X+aA)+this._center[0]+this.canvas._offsets.left,(f-an)*Math.sin(ak*X+aA)+this._center[1]+this.canvas._offsets.top,ak*X+aA]);V.stroke();V.lineWidth=1+this.diameter/440;if(X<this.ticks.length-1){for(var W=1;W<=E;W++){V.beginPath();V.moveTo(-f*Math.cos(ak*X+o*W+aA),f*Math.sin(ak*X+o*W+aA));V.lineTo(-(f-u)*Math.cos(ak*X+o*W+aA),(f-u)*Math.sin(ak*X+o*W+aA));V.stroke()}}}V.restore()}if(this.showTickLabels){var I,U,R,aH,F,m=0;var al=this.tickPadding*(1-1/(this.diameter/80+1));for(X=0;X<this.ticks.length;X++){I=c('<div class="jqplot-meterGauge-tick" style="position:absolute;">'+this.ticks[X][1]+"</div>");this.canvas._elem.after(I);aH=I.outerWidth(true);eh=I.outerHeight(true);U=this._tickPoints[X][0]-aH*(this._tickPoints[X][2]-Math.PI)/Math.PI-al*Math.cos(this._tickPoints[X][2]);R=this._tickPoints[X][1]-eh/2+eh/2*Math.pow(Math.abs((Math.sin(this._tickPoints[X][2]))),0.5)+al/3*Math.pow(Math.abs((Math.sin(this._tickPoints[X][2]))),0.5);I.css({left:U,top:R});F=aH*Math.cos(this._tickPoints[X][2])+eh*Math.sin(Math.PI/2+this._tickPoints[X][2]/2);m=(F>m)?F:m}}if(this.label&&this.labelPosition=="inside"){var U=this._center[0]+this.canvas._offsets.left;var al=this.tickPadding*(1-1/(this.diameter/80+1));var R=0.5*(this._center[1]+this.canvas._offsets.top-this.hubRadius)+0.5*(this._center[1]+this.canvas._offsets.top-this.tickOuterRadius+this.tickLength+al)+this.labelHeightAdjust;U-=this._labelElem.outerWidth(true)/2;R-=this._labelElem.outerHeight(true)/2;this._labelElem.css({left:U,top:R})}else{if(this.label&&this.labelPosition=="bottom"){var U=this._center[0]+this.canvas._offsets.left-this._labelElem.outerWidth(true)/2;var R=this._center[1]+this.canvas._offsets.top+this.innerPad+ +this.ringWidth+this.padding+this.labelHeightAdjust;this._labelElem.css({left:U,top:R})}}V.save();var at=this.intervalInnerRadius||this.hubRadius*1.5;if(this.intervalOuterRadius==null){if(this.showTickLabels){var ae=(this.tickOuterRadius-this.tickLength-this.tickPadding-this.diameter/8)}else{var ae=(this.tickOuterRadius-this.tickLength-this.diameter/16)}}else{var ae=this.intervalOuterRadius}var N=this.max-this.min;var az=this.intervals[this.intervals.length-1]-this.min;var y,Y,s=this.span*Math.PI/180;for(X=0;X<this.intervals.length;X++){y=(X==0)?aA:aA+(this.intervals[X-1][0]-this.min)*s/N;if(y<0){y=0}Y=aA+(this.intervals[X][0]-this.min)*s/N;if(Y<0){Y=0}V.beginPath();V.fillStyle=this.intervals[X][2];V.arc(0,0,at,y,Y,false);V.lineTo(ae*Math.cos(Y),ae*Math.sin(Y));V.arc(0,0,ae,Y,y,true);V.lineTo(at*Math.cos(y),at*Math.sin(y));V.closePath();V.fill()}V.restore();var au=this.data[0][1];var P=this.max-this.min;if(this.pegNeedle){if(this.data[0][1]>this.max+P*3/this.span){au=this.max+P*3/this.span}if(this.data[0][1]<this.min-P*3/this.span){au=this.min-P*3/this.span}}var aj=(au-this.min)/P*this.span*Math.PI/180+this.startAngle;V.save();V.beginPath();V.fillStyle=this.ringColor;V.strokeStyle=this.ringColor;this.needleLength=(this.tickOuterRadius-this.tickLength)*0.85;this.needleThickness=(this.needleThickness<2)?2:this.needleThickness;var aD=this.needleThickness*0.4;var v=this.needleLength/10;var q=(this.needleThickness-aD)/10;var ao;for(var X=0;X<10;X++){ao=this.needleThickness-X*q;V.moveTo(v*X*Math.cos(aj),v*X*Math.sin(aj));V.lineWidth=ao;V.lineTo(v*(X+1)*Math.cos(aj),v*(X+1)*Math.sin(aj));V.stroke()}V.restore()}else{this._center=[(J-ap*ag)/2+ap*ag,(Q-ap*af)/2+ap*af]}};c.jqplot.MeterGaugeAxisRenderer=function(){c.jqplot.LinearAxisRenderer.call(this)};c.jqplot.MeterGaugeAxisRenderer.prototype=new c.jqplot.LinearAxisRenderer();c.jqplot.MeterGaugeAxisRenderer.prototype.constructor=c.jqplot.MeterGaugeAxisRenderer;c.jqplot.MeterGaugeAxisRenderer.prototype.init=function(e){this.tickRenderer=c.jqplot.MeterGaugeTickRenderer;c.extend(true,this,e);this._dataBounds={min:0,max:100};this.min=0;this.max=100;this.showTicks=false;this.ticks=[];this.showMark=false;this.show=false};c.jqplot.MeterGaugeLegendRenderer=function(){c.jqplot.TableLegendRenderer.call(this)};c.jqplot.MeterGaugeLegendRenderer.prototype=new c.jqplot.TableLegendRenderer();c.jqplot.MeterGaugeLegendRenderer.prototype.constructor=c.jqplot.MeterGaugeLegendRenderer;c.jqplot.MeterGaugeLegendRenderer.prototype.init=function(e){this.numberRows=null;this.numberColumns=null;c.extend(true,this,e)};c.jqplot.MeterGaugeLegendRenderer.prototype.draw=function(){var g=this;if(this.show){var p=this._series;var t="position:absolute;";t+=(this.background)?"background:"+this.background+";":"";t+=(this.border)?"border:"+this.border+";":"";t+=(this.fontSize)?"font-size:"+this.fontSize+";":"";t+=(this.fontFamily)?"font-family:"+this.fontFamily+";":"";t+=(this.textColor)?"color:"+this.textColor+";":"";t+=(this.marginTop!=null)?"margin-top:"+this.marginTop+";":"";t+=(this.marginBottom!=null)?"margin-bottom:"+this.marginBottom+";":"";t+=(this.marginLeft!=null)?"margin-left:"+this.marginLeft+";":"";t+=(this.marginRight!=null)?"margin-right:"+this.marginRight+";":"";this._elem=c('<table class="jqplot-table-legend" style="'+t+'"></table>');var x=false,o=false,e,m;var q=p[0];if(q.show){var y=q.data;if(this.numberRows){e=this.numberRows;if(!this.numberColumns){m=Math.ceil(y.length/e)}else{m=this.numberColumns}}else{if(this.numberColumns){m=this.numberColumns;e=Math.ceil(y.length/this.numberColumns)}else{e=y.length;m=1}}var w,v,f,k,h,l,n,u;var r=0;for(w=0;w<e;w++){if(o){f=c('<tr class="jqplot-table-legend"></tr>').prependTo(this._elem)}else{f=c('<tr class="jqplot-table-legend"></tr>').appendTo(this._elem)}for(v=0;v<m;v++){if(r<y.length){l=this.labels[r]||y[r][0].toString();u=colorGenerator.next();if(!o){if(w>0){x=true}else{x=false}}else{if(w==e-1){x=false}else{x=true}}n=(x)?this.rowSpacing:"0";k=c('<td class="jqplot-table-legend" style="text-align:center;padding-top:'+n+';"><div><div class="jqplot-table-legend-swatch" style="border-color:'+u+';"></div></div></td>');h=c('<td class="jqplot-table-legend" style="padding-top:'+n+';"></td>');if(this.escapeHtml){h.text(l)}else{h.html(l)}if(o){h.prependTo(f);k.prependTo(f)}else{k.appendTo(f);h.appendTo(f)}x=true}r++}}}}return this._elem};function a(j,h,f){f=f||{};f.axesDefaults=f.axesDefaults||{};f.legend=f.legend||{};f.seriesDefaults=f.seriesDefaults||{};f.grid=f.grid||{};f.gridPadding=f.gridPadding||{};var e=false;if(f.seriesDefaults.renderer==c.jqplot.MeterGaugeRenderer){e=true}else{if(f.series){for(var g=0;g<f.series.length;g++){if(f.series[g].renderer==c.jqplot.MeterGaugeRenderer){e=true}}}}if(e){f.axesDefaults.renderer=c.jqplot.MeterGaugeAxisRenderer;f.legend.renderer=c.jqplot.MeterGaugeLegendRenderer;f.legend.preDraw=true;f.grid.background=f.grid.background||"white";f.grid.drawGridlines=false;f.grid.borderWidth=(f.grid.borderWidth!=null)?f.grid.borderWidth:0;f.grid.shadow=(f.grid.shadow!=null)?f.grid.shadow:false;f.gridPadding.top=(f.gridPadding.top!=null)?f.gridPadding.top:0;f.gridPadding.bottom=(f.gridPadding.bottom!=null)?f.gridPadding.bottom:0;f.gridPadding.left=(f.gridPadding.left!=null)?f.gridPadding.left:0;f.gridPadding.right=(f.gridPadding.right!=null)?f.gridPadding.right:0}}function d(e){}c.jqplot.preInitHooks.push(a);c.jqplot.postParseOptionsHooks.push(d);c.jqplot.MeterGaugeTickRenderer=function(){c.jqplot.AxisTickRenderer.call(this)};c.jqplot.MeterGaugeTickRenderer.prototype=new c.jqplot.AxisTickRenderer();c.jqplot.MeterGaugeTickRenderer.prototype.constructor=c.jqplot.MeterGaugeTickRenderer})(jQuery);
@@ -0,0 +1,343 @@
1
+ /**
2
+ * Copyright (c) 2009 - 2010 Chris Leonello
3
+ * jqPlot is currently available for use in all personal or commercial projects
4
+ * under both the MIT and GPL version 2.0 licenses. This means that you can
5
+ * choose the license that best suits your project and use it accordingly.
6
+ *
7
+ * The author would appreciate an email letting him know of any substantial
8
+ * use of jqPlot. You can reach the author at: chris at jqplot dot com
9
+ * or see http://www.jqplot.com/info.php . This is, of course,
10
+ * not required.
11
+ *
12
+ * If you are feeling kind and generous, consider supporting the project by
13
+ * making a donation at: http://www.jqplot.com/donate.php .
14
+ *
15
+ * Thanks for using jqPlot!
16
+ *
17
+ */
18
+ (function($) {
19
+ /**
20
+ * Class: $.jqplot.OHLCRenderer
21
+ * jqPlot Plugin to draw Open Hi Low Close, Candlestick and Hi Low Close charts.
22
+ *
23
+ * To use this plugin, include the renderer js file in
24
+ * your source:
25
+ *
26
+ * > <script type="text/javascript" src="plugins/jqplot.ohlcRenderer.js"></script>
27
+ *
28
+ * You will most likely want to use a date axis renderer
29
+ * for the x axis also, so include the date axis render js file also:
30
+ *
31
+ * > <script type="text/javascript" src="plugins/jqplot.dateAxisRenderer.js"></script>
32
+ *
33
+ * Then you set the renderer in the series options on your plot:
34
+ *
35
+ * > series: [{renderer:$.jqplot.OHLCRenderer}]
36
+ *
37
+ * For OHLC and candlestick charts, data should be specified
38
+ * like so:
39
+ *
40
+ * > dat = [['07/06/2009',138.7,139.68,135.18,135.4], ['06/29/2009',143.46,144.66,139.79,140.02], ...]
41
+ *
42
+ * If the data array has only 4 values per point instead of 5,
43
+ * the renderer will create a Hi Low Close chart instead. In that case,
44
+ * data should be supplied like:
45
+ *
46
+ * > dat = [['07/06/2009',139.68,135.18,135.4], ['06/29/2009',144.66,139.79,140.02], ...]
47
+ *
48
+ * To generate a candlestick chart instead of an OHLC chart,
49
+ * set the "candlestick" option to true:
50
+ *
51
+ * > series: [{renderer:$.jqplot.OHLCRenderer, rendererOptions:{candleStick:true}}],
52
+ *
53
+ */
54
+ $.jqplot.OHLCRenderer = function(){
55
+ // subclass line renderer to make use of some of it's methods.
56
+ $.jqplot.LineRenderer.call(this);
57
+ // prop: candleStick
58
+ // true to render chart as candleStick.
59
+ // Must have an open price, cannot be a hlc chart.
60
+ this.candleStick = false;
61
+ // prop: tickLength
62
+ // length of the line in pixels indicating open and close price.
63
+ // Default will auto calculate based on plot width and
64
+ // number of points displayed.
65
+ this.tickLength = 'auto';
66
+ // prop: bodyWidth
67
+ // width of the candlestick body in pixels. Default will auto calculate
68
+ // based on plot width and number of candlesticks displayed.
69
+ this.bodyWidth = 'auto';
70
+ // prop: openColor
71
+ // color of the open price tick mark. Default is series color.
72
+ this.openColor = null;
73
+ // prop: closeColor
74
+ // color of the close price tick mark. Default is series color.
75
+ this.closeColor = null;
76
+ // prop: wickColor
77
+ // color of the hi-lo line thorugh the candlestick body.
78
+ // Default is the series color.
79
+ this.wickColor = null;
80
+ // prop: fillUpBody
81
+ // true to render an "up" day (close price greater than open price)
82
+ // with a filled candlestick body.
83
+ this.fillUpBody = false;
84
+ // prop: fillDownBody
85
+ // true to render a "down" day (close price lower than open price)
86
+ // with a filled candlestick body.
87
+ this.fillDownBody = true;
88
+ // prop: upBodyColor
89
+ // Color of candlestick body of an "up" day. Default is series color.
90
+ this.upBodyColor = null;
91
+ // prop: downBodyColor
92
+ // Color of candlestick body on a "down" day. Default is series color.
93
+ this.downBodyColor = null;
94
+ // prop: hlc
95
+ // true if is a hi-low-close chart (no open price).
96
+ // This is determined automatically from the series data.
97
+ this.hlc = false;
98
+ this._tickLength;
99
+ this._bodyWidth;
100
+ };
101
+
102
+ $.jqplot.OHLCRenderer.prototype = new $.jqplot.LineRenderer();
103
+ $.jqplot.OHLCRenderer.prototype.constructor = $.jqplot.OHLCRenderer;
104
+
105
+ // called with scope of series.
106
+ $.jqplot.OHLCRenderer.prototype.init = function(options) {
107
+ // prop: lineWidth
108
+ // Width of the hi-low line and open/close ticks.
109
+ this.lineWidth = 1.5;
110
+ $.jqplot.LineRenderer.prototype.init.call(this, options);
111
+ // set the yaxis data bounds here to account for hi and low values
112
+ var db = this._yaxis._dataBounds;
113
+ var d = this._plotData;
114
+ // if data points have less than 5 values, force a hlc chart.
115
+ if (d[0].length < 5) {
116
+ this.renderer.hlc = true;
117
+
118
+ for (var j=0; j<d.length; j++) {
119
+ if (d[j][2] < db.min || db.min == null) {
120
+ db.min = d[j][2];
121
+ }
122
+ if (d[j][1] > db.max || db.max == null) {
123
+ db.max = d[j][1];
124
+ }
125
+ }
126
+ }
127
+ else {
128
+ for (var j=0; j<d.length; j++) {
129
+ if (d[j][3] < db.min || db.min == null) {
130
+ db.min = d[j][3];
131
+ }
132
+ if (d[j][2] > db.max || db.max == null) {
133
+ db.max = d[j][2];
134
+ }
135
+ }
136
+ }
137
+
138
+ };
139
+
140
+ // called within scope of series.
141
+ $.jqplot.OHLCRenderer.prototype.draw = function(ctx, gd, options) {
142
+ var d = this.data;
143
+ var xmin = this._xaxis.min;
144
+ var xmax = this._xaxis.max;
145
+ // index of last value below range of plot.
146
+ var xminidx = 0;
147
+ // index of first value above range of plot.
148
+ var xmaxidx = d.length;
149
+ var xp = this._xaxis.series_u2p;
150
+ var yp = this._yaxis.series_u2p;
151
+ var i, prevColor, ops, b, h, w, a, points;
152
+ var o;
153
+ var r = this.renderer;
154
+ var opts = (options != undefined) ? options : {};
155
+ var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
156
+ var fill = (opts.fill != undefined) ? opts.fill : this.fill;
157
+ var fillAndStroke = (opts.fillAndStroke != undefined) ? opts.fillAndStroke : this.fillAndStroke;
158
+ r.bodyWidth = (opts.bodyWidth != undefined) ? opts.bodyWidth : r.bodyWidth;
159
+ r.tickLength = (opts.tickLength != undefined) ? opts.tickLength : r.tickLength;
160
+ ctx.save();
161
+ if (this.show) {
162
+ var x, open, hi, low, close;
163
+ // need to get widths based on number of points shown,
164
+ // not on total number of points. Use the results
165
+ // to speed up drawing in next step.
166
+ for (var i=0; i<d.length; i++) {
167
+ if (d[i][0] < xmin) {
168
+ xminidx = i;
169
+ }
170
+ else if (d[i][0] < xmax) {
171
+ xmaxidx = i+1;
172
+ }
173
+ }
174
+
175
+ if (r.candleStick) {
176
+ if (typeof(r.bodyWidth) == 'number') {
177
+ r._bodyWidth = r.bodyWidth;
178
+ }
179
+ else {
180
+ r._bodyWidth = Math.min(20, ctx.canvas.width/(xmaxidx - xminidx)/2);
181
+ }
182
+ }
183
+ else {
184
+ if (typeof(r.tickLength) == 'number') {
185
+ r._tickLength = r.tickLength;
186
+ }
187
+ else {
188
+ r._tickLength = Math.min(10, ctx.canvas.width/(xmaxidx - xminidx)/4);
189
+ }
190
+ }
191
+
192
+ for (var i=xminidx; i<xmaxidx; i++) {
193
+ x = xp(d[i][0]);
194
+ if (r.hlc) {
195
+ open = null;
196
+ hi = yp(d[i][1]);
197
+ low = yp(d[i][2]);
198
+ close = yp(d[i][3]);
199
+ }
200
+ else {
201
+ open = yp(d[i][1]);
202
+ hi = yp(d[i][2]);
203
+ low = yp(d[i][3]);
204
+ close = yp(d[i][4]);
205
+ }
206
+ o = {};
207
+ if (r.candleStick && !r.hlc) {
208
+ w = r._bodyWidth;
209
+ a = x - w/2;
210
+ // draw candle
211
+ // determine if candle up or down
212
+ // up, remember grid coordinates increase downward
213
+ if (close < open) {
214
+ // draw wick
215
+ if (r.wickColor) {
216
+ o.color = r.wickColor;
217
+ }
218
+ else if (r.downBodyColor) {
219
+ o.color = r.upBodyColor;
220
+ }
221
+ ops = $.extend(true, {}, opts, o);
222
+ r.shapeRenderer.draw(ctx, [[x, hi], [x, close]], ops);
223
+ r.shapeRenderer.draw(ctx, [[x, open], [x, low]], ops);
224
+ o = {};
225
+ b = close;
226
+ h = open - close;
227
+ // if color specified, use it
228
+ if (r.fillUpBody) {
229
+ o.fillRect = true;
230
+ }
231
+ else {
232
+ o.strokeRect = true;
233
+ w = w - this.lineWidth;
234
+ a = x - w/2;
235
+ }
236
+ if (r.upBodyColor) {
237
+ o.color = r.upBodyColor;
238
+ o.fillStyle = r.upBodyColor;
239
+ }
240
+ points = [a, b, w, h];
241
+ }
242
+ // down
243
+ else if (close > open) {
244
+ // draw wick
245
+ if (r.wickColor) {
246
+ o.color = r.wickColor;
247
+ }
248
+ else if (r.downBodyColor) {
249
+ o.color = r.downBodyColor;
250
+ }
251
+ ops = $.extend(true, {}, opts, o);
252
+ r.shapeRenderer.draw(ctx, [[x, hi], [x, open]], ops);
253
+ r.shapeRenderer.draw(ctx, [[x, close], [x, low]], ops);
254
+
255
+ o = {};
256
+
257
+ b = open;
258
+ h = close - open;
259
+ // if color specified, use it
260
+ if (r.fillDownBody) {
261
+ o.fillRect = true;
262
+ }
263
+ else {
264
+ o.strokeRect = true;
265
+ w = w - this.lineWidth;
266
+ a = x - w/2;
267
+ }
268
+ if (r.downBodyColor) {
269
+ o.color = r.downBodyColor;
270
+ o.fillStyle = r.downBodyColor;
271
+ }
272
+ points = [a, b, w, h];
273
+ }
274
+ // even, open = close
275
+ else {
276
+ // draw wick
277
+ if (r.wickColor) {
278
+ o.color = r.wickColor;
279
+ }
280
+ ops = $.extend(true, {}, opts, o);
281
+ r.shapeRenderer.draw(ctx, [[x, hi], [x, low]], ops);
282
+ o = {};
283
+ o.fillRect = false;
284
+ o.strokeRect = false;
285
+ a = [x - w/2, open];
286
+ b = [x + w/2, close];
287
+ w = null;
288
+ h = null;
289
+ points = [a, b];
290
+ }
291
+ ops = $.extend(true, {}, opts, o);
292
+ r.shapeRenderer.draw(ctx, points, ops);
293
+ }
294
+ else {
295
+ prevColor = opts.color;
296
+ if (r.openColor) {
297
+ opts.color = r.openColor;
298
+ }
299
+ // draw open tick
300
+ if (!r.hlc) {
301
+ r.shapeRenderer.draw(ctx, [[x-r._tickLength, open], [x, open]], opts);
302
+ }
303
+ opts.color = prevColor;
304
+ // draw wick
305
+ if (r.wickColor) {
306
+ opts.color = r.wickColor;
307
+ }
308
+ r.shapeRenderer.draw(ctx, [[x, hi], [x, low]], opts);
309
+ opts.color = prevColor;
310
+ // draw close tick
311
+ if (r.closeColor) {
312
+ opts.color = r.closeColor;
313
+ }
314
+ r.shapeRenderer.draw(ctx, [[x, close], [x+r._tickLength, close]], opts);
315
+ opts.color = prevColor;
316
+ }
317
+ }
318
+ }
319
+
320
+ ctx.restore();
321
+ };
322
+
323
+ $.jqplot.OHLCRenderer.prototype.drawShadow = function(ctx, gd, options) {
324
+ // This is a no-op, shadows drawn with lines.
325
+ };
326
+
327
+ // called with scope of plot.
328
+ $.jqplot.OHLCRenderer.checkOptions = function(target, data, options) {
329
+ // provide some sensible highlighter options by default
330
+ // These aren't good for hlc, only for ohlc or candlestick
331
+ if (!options.highlighter) {
332
+ options.highlighter = {
333
+ showMarker:false,
334
+ tooltipAxes: 'y',
335
+ yvalues: 4,
336
+ formatString:'<table class="jqplot-highlighter"><tr><td>date:</td><td>%s</td></tr><tr><td>open:</td><td>%s</td></tr><tr><td>hi:</td><td>%s</td></tr><tr><td>low:</td><td>%s</td></tr><tr><td>close:</td><td>%s</td></tr></table>'
337
+ };
338
+ }
339
+ };
340
+
341
+ //$.jqplot.preInitHooks.push($.jqplot.OHLCRenderer.checkOptions);
342
+
343
+ })(jQuery);
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright (c) 2009 - 2010 Chris Leonello
3
+ * jqPlot is currently available for use in all personal or commercial projects
4
+ * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
5
+ * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
6
+ * choose the license that best suits your project and use it accordingly.
7
+ *
8
+ * Although not required, the author would appreciate an email letting him
9
+ * know of any substantial use of jqPlot. You can reach the author at:
10
+ * chris at jqplot or see http://www.jqplot.com/info.php .
11
+ *
12
+ * If you are feeling kind and generous, consider supporting the project by
13
+ * making a donation at: http://www.jqplot.com/donate.php .
14
+ *
15
+ * jqPlot includes date instance methods and printf/sprintf functions by other authors:
16
+ *
17
+ * Date instance methods contained in jqplot.dateMethods.js:
18
+ *
19
+ * author Ken Snyder (ken d snyder at gmail dot com)
20
+ * date 2008-09-10
21
+ * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
22
+ * license Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
23
+ *
24
+ * JavaScript printf/sprintf functions contained in jqplot.sprintf.js:
25
+ *
26
+ * version 2007.04.27
27
+ * author Ash Searle
28
+ * http://hexmen.com/blog/2007/03/printf-sprintf/
29
+ * http://hexmen.com/js/sprintf.js
30
+ * The author (Ash Searle) has placed this code in the public domain:
31
+ * "This code is unrestricted: you are free to use it however you like."
32
+ *
33
+ */
34
+ (function(a){a.jqplot.OHLCRenderer=function(){a.jqplot.LineRenderer.call(this);this.candleStick=false;this.tickLength="auto";this.bodyWidth="auto";this.openColor=null;this.closeColor=null;this.wickColor=null;this.fillUpBody=false;this.fillDownBody=true;this.upBodyColor=null;this.downBodyColor=null;this.hlc=false;this._tickLength;this._bodyWidth};a.jqplot.OHLCRenderer.prototype=new a.jqplot.LineRenderer();a.jqplot.OHLCRenderer.prototype.constructor=a.jqplot.OHLCRenderer;a.jqplot.OHLCRenderer.prototype.init=function(e){this.lineWidth=1.5;a.jqplot.LineRenderer.prototype.init.call(this,e);var b=this._yaxis._dataBounds;var f=this._plotData;if(f[0].length<5){this.renderer.hlc=true;for(var c=0;c<f.length;c++){if(f[c][2]<b.min||b.min==null){b.min=f[c][2]}if(f[c][1]>b.max||b.max==null){b.max=f[c][1]}}}else{for(var c=0;c<f.length;c++){if(f[c][3]<b.min||b.min==null){b.min=f[c][3]}if(f[c][2]>b.max||b.max==null){b.max=f[c][2]}}}};a.jqplot.OHLCRenderer.prototype.draw=function(z,J,g){var G=this.data;var u=this._xaxis.min;var y=this._xaxis.max;var k=0;var H=G.length;var n=this._xaxis.series_u2p;var F=this._yaxis.series_u2p;var C,D,e,I,E,m,K,B;var v;var t=this.renderer;var q=(g!=undefined)?g:{};var j=(q.shadow!=undefined)?q.shadow:this.shadow;var A=(q.fill!=undefined)?q.fill:this.fill;var c=(q.fillAndStroke!=undefined)?q.fillAndStroke:this.fillAndStroke;t.bodyWidth=(q.bodyWidth!=undefined)?q.bodyWidth:t.bodyWidth;t.tickLength=(q.tickLength!=undefined)?q.tickLength:t.tickLength;z.save();if(this.show){var l,p,f,L,s;for(var C=0;C<G.length;C++){if(G[C][0]<u){k=C}else{if(G[C][0]<y){H=C+1}}}if(t.candleStick){if(typeof(t.bodyWidth)=="number"){t._bodyWidth=t.bodyWidth}else{t._bodyWidth=Math.min(20,z.canvas.width/(H-k)/2)}}else{if(typeof(t.tickLength)=="number"){t._tickLength=t.tickLength}else{t._tickLength=Math.min(10,z.canvas.width/(H-k)/4)}}for(var C=k;C<H;C++){l=n(G[C][0]);if(t.hlc){p=null;f=F(G[C][1]);L=F(G[C][2]);s=F(G[C][3])}else{p=F(G[C][1]);f=F(G[C][2]);L=F(G[C][3]);s=F(G[C][4])}v={};if(t.candleStick&&!t.hlc){m=t._bodyWidth;K=l-m/2;if(s<p){if(t.wickColor){v.color=t.wickColor}else{if(t.downBodyColor){v.color=t.upBodyColor}}e=a.extend(true,{},q,v);t.shapeRenderer.draw(z,[[l,f],[l,s]],e);t.shapeRenderer.draw(z,[[l,p],[l,L]],e);v={};I=s;E=p-s;if(t.fillUpBody){v.fillRect=true}else{v.strokeRect=true;m=m-this.lineWidth;K=l-m/2}if(t.upBodyColor){v.color=t.upBodyColor;v.fillStyle=t.upBodyColor}B=[K,I,m,E]}else{if(s>p){if(t.wickColor){v.color=t.wickColor}else{if(t.downBodyColor){v.color=t.downBodyColor}}e=a.extend(true,{},q,v);t.shapeRenderer.draw(z,[[l,f],[l,p]],e);t.shapeRenderer.draw(z,[[l,s],[l,L]],e);v={};I=p;E=s-p;if(t.fillDownBody){v.fillRect=true}else{v.strokeRect=true;m=m-this.lineWidth;K=l-m/2}if(t.downBodyColor){v.color=t.downBodyColor;v.fillStyle=t.downBodyColor}B=[K,I,m,E]}else{if(t.wickColor){v.color=t.wickColor}e=a.extend(true,{},q,v);t.shapeRenderer.draw(z,[[l,f],[l,L]],e);v={};v.fillRect=false;v.strokeRect=false;K=[l-m/2,p];I=[l+m/2,s];m=null;E=null;B=[K,I]}}e=a.extend(true,{},q,v);t.shapeRenderer.draw(z,B,e)}else{D=q.color;if(t.openColor){q.color=t.openColor}if(!t.hlc){t.shapeRenderer.draw(z,[[l-t._tickLength,p],[l,p]],q)}q.color=D;if(t.wickColor){q.color=t.wickColor}t.shapeRenderer.draw(z,[[l,f],[l,L]],q);q.color=D;if(t.closeColor){q.color=t.closeColor}t.shapeRenderer.draw(z,[[l,s],[l+t._tickLength,s]],q);q.color=D}}}z.restore()};a.jqplot.OHLCRenderer.prototype.drawShadow=function(b,d,c){};a.jqplot.OHLCRenderer.checkOptions=function(d,c,b){if(!b.highlighter){b.highlighter={showMarker:false,tooltipAxes:"y",yvalues:4,formatString:'<table class="jqplot-highlighter"><tr><td>date:</td><td>%s</td></tr><tr><td>open:</td><td>%s</td></tr><tr><td>hi:</td><td>%s</td></tr><tr><td>low:</td><td>%s</td></tr><tr><td>close:</td><td>%s</td></tr></table>'}}}})(jQuery);
@@ -0,0 +1,749 @@
1
+ /**
2
+ * Copyright (c) 2009 - 2010 Chris Leonello
3
+ * jqPlot is currently available for use in all personal or commercial projects
4
+ * under both the MIT and GPL version 2.0 licenses. This means that you can
5
+ * choose the license that best suits your project and use it accordingly.
6
+ *
7
+ * The author would appreciate an email letting him know of any substantial
8
+ * use of jqPlot. You can reach the author at: chris at jqplot dot com
9
+ * or see http://www.jqplot.com/info.php . This is, of course,
10
+ * not required.
11
+ *
12
+ * If you are feeling kind and generous, consider supporting the project by
13
+ * making a donation at: http://www.jqplot.com/donate.php .
14
+ *
15
+ * Thanks for using jqPlot!
16
+ *
17
+ */
18
+ (function($) {
19
+ /**
20
+ * Class: $.jqplot.PieRenderer
21
+ * Plugin renderer to draw a pie chart.
22
+ * x values, if present, will be used as slice labels.
23
+ * y values give slice size.
24
+ *
25
+ * To use this renderer, you need to include the
26
+ * pie renderer plugin, for example:
27
+ *
28
+ * > <script type="text/javascript" src="plugins/jqplot.pieRenderer.js"></script>
29
+ *
30
+ * Properties described here are passed into the $.jqplot function
31
+ * as options on the series renderer. For example:
32
+ *
33
+ * > plot2 = $.jqplot('chart2', [s1, s2], {
34
+ * > seriesDefaults: {
35
+ * > renderer:$.jqplot.PieRenderer,
36
+ * > rendererOptions:{
37
+ * > sliceMargin: 2,
38
+ * > startAngle: -90
39
+ * > }
40
+ * > }
41
+ * > });
42
+ *
43
+ * A pie plot will trigger events on the plot target
44
+ * according to user interaction. All events return the event object,
45
+ * the series index, the point (slice) index, and the point data for
46
+ * the appropriate slice.
47
+ *
48
+ * 'jqplotDataMouseOver' - triggered when user mouseing over a slice.
49
+ * 'jqplotDataHighlight' - triggered the first time user mouses over a slice,
50
+ * if highlighting is enabled.
51
+ * 'jqplotDataUnhighlight' - triggered when a user moves the mouse out of
52
+ * a highlighted slice.
53
+ * 'jqplotDataClick' - triggered when the user clicks on a slice.
54
+ * 'jqplotDataRightClick' - tiggered when the user right clicks on a slice if
55
+ * the "captureRightClick" option is set to true on the plot.
56
+ */
57
+ $.jqplot.PieRenderer = function(){
58
+ $.jqplot.LineRenderer.call(this);
59
+ };
60
+
61
+ $.jqplot.PieRenderer.prototype = new $.jqplot.LineRenderer();
62
+ $.jqplot.PieRenderer.prototype.constructor = $.jqplot.PieRenderer;
63
+
64
+ // called with scope of a series
65
+ $.jqplot.PieRenderer.prototype.init = function(options, plot) {
66
+ // Group: Properties
67
+ //
68
+ // prop: diameter
69
+ // Outer diameter of the pie, auto computed by default
70
+ this.diameter = null;
71
+ // prop: padding
72
+ // padding between the pie and plot edges, legend, etc.
73
+ this.padding = 20;
74
+ // prop: sliceMargin
75
+ // angular spacing between pie slices in degrees.
76
+ this.sliceMargin = 0;
77
+ // prop: fill
78
+ // true or false, wether to fil the slices.
79
+ this.fill = true;
80
+ // prop: shadowOffset
81
+ // offset of the shadow from the slice and offset of
82
+ // each succesive stroke of the shadow from the last.
83
+ this.shadowOffset = 2;
84
+ // prop: shadowAlpha
85
+ // transparency of the shadow (0 = transparent, 1 = opaque)
86
+ this.shadowAlpha = 0.07;
87
+ // prop: shadowDepth
88
+ // number of strokes to apply to the shadow,
89
+ // each stroke offset shadowOffset from the last.
90
+ this.shadowDepth = 5;
91
+ // prop: highlightMouseOver
92
+ // True to highlight slice when moused over.
93
+ // This must be false to enable highlightMouseDown to highlight when clicking on a slice.
94
+ this.highlightMouseOver = true;
95
+ // prop: highlightMouseDown
96
+ // True to highlight when a mouse button is pressed over a slice.
97
+ // This will be disabled if highlightMouseOver is true.
98
+ this.highlightMouseDown = false;
99
+ // prop: highlightColors
100
+ // an array of colors to use when highlighting a slice.
101
+ this.highlightColors = [];
102
+ // prop: dataLabels
103
+ // Either 'label', 'value', 'percent' or an array of labels to place on the pie slices.
104
+ // Defaults to percentage of each pie slice.
105
+ this.dataLabels = 'percent';
106
+ // prop: showDataLabels
107
+ // true to show data labels on slices.
108
+ this.showDataLabels = false;
109
+ // prop: dataLabelFormatString
110
+ // Format string for data labels. If none, '%s' is used for "label" and for arrays, '%d' for value and '%d%%' for percentage.
111
+ this.dataLabelFormatString = null;
112
+ // prop: dataLabelThreshold
113
+ // Threshhold in percentage (0 - 100) of pie area, below which no label will be displayed.
114
+ // This applies to all label types, not just to percentage labels.
115
+ this.dataLabelThreshold = 3;
116
+ // prop: dataLabelPositionFactor
117
+ // A Multiplier (0-1) of the pie radius which controls position of label on slice.
118
+ // Increasing will slide label toward edge of pie, decreasing will slide label toward center of pie.
119
+ this.dataLabelPositionFactor = 0.52;
120
+ // prop: dataLabelNudge
121
+ // Number of pixels to slide the label away from (+) or toward (-) the center of the pie.
122
+ this.dataLabelNudge = 2;
123
+ // prop: dataLabelCenterOn
124
+ // True to center the data label at its position.
125
+ // False to set the inside facing edge of the label at its position.
126
+ this.dataLabelCenterOn = true;
127
+ // prop: startAngle
128
+ // Angle to start drawing pie in degrees.
129
+ // According to orientation of canvas coordinate system:
130
+ // 0 = on the positive x axis
131
+ // -90 = on the positive y axis.
132
+ // 90 = on the negaive y axis.
133
+ // 180 or - 180 = on the negative x axis.
134
+ this.startAngle = 0;
135
+ this.tickRenderer = $.jqplot.PieTickRenderer;
136
+
137
+ // if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
138
+ if (options.highlightMouseDown && options.highlightMouseOver == null) {
139
+ options.highlightMouseOver = false;
140
+ }
141
+
142
+ $.extend(true, this, options);
143
+ if (this.diameter != null) {
144
+ this.diameter = this.diameter - this.sliceMargin;
145
+ }
146
+ this._diameter = null;
147
+ this._radius = null;
148
+ // array of [start,end] angles arrays, one for each slice. In radians.
149
+ this._sliceAngles = [];
150
+ // index of the currenty highlighted point, if any
151
+ this._highlightedPoint = null;
152
+
153
+ // set highlight colors if none provided
154
+ if (this.highlightColors.length == 0) {
155
+ for (var i=0; i<this.seriesColors.length; i++){
156
+ var rgba = $.jqplot.getColorComponents(this.seriesColors[i]);
157
+ var newrgb = [rgba[0], rgba[1], rgba[2]];
158
+ var sum = newrgb[0] + newrgb[1] + newrgb[2];
159
+ for (var j=0; j<3; j++) {
160
+ // when darkening, lowest color component can be is 60.
161
+ newrgb[j] = (sum > 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.3 * (255 - newrgb[j]);
162
+ newrgb[j] = parseInt(newrgb[j], 10);
163
+ }
164
+ this.highlightColors.push('rgb('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+')');
165
+ }
166
+ }
167
+
168
+ this.highlightColorGenerator = new $.jqplot.ColorGenerator(this.highlightColors);
169
+
170
+ plot.postParseOptionsHooks.addOnce(postParseOptions);
171
+ plot.postInitHooks.addOnce(postInit);
172
+ plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
173
+ plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
174
+ plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
175
+ plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
176
+ plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
177
+ plot.postDrawHooks.addOnce(postPlotDraw);
178
+ };
179
+
180
+ $.jqplot.PieRenderer.prototype.setGridData = function(plot) {
181
+ // set gridData property. This will hold angle in radians of each data point.
182
+ var stack = [];
183
+ var td = [];
184
+ var sa = this.startAngle/180*Math.PI;
185
+ var tot = 0;
186
+ for (var i=0; i<this.data.length; i++){
187
+ stack.push(this.data[i][1]);
188
+ td.push([this.data[i][0]]);
189
+ if (i>0) {
190
+ stack[i] += stack[i-1];
191
+ }
192
+ tot += this.data[i][1];
193
+ }
194
+ var fact = Math.PI*2/stack[stack.length - 1];
195
+
196
+ for (var i=0; i<stack.length; i++) {
197
+ td[i][1] = stack[i] * fact;
198
+ td[i][2] = this.data[i][1]/tot;
199
+ }
200
+ this.gridData = td;
201
+ };
202
+
203
+ $.jqplot.PieRenderer.prototype.makeGridData = function(data, plot) {
204
+ var stack = [];
205
+ var td = [];
206
+ var tot = 0;
207
+ var sa = this.startAngle/180*Math.PI;
208
+ for (var i=0; i<data.length; i++){
209
+ stack.push(data[i][1]);
210
+ td.push([data[i][0]]);
211
+ if (i>0) {
212
+ stack[i] += stack[i-1];
213
+ }
214
+ tot += data[i][1];
215
+ }
216
+ var fact = Math.PI*2/stack[stack.length - 1];
217
+
218
+ for (var i=0; i<stack.length; i++) {
219
+ td[i][1] = stack[i] * fact;
220
+ td[i][2] = data[i][1]/tot;
221
+ }
222
+ return td;
223
+ };
224
+
225
+ $.jqplot.PieRenderer.prototype.drawSlice = function (ctx, ang1, ang2, color, isShadow) {
226
+ var r = this._diameter / 2;
227
+ var fill = this.fill;
228
+ var lineWidth = this.lineWidth;
229
+ ctx.save();
230
+ ctx.translate(this._center[0], this._center[1]);
231
+ ctx.translate(this.sliceMargin*Math.cos((ang1+ang2)/2), this.sliceMargin*Math.sin((ang1+ang2)/2));
232
+
233
+ if (isShadow) {
234
+ for (var i=0; i<this.shadowDepth; i++) {
235
+ ctx.save();
236
+ ctx.translate(this.shadowOffset*Math.cos(this.shadowAngle/180*Math.PI), this.shadowOffset*Math.sin(this.shadowAngle/180*Math.PI));
237
+ doDraw();
238
+ }
239
+ }
240
+
241
+ else {
242
+ doDraw();
243
+ }
244
+
245
+ function doDraw () {
246
+ // Fix for IE and Chrome that can't seem to draw circles correctly.
247
+ // ang2 should always be <= 2 pi since that is the way the data is converted.
248
+ if (ang2 > 6.282 + this.startAngle) {
249
+ ang2 = 6.282 + this.startAngle;
250
+ if (ang1 > ang2) {
251
+ ang1 = 6.281 + this.startAngle;
252
+ }
253
+ }
254
+ // Fix for IE, where it can't seem to handle 0 degree angles. Also avoids
255
+ // ugly line on unfilled pies.
256
+ if (ang1 == ang2) {
257
+ return;
258
+ }
259
+
260
+ ctx.beginPath();
261
+ ctx.fillStyle = color;
262
+ ctx.strokeStyle = color;
263
+ ctx.lineWidth = lineWidth;
264
+ ctx.arc(0, 0, r, ang1, ang2, false);
265
+ ctx.lineTo(0,0);
266
+ ctx.closePath();
267
+
268
+ if (fill) {
269
+ ctx.fill();
270
+ }
271
+ else {
272
+ ctx.stroke();
273
+ }
274
+ }
275
+
276
+ if (isShadow) {
277
+ for (var i=0; i<this.shadowDepth; i++) {
278
+ ctx.restore();
279
+ }
280
+ }
281
+
282
+ ctx.restore();
283
+ };
284
+
285
+ // called with scope of series
286
+ $.jqplot.PieRenderer.prototype.draw = function (ctx, gd, options, plot) {
287
+ var i;
288
+ var opts = (options != undefined) ? options : {};
289
+ // offset and direction of offset due to legend placement
290
+ var offx = 0;
291
+ var offy = 0;
292
+ var trans = 1;
293
+ var colorGenerator = new $.jqplot.ColorGenerator(this.seriesColors);
294
+ if (options.legendInfo && options.legendInfo.placement == 'insideGrid') {
295
+ var li = options.legendInfo;
296
+ switch (li.location) {
297
+ case 'nw':
298
+ offx = li.width + li.xoffset;
299
+ break;
300
+ case 'w':
301
+ offx = li.width + li.xoffset;
302
+ break;
303
+ case 'sw':
304
+ offx = li.width + li.xoffset;
305
+ break;
306
+ case 'ne':
307
+ offx = li.width + li.xoffset;
308
+ trans = -1;
309
+ break;
310
+ case 'e':
311
+ offx = li.width + li.xoffset;
312
+ trans = -1;
313
+ break;
314
+ case 'se':
315
+ offx = li.width + li.xoffset;
316
+ trans = -1;
317
+ break;
318
+ case 'n':
319
+ offy = li.height + li.yoffset;
320
+ break;
321
+ case 's':
322
+ offy = li.height + li.yoffset;
323
+ trans = -1;
324
+ break;
325
+ default:
326
+ break;
327
+ }
328
+ }
329
+
330
+ var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
331
+ var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
332
+ var fill = (opts.fill != undefined) ? opts.fill : this.fill;
333
+ var cw = ctx.canvas.width;
334
+ var ch = ctx.canvas.height;
335
+ var w = cw - offx - 2 * this.padding;
336
+ var h = ch - offy - 2 * this.padding;
337
+ var mindim = Math.min(w,h);
338
+ var d = mindim;
339
+ // this._diameter = this.diameter || d;
340
+ this._diameter = this.diameter || d - this.sliceMargin;
341
+
342
+ var r = this._radius = this._diameter/2;
343
+ var sa = this.startAngle / 180 * Math.PI;
344
+ this._center = [(cw - trans * offx)/2 + trans * offx, (ch - trans*offy)/2 + trans * offy];
345
+
346
+ if (this.shadow) {
347
+ var shadowColor = 'rgba(0,0,0,'+this.shadowAlpha+')';
348
+ for (var i=0; i<gd.length; i++) {
349
+ var ang1 = (i == 0) ? sa : gd[i-1][1] + sa;
350
+ // Adjust ang1 and ang2 for sliceMargin
351
+ ang1 += this.sliceMargin/180*Math.PI;
352
+ this.renderer.drawSlice.call (this, ctx, ang1, gd[i][1]+sa, shadowColor, true);
353
+ }
354
+
355
+ }
356
+ for (var i=0; i<gd.length; i++) {
357
+ var ang1 = (i == 0) ? sa : gd[i-1][1] + sa;
358
+ // Adjust ang1 and ang2 for sliceMargin
359
+ ang1 += this.sliceMargin/180*Math.PI;
360
+ var ang2 = gd[i][1] + sa;
361
+ this._sliceAngles.push([ang1, ang2]);
362
+
363
+ this.renderer.drawSlice.call (this, ctx, ang1, ang2, colorGenerator.next(), false);
364
+
365
+ if (this.showDataLabels && gd[i][2]*100 >= this.dataLabelThreshold) {
366
+ var fstr, avgang = (ang1+ang2)/2, label;
367
+
368
+ if (this.dataLabels == 'label') {
369
+ fstr = this.dataLabelFormatString || '%s';
370
+ label = $.jqplot.sprintf(fstr, gd[i][0]);
371
+ }
372
+ else if (this.dataLabels == 'value') {
373
+ fstr = this.dataLabelFormatString || '%d';
374
+ label = $.jqplot.sprintf(fstr, gd[i][1]);
375
+ }
376
+ else if (this.dataLabels == 'percent') {
377
+ fstr = this.dataLabelFormatString || '%d%%';
378
+ label = $.jqplot.sprintf(fstr, gd[i][2]*100);
379
+ }
380
+ else if (this.dataLabels.constructor == Array) {
381
+ fstr = this.dataLabelFormatString || '%s';
382
+ label = $.jqplot.sprintf(fstr, this.dataLabels[i]);
383
+ }
384
+
385
+ var fact = (this._radius ) * this.dataLabelPositionFactor + this.sliceMargin + this.dataLabelNudge;
386
+
387
+ var x = this._center[0] + Math.cos(avgang) * fact + this.canvas._offsets.left;
388
+ var y = this._center[1] + Math.sin(avgang) * fact + this.canvas._offsets.top;
389
+
390
+ var labelelem = $('<div class="jqplot-pie-series jqplot-data-label" style="position:absolute;">' + label + '</div>').insertBefore(plot.eventCanvas._elem);
391
+ if (this.dataLabelCenterOn) {
392
+ x -= labelelem.width()/2;
393
+ y -= labelelem.height()/2;
394
+ }
395
+ else {
396
+ x -= labelelem.width() * Math.sin(avgang/2);
397
+ y -= labelelem.height()/2;
398
+ }
399
+ x = Math.round(x);
400
+ y = Math.round(y);
401
+ labelelem.css({left: x, top: y});
402
+ }
403
+ }
404
+
405
+ };
406
+
407
+ $.jqplot.PieAxisRenderer = function() {
408
+ $.jqplot.LinearAxisRenderer.call(this);
409
+ };
410
+
411
+ $.jqplot.PieAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
412
+ $.jqplot.PieAxisRenderer.prototype.constructor = $.jqplot.PieAxisRenderer;
413
+
414
+
415
+ // There are no traditional axes on a pie chart. We just need to provide
416
+ // dummy objects with properties so the plot will render.
417
+ // called with scope of axis object.
418
+ $.jqplot.PieAxisRenderer.prototype.init = function(options){
419
+ //
420
+ this.tickRenderer = $.jqplot.PieTickRenderer;
421
+ $.extend(true, this, options);
422
+ // I don't think I'm going to need _dataBounds here.
423
+ // have to go Axis scaling in a way to fit chart onto plot area
424
+ // and provide u2p and p2u functionality for mouse cursor, etc.
425
+ // for convienence set _dataBounds to 0 and 100 and
426
+ // set min/max to 0 and 100.
427
+ this._dataBounds = {min:0, max:100};
428
+ this.min = 0;
429
+ this.max = 100;
430
+ this.showTicks = false;
431
+ this.ticks = [];
432
+ this.showMark = false;
433
+ this.show = false;
434
+ };
435
+
436
+
437
+
438
+
439
+ $.jqplot.PieLegendRenderer = function(){
440
+ $.jqplot.TableLegendRenderer.call(this);
441
+ };
442
+
443
+ $.jqplot.PieLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
444
+ $.jqplot.PieLegendRenderer.prototype.constructor = $.jqplot.PieLegendRenderer;
445
+
446
+ /**
447
+ * Class: $.jqplot.PieLegendRenderer
448
+ * Legend Renderer specific to pie plots. Set by default
449
+ * when user creates a pie plot.
450
+ */
451
+ $.jqplot.PieLegendRenderer.prototype.init = function(options) {
452
+ // Group: Properties
453
+ //
454
+ // prop: numberRows
455
+ // Maximum number of rows in the legend. 0 or null for unlimited.
456
+ this.numberRows = null;
457
+ // prop: numberColumns
458
+ // Maximum number of columns in the legend. 0 or null for unlimited.
459
+ this.numberColumns = null;
460
+ $.extend(true, this, options);
461
+ };
462
+
463
+ // called with context of legend
464
+ $.jqplot.PieLegendRenderer.prototype.draw = function() {
465
+ var legend = this;
466
+ if (this.show) {
467
+ var series = this._series;
468
+ var ss = 'position:absolute;';
469
+ ss += (this.background) ? 'background:'+this.background+';' : '';
470
+ ss += (this.border) ? 'border:'+this.border+';' : '';
471
+ ss += (this.fontSize) ? 'font-size:'+this.fontSize+';' : '';
472
+ ss += (this.fontFamily) ? 'font-family:'+this.fontFamily+';' : '';
473
+ ss += (this.textColor) ? 'color:'+this.textColor+';' : '';
474
+ ss += (this.marginTop != null) ? 'margin-top:'+this.marginTop+';' : '';
475
+ ss += (this.marginBottom != null) ? 'margin-bottom:'+this.marginBottom+';' : '';
476
+ ss += (this.marginLeft != null) ? 'margin-left:'+this.marginLeft+';' : '';
477
+ ss += (this.marginRight != null) ? 'margin-right:'+this.marginRight+';' : '';
478
+ this._elem = $('<table class="jqplot-table-legend" style="'+ss+'"></table>');
479
+ // Pie charts legends don't go by number of series, but by number of data points
480
+ // in the series. Refactor things here for that.
481
+
482
+ var pad = false,
483
+ reverse = false,
484
+ nr, nc;
485
+ var s = series[0];
486
+ var colorGenerator = new $.jqplot.ColorGenerator(s.seriesColors);
487
+
488
+ if (s.show) {
489
+ var pd = s.data;
490
+ if (this.numberRows) {
491
+ nr = this.numberRows;
492
+ if (!this.numberColumns){
493
+ nc = Math.ceil(pd.length/nr);
494
+ }
495
+ else{
496
+ nc = this.numberColumns;
497
+ }
498
+ }
499
+ else if (this.numberColumns) {
500
+ nc = this.numberColumns;
501
+ nr = Math.ceil(pd.length/this.numberColumns);
502
+ }
503
+ else {
504
+ nr = pd.length;
505
+ nc = 1;
506
+ }
507
+
508
+ var i, j, tr, td1, td2, lt, rs, color;
509
+ var idx = 0;
510
+
511
+ for (i=0; i<nr; i++) {
512
+ if (reverse){
513
+ tr = $('<tr class="jqplot-table-legend"></tr>').prependTo(this._elem);
514
+ }
515
+ else{
516
+ tr = $('<tr class="jqplot-table-legend"></tr>').appendTo(this._elem);
517
+ }
518
+ for (j=0; j<nc; j++) {
519
+ if (idx < pd.length){
520
+ lt = this.labels[idx] || pd[idx][0].toString();
521
+ color = colorGenerator.next();
522
+ if (!reverse){
523
+ if (i>0){
524
+ pad = true;
525
+ }
526
+ else{
527
+ pad = false;
528
+ }
529
+ }
530
+ else{
531
+ if (i == nr -1){
532
+ pad = false;
533
+ }
534
+ else{
535
+ pad = true;
536
+ }
537
+ }
538
+ rs = (pad) ? this.rowSpacing : '0';
539
+
540
+ td1 = $('<td class="jqplot-table-legend" style="text-align:center;padding-top:'+rs+';">'+
541
+ '<div><div class="jqplot-table-legend-swatch" style="border-color:'+color+';"></div>'+
542
+ '</div></td>');
543
+ td2 = $('<td class="jqplot-table-legend" style="padding-top:'+rs+';"></td>');
544
+ if (this.escapeHtml){
545
+ td2.text(lt);
546
+ }
547
+ else {
548
+ td2.html(lt);
549
+ }
550
+ if (reverse) {
551
+ td2.prependTo(tr);
552
+ td1.prependTo(tr);
553
+ }
554
+ else {
555
+ td1.appendTo(tr);
556
+ td2.appendTo(tr);
557
+ }
558
+ pad = true;
559
+ }
560
+ idx++;
561
+ }
562
+ }
563
+ }
564
+ }
565
+ return this._elem;
566
+ };
567
+
568
+ $.jqplot.PieRenderer.prototype.handleMove = function(ev, gridpos, datapos, neighbor, plot) {
569
+ if (neighbor) {
570
+ var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
571
+ plot.target.trigger('jqplotDataMouseOver', ins);
572
+ if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.pieRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
573
+ plot.target.trigger('jqplotDataHighlight', ins);
574
+ highlight (plot, ins[0], ins[1]);
575
+ }
576
+ }
577
+ else if (neighbor == null) {
578
+ unhighlight (plot);
579
+ }
580
+ };
581
+
582
+
583
+ // this.eventCanvas._elem.bind($.jqplot.eventListenerHooks[i][0], {plot:this}, $.jqplot.eventListenerHooks[i][1]);
584
+
585
+ // setup default renderers for axes and legend so user doesn't have to
586
+ // called with scope of plot
587
+ function preInit(target, data, options) {
588
+ options = options || {};
589
+ options.axesDefaults = options.axesDefaults || {};
590
+ options.legend = options.legend || {};
591
+ options.seriesDefaults = options.seriesDefaults || {};
592
+ // only set these if there is a pie series
593
+ var setopts = false;
594
+ if (options.seriesDefaults.renderer == $.jqplot.PieRenderer) {
595
+ setopts = true;
596
+ }
597
+ else if (options.series) {
598
+ for (var i=0; i < options.series.length; i++) {
599
+ if (options.series[i].renderer == $.jqplot.PieRenderer) {
600
+ setopts = true;
601
+ }
602
+ }
603
+ }
604
+
605
+ if (setopts) {
606
+ options.axesDefaults.renderer = $.jqplot.PieAxisRenderer;
607
+ options.legend.renderer = $.jqplot.PieLegendRenderer;
608
+ options.legend.preDraw = true;
609
+ }
610
+ }
611
+
612
+ function postInit(target, data, options) {
613
+ for (i=0; i<this.series.length; i++) {
614
+ if (this.series[i].renderer.constructor == $.jqplot.PieRenderer) {
615
+ // don't allow mouseover and mousedown at same time.
616
+ if (this.series[i].highlightMouseOver) {
617
+ this.series[i].highlightMouseDown = false;
618
+ }
619
+ }
620
+ }
621
+ this.target.bind('mouseout', {plot:this}, function (ev) { unhighlight(ev.data.plot); });
622
+ }
623
+
624
+ // called with scope of plot
625
+ function postParseOptions(options) {
626
+ for (var i=0; i<this.series.length; i++) {
627
+ this.series[i].seriesColors = this.seriesColors;
628
+ this.series[i].colorGenerator = this.colorGenerator;
629
+ }
630
+ }
631
+
632
+ function highlight (plot, sidx, pidx) {
633
+ var s = plot.series[sidx];
634
+ var canvas = plot.plugins.pieRenderer.highlightCanvas;
635
+ canvas._ctx.clearRect(0,0,canvas._ctx.canvas.width, canvas._ctx.canvas.height);
636
+ s._highlightedPoint = pidx;
637
+ plot.plugins.pieRenderer.highlightedSeriesIndex = sidx;
638
+ s.renderer.drawSlice.call(s, canvas._ctx, s._sliceAngles[pidx][0], s._sliceAngles[pidx][1], s.highlightColorGenerator.get(pidx), false);
639
+ }
640
+
641
+ function unhighlight (plot) {
642
+ var canvas = plot.plugins.pieRenderer.highlightCanvas;
643
+ canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
644
+ for (var i=0; i<plot.series.length; i++) {
645
+ plot.series[i]._highlightedPoint = null;
646
+ }
647
+ plot.plugins.pieRenderer.highlightedSeriesIndex = null;
648
+ plot.target.trigger('jqplotDataUnhighlight');
649
+ }
650
+
651
+ function handleMove(ev, gridpos, datapos, neighbor, plot) {
652
+ if (neighbor) {
653
+ var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
654
+ var evt1 = jQuery.Event('jqplotDataMouseOver');
655
+ evt1.pageX = ev.pageX;
656
+ evt1.pageY = ev.pageY;
657
+ plot.target.trigger(evt1, ins);
658
+ if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.pieRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
659
+ var evt = jQuery.Event('jqplotDataHighlight');
660
+ evt.pageX = ev.pageX;
661
+ evt.pageY = ev.pageY;
662
+ plot.target.trigger(evt, ins);
663
+ highlight (plot, ins[0], ins[1]);
664
+ }
665
+ }
666
+ else if (neighbor == null) {
667
+ unhighlight (plot);
668
+ }
669
+ }
670
+
671
+ function handleMouseDown(ev, gridpos, datapos, neighbor, plot) {
672
+ if (neighbor) {
673
+ var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
674
+ if (plot.series[ins[0]].highlightMouseDown && !(ins[0] == plot.plugins.pieRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
675
+ var evt = jQuery.Event('jqplotDataHighlight');
676
+ evt.pageX = ev.pageX;
677
+ evt.pageY = ev.pageY;
678
+ plot.target.trigger(evt, ins);
679
+ highlight (plot, ins[0], ins[1]);
680
+ }
681
+ }
682
+ else if (neighbor == null) {
683
+ unhighlight (plot);
684
+ }
685
+ }
686
+
687
+ function handleMouseUp(ev, gridpos, datapos, neighbor, plot) {
688
+ var idx = plot.plugins.pieRenderer.highlightedSeriesIndex;
689
+ if (idx != null && plot.series[idx].highlightMouseDown) {
690
+ unhighlight(plot);
691
+ }
692
+ }
693
+
694
+ function handleClick(ev, gridpos, datapos, neighbor, plot) {
695
+ if (neighbor) {
696
+ var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
697
+ var evt = jQuery.Event('jqplotDataClick');
698
+ evt.pageX = ev.pageX;
699
+ evt.pageY = ev.pageY;
700
+ plot.target.trigger(evt, ins);
701
+ }
702
+ }
703
+
704
+ function handleRightClick(ev, gridpos, datapos, neighbor, plot) {
705
+ if (neighbor) {
706
+ var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
707
+ var idx = plot.plugins.pieRenderer.highlightedSeriesIndex;
708
+ if (idx != null && plot.series[idx].highlightMouseDown) {
709
+ unhighlight(plot);
710
+ }
711
+ var evt = jQuery.Event('jqplotDataRightClick');
712
+ evt.pageX = ev.pageX;
713
+ evt.pageY = ev.pageY;
714
+ plot.target.trigger(evt, ins);
715
+ }
716
+ }
717
+
718
+ // called within context of plot
719
+ // create a canvas which we can draw on.
720
+ // insert it before the eventCanvas, so eventCanvas will still capture events.
721
+ function postPlotDraw() {
722
+ this.plugins.pieRenderer = {highlightedSeriesIndex:null};
723
+ this.plugins.pieRenderer.highlightCanvas = new $.jqplot.GenericCanvas();
724
+
725
+ // do we have any data labels? if so, put highlight canvas before those
726
+ var labels = $(this.targetId+' .jqplot-data-label');
727
+ if (labels.length) {
728
+ $(labels[0]).before(this.plugins.pieRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-pieRenderer-highlight-canvas', this._plotDimensions));
729
+ }
730
+ // else put highlight canvas before event canvas.
731
+ else {
732
+ this.eventCanvas._elem.before(this.plugins.pieRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-pieRenderer-highlight-canvas', this._plotDimensions));
733
+ }
734
+
735
+ var hctx = this.plugins.pieRenderer.highlightCanvas.setContext();
736
+ }
737
+
738
+ $.jqplot.preInitHooks.push(preInit);
739
+
740
+ $.jqplot.PieTickRenderer = function() {
741
+ $.jqplot.AxisTickRenderer.call(this);
742
+ };
743
+
744
+ $.jqplot.PieTickRenderer.prototype = new $.jqplot.AxisTickRenderer();
745
+ $.jqplot.PieTickRenderer.prototype.constructor = $.jqplot.PieTickRenderer;
746
+
747
+ })(jQuery);
748
+
749
+