mdarray-sol 0.1.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (683) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +35 -0
  3. data/LICENSE.txt~ +73 -0
  4. data/README.md +140 -0
  5. data/README.md~ +290 -0
  6. data/Rakefile +80 -0
  7. data/config.rb +223 -0
  8. data/doc/Nashorn.html +1406 -0
  9. data/doc/Sol.html +692 -0
  10. data/doc/Sol/BarChart.html +181 -0
  11. data/doc/Sol/BaseChart.html +799 -0
  12. data/doc/Sol/Bootstrap.html +1134 -0
  13. data/doc/Sol/Bridge.html +448 -0
  14. data/doc/Sol/Chart.html +1162 -0
  15. data/doc/Sol/CoordinateChart.html +673 -0
  16. data/doc/Sol/DCFX.html +807 -0
  17. data/doc/Sol/Dashboard.html +1967 -0
  18. data/doc/Sol/ExecMessages.html +332 -0
  19. data/doc/Sol/GuiCommunication.html +230 -0
  20. data/doc/Sol/Interval.html +1213 -0
  21. data/doc/Sol/JS.html +448 -0
  22. data/doc/Sol/LineChart.html +344 -0
  23. data/doc/Sol/LinearScale.html +334 -0
  24. data/doc/Sol/Margins.html +219 -0
  25. data/doc/Sol/OrdinalScale.html +263 -0
  26. data/doc/Sol/ReadBuffer.html +302 -0
  27. data/doc/Sol/Scale.html +462 -0
  28. data/doc/Sol/Stack.html +199 -0
  29. data/doc/Sol/TimeScale.html +396 -0
  30. data/doc/_index.html +362 -0
  31. data/doc/class_list.html +58 -0
  32. data/doc/css/common.css +1 -0
  33. data/doc/css/full_list.css +57 -0
  34. data/doc/css/style.css +339 -0
  35. data/doc/file.README.html +95 -0
  36. data/doc/file_list.html +60 -0
  37. data/doc/frames.html +26 -0
  38. data/doc/index.html +95 -0
  39. data/doc/js/app.js +219 -0
  40. data/doc/js/full_list.js +181 -0
  41. data/doc/js/jquery.js +4 -0
  42. data/doc/method_list.html +849 -0
  43. data/doc/top-level-namespace.html +135 -0
  44. data/examples/bar_chart/bar_chart.rb +268 -0
  45. data/examples/bar_plot.rb +96 -0
  46. data/examples/charts/area.rb +25 -0
  47. data/examples/charts/area_script.rb +69 -0
  48. data/examples/charts/env.rb +8 -0
  49. data/examples/charts/monthly-move.csv +6725 -0
  50. data/examples/charts/morley.csv +101 -0
  51. data/examples/charts/morley2.csv +81 -0
  52. data/examples/charts/morley3.csv +121 -0
  53. data/examples/d3_tutorial.rb +98 -0
  54. data/examples/sc_plot.rb +57 -0
  55. data/examples/scatterplot/axes.rb +111 -0
  56. data/examples/scatterplot/scatterplot.rb +221 -0
  57. data/examples/us_states/map.rb +90 -0
  58. data/examples/us_states/us-ag-productivity2004.csv +49 -0
  59. data/examples/us_states/us-cities.csv +51 -0
  60. data/examples/util/linear_scale.rb +83 -0
  61. data/examples/util/ordinal_scale.rb +72 -0
  62. data/init.rb +39 -0
  63. data/lib/jx/array_handler.js +70 -0
  64. data/lib/jx/callback.rb +255 -0
  65. data/lib/jx/hash_handler.js +87 -0
  66. data/lib/jx/irbobject.rb +121 -0
  67. data/lib/jx/js.rb +442 -0
  68. data/lib/jx/js_array.rb +31 -0
  69. data/lib/jx/js_hash.rb +76 -0
  70. data/lib/jx/js_init.rb +62 -0
  71. data/lib/jx/jsarray.rb +66 -0
  72. data/lib/jx/jsfunction.rb +73 -0
  73. data/lib/jx/jsobject.rb +188 -0
  74. data/lib/jx/jsstyle_sheet.rb +231 -0
  75. data/lib/jx/jsundefined.rb +46 -0
  76. data/lib/jx/proxy_array.rb +62 -0
  77. data/lib/jx/rbobject.rb +80 -0
  78. data/lib/jx/ruby_proxy.js +176 -0
  79. data/lib/jx/ruby_rich.js +70 -0
  80. data/lib/jx/sol.rb +109 -0
  81. data/lib/mdarray-sol.rb +34 -0
  82. data/lib/mdarray/jsmdarray.rb +39 -0
  83. data/lib/ruby_rich/bootstrap.rb +230 -0
  84. data/lib/ruby_rich/config.html +22 -0
  85. data/lib/ruby_rich/dashboard.rb +299 -0
  86. data/lib/ruby_rich/ruby_rich.rb +120 -0
  87. data/lib/sol/bar_chart.rb +35 -0
  88. data/lib/sol/base_chart.rb +148 -0
  89. data/lib/sol/chart.rb +138 -0
  90. data/lib/sol/coordinate_chart.rb +128 -0
  91. data/lib/sol/interval.rb +156 -0
  92. data/lib/sol/line_chart.rb +58 -0
  93. data/lib/sol/margins.rb +52 -0
  94. data/lib/sol/scale.rb +212 -0
  95. data/lib/sol/stack.rb +44 -0
  96. data/node_modules/bootstrap/Gruntfile.js +533 -0
  97. data/node_modules/bootstrap/dist/js/bootstrap.js +2363 -0
  98. data/node_modules/bootstrap/dist/js/bootstrap.min.js +7 -0
  99. data/node_modules/bootstrap/dist/js/npm.js +13 -0
  100. data/node_modules/bootstrap/grunt/bs-commonjs-generator.js +30 -0
  101. data/node_modules/bootstrap/grunt/bs-glyphicons-data-generator.js +42 -0
  102. data/node_modules/bootstrap/grunt/bs-lessdoc-parser.js +237 -0
  103. data/node_modules/bootstrap/grunt/bs-raw-files-generator.js +44 -0
  104. data/node_modules/bootstrap/js/affix.js +162 -0
  105. data/node_modules/bootstrap/js/alert.js +94 -0
  106. data/node_modules/bootstrap/js/button.js +120 -0
  107. data/node_modules/bootstrap/js/carousel.js +237 -0
  108. data/node_modules/bootstrap/js/collapse.js +211 -0
  109. data/node_modules/bootstrap/js/dropdown.js +165 -0
  110. data/node_modules/bootstrap/js/modal.js +337 -0
  111. data/node_modules/bootstrap/js/popover.js +108 -0
  112. data/node_modules/bootstrap/js/scrollspy.js +172 -0
  113. data/node_modules/bootstrap/js/tab.js +155 -0
  114. data/node_modules/bootstrap/js/tooltip.js +514 -0
  115. data/node_modules/bootstrap/js/transition.js +59 -0
  116. data/node_modules/chai/chai.js +6142 -0
  117. data/node_modules/chai/index.js +1 -0
  118. data/node_modules/chai/karma.conf.js +28 -0
  119. data/node_modules/chai/karma.sauce.js +41 -0
  120. data/node_modules/chai/lib/chai.js +93 -0
  121. data/node_modules/chai/lib/chai/assertion.js +131 -0
  122. data/node_modules/chai/lib/chai/config.js +55 -0
  123. data/node_modules/chai/lib/chai/core/assertions.js +1860 -0
  124. data/node_modules/chai/lib/chai/interface/assert.js +1645 -0
  125. data/node_modules/chai/lib/chai/interface/expect.js +34 -0
  126. data/node_modules/chai/lib/chai/interface/should.js +201 -0
  127. data/node_modules/chai/lib/chai/utils/addChainableMethod.js +112 -0
  128. data/node_modules/chai/lib/chai/utils/addMethod.js +44 -0
  129. data/node_modules/chai/lib/chai/utils/addProperty.js +48 -0
  130. data/node_modules/chai/lib/chai/utils/expectTypes.js +42 -0
  131. data/node_modules/chai/lib/chai/utils/flag.js +33 -0
  132. data/node_modules/chai/lib/chai/utils/getActual.js +20 -0
  133. data/node_modules/chai/lib/chai/utils/getEnumerableProperties.js +26 -0
  134. data/node_modules/chai/lib/chai/utils/getMessage.js +51 -0
  135. data/node_modules/chai/lib/chai/utils/getName.js +22 -0
  136. data/node_modules/chai/lib/chai/utils/getPathInfo.js +111 -0
  137. data/node_modules/chai/lib/chai/utils/getPathValue.js +43 -0
  138. data/node_modules/chai/lib/chai/utils/getProperties.js +36 -0
  139. data/node_modules/chai/lib/chai/utils/hasProperty.js +64 -0
  140. data/node_modules/chai/lib/chai/utils/index.js +130 -0
  141. data/node_modules/chai/lib/chai/utils/inspect.js +335 -0
  142. data/node_modules/chai/lib/chai/utils/objDisplay.js +50 -0
  143. data/node_modules/chai/lib/chai/utils/overwriteChainableMethod.js +54 -0
  144. data/node_modules/chai/lib/chai/utils/overwriteMethod.js +52 -0
  145. data/node_modules/chai/lib/chai/utils/overwriteProperty.js +55 -0
  146. data/node_modules/chai/lib/chai/utils/test.js +28 -0
  147. data/node_modules/chai/lib/chai/utils/transferFlags.js +45 -0
  148. data/node_modules/chai/node_modules/assertion-error/index.js +116 -0
  149. data/node_modules/chai/node_modules/deep-eql/index.js +1 -0
  150. data/node_modules/chai/node_modules/deep-eql/karma.conf.js +20 -0
  151. data/node_modules/chai/node_modules/deep-eql/lib/eql.js +257 -0
  152. data/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/index.js +1 -0
  153. data/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/lib/type.js +142 -0
  154. data/node_modules/chai/node_modules/type-detect/index.js +1 -0
  155. data/node_modules/chai/node_modules/type-detect/lib/type.js +134 -0
  156. data/node_modules/chai/sauce.browsers.js +128 -0
  157. data/node_modules/dc/Gruntfile.js +437 -0
  158. data/node_modules/dc/dc.js +10477 -0
  159. data/node_modules/dc/dc.min.js +23 -0
  160. data/node_modules/dc/docs/coverage.js +203 -0
  161. data/node_modules/dc/grunt/format-file-list.js +33 -0
  162. data/node_modules/dc/index.js +5 -0
  163. data/node_modules/dc/node_modules/crossfilter2/crossfilter.js +1401 -0
  164. data/node_modules/dc/node_modules/crossfilter2/crossfilter.min.js +1 -0
  165. data/node_modules/dc/node_modules/crossfilter2/index.js +1 -0
  166. data/node_modules/dc/node_modules/crossfilter2/src/array.js +46 -0
  167. data/node_modules/dc/node_modules/crossfilter2/src/bisect.js +44 -0
  168. data/node_modules/dc/node_modules/crossfilter2/src/crossfilter.js +872 -0
  169. data/node_modules/dc/node_modules/crossfilter2/src/filter.js +19 -0
  170. data/node_modules/dc/node_modules/crossfilter2/src/heap.js +44 -0
  171. data/node_modules/dc/node_modules/crossfilter2/src/heapselect.js +36 -0
  172. data/node_modules/dc/node_modules/crossfilter2/src/identity.js +3 -0
  173. data/node_modules/dc/node_modules/crossfilter2/src/insertionsort.js +18 -0
  174. data/node_modules/dc/node_modules/crossfilter2/src/null.js +3 -0
  175. data/node_modules/dc/node_modules/crossfilter2/src/permute.js +8 -0
  176. data/node_modules/dc/node_modules/crossfilter2/src/quicksort.js +283 -0
  177. data/node_modules/dc/node_modules/crossfilter2/src/reduce.js +19 -0
  178. data/node_modules/dc/node_modules/crossfilter2/src/zero.js +3 -0
  179. data/node_modules/dc/node_modules/d3/d3.js +9554 -0
  180. data/node_modules/dc/node_modules/d3/d3.min.js +5 -0
  181. data/node_modules/dc/node_modules/d3/package.js +13 -0
  182. data/node_modules/dc/node_modules/d3/src/arrays/ascending.js +5 -0
  183. data/node_modules/dc/node_modules/d3/src/arrays/bisect.js +36 -0
  184. data/node_modules/dc/node_modules/d3/src/arrays/descending.js +3 -0
  185. data/node_modules/dc/node_modules/d3/src/arrays/deviation.js +6 -0
  186. data/node_modules/dc/node_modules/d3/src/arrays/entries.js +5 -0
  187. data/node_modules/dc/node_modules/d3/src/arrays/extent.js +21 -0
  188. data/node_modules/dc/node_modules/d3/src/arrays/index.js +25 -0
  189. data/node_modules/dc/node_modules/d3/src/arrays/keys.js +5 -0
  190. data/node_modules/dc/node_modules/d3/src/arrays/map.js +84 -0
  191. data/node_modules/dc/node_modules/d3/src/arrays/max.js +14 -0
  192. data/node_modules/dc/node_modules/d3/src/arrays/mean.js +15 -0
  193. data/node_modules/dc/node_modules/d3/src/arrays/median.js +16 -0
  194. data/node_modules/dc/node_modules/d3/src/arrays/merge.js +21 -0
  195. data/node_modules/dc/node_modules/d3/src/arrays/min.js +14 -0
  196. data/node_modules/dc/node_modules/d3/src/arrays/nest.js +97 -0
  197. data/node_modules/dc/node_modules/d3/src/arrays/pairs.js +5 -0
  198. data/node_modules/dc/node_modules/d3/src/arrays/permute.js +5 -0
  199. data/node_modules/dc/node_modules/d3/src/arrays/quantile.js +8 -0
  200. data/node_modules/dc/node_modules/d3/src/arrays/range.js +26 -0
  201. data/node_modules/dc/node_modules/d3/src/arrays/set.js +27 -0
  202. data/node_modules/dc/node_modules/d3/src/arrays/shuffle.js +9 -0
  203. data/node_modules/dc/node_modules/d3/src/arrays/sum.js +14 -0
  204. data/node_modules/dc/node_modules/d3/src/arrays/transpose.js +15 -0
  205. data/node_modules/dc/node_modules/d3/src/arrays/values.js +5 -0
  206. data/node_modules/dc/node_modules/d3/src/arrays/variance.js +29 -0
  207. data/node_modules/dc/node_modules/d3/src/arrays/zip.js +5 -0
  208. data/node_modules/dc/node_modules/d3/src/behavior/behavior.js +1 -0
  209. data/node_modules/dc/node_modules/d3/src/behavior/drag.js +88 -0
  210. data/node_modules/dc/node_modules/d3/src/behavior/index.js +3 -0
  211. data/node_modules/dc/node_modules/d3/src/behavior/zoom.js +348 -0
  212. data/node_modules/dc/node_modules/d3/src/color/color.js +7 -0
  213. data/node_modules/dc/node_modules/d3/src/color/hcl.js +34 -0
  214. data/node_modules/dc/node_modules/d3/src/color/hsl.js +56 -0
  215. data/node_modules/dc/node_modules/d3/src/color/index.js +6 -0
  216. data/node_modules/dc/node_modules/d3/src/color/lab.js +60 -0
  217. data/node_modules/dc/node_modules/d3/src/color/rgb.js +301 -0
  218. data/node_modules/dc/node_modules/d3/src/color/xyz.js +7 -0
  219. data/node_modules/dc/node_modules/d3/src/compat/array.js +15 -0
  220. data/node_modules/dc/node_modules/d3/src/compat/date.js +3 -0
  221. data/node_modules/dc/node_modules/d3/src/compat/index.js +3 -0
  222. data/node_modules/dc/node_modules/d3/src/compat/style.js +23 -0
  223. data/node_modules/dc/node_modules/d3/src/core/array.js +2 -0
  224. data/node_modules/dc/node_modules/d3/src/core/class.js +8 -0
  225. data/node_modules/dc/node_modules/d3/src/core/document.js +15 -0
  226. data/node_modules/dc/node_modules/d3/src/core/functor.js +5 -0
  227. data/node_modules/dc/node_modules/d3/src/core/identity.js +3 -0
  228. data/node_modules/dc/node_modules/d3/src/core/index.js +3 -0
  229. data/node_modules/dc/node_modules/d3/src/core/noop.js +1 -0
  230. data/node_modules/dc/node_modules/d3/src/core/ns.js +18 -0
  231. data/node_modules/dc/node_modules/d3/src/core/rebind.js +16 -0
  232. data/node_modules/dc/node_modules/d3/src/core/source.js +3 -0
  233. data/node_modules/dc/node_modules/d3/src/core/subclass.js +11 -0
  234. data/node_modules/dc/node_modules/d3/src/core/target.js +3 -0
  235. data/node_modules/dc/node_modules/d3/src/core/true.js +3 -0
  236. data/node_modules/dc/node_modules/d3/src/core/vendor.js +10 -0
  237. data/node_modules/dc/node_modules/d3/src/core/zero.js +3 -0
  238. data/node_modules/dc/node_modules/d3/src/d3.js +23 -0
  239. data/node_modules/dc/node_modules/d3/src/dsv/csv.js +3 -0
  240. data/node_modules/dc/node_modules/d3/src/dsv/dsv.js +136 -0
  241. data/node_modules/dc/node_modules/d3/src/dsv/index.js +3 -0
  242. data/node_modules/dc/node_modules/d3/src/dsv/tsv.js +3 -0
  243. data/node_modules/dc/node_modules/d3/src/end.js +4 -0
  244. data/node_modules/dc/node_modules/d3/src/event/dispatch.js +69 -0
  245. data/node_modules/dc/node_modules/d3/src/event/drag.js +36 -0
  246. data/node_modules/dc/node_modules/d3/src/event/event.js +50 -0
  247. data/node_modules/dc/node_modules/d3/src/event/index.js +6 -0
  248. data/node_modules/dc/node_modules/d3/src/event/mouse.js +39 -0
  249. data/node_modules/dc/node_modules/d3/src/event/timer.js +82 -0
  250. data/node_modules/dc/node_modules/d3/src/event/touch.js +11 -0
  251. data/node_modules/dc/node_modules/d3/src/event/touches.js +12 -0
  252. data/node_modules/dc/node_modules/d3/src/format/collapse.js +3 -0
  253. data/node_modules/dc/node_modules/d3/src/format/format.js +3 -0
  254. data/node_modules/dc/node_modules/d3/src/format/formatPrefix.js +24 -0
  255. data/node_modules/dc/node_modules/d3/src/format/index.js +4 -0
  256. data/node_modules/dc/node_modules/d3/src/format/precision.js +3 -0
  257. data/node_modules/dc/node_modules/d3/src/format/requote.js +5 -0
  258. data/node_modules/dc/node_modules/d3/src/format/round.js +5 -0
  259. data/node_modules/dc/node_modules/d3/src/geo/albers-usa.js +129 -0
  260. data/node_modules/dc/node_modules/d3/src/geo/albers.js +11 -0
  261. data/node_modules/dc/node_modules/d3/src/geo/area.js +69 -0
  262. data/node_modules/dc/node_modules/d3/src/geo/azimuthal-equal-area.js +12 -0
  263. data/node_modules/dc/node_modules/d3/src/geo/azimuthal-equidistant.js +13 -0
  264. data/node_modules/dc/node_modules/d3/src/geo/azimuthal.js +25 -0
  265. data/node_modules/dc/node_modules/d3/src/geo/bounds.js +168 -0
  266. data/node_modules/dc/node_modules/d3/src/geo/cartesian.js +47 -0
  267. data/node_modules/dc/node_modules/d3/src/geo/centroid.js +149 -0
  268. data/node_modules/dc/node_modules/d3/src/geo/circle.js +81 -0
  269. data/node_modules/dc/node_modules/d3/src/geo/clip-antimeridian.js +95 -0
  270. data/node_modules/dc/node_modules/d3/src/geo/clip-circle.js +178 -0
  271. data/node_modules/dc/node_modules/d3/src/geo/clip-extent.js +196 -0
  272. data/node_modules/dc/node_modules/d3/src/geo/clip-polygon.js +104 -0
  273. data/node_modules/dc/node_modules/d3/src/geo/clip.js +149 -0
  274. data/node_modules/dc/node_modules/d3/src/geo/compose.js +12 -0
  275. data/node_modules/dc/node_modules/d3/src/geo/conic-conformal.js +39 -0
  276. data/node_modules/dc/node_modules/d3/src/geo/conic-equal-area.js +33 -0
  277. data/node_modules/dc/node_modules/d3/src/geo/conic-equidistant.js +36 -0
  278. data/node_modules/dc/node_modules/d3/src/geo/conic.js +16 -0
  279. data/node_modules/dc/node_modules/d3/src/geo/distance.js +13 -0
  280. data/node_modules/dc/node_modules/d3/src/geo/equirectangular.js +10 -0
  281. data/node_modules/dc/node_modules/d3/src/geo/geo.js +1 -0
  282. data/node_modules/dc/node_modules/d3/src/geo/gnomonic.js +12 -0
  283. data/node_modules/dc/node_modules/d3/src/geo/graticule.js +103 -0
  284. data/node_modules/dc/node_modules/d3/src/geo/greatArc.js +42 -0
  285. data/node_modules/dc/node_modules/d3/src/geo/index.js +33 -0
  286. data/node_modules/dc/node_modules/d3/src/geo/interpolate.js +38 -0
  287. data/node_modules/dc/node_modules/d3/src/geo/length.js +44 -0
  288. data/node_modules/dc/node_modules/d3/src/geo/mercator.js +48 -0
  289. data/node_modules/dc/node_modules/d3/src/geo/orthographic.js +12 -0
  290. data/node_modules/dc/node_modules/d3/src/geo/path-area.js +41 -0
  291. data/node_modules/dc/node_modules/d3/src/geo/path-bounds.js +21 -0
  292. data/node_modules/dc/node_modules/d3/src/geo/path-buffer.js +59 -0
  293. data/node_modules/dc/node_modules/d3/src/geo/path-centroid.js +78 -0
  294. data/node_modules/dc/node_modules/d3/src/geo/path-context.js +49 -0
  295. data/node_modules/dc/node_modules/d3/src/geo/path.js +87 -0
  296. data/node_modules/dc/node_modules/d3/src/geo/point-in-polygon.js +71 -0
  297. data/node_modules/dc/node_modules/d3/src/geo/projection.js +121 -0
  298. data/node_modules/dc/node_modules/d3/src/geo/resample.js +109 -0
  299. data/node_modules/dc/node_modules/d3/src/geo/rotation.js +79 -0
  300. data/node_modules/dc/node_modules/d3/src/geo/spherical.js +13 -0
  301. data/node_modules/dc/node_modules/d3/src/geo/stereographic.js +12 -0
  302. data/node_modules/dc/node_modules/d3/src/geo/stream.js +71 -0
  303. data/node_modules/dc/node_modules/d3/src/geo/transform.js +36 -0
  304. data/node_modules/dc/node_modules/d3/src/geo/transverse-mercator.js +31 -0
  305. data/node_modules/dc/node_modules/d3/src/geom/clip-line.js +66 -0
  306. data/node_modules/dc/node_modules/d3/src/geom/delaunay.js +6 -0
  307. data/node_modules/dc/node_modules/d3/src/geom/geom.js +1 -0
  308. data/node_modules/dc/node_modules/d3/src/geom/hull.js +91 -0
  309. data/node_modules/dc/node_modules/d3/src/geom/index.js +6 -0
  310. data/node_modules/dc/node_modules/d3/src/geom/point.js +7 -0
  311. data/node_modules/dc/node_modules/d3/src/geom/polygon.js +105 -0
  312. data/node_modules/dc/node_modules/d3/src/geom/quadtree.js +243 -0
  313. data/node_modules/dc/node_modules/d3/src/geom/voronoi.js +110 -0
  314. data/node_modules/dc/node_modules/d3/src/geom/voronoi/beach.js +186 -0
  315. data/node_modules/dc/node_modules/d3/src/geom/voronoi/cell.js +64 -0
  316. data/node_modules/dc/node_modules/d3/src/geom/voronoi/circle.js +73 -0
  317. data/node_modules/dc/node_modules/d3/src/geom/voronoi/clip.js +80 -0
  318. data/node_modules/dc/node_modules/d3/src/geom/voronoi/edge.js +50 -0
  319. data/node_modules/dc/node_modules/d3/src/geom/voronoi/index.js +59 -0
  320. data/node_modules/dc/node_modules/d3/src/geom/voronoi/red-black.js +235 -0
  321. data/node_modules/dc/node_modules/d3/src/interpolate/array.js +19 -0
  322. data/node_modules/dc/node_modules/d3/src/interpolate/ease.js +111 -0
  323. data/node_modules/dc/node_modules/d3/src/interpolate/hcl.js +20 -0
  324. data/node_modules/dc/node_modules/d3/src/interpolate/hsl.js +20 -0
  325. data/node_modules/dc/node_modules/d3/src/interpolate/index.js +14 -0
  326. data/node_modules/dc/node_modules/d3/src/interpolate/interpolate.js +26 -0
  327. data/node_modules/dc/node_modules/d3/src/interpolate/lab.js +17 -0
  328. data/node_modules/dc/node_modules/d3/src/interpolate/number.js +6 -0
  329. data/node_modules/dc/node_modules/d3/src/interpolate/object.js +25 -0
  330. data/node_modules/dc/node_modules/d3/src/interpolate/rgb.js +20 -0
  331. data/node_modules/dc/node_modules/d3/src/interpolate/round.js +6 -0
  332. data/node_modules/dc/node_modules/d3/src/interpolate/string.js +54 -0
  333. data/node_modules/dc/node_modules/d3/src/interpolate/transform.js +59 -0
  334. data/node_modules/dc/node_modules/d3/src/interpolate/uninterpolate.js +9 -0
  335. data/node_modules/dc/node_modules/d3/src/interpolate/zoom.js +53 -0
  336. data/node_modules/dc/node_modules/d3/src/layout/bundle.js +59 -0
  337. data/node_modules/dc/node_modules/d3/src/layout/chord.js +157 -0
  338. data/node_modules/dc/node_modules/d3/src/layout/cluster.js +92 -0
  339. data/node_modules/dc/node_modules/d3/src/layout/force.js +372 -0
  340. data/node_modules/dc/node_modules/d3/src/layout/hierarchy.js +136 -0
  341. data/node_modules/dc/node_modules/d3/src/layout/histogram.js +110 -0
  342. data/node_modules/dc/node_modules/d3/src/layout/index.js +13 -0
  343. data/node_modules/dc/node_modules/d3/src/layout/layout.js +1 -0
  344. data/node_modules/dc/node_modules/d3/src/layout/pack.js +211 -0
  345. data/node_modules/dc/node_modules/d3/src/layout/partition.js +51 -0
  346. data/node_modules/dc/node_modules/d3/src/layout/pie.js +78 -0
  347. data/node_modules/dc/node_modules/d3/src/layout/stack.js +247 -0
  348. data/node_modules/dc/node_modules/d3/src/layout/tree.js +240 -0
  349. data/node_modules/dc/node_modules/d3/src/layout/treemap.js +229 -0
  350. data/node_modules/dc/node_modules/d3/src/locale/ca-ES.js +16 -0
  351. data/node_modules/dc/node_modules/d3/src/locale/de-CH.js +16 -0
  352. data/node_modules/dc/node_modules/d3/src/locale/de-DE.js +16 -0
  353. data/node_modules/dc/node_modules/d3/src/locale/en-CA.js +16 -0
  354. data/node_modules/dc/node_modules/d3/src/locale/en-GB.js +16 -0
  355. data/node_modules/dc/node_modules/d3/src/locale/en-US.js +16 -0
  356. data/node_modules/dc/node_modules/d3/src/locale/es-ES.js +16 -0
  357. data/node_modules/dc/node_modules/d3/src/locale/fi-FI.js +16 -0
  358. data/node_modules/dc/node_modules/d3/src/locale/fr-CA.js +16 -0
  359. data/node_modules/dc/node_modules/d3/src/locale/fr-FR.js +16 -0
  360. data/node_modules/dc/node_modules/d3/src/locale/he-IL.js +16 -0
  361. data/node_modules/dc/node_modules/d3/src/locale/hu-HU.js +16 -0
  362. data/node_modules/dc/node_modules/d3/src/locale/it-IT.js +16 -0
  363. data/node_modules/dc/node_modules/d3/src/locale/ja-JP.js +16 -0
  364. data/node_modules/dc/node_modules/d3/src/locale/ko-KR.js +16 -0
  365. data/node_modules/dc/node_modules/d3/src/locale/locale.js +9 -0
  366. data/node_modules/dc/node_modules/d3/src/locale/mk-MK.js +16 -0
  367. data/node_modules/dc/node_modules/d3/src/locale/nl-NL.js +16 -0
  368. data/node_modules/dc/node_modules/d3/src/locale/number-format.js +155 -0
  369. data/node_modules/dc/node_modules/d3/src/locale/pl-PL.js +16 -0
  370. data/node_modules/dc/node_modules/d3/src/locale/pt-BR.js +16 -0
  371. data/node_modules/dc/node_modules/d3/src/locale/ru-RU.js +16 -0
  372. data/node_modules/dc/node_modules/d3/src/locale/sv-SE.js +16 -0
  373. data/node_modules/dc/node_modules/d3/src/locale/time-format.js +370 -0
  374. data/node_modules/dc/node_modules/d3/src/locale/time-scale.js +0 -0
  375. data/node_modules/dc/node_modules/d3/src/locale/zh-CN.js +16 -0
  376. data/node_modules/dc/node_modules/d3/src/math/abs.js +1 -0
  377. data/node_modules/dc/node_modules/d3/src/math/adder.js +34 -0
  378. data/node_modules/dc/node_modules/d3/src/math/index.js +2 -0
  379. data/node_modules/dc/node_modules/d3/src/math/number.js +7 -0
  380. data/node_modules/dc/node_modules/d3/src/math/random.js +34 -0
  381. data/node_modules/dc/node_modules/d3/src/math/transform.js +64 -0
  382. data/node_modules/dc/node_modules/d3/src/math/trigonometry.js +44 -0
  383. data/node_modules/dc/node_modules/d3/src/scale/bilinear.js +7 -0
  384. data/node_modules/dc/node_modules/d3/src/scale/category.js +58 -0
  385. data/node_modules/dc/node_modules/d3/src/scale/identity.js +33 -0
  386. data/node_modules/dc/node_modules/d3/src/scale/index.js +11 -0
  387. data/node_modules/dc/node_modules/d3/src/scale/linear.js +160 -0
  388. data/node_modules/dc/node_modules/d3/src/scale/log.js +92 -0
  389. data/node_modules/dc/node_modules/d3/src/scale/nice.js +30 -0
  390. data/node_modules/dc/node_modules/d3/src/scale/ordinal.js +102 -0
  391. data/node_modules/dc/node_modules/d3/src/scale/polylinear.js +24 -0
  392. data/node_modules/dc/node_modules/d3/src/scale/pow.js +57 -0
  393. data/node_modules/dc/node_modules/d3/src/scale/quantile.js +55 -0
  394. data/node_modules/dc/node_modules/d3/src/scale/quantize.js +44 -0
  395. data/node_modules/dc/node_modules/d3/src/scale/scale.js +10 -0
  396. data/node_modules/dc/node_modules/d3/src/scale/sqrt.js +6 -0
  397. data/node_modules/dc/node_modules/d3/src/scale/threshold.js +36 -0
  398. data/node_modules/dc/node_modules/d3/src/selection/append.js +28 -0
  399. data/node_modules/dc/node_modules/d3/src/selection/attr.js +62 -0
  400. data/node_modules/dc/node_modules/d3/src/selection/call.js +8 -0
  401. data/node_modules/dc/node_modules/d3/src/selection/classed.js +76 -0
  402. data/node_modules/dc/node_modules/d3/src/selection/data.js +117 -0
  403. data/node_modules/dc/node_modules/d3/src/selection/datum.js +7 -0
  404. data/node_modules/dc/node_modules/d3/src/selection/each.js +16 -0
  405. data/node_modules/dc/node_modules/d3/src/selection/empty.js +5 -0
  406. data/node_modules/dc/node_modules/d3/src/selection/enter-insert.js +20 -0
  407. data/node_modules/dc/node_modules/d3/src/selection/enter-select.js +27 -0
  408. data/node_modules/dc/node_modules/d3/src/selection/enter.js +21 -0
  409. data/node_modules/dc/node_modules/d3/src/selection/filter.js +28 -0
  410. data/node_modules/dc/node_modules/d3/src/selection/html.js +10 -0
  411. data/node_modules/dc/node_modules/d3/src/selection/index.js +1 -0
  412. data/node_modules/dc/node_modules/d3/src/selection/insert.js +9 -0
  413. data/node_modules/dc/node_modules/d3/src/selection/interrupt.js +27 -0
  414. data/node_modules/dc/node_modules/d3/src/selection/node.js +11 -0
  415. data/node_modules/dc/node_modules/d3/src/selection/on.js +106 -0
  416. data/node_modules/dc/node_modules/d3/src/selection/order.js +13 -0
  417. data/node_modules/dc/node_modules/d3/src/selection/property.js +43 -0
  418. data/node_modules/dc/node_modules/d3/src/selection/remove.js +13 -0
  419. data/node_modules/dc/node_modules/d3/src/selection/select.js +32 -0
  420. data/node_modules/dc/node_modules/d3/src/selection/selectAll.js +27 -0
  421. data/node_modules/dc/node_modules/d3/src/selection/selection.js +81 -0
  422. data/node_modules/dc/node_modules/d3/src/selection/size.js +7 -0
  423. data/node_modules/dc/node_modules/d3/src/selection/sort.js +15 -0
  424. data/node_modules/dc/node_modules/d3/src/selection/style.js +59 -0
  425. data/node_modules/dc/node_modules/d3/src/selection/text.js +10 -0
  426. data/node_modules/dc/node_modules/d3/src/selection/transition.js +21 -0
  427. data/node_modules/dc/node_modules/d3/src/start.js +2 -0
  428. data/node_modules/dc/node_modules/d3/src/svg/arc.js +292 -0
  429. data/node_modules/dc/node_modules/d3/src/svg/area-radial.js +14 -0
  430. data/node_modules/dc/node_modules/d3/src/svg/area.js +121 -0
  431. data/node_modules/dc/node_modules/d3/src/svg/axis.js +160 -0
  432. data/node_modules/dc/node_modules/d3/src/svg/brush.js +429 -0
  433. data/node_modules/dc/node_modules/d3/src/svg/chord.js +90 -0
  434. data/node_modules/dc/node_modules/d3/src/svg/diagonal-radial.js +27 -0
  435. data/node_modules/dc/node_modules/d3/src/svg/diagonal.js +43 -0
  436. data/node_modules/dc/node_modules/d3/src/svg/index.js +12 -0
  437. data/node_modules/dc/node_modules/d3/src/svg/line-radial.js +27 -0
  438. data/node_modules/dc/node_modules/d3/src/svg/line.js +432 -0
  439. data/node_modules/dc/node_modules/d3/src/svg/svg.js +1 -0
  440. data/node_modules/dc/node_modules/d3/src/svg/symbol.js +105 -0
  441. data/node_modules/dc/node_modules/d3/src/time/day.js +21 -0
  442. data/node_modules/dc/node_modules/d3/src/time/format-iso.js +19 -0
  443. data/node_modules/dc/node_modules/d3/src/time/format-utc.js +3 -0
  444. data/node_modules/dc/node_modules/d3/src/time/format.js +4 -0
  445. data/node_modules/dc/node_modules/d3/src/time/hour.js +14 -0
  446. data/node_modules/dc/node_modules/d3/src/time/index.js +14 -0
  447. data/node_modules/dc/node_modules/d3/src/time/interval.js +71 -0
  448. data/node_modules/dc/node_modules/d3/src/time/minute.js +13 -0
  449. data/node_modules/dc/node_modules/d3/src/time/month.js +16 -0
  450. data/node_modules/dc/node_modules/d3/src/time/scale-utc.js +25 -0
  451. data/node_modules/dc/node_modules/d3/src/time/scale.js +155 -0
  452. data/node_modules/dc/node_modules/d3/src/time/second.js +13 -0
  453. data/node_modules/dc/node_modules/d3/src/time/time.js +33 -0
  454. data/node_modules/dc/node_modules/d3/src/time/week.js +31 -0
  455. data/node_modules/dc/node_modules/d3/src/time/year.js +16 -0
  456. data/node_modules/dc/node_modules/d3/src/transition/attr.js +58 -0
  457. data/node_modules/dc/node_modules/d3/src/transition/delay.js +10 -0
  458. data/node_modules/dc/node_modules/d3/src/transition/duration.js +10 -0
  459. data/node_modules/dc/node_modules/d3/src/transition/each.js +26 -0
  460. data/node_modules/dc/node_modules/d3/src/transition/ease.js +10 -0
  461. data/node_modules/dc/node_modules/d3/src/transition/filter.js +22 -0
  462. data/node_modules/dc/node_modules/d3/src/transition/index.js +1 -0
  463. data/node_modules/dc/node_modules/d3/src/transition/remove.js +9 -0
  464. data/node_modules/dc/node_modules/d3/src/transition/select.js +28 -0
  465. data/node_modules/dc/node_modules/d3/src/transition/selectAll.js +31 -0
  466. data/node_modules/dc/node_modules/d3/src/transition/style.js +53 -0
  467. data/node_modules/dc/node_modules/d3/src/transition/subtransition.js +25 -0
  468. data/node_modules/dc/node_modules/d3/src/transition/text.js +11 -0
  469. data/node_modules/dc/node_modules/d3/src/transition/transition.js +161 -0
  470. data/node_modules/dc/node_modules/d3/src/transition/tween.js +17 -0
  471. data/node_modules/dc/node_modules/d3/src/xhr/html.js +12 -0
  472. data/node_modules/dc/node_modules/d3/src/xhr/index.js +5 -0
  473. data/node_modules/dc/node_modules/d3/src/xhr/json.js +9 -0
  474. data/node_modules/dc/node_modules/d3/src/xhr/text.js +5 -0
  475. data/node_modules/dc/node_modules/d3/src/xhr/xhr.js +126 -0
  476. data/node_modules/dc/node_modules/d3/src/xhr/xml.js +5 -0
  477. data/node_modules/dc/regression/inject-serializer.js +6 -0
  478. data/node_modules/dc/regression/stock-regression-test.js +140 -0
  479. data/node_modules/dc/spec/bar-chart-spec.js +1230 -0
  480. data/node_modules/dc/spec/base-mixin-spec.js +611 -0
  481. data/node_modules/dc/spec/biggish-data-spec.js +136 -0
  482. data/node_modules/dc/spec/box-plot-spec.js +211 -0
  483. data/node_modules/dc/spec/bubble-chart-spec.js +450 -0
  484. data/node_modules/dc/spec/bubble-overlay-spec.js +102 -0
  485. data/node_modules/dc/spec/color-spec.js +89 -0
  486. data/node_modules/dc/spec/composite-chart-spec.js +691 -0
  487. data/node_modules/dc/spec/coordinate-grid-chart-spec.js +962 -0
  488. data/node_modules/dc/spec/core-spec.js +301 -0
  489. data/node_modules/dc/spec/data-addition-spec.js +122 -0
  490. data/node_modules/dc/spec/data-count-spec.js +180 -0
  491. data/node_modules/dc/spec/data-grid-spec.js +124 -0
  492. data/node_modules/dc/spec/data-table-spec.js +251 -0
  493. data/node_modules/dc/spec/event-spec.js +41 -0
  494. data/node_modules/dc/spec/filter-dates-spec.js +92 -0
  495. data/node_modules/dc/spec/filters-spec.js +140 -0
  496. data/node_modules/dc/spec/geo-choropleth-chart-spec.js +225 -0
  497. data/node_modules/dc/spec/heatmap-spec.js +363 -0
  498. data/node_modules/dc/spec/helpers/custom_matchers.js +213 -0
  499. data/node_modules/dc/spec/helpers/fixtures.js +81 -0
  500. data/node_modules/dc/spec/helpers/geoFixtures.js +113 -0
  501. data/node_modules/dc/spec/helpers/load-jsreporter.js +37 -0
  502. data/node_modules/dc/spec/helpers/spec-helper.js +53 -0
  503. data/node_modules/dc/spec/legend-spec.js +266 -0
  504. data/node_modules/dc/spec/line-chart-spec.js +709 -0
  505. data/node_modules/dc/spec/logger-spec.js +80 -0
  506. data/node_modules/dc/spec/number-display-spec.js +168 -0
  507. data/node_modules/dc/spec/pie-chart-spec.js +677 -0
  508. data/node_modules/dc/spec/row-chart-spec.js +362 -0
  509. data/node_modules/dc/spec/scatter-plot-spec.js +336 -0
  510. data/node_modules/dc/spec/series-chart-spec.js +133 -0
  511. data/node_modules/dc/spec/utils-spec.js +110 -0
  512. data/node_modules/dc/src/banner.js +2 -0
  513. data/node_modules/dc/src/bar-chart.js +374 -0
  514. data/node_modules/dc/src/base-mixin.js +1478 -0
  515. data/node_modules/dc/src/box-plot.js +240 -0
  516. data/node_modules/dc/src/bubble-chart.js +177 -0
  517. data/node_modules/dc/src/bubble-mixin.js +244 -0
  518. data/node_modules/dc/src/bubble-overlay.js +207 -0
  519. data/node_modules/dc/src/cap-mixin.js +151 -0
  520. data/node_modules/dc/src/color-mixin.js +172 -0
  521. data/node_modules/dc/src/composite-chart.js +544 -0
  522. data/node_modules/dc/src/coordinate-grid-mixin.js +1300 -0
  523. data/node_modules/dc/src/core.js +425 -0
  524. data/node_modules/dc/src/d3.box.js +317 -0
  525. data/node_modules/dc/src/data-count.js +110 -0
  526. data/node_modules/dc/src/data-grid.js +243 -0
  527. data/node_modules/dc/src/data-table.js +419 -0
  528. data/node_modules/dc/src/errors.js +28 -0
  529. data/node_modules/dc/src/events.js +37 -0
  530. data/node_modules/dc/src/filters.js +124 -0
  531. data/node_modules/dc/src/footer.js +35 -0
  532. data/node_modules/dc/src/geo-choropleth-chart.js +279 -0
  533. data/node_modules/dc/src/heatmap.js +378 -0
  534. data/node_modules/dc/src/legend.js +277 -0
  535. data/node_modules/dc/src/line-chart.js +504 -0
  536. data/node_modules/dc/src/logger.js +40 -0
  537. data/node_modules/dc/src/margin-mixin.js +44 -0
  538. data/node_modules/dc/src/number-display.js +141 -0
  539. data/node_modules/dc/src/pie-chart.js +571 -0
  540. data/node_modules/dc/src/row-chart.js +425 -0
  541. data/node_modules/dc/src/scatter-plot.js +338 -0
  542. data/node_modules/dc/src/series-chart.js +192 -0
  543. data/node_modules/dc/src/stack-mixin.js +319 -0
  544. data/node_modules/dc/src/utils.js +290 -0
  545. data/node_modules/dc/web/docs/html/scripts/docstrap.lib.js +11 -0
  546. data/node_modules/dc/web/docs/html/scripts/fulltext-search-ui.js +89 -0
  547. data/node_modules/dc/web/docs/html/scripts/fulltext-search.js +36 -0
  548. data/node_modules/dc/web/docs/html/scripts/lunr.min.js +7 -0
  549. data/node_modules/dc/web/docs/html/scripts/prettify/jquery.min.js +6 -0
  550. data/node_modules/dc/web/docs/html/scripts/prettify/lang-css.js +21 -0
  551. data/node_modules/dc/web/docs/html/scripts/prettify/prettify.js +496 -0
  552. data/node_modules/dc/web/docs/html/scripts/sunlight.js +1157 -0
  553. data/node_modules/dc/web/docs/html/scripts/toc.js +203 -0
  554. data/node_modules/dc/web/ep/list.js +106 -0
  555. data/node_modules/dc/web/examples/lysenko-interval-tree.js +447 -0
  556. data/node_modules/dc/web/highlighter/shAutoloader.js +17 -0
  557. data/node_modules/dc/web/highlighter/shBrushJScript.js +52 -0
  558. data/node_modules/dc/web/highlighter/shBrushXml.js +69 -0
  559. data/node_modules/dc/web/highlighter/shCore.js +17 -0
  560. data/node_modules/dc/web/js/colorbrewer.js +1 -0
  561. data/node_modules/dc/web/js/crossfilter.js +1401 -0
  562. data/node_modules/dc/web/js/d3.js +9554 -0
  563. data/node_modules/dc/web/js/dc.js +10477 -0
  564. data/node_modules/dc/web/js/dc.min.js +23 -0
  565. data/node_modules/dc/web/js/env-data.js +218 -0
  566. data/node_modules/dc/web/js/jasmine-jsreporter.js +394 -0
  567. data/node_modules/dc/web/stock.js +685 -0
  568. data/node_modules/dc/web/transitions/transition-test.js +45 -0
  569. data/node_modules/jquery/dist/jquery.js +9814 -0
  570. data/node_modules/jquery/dist/jquery.min.js +4 -0
  571. data/node_modules/jquery/external/sizzle/dist/sizzle.js +2143 -0
  572. data/node_modules/jquery/external/sizzle/dist/sizzle.min.js +3 -0
  573. data/node_modules/jquery/src/ajax.js +845 -0
  574. data/node_modules/jquery/src/ajax/jsonp.js +100 -0
  575. data/node_modules/jquery/src/ajax/load.js +83 -0
  576. data/node_modules/jquery/src/ajax/parseJSON.js +13 -0
  577. data/node_modules/jquery/src/ajax/parseXML.js +27 -0
  578. data/node_modules/jquery/src/ajax/script.js +68 -0
  579. data/node_modules/jquery/src/ajax/var/location.js +3 -0
  580. data/node_modules/jquery/src/ajax/var/nonce.js +5 -0
  581. data/node_modules/jquery/src/ajax/var/rquery.js +3 -0
  582. data/node_modules/jquery/src/ajax/xhr.js +167 -0
  583. data/node_modules/jquery/src/attributes.js +11 -0
  584. data/node_modules/jquery/src/attributes/attr.js +142 -0
  585. data/node_modules/jquery/src/attributes/classes.js +177 -0
  586. data/node_modules/jquery/src/attributes/prop.js +125 -0
  587. data/node_modules/jquery/src/attributes/support.js +36 -0
  588. data/node_modules/jquery/src/attributes/val.js +177 -0
  589. data/node_modules/jquery/src/callbacks.js +232 -0
  590. data/node_modules/jquery/src/core.js +494 -0
  591. data/node_modules/jquery/src/core/access.js +65 -0
  592. data/node_modules/jquery/src/core/init.js +134 -0
  593. data/node_modules/jquery/src/core/parseHTML.js +41 -0
  594. data/node_modules/jquery/src/core/ready.js +103 -0
  595. data/node_modules/jquery/src/core/var/rsingleTag.js +5 -0
  596. data/node_modules/jquery/src/css.js +502 -0
  597. data/node_modules/jquery/src/css/addGetHookIf.js +24 -0
  598. data/node_modules/jquery/src/css/adjustCSS.js +65 -0
  599. data/node_modules/jquery/src/css/curCSS.js +60 -0
  600. data/node_modules/jquery/src/css/defaultDisplay.js +72 -0
  601. data/node_modules/jquery/src/css/hiddenVisibleSelectors.js +18 -0
  602. data/node_modules/jquery/src/css/showHide.js +48 -0
  603. data/node_modules/jquery/src/css/support.js +121 -0
  604. data/node_modules/jquery/src/css/var/cssExpand.js +3 -0
  605. data/node_modules/jquery/src/css/var/getStyles.js +15 -0
  606. data/node_modules/jquery/src/css/var/isHidden.js +16 -0
  607. data/node_modules/jquery/src/css/var/rmargin.js +3 -0
  608. data/node_modules/jquery/src/css/var/rnumnonpx.js +5 -0
  609. data/node_modules/jquery/src/css/var/swap.js +24 -0
  610. data/node_modules/jquery/src/data.js +187 -0
  611. data/node_modules/jquery/src/data/Data.js +200 -0
  612. data/node_modules/jquery/src/data/var/acceptData.js +18 -0
  613. data/node_modules/jquery/src/data/var/dataPriv.js +5 -0
  614. data/node_modules/jquery/src/data/var/dataUser.js +5 -0
  615. data/node_modules/jquery/src/deferred.js +158 -0
  616. data/node_modules/jquery/src/deprecated.js +32 -0
  617. data/node_modules/jquery/src/dimensions.js +54 -0
  618. data/node_modules/jquery/src/effects.js +629 -0
  619. data/node_modules/jquery/src/effects/Tween.js +121 -0
  620. data/node_modules/jquery/src/effects/animatedSelector.js +13 -0
  621. data/node_modules/jquery/src/event.js +711 -0
  622. data/node_modules/jquery/src/event/ajax.js +20 -0
  623. data/node_modules/jquery/src/event/alias.js +27 -0
  624. data/node_modules/jquery/src/event/focusin.js +53 -0
  625. data/node_modules/jquery/src/event/support.js +9 -0
  626. data/node_modules/jquery/src/event/trigger.js +183 -0
  627. data/node_modules/jquery/src/exports/amd.js +24 -0
  628. data/node_modules/jquery/src/exports/global.js +26 -0
  629. data/node_modules/jquery/src/intro.js +44 -0
  630. data/node_modules/jquery/src/jquery.js +37 -0
  631. data/node_modules/jquery/src/manipulation.js +481 -0
  632. data/node_modules/jquery/src/manipulation/_evalUrl.js +20 -0
  633. data/node_modules/jquery/src/manipulation/buildFragment.js +102 -0
  634. data/node_modules/jquery/src/manipulation/getAll.js +21 -0
  635. data/node_modules/jquery/src/manipulation/setGlobalEval.js +20 -0
  636. data/node_modules/jquery/src/manipulation/support.js +33 -0
  637. data/node_modules/jquery/src/manipulation/var/rcheckableType.js +3 -0
  638. data/node_modules/jquery/src/manipulation/var/rscriptType.js +3 -0
  639. data/node_modules/jquery/src/manipulation/var/rtagName.js +3 -0
  640. data/node_modules/jquery/src/manipulation/wrapMap.js +27 -0
  641. data/node_modules/jquery/src/offset.js +218 -0
  642. data/node_modules/jquery/src/outro.js +2 -0
  643. data/node_modules/jquery/src/queue.js +143 -0
  644. data/node_modules/jquery/src/queue/delay.js +22 -0
  645. data/node_modules/jquery/src/selector-native.js +211 -0
  646. data/node_modules/jquery/src/selector-sizzle.js +14 -0
  647. data/node_modules/jquery/src/selector.js +1 -0
  648. data/node_modules/jquery/src/serialize.js +125 -0
  649. data/node_modules/jquery/src/traversing.js +175 -0
  650. data/node_modules/jquery/src/traversing/findFilter.js +100 -0
  651. data/node_modules/jquery/src/traversing/var/dir.js +20 -0
  652. data/node_modules/jquery/src/traversing/var/rneedsContext.js +6 -0
  653. data/node_modules/jquery/src/traversing/var/siblings.js +15 -0
  654. data/node_modules/jquery/src/var/arr.js +3 -0
  655. data/node_modules/jquery/src/var/class2type.js +5 -0
  656. data/node_modules/jquery/src/var/concat.js +5 -0
  657. data/node_modules/jquery/src/var/document.js +3 -0
  658. data/node_modules/jquery/src/var/documentElement.js +5 -0
  659. data/node_modules/jquery/src/var/hasOwn.js +5 -0
  660. data/node_modules/jquery/src/var/indexOf.js +5 -0
  661. data/node_modules/jquery/src/var/pnum.js +3 -0
  662. data/node_modules/jquery/src/var/push.js +5 -0
  663. data/node_modules/jquery/src/var/rcssNum.js +7 -0
  664. data/node_modules/jquery/src/var/rnotwhite.js +3 -0
  665. data/node_modules/jquery/src/var/slice.js +5 -0
  666. data/node_modules/jquery/src/var/support.js +5 -0
  667. data/node_modules/jquery/src/var/toString.js +5 -0
  668. data/node_modules/jquery/src/wrap.js +79 -0
  669. data/target/mdarray_sol.jar +0 -0
  670. data/test/jx/test_complete.rb +35 -0
  671. data/test/jx/test_js.rb +543 -0
  672. data/test/jx/test_proxy_array.rb +239 -0
  673. data/test/jx/test_proxy_hash.rb +160 -0
  674. data/test/jx/test_proxy_lambda.rb +80 -0
  675. data/test/jx/test_rb_js_compat.rb +135 -0
  676. data/test/jx/test_style_sheets.rb +90 -0
  677. data/test/mdarray/test_mdarray.rb +75 -0
  678. data/util/cacert.pem +4095 -0
  679. data/util/download.rb +256 -0
  680. data/vendor/jxbrowser-6.8.jar +0 -0
  681. data/vendor/licence.jar +0 -0
  682. data/version.rb +2 -0
  683. metadata +817 -0
@@ -0,0 +1,1478 @@
1
+ /**
2
+ * `dc.baseMixin` is an abstract functional object representing a basic `dc` chart object
3
+ * for all chart and widget implementations. Methods from the {@link #dc.baseMixin dc.baseMixin} are inherited
4
+ * and available on all chart implementations in the `dc` library.
5
+ * @name baseMixin
6
+ * @memberof dc
7
+ * @mixin
8
+ * @param {Object} _chart
9
+ * @return {dc.baseMixin}
10
+ */
11
+ dc.baseMixin = function (_chart) {
12
+ _chart.__dcFlag__ = dc.utils.uniqueId();
13
+
14
+ var _dimension;
15
+ var _group;
16
+
17
+ var _anchor;
18
+ var _root;
19
+ var _svg;
20
+ var _isChild;
21
+
22
+ var _minWidth = 200;
23
+ var _defaultWidthCalc = function (element) {
24
+ var width = element && element.getBoundingClientRect && element.getBoundingClientRect().width;
25
+ return (width && width > _minWidth) ? width : _minWidth;
26
+ };
27
+ var _widthCalc = _defaultWidthCalc;
28
+
29
+ var _minHeight = 200;
30
+ var _defaultHeightCalc = function (element) {
31
+ var height = element && element.getBoundingClientRect && element.getBoundingClientRect().height;
32
+ return (height && height > _minHeight) ? height : _minHeight;
33
+ };
34
+ var _heightCalc = _defaultHeightCalc;
35
+ var _width, _height;
36
+
37
+ var _keyAccessor = dc.pluck('key');
38
+ var _valueAccessor = dc.pluck('value');
39
+ var _label = dc.pluck('key');
40
+
41
+ var _ordering = dc.pluck('key');
42
+ var _orderSort;
43
+
44
+ var _renderLabel = false;
45
+
46
+ var _title = function (d) {
47
+ return _chart.keyAccessor()(d) + ': ' + _chart.valueAccessor()(d);
48
+ };
49
+ var _renderTitle = true;
50
+ var _controlsUseVisibility = false;
51
+
52
+ var _transitionDuration = 750;
53
+
54
+ var _filterPrinter = dc.printers.filters;
55
+
56
+ var _mandatoryAttributes = ['dimension', 'group'];
57
+
58
+ var _chartGroup = dc.constants.DEFAULT_CHART_GROUP;
59
+
60
+ var _listeners = d3.dispatch(
61
+ 'preRender',
62
+ 'postRender',
63
+ 'preRedraw',
64
+ 'postRedraw',
65
+ 'filtered',
66
+ 'zoomed',
67
+ 'renderlet',
68
+ 'pretransition');
69
+
70
+ var _legend;
71
+ var _commitHandler;
72
+
73
+ var _filters = [];
74
+ var _filterHandler = function (dimension, filters) {
75
+ if (filters.length === 0) {
76
+ dimension.filter(null);
77
+ } else if (filters.length === 1 && !filters[0].isFiltered) {
78
+ // single value and not a function-based filter
79
+ dimension.filterExact(filters[0]);
80
+ } else if (filters.length === 1 && filters[0].filterType === 'RangedFilter') {
81
+ // single range-based filter
82
+ dimension.filterRange(filters[0]);
83
+ } else {
84
+ dimension.filterFunction(function (d) {
85
+ for (var i = 0; i < filters.length; i++) {
86
+ var filter = filters[i];
87
+ if (filter.isFiltered && filter.isFiltered(d)) {
88
+ return true;
89
+ } else if (filter <= d && filter >= d) {
90
+ return true;
91
+ }
92
+ }
93
+ return false;
94
+ });
95
+ }
96
+ return filters;
97
+ };
98
+
99
+ var _data = function (group) {
100
+ return group.all();
101
+ };
102
+
103
+ /**
104
+ * Set or get the height attribute of a chart. The height is applied to the SVGElement generated by
105
+ * the chart when rendered (or re-rendered). If a value is given, then it will be used to calculate
106
+ * the new height and the chart returned for method chaining. The value can either be a numeric, a
107
+ * function, or falsy. If no value is specified then the value of the current height attribute will
108
+ * be returned.
109
+ *
110
+ * By default, without an explicit height being given, the chart will select the width of its
111
+ * anchor element. If that isn't possible it defaults to 200 (provided by the
112
+ * {@link dc.baseMixin#minHeight minHeight} property). Setting the value falsy will return
113
+ * the chart to the default behavior.
114
+ * @method height
115
+ * @memberof dc.baseMixin
116
+ * @instance
117
+ * @see {@link dc.baseMixin#minHeight minHeight}
118
+ * @example
119
+ * // Default height
120
+ * chart.height(function (element) {
121
+ * var height = element && element.getBoundingClientRect && element.getBoundingClientRect().height;
122
+ * return (height && height > chart.minHeight()) ? height : chart.minHeight();
123
+ * });
124
+ *
125
+ * chart.height(250); // Set the chart's height to 250px;
126
+ * chart.height(function(anchor) { return doSomethingWith(anchor); }); // set the chart's height with a function
127
+ * chart.height(null); // reset the height to the default auto calculation
128
+ * @param {Number|Function} [height]
129
+ * @return {Number}
130
+ * @return {dc.baseMixin}
131
+ */
132
+ _chart.height = function (height) {
133
+ if (!arguments.length) {
134
+ if (!dc.utils.isNumber(_height)) {
135
+ // only calculate once
136
+ _height = _heightCalc(_root.node());
137
+ }
138
+ return _height;
139
+ }
140
+ _heightCalc = d3.functor(height || _defaultHeightCalc);
141
+ _height = undefined;
142
+ return _chart;
143
+ };
144
+
145
+ /**
146
+ * Set or get the width attribute of a chart.
147
+ * @method width
148
+ * @memberof dc.baseMixin
149
+ * @instance
150
+ * @see {@link dc.baseMixin#height height}
151
+ * @see {@link dc.baseMixin#minWidth minWidth}
152
+ * @example
153
+ * // Default width
154
+ * chart.width(function (element) {
155
+ * var width = element && element.getBoundingClientRect && element.getBoundingClientRect().width;
156
+ * return (width && width > chart.minWidth()) ? width : chart.minWidth();
157
+ * });
158
+ * @param {Number|Function} [width]
159
+ * @return {Number}
160
+ * @return {dc.baseMixin}
161
+ */
162
+ _chart.width = function (width) {
163
+ if (!arguments.length) {
164
+ if (!dc.utils.isNumber(_width)) {
165
+ // only calculate once
166
+ _width = _widthCalc(_root.node());
167
+ }
168
+ return _width;
169
+ }
170
+ _widthCalc = d3.functor(width || _defaultWidthCalc);
171
+ _width = undefined;
172
+ return _chart;
173
+ };
174
+
175
+ /**
176
+ * Set or get the minimum width attribute of a chart. This only has effect when used with the default
177
+ * {@link dc.baseMixin#width width} function.
178
+ * @method minWidth
179
+ * @memberof dc.baseMixin
180
+ * @instance
181
+ * @see {@link dc.baseMixin#width width}
182
+ * @param {Number} [minWidth=200]
183
+ * @return {Number}
184
+ * @return {dc.baseMixin}
185
+ */
186
+ _chart.minWidth = function (minWidth) {
187
+ if (!arguments.length) {
188
+ return _minWidth;
189
+ }
190
+ _minWidth = minWidth;
191
+ return _chart;
192
+ };
193
+
194
+ /**
195
+ * Set or get the minimum height attribute of a chart. This only has effect when used with the default
196
+ * {@link dc.baseMixin#height height} function.
197
+ * @method minHeight
198
+ * @memberof dc.baseMixin
199
+ * @instance
200
+ * @see {@link dc.baseMixin#height height}
201
+ * @param {Number} [minHeight=200]
202
+ * @return {Number}
203
+ * @return {dc.baseMixin}
204
+ */
205
+ _chart.minHeight = function (minHeight) {
206
+ if (!arguments.length) {
207
+ return _minHeight;
208
+ }
209
+ _minHeight = minHeight;
210
+ return _chart;
211
+ };
212
+
213
+ /**
214
+ * **mandatory**
215
+ *
216
+ * Set or get the dimension attribute of a chart. In `dc`, a dimension can be any valid [crossfilter
217
+ * dimension](https://github.com/square/crossfilter/wiki/API-Reference#wiki-dimension).
218
+ *
219
+ * If a value is given, then it will be used as the new dimension. If no value is specified then
220
+ * the current dimension will be returned.
221
+ * @method dimension
222
+ * @memberof dc.baseMixin
223
+ * @instance
224
+ * @see {@link https://github.com/square/crossfilter/wiki/API-Reference#dimension crossfilter.dimension}
225
+ * @example
226
+ * var index = crossfilter([]);
227
+ * var dimension = index.dimension(dc.pluck('key'));
228
+ * chart.dimension(dimension);
229
+ * @param {crossfilter.dimension} [dimension]
230
+ * @return {crossfilter.dimension}
231
+ * @return {dc.baseMixin}
232
+ */
233
+ _chart.dimension = function (dimension) {
234
+ if (!arguments.length) {
235
+ return _dimension;
236
+ }
237
+ _dimension = dimension;
238
+ _chart.expireCache();
239
+ return _chart;
240
+ };
241
+
242
+ /**
243
+ * Set the data callback or retrieve the chart's data set. The data callback is passed the chart's
244
+ * group and by default will return
245
+ * {@link https://github.com/square/crossfilter/wiki/API-Reference#group_all group.all}.
246
+ * This behavior may be modified to, for instance, return only the top 5 groups.
247
+ * @method data
248
+ * @memberof dc.baseMixin
249
+ * @instance
250
+ * @example
251
+ * // Default data function
252
+ * chart.data(function (group) { return group.all(); });
253
+ *
254
+ * chart.data(function (group) { return group.top(5); });
255
+ * @param {Function} [callback]
256
+ * @return {*}
257
+ * @return {dc.baseMixin}
258
+ */
259
+ _chart.data = function (callback) {
260
+ if (!arguments.length) {
261
+ return _data.call(_chart, _group);
262
+ }
263
+ _data = d3.functor(callback);
264
+ _chart.expireCache();
265
+ return _chart;
266
+ };
267
+
268
+ /**
269
+ * **mandatory**
270
+ *
271
+ * Set or get the group attribute of a chart. In `dc` a group is a
272
+ * {@link https://github.com/square/crossfilter/wiki/API-Reference#group-map-reduce crossfilter group}.
273
+ * Usually the group should be created from the particular dimension associated with the same chart. If a value is
274
+ * given, then it will be used as the new group.
275
+ *
276
+ * If no value specified then the current group will be returned.
277
+ * If `name` is specified then it will be used to generate legend label.
278
+ * @method group
279
+ * @memberof dc.baseMixin
280
+ * @instance
281
+ * @see {@link https://github.com/square/crossfilter/wiki/API-Reference#group-map-reduce crossfilter.group}
282
+ * @example
283
+ * var index = crossfilter([]);
284
+ * var dimension = index.dimension(dc.pluck('key'));
285
+ * chart.dimension(dimension);
286
+ * chart.group(dimension.group(crossfilter.reduceSum()));
287
+ * @param {crossfilter.group} [group]
288
+ * @param {String} [name]
289
+ * @return {crossfilter.group}
290
+ * @return {dc.baseMixin}
291
+ */
292
+ _chart.group = function (group, name) {
293
+ if (!arguments.length) {
294
+ return _group;
295
+ }
296
+ _group = group;
297
+ _chart._groupName = name;
298
+ _chart.expireCache();
299
+ return _chart;
300
+ };
301
+
302
+ /**
303
+ * Get or set an accessor to order ordinal dimensions. This uses
304
+ * {@link https://github.com/square/crossfilter/wiki/API-Reference#quicksort_by crossfilter.quicksort.by} as the
305
+ * sort.
306
+ * @method ordering
307
+ * @memberof dc.baseMixin
308
+ * @instance
309
+ * @see {@link https://github.com/square/crossfilter/wiki/API-Reference#quicksort_by crossfilter.quicksort.by}
310
+ * @example
311
+ * // Default ordering accessor
312
+ * _chart.ordering(dc.pluck('key'));
313
+ * @param {Function} [orderFunction]
314
+ * @return {Function}
315
+ * @return {dc.baseMixin}
316
+ */
317
+ _chart.ordering = function (orderFunction) {
318
+ if (!arguments.length) {
319
+ return _ordering;
320
+ }
321
+ _ordering = orderFunction;
322
+ _orderSort = crossfilter.quicksort.by(_ordering);
323
+ _chart.expireCache();
324
+ return _chart;
325
+ };
326
+
327
+ _chart._computeOrderedGroups = function (data) {
328
+ var dataCopy = data.slice(0);
329
+
330
+ if (dataCopy.length <= 1) {
331
+ return dataCopy;
332
+ }
333
+
334
+ if (!_orderSort) {
335
+ _orderSort = crossfilter.quicksort.by(_ordering);
336
+ }
337
+
338
+ return _orderSort(dataCopy, 0, dataCopy.length);
339
+ };
340
+
341
+ /**
342
+ * Clear all filters associated with this chart
343
+ *
344
+ * The same can be achieved by calling {@link dc.baseMixin#filter chart.filter(null)}.
345
+ * @method filterAll
346
+ * @memberof dc.baseMixin
347
+ * @instance
348
+ * @return {dc.baseMixin}
349
+ */
350
+ _chart.filterAll = function () {
351
+ return _chart.filter(null);
352
+ };
353
+
354
+ /**
355
+ * Execute d3 single selection in the chart's scope using the given selector and return the d3
356
+ * selection.
357
+ *
358
+ * This function is **not chainable** since it does not return a chart instance; however the d3
359
+ * selection result can be chained to d3 function calls.
360
+ * @method select
361
+ * @memberof dc.baseMixin
362
+ * @instance
363
+ * @see {@link https://github.com/mbostock/d3/wiki/Selections d3.selection}
364
+ * @example
365
+ * // Similar to:
366
+ * d3.select('#chart-id').select(selector);
367
+ * @return {d3.selection}
368
+ */
369
+ _chart.select = function (s) {
370
+ return _root.select(s);
371
+ };
372
+
373
+ /**
374
+ * Execute in scope d3 selectAll using the given selector and return d3 selection result.
375
+ *
376
+ * This function is **not chainable** since it does not return a chart instance; however the d3
377
+ * selection result can be chained to d3 function calls.
378
+ * @method selectAll
379
+ * @memberof dc.baseMixin
380
+ * @instance
381
+ * @see {@link https://github.com/mbostock/d3/wiki/Selections d3.selection}
382
+ * @example
383
+ * // Similar to:
384
+ * d3.select('#chart-id').selectAll(selector);
385
+ * @return {d3.selection}
386
+ */
387
+ _chart.selectAll = function (s) {
388
+ return _root ? _root.selectAll(s) : null;
389
+ };
390
+
391
+ /**
392
+ * Set the root SVGElement to either be an existing chart's root; or any valid [d3 single
393
+ * selector](https://github.com/mbostock/d3/wiki/Selections#selecting-elements) specifying a dom
394
+ * block element such as a div; or a dom element or d3 selection. Optionally registers the chart
395
+ * within the chartGroup. This class is called internally on chart initialization, but be called
396
+ * again to relocate the chart. However, it will orphan any previously created SVGElements.
397
+ * @method anchor
398
+ * @memberof dc.baseMixin
399
+ * @instance
400
+ * @param {anchorChart|anchorSelector|anchorNode} [parent]
401
+ * @param {String} [chartGroup]
402
+ * @return {String|node|d3.selection}
403
+ * @return {dc.baseMixin}
404
+ */
405
+ _chart.anchor = function (parent, chartGroup) {
406
+ if (!arguments.length) {
407
+ return _anchor;
408
+ }
409
+ if (dc.instanceOfChart(parent)) {
410
+ _anchor = parent.anchor();
411
+ _root = parent.root();
412
+ _isChild = true;
413
+ } else if (parent) {
414
+ if (parent.select && parent.classed) { // detect d3 selection
415
+ _anchor = parent.node();
416
+ } else {
417
+ _anchor = parent;
418
+ }
419
+ _root = d3.select(_anchor);
420
+ _root.classed(dc.constants.CHART_CLASS, true);
421
+ dc.registerChart(_chart, chartGroup);
422
+ _isChild = false;
423
+ } else {
424
+ throw new dc.errors.BadArgumentException('parent must be defined');
425
+ }
426
+ _chartGroup = chartGroup;
427
+ return _chart;
428
+ };
429
+
430
+ /**
431
+ * Returns the DOM id for the chart's anchored location.
432
+ * @method anchorName
433
+ * @memberof dc.baseMixin
434
+ * @instance
435
+ * @return {String}
436
+ */
437
+ _chart.anchorName = function () {
438
+ var a = _chart.anchor();
439
+ if (a && a.id) {
440
+ return a.id;
441
+ }
442
+ if (a && a.replace) {
443
+ return a.replace('#', '');
444
+ }
445
+ return 'dc-chart' + _chart.chartID();
446
+ };
447
+
448
+ /**
449
+ * Returns the root element where a chart resides. Usually it will be the parent div element where
450
+ * the SVGElement was created. You can also pass in a new root element however this is usually handled by
451
+ * dc internally. Resetting the root element on a chart outside of dc internals may have
452
+ * unexpected consequences.
453
+ * @method root
454
+ * @memberof dc.baseMixin
455
+ * @instance
456
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement HTMLElement}
457
+ * @param {HTMLElement} [rootElement]
458
+ * @return {HTMLElement}
459
+ * @return {dc.baseMixin}
460
+ */
461
+ _chart.root = function (rootElement) {
462
+ if (!arguments.length) {
463
+ return _root;
464
+ }
465
+ _root = rootElement;
466
+ return _chart;
467
+ };
468
+
469
+ /**
470
+ * Returns the top SVGElement for this specific chart. You can also pass in a new SVGElement,
471
+ * however this is usually handled by dc internally. Resetting the SVGElement on a chart outside
472
+ * of dc internals may have unexpected consequences.
473
+ * @method svg
474
+ * @memberof dc.baseMixin
475
+ * @instance
476
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/SVGElement SVGElement}
477
+ * @param {SVGElement|d3.selection} [svgElement]
478
+ * @return {SVGElement|d3.selection}
479
+ * @return {dc.baseMixin}
480
+ */
481
+ _chart.svg = function (svgElement) {
482
+ if (!arguments.length) {
483
+ return _svg;
484
+ }
485
+ _svg = svgElement;
486
+ return _chart;
487
+ };
488
+
489
+ /**
490
+ * Remove the chart's SVGElements from the dom and recreate the container SVGElement.
491
+ * @method resetSvg
492
+ * @memberof dc.baseMixin
493
+ * @instance
494
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/SVGElement SVGElement}
495
+ * @return {SVGElement}
496
+ */
497
+ _chart.resetSvg = function () {
498
+ _chart.select('svg').remove();
499
+ return generateSvg();
500
+ };
501
+
502
+ function sizeSvg () {
503
+ if (_svg) {
504
+ _svg
505
+ .attr('width', _chart.width())
506
+ .attr('height', _chart.height());
507
+ }
508
+ }
509
+
510
+ function generateSvg () {
511
+ _svg = _chart.root().append('svg');
512
+ sizeSvg();
513
+ return _svg;
514
+ }
515
+
516
+ /**
517
+ * Set or get the filter printer function. The filter printer function is used to generate human
518
+ * friendly text for filter value(s) associated with the chart instance. By default dc charts use a
519
+ * default filter printer `dc.printers.filter` that provides simple printing support for both
520
+ * single value and ranged filters.
521
+ * @method filterPrinter
522
+ * @memberof dc.baseMixin
523
+ * @instance
524
+ * @param {Function} [filterPrinterFunction=dc.printers.filter]
525
+ * @return {Function}
526
+ * @return {dc.baseMixin}
527
+ */
528
+ _chart.filterPrinter = function (filterPrinterFunction) {
529
+ if (!arguments.length) {
530
+ return _filterPrinter;
531
+ }
532
+ _filterPrinter = filterPrinterFunction;
533
+ return _chart;
534
+ };
535
+
536
+ /**
537
+ * If set, use the `visibility` attribute instead of the `display` attribute for showing/hiding
538
+ * chart reset and filter controls, for less disruption to the layout.
539
+ * @method controlsUseVisibility
540
+ * @memberof dc.baseMixin
541
+ * @instance
542
+ * @param {Boolean} [controlsUseVisibility=false]
543
+ * @return {Boolean}
544
+ * @return {dc.baseMixin}
545
+ **/
546
+ _chart.controlsUseVisibility = function (_) {
547
+ if (!arguments.length) {
548
+ return _controlsUseVisibility;
549
+ }
550
+ _controlsUseVisibility = _;
551
+ return _chart;
552
+ };
553
+
554
+ /**
555
+ * Turn on optional control elements within the root element. dc currently supports the
556
+ * following html control elements.
557
+ * * root.selectAll('.reset') - elements are turned on if the chart has an active filter. This type
558
+ * of control element is usually used to store a reset link to allow user to reset filter on a
559
+ * certain chart. This element will be turned off automatically if the filter is cleared.
560
+ * * root.selectAll('.filter') elements are turned on if the chart has an active filter. The text
561
+ * content of this element is then replaced with the current filter value using the filter printer
562
+ * function. This type of element will be turned off automatically if the filter is cleared.
563
+ * @method turnOnControls
564
+ * @memberof dc.baseMixin
565
+ * @instance
566
+ * @return {dc.baseMixin}
567
+ */
568
+ _chart.turnOnControls = function () {
569
+ if (_root) {
570
+ var attribute = _chart.controlsUseVisibility() ? 'visibility' : 'display';
571
+ _chart.selectAll('.reset').style(attribute, null);
572
+ _chart.selectAll('.filter').text(_filterPrinter(_chart.filters())).style(attribute, null);
573
+ }
574
+ return _chart;
575
+ };
576
+
577
+ /**
578
+ * Turn off optional control elements within the root element.
579
+ * @method turnOffControls
580
+ * @memberof dc.baseMixin
581
+ * @see {@link dc.baseMixin#turnOnControls turnOnControls}
582
+ * @instance
583
+ * @return {dc.baseMixin}
584
+ */
585
+ _chart.turnOffControls = function () {
586
+ if (_root) {
587
+ var attribute = _chart.controlsUseVisibility() ? 'visibility' : 'display';
588
+ var value = _chart.controlsUseVisibility() ? 'hidden' : 'none';
589
+ _chart.selectAll('.reset').style(attribute, value);
590
+ _chart.selectAll('.filter').style(attribute, value).text(_chart.filter());
591
+ }
592
+ return _chart;
593
+ };
594
+
595
+ /**
596
+ * Set or get the animation transition duration (in milliseconds) for this chart instance.
597
+ * @method transitionDuration
598
+ * @memberof dc.baseMixin
599
+ * @instance
600
+ * @param {Number} [duration=750]
601
+ * @return {Number}
602
+ * @return {dc.baseMixin}
603
+ */
604
+ _chart.transitionDuration = function (duration) {
605
+ if (!arguments.length) {
606
+ return _transitionDuration;
607
+ }
608
+ _transitionDuration = duration;
609
+ return _chart;
610
+ };
611
+
612
+ _chart._mandatoryAttributes = function (_) {
613
+ if (!arguments.length) {
614
+ return _mandatoryAttributes;
615
+ }
616
+ _mandatoryAttributes = _;
617
+ return _chart;
618
+ };
619
+
620
+ function checkForMandatoryAttributes (a) {
621
+ if (!_chart[a] || !_chart[a]()) {
622
+ throw new dc.errors.InvalidStateException('Mandatory attribute chart.' + a +
623
+ ' is missing on chart[#' + _chart.anchorName() + ']');
624
+ }
625
+ }
626
+
627
+ /**
628
+ * Invoking this method will force the chart to re-render everything from scratch. Generally it
629
+ * should only be used to render the chart for the first time on the page or if you want to make
630
+ * sure everything is redrawn from scratch instead of relying on the default incremental redrawing
631
+ * behaviour.
632
+ * @method render
633
+ * @memberof dc.baseMixin
634
+ * @instance
635
+ * @return {dc.baseMixin}
636
+ */
637
+ _chart.render = function () {
638
+ _height = _width = undefined; // force recalculate
639
+ _listeners.preRender(_chart);
640
+
641
+ if (_mandatoryAttributes) {
642
+ _mandatoryAttributes.forEach(checkForMandatoryAttributes);
643
+ }
644
+
645
+ var result = _chart._doRender();
646
+
647
+ if (_legend) {
648
+ _legend.render();
649
+ }
650
+
651
+ _chart._activateRenderlets('postRender');
652
+
653
+ return result;
654
+ };
655
+
656
+ _chart._activateRenderlets = function (event) {
657
+ _listeners.pretransition(_chart);
658
+ if (_chart.transitionDuration() > 0 && _svg) {
659
+ _svg.transition().duration(_chart.transitionDuration())
660
+ .each('end', function () {
661
+ _listeners.renderlet(_chart);
662
+ if (event) {
663
+ _listeners[event](_chart);
664
+ }
665
+ });
666
+ } else {
667
+ _listeners.renderlet(_chart);
668
+ if (event) {
669
+ _listeners[event](_chart);
670
+ }
671
+ }
672
+ };
673
+
674
+ /**
675
+ * Calling redraw will cause the chart to re-render data changes incrementally. If there is no
676
+ * change in the underlying data dimension then calling this method will have no effect on the
677
+ * chart. Most chart interaction in dc will automatically trigger this method through internal
678
+ * events (in particular {@link dc.redrawAll dc.redrawAll}; therefore, you only need to
679
+ * manually invoke this function if data is manipulated outside of dc's control (for example if
680
+ * data is loaded in the background using
681
+ * {@link https://github.com/square/crossfilter/wiki/API-Reference#crossfilter_add crossfilter.add}.
682
+ * @method redraw
683
+ * @memberof dc.baseMixin
684
+ * @instance
685
+ * @return {dc.baseMixin}
686
+ */
687
+ _chart.redraw = function () {
688
+ sizeSvg();
689
+ _listeners.preRedraw(_chart);
690
+
691
+ var result = _chart._doRedraw();
692
+
693
+ if (_legend) {
694
+ _legend.render();
695
+ }
696
+
697
+ _chart._activateRenderlets('postRedraw');
698
+
699
+ return result;
700
+ };
701
+
702
+ /**
703
+ * Gets/sets the commit handler. If the chart has a commit handler, the handler will be called when
704
+ * the chart's filters have changed, in order to send the filter data asynchronously to a server.
705
+ *
706
+ * Unlike other functions in dc.js, the commit handler is asynchronous. It takes two arguments:
707
+ * a flag indicating whether this is a render (true) or a redraw (false), and a callback to be
708
+ * triggered once the commit is filtered. The callback has the standard node.js continuation signature
709
+ * with error first and result second.
710
+ * @method commitHandler
711
+ * @memberof dc.baseMixin
712
+ * @instance
713
+ * @return {dc.baseMixin}
714
+ */
715
+ _chart.commitHandler = function (commitHandler) {
716
+ if (!arguments.length) {
717
+ return _commitHandler;
718
+ }
719
+ _commitHandler = commitHandler;
720
+ return _chart;
721
+ };
722
+
723
+ /**
724
+ * Redraws all charts in the same group as this chart, typically in reaction to a filter
725
+ * change. If the chart has a {@link dc.baseMixin.commitFilter commitHandler}, it will
726
+ * be executed and waited for.
727
+ * @method redrawGroup
728
+ * @memberof dc.baseMixin
729
+ * @instance
730
+ * @return {dc.baseMixin}
731
+ */
732
+ _chart.redrawGroup = function () {
733
+ if (_commitHandler) {
734
+ _commitHandler(false, function (error, result) {
735
+ if (error) {
736
+ console.log(error);
737
+ } else {
738
+ dc.redrawAll(_chart.chartGroup());
739
+ }
740
+ });
741
+ } else {
742
+ dc.redrawAll(_chart.chartGroup());
743
+ }
744
+ return _chart;
745
+ };
746
+
747
+ /**
748
+ * Renders all charts in the same group as this chart. If the chart has a
749
+ * {@link dc.baseMixin.commitFilter commitHandler}, it will be executed and waited for
750
+ * @method renderGroup
751
+ * @memberof dc.baseMixin
752
+ * @instance
753
+ * @return {dc.baseMixin}
754
+ */
755
+ _chart.renderGroup = function () {
756
+ if (_commitHandler) {
757
+ _commitHandler(false, function (error, result) {
758
+ if (error) {
759
+ console.log(error);
760
+ } else {
761
+ dc.renderAll(_chart.chartGroup());
762
+ }
763
+ });
764
+ } else {
765
+ dc.renderAll(_chart.chartGroup());
766
+ }
767
+ return _chart;
768
+ };
769
+
770
+ _chart._invokeFilteredListener = function (f) {
771
+ if (f !== undefined) {
772
+ _listeners.filtered(_chart, f);
773
+ }
774
+ };
775
+
776
+ _chart._invokeZoomedListener = function () {
777
+ _listeners.zoomed(_chart);
778
+ };
779
+
780
+ var _hasFilterHandler = function (filters, filter) {
781
+ if (filter === null || typeof(filter) === 'undefined') {
782
+ return filters.length > 0;
783
+ }
784
+ return filters.some(function (f) {
785
+ return filter <= f && filter >= f;
786
+ });
787
+ };
788
+
789
+ /**
790
+ * Set or get the has filter handler. The has filter handler is a function that checks to see if
791
+ * the chart's current filters include a specific filter. Using a custom has filter handler allows
792
+ * you to change the way filters are checked for and replaced.
793
+ * @method hasFilterHandler
794
+ * @memberof dc.baseMixin
795
+ * @instance
796
+ * @example
797
+ * // default has filter handler
798
+ * chart.hasFilterHandler(function (filters, filter) {
799
+ * if (filter === null || typeof(filter) === 'undefined') {
800
+ * return filters.length > 0;
801
+ * }
802
+ * return filters.some(function (f) {
803
+ * return filter <= f && filter >= f;
804
+ * });
805
+ * });
806
+ *
807
+ * // custom filter handler (no-op)
808
+ * chart.hasFilterHandler(function(filters, filter) {
809
+ * return false;
810
+ * });
811
+ * @param {Function} [hasFilterHandler]
812
+ * @return {Function}
813
+ * @return {dc.baseMixin}
814
+ */
815
+ _chart.hasFilterHandler = function (hasFilterHandler) {
816
+ if (!arguments.length) {
817
+ return _hasFilterHandler;
818
+ }
819
+ _hasFilterHandler = hasFilterHandler;
820
+ return _chart;
821
+ };
822
+
823
+ /**
824
+ * Check whether any active filter or a specific filter is associated with particular chart instance.
825
+ * This function is **not chainable**.
826
+ * @method hasFilter
827
+ * @memberof dc.baseMixin
828
+ * @instance
829
+ * @see {@link dc.baseMixin#hasFilterHandler hasFilterHandler}
830
+ * @param {*} [filter]
831
+ * @return {Boolean}
832
+ */
833
+ _chart.hasFilter = function (filter) {
834
+ return _hasFilterHandler(_filters, filter);
835
+ };
836
+
837
+ var _removeFilterHandler = function (filters, filter) {
838
+ for (var i = 0; i < filters.length; i++) {
839
+ if (filters[i] <= filter && filters[i] >= filter) {
840
+ filters.splice(i, 1);
841
+ break;
842
+ }
843
+ }
844
+ return filters;
845
+ };
846
+
847
+ /**
848
+ * Set or get the remove filter handler. The remove filter handler is a function that removes a
849
+ * filter from the chart's current filters. Using a custom remove filter handler allows you to
850
+ * change how filters are removed or perform additional work when removing a filter, e.g. when
851
+ * using a filter server other than crossfilter.
852
+ *
853
+ * Any changes should modify the `filters` array argument and return that array.
854
+ * @method removeFilterHandler
855
+ * @memberof dc.baseMixin
856
+ * @instance
857
+ * @example
858
+ * // default remove filter handler
859
+ * chart.removeFilterHandler(function (filters, filter) {
860
+ * for (var i = 0; i < filters.length; i++) {
861
+ * if (filters[i] <= filter && filters[i] >= filter) {
862
+ * filters.splice(i, 1);
863
+ * break;
864
+ * }
865
+ * }
866
+ * return filters;
867
+ * });
868
+ *
869
+ * // custom filter handler (no-op)
870
+ * chart.removeFilterHandler(function(filters, filter) {
871
+ * return filters;
872
+ * });
873
+ * @param {Function} [removeFilterHandler]
874
+ * @return {Function}
875
+ * @return {dc.baseMixin}
876
+ */
877
+ _chart.removeFilterHandler = function (removeFilterHandler) {
878
+ if (!arguments.length) {
879
+ return _removeFilterHandler;
880
+ }
881
+ _removeFilterHandler = removeFilterHandler;
882
+ return _chart;
883
+ };
884
+
885
+ var _addFilterHandler = function (filters, filter) {
886
+ filters.push(filter);
887
+ return filters;
888
+ };
889
+
890
+ /**
891
+ * Set or get the add filter handler. The add filter handler is a function that adds a filter to
892
+ * the chart's filter list. Using a custom add filter handler allows you to change the way filters
893
+ * are added or perform additional work when adding a filter, e.g. when using a filter server other
894
+ * than crossfilter.
895
+ *
896
+ * Any changes should modify the `filters` array argument and return that array.
897
+ * @method addFilterHandler
898
+ * @memberof dc.baseMixin
899
+ * @instance
900
+ * @example
901
+ * // default add filter handler
902
+ * chart.addFilterHandler(function (filters, filter) {
903
+ * filters.push(filter);
904
+ * return filters;
905
+ * });
906
+ *
907
+ * // custom filter handler (no-op)
908
+ * chart.addFilterHandler(function(filters, filter) {
909
+ * return filters;
910
+ * });
911
+ * @param {Function} [addFilterHandler]
912
+ * @return {Function}
913
+ * @return {dc.baseMixin}
914
+ */
915
+ _chart.addFilterHandler = function (addFilterHandler) {
916
+ if (!arguments.length) {
917
+ return _addFilterHandler;
918
+ }
919
+ _addFilterHandler = addFilterHandler;
920
+ return _chart;
921
+ };
922
+
923
+ var _resetFilterHandler = function (filters) {
924
+ return [];
925
+ };
926
+
927
+ /**
928
+ * Set or get the reset filter handler. The reset filter handler is a function that resets the
929
+ * chart's filter list by returning a new list. Using a custom reset filter handler allows you to
930
+ * change the way filters are reset, or perform additional work when resetting the filters,
931
+ * e.g. when using a filter server other than crossfilter.
932
+ *
933
+ * This function should return an array.
934
+ * @method resetFilterHandler
935
+ * @memberof dc.baseMixin
936
+ * @instance
937
+ * @example
938
+ * // default remove filter handler
939
+ * function (filters) {
940
+ * return [];
941
+ * }
942
+ *
943
+ * // custom filter handler (no-op)
944
+ * chart.resetFilterHandler(function(filters) {
945
+ * return filters;
946
+ * });
947
+ * @param {Function} [resetFilterHandler]
948
+ * @return {dc.baseMixin}
949
+ */
950
+ _chart.resetFilterHandler = function (resetFilterHandler) {
951
+ if (!arguments.length) {
952
+ return _resetFilterHandler;
953
+ }
954
+ _resetFilterHandler = resetFilterHandler;
955
+ return _chart;
956
+ };
957
+
958
+ function applyFilters () {
959
+ if (_chart.dimension() && _chart.dimension().filter) {
960
+ var fs = _filterHandler(_chart.dimension(), _filters);
961
+ _filters = fs ? fs : _filters;
962
+ }
963
+ }
964
+
965
+ _chart.replaceFilter = function (_) {
966
+ _filters = [];
967
+ _chart.filter(_);
968
+ };
969
+
970
+ /**
971
+ * Filter the chart by the given value or return the current filter if the input parameter is missing.
972
+ * If the passed filter is not currently in the chart's filters, it is added to the filters by the
973
+ * {@link dc.baseMixin#addFilterHandler addFilterHandler}. If a filter exists already within the chart's
974
+ * filters, it will be removed by the {@link dc.baseMixin#removeFilterHandler removeFilterHandler}. If
975
+ * a `null` value was passed at the filter, this denotes that the filters should be reset, and is performed
976
+ * by the {@link dc.baseMixin#resetFilterHandler resetFilterHandler}.
977
+ *
978
+ * Once the filters array has been updated, the filters are applied to the crossfilter.dimension, using the
979
+ * {@link dc.baseMixin#filterHandler filterHandler}.
980
+ * @method filter
981
+ * @memberof dc.baseMixin
982
+ * @instance
983
+ * @see {@link dc.baseMixin#addFilterHandler addFilterHandler}
984
+ * @see {@link dc.baseMixin#removeFilterHandler removeFilterHandler}
985
+ * @see {@link dc.baseMixin#resetFilterHandler resetFilterHandler}
986
+ * @see {@link dc.baseMixin#filterHandler filterHandler}
987
+ * @example
988
+ * // filter by a single string
989
+ * chart.filter('Sunday');
990
+ * // filter by a single age
991
+ * chart.filter(18);
992
+ * // filter by range -- note the use of dc.filters.RangedFilter
993
+ * // which is different from the regular crossfilter syntax, dimension.filter([15,20])
994
+ * chart.filter(dc.filters.RangedFilter(15,20));
995
+ * @param {*} [filter]
996
+ * @return {dc.baseMixin}
997
+ */
998
+ _chart.filter = function (filter) {
999
+ if (!arguments.length) {
1000
+ return _filters.length > 0 ? _filters[0] : null;
1001
+ }
1002
+ if (filter instanceof Array && filter[0] instanceof Array && !filter.isFiltered) {
1003
+ filter[0].forEach(function (d) {
1004
+ if (_chart.hasFilter(d)) {
1005
+ _removeFilterHandler(_filters, d);
1006
+ } else {
1007
+ _addFilterHandler(_filters, d);
1008
+ }
1009
+ });
1010
+ } else if (filter === null) {
1011
+ _filters = _resetFilterHandler(_filters);
1012
+ } else {
1013
+ if (_chart.hasFilter(filter)) {
1014
+ _removeFilterHandler(_filters, filter);
1015
+ } else {
1016
+ _addFilterHandler(_filters, filter);
1017
+ }
1018
+ }
1019
+ applyFilters();
1020
+ _chart._invokeFilteredListener(filter);
1021
+
1022
+ if (_root !== null && _chart.hasFilter()) {
1023
+ _chart.turnOnControls();
1024
+ } else {
1025
+ _chart.turnOffControls();
1026
+ }
1027
+
1028
+ return _chart;
1029
+ };
1030
+
1031
+ /**
1032
+ * Returns all current filters. This method does not perform defensive cloning of the internal
1033
+ * filter array before returning, therefore any modification of the returned array will effect the
1034
+ * chart's internal filter storage.
1035
+ * @method filters
1036
+ * @memberof dc.baseMixin
1037
+ * @instance
1038
+ * @return {Array<*>}
1039
+ */
1040
+ _chart.filters = function () {
1041
+ return _filters;
1042
+ };
1043
+
1044
+ _chart.highlightSelected = function (e) {
1045
+ d3.select(e).classed(dc.constants.SELECTED_CLASS, true);
1046
+ d3.select(e).classed(dc.constants.DESELECTED_CLASS, false);
1047
+ };
1048
+
1049
+ _chart.fadeDeselected = function (e) {
1050
+ d3.select(e).classed(dc.constants.SELECTED_CLASS, false);
1051
+ d3.select(e).classed(dc.constants.DESELECTED_CLASS, true);
1052
+ };
1053
+
1054
+ _chart.resetHighlight = function (e) {
1055
+ d3.select(e).classed(dc.constants.SELECTED_CLASS, false);
1056
+ d3.select(e).classed(dc.constants.DESELECTED_CLASS, false);
1057
+ };
1058
+
1059
+ /**
1060
+ * This function is passed to d3 as the onClick handler for each chart. The default behavior is to
1061
+ * filter on the clicked datum (passed to the callback) and redraw the chart group.
1062
+ * @method onClick
1063
+ * @memberof dc.baseMixin
1064
+ * @instance
1065
+ * @param {*} datum
1066
+ */
1067
+ _chart.onClick = function (datum) {
1068
+ var filter = _chart.keyAccessor()(datum);
1069
+ dc.events.trigger(function () {
1070
+ _chart.filter(filter);
1071
+ _chart.redrawGroup();
1072
+ });
1073
+ };
1074
+
1075
+ /**
1076
+ * Set or get the filter handler. The filter handler is a function that performs the filter action
1077
+ * on a specific dimension. Using a custom filter handler allows you to perform additional logic
1078
+ * before or after filtering.
1079
+ * @method filterHandler
1080
+ * @memberof dc.baseMixin
1081
+ * @instance
1082
+ * @see {@link https://github.com/square/crossfilter/wiki/API-Reference#dimension_filter crossfilter.dimension.filter}
1083
+ * @example
1084
+ * // default filter handler
1085
+ * chart.filterHandler(function (dimension, filters) {
1086
+ * dimension.filter(null);
1087
+ * if (filters.length === 0) {
1088
+ * dimension.filter(null);
1089
+ * } else {
1090
+ * dimension.filterFunction(function (d) {
1091
+ * for (var i = 0; i < filters.length; i++) {
1092
+ * var filter = filters[i];
1093
+ * if (filter.isFiltered && filter.isFiltered(d)) {
1094
+ * return true;
1095
+ * } else if (filter <= d && filter >= d) {
1096
+ * return true;
1097
+ * }
1098
+ * }
1099
+ * return false;
1100
+ * });
1101
+ * }
1102
+ * return filters;
1103
+ * });
1104
+ *
1105
+ * // custom filter handler
1106
+ * chart.filterHandler(function(dimension, filter){
1107
+ * var newFilter = filter + 10;
1108
+ * dimension.filter(newFilter);
1109
+ * return newFilter; // set the actual filter value to the new value
1110
+ * });
1111
+ * @param {Function} [filterHandler]
1112
+ * @return {Function}
1113
+ * @return {dc.baseMixin}
1114
+ */
1115
+ _chart.filterHandler = function (filterHandler) {
1116
+ if (!arguments.length) {
1117
+ return _filterHandler;
1118
+ }
1119
+ _filterHandler = filterHandler;
1120
+ return _chart;
1121
+ };
1122
+
1123
+ // abstract function stub
1124
+ _chart._doRender = function () {
1125
+ // do nothing in base, should be overridden by sub-function
1126
+ return _chart;
1127
+ };
1128
+
1129
+ _chart._doRedraw = function () {
1130
+ // do nothing in base, should be overridden by sub-function
1131
+ return _chart;
1132
+ };
1133
+
1134
+ _chart.legendables = function () {
1135
+ // do nothing in base, should be overridden by sub-function
1136
+ return [];
1137
+ };
1138
+
1139
+ _chart.legendHighlight = function () {
1140
+ // do nothing in base, should be overridden by sub-function
1141
+ };
1142
+
1143
+ _chart.legendReset = function () {
1144
+ // do nothing in base, should be overridden by sub-function
1145
+ };
1146
+
1147
+ _chart.legendToggle = function () {
1148
+ // do nothing in base, should be overriden by sub-function
1149
+ };
1150
+
1151
+ _chart.isLegendableHidden = function () {
1152
+ // do nothing in base, should be overridden by sub-function
1153
+ return false;
1154
+ };
1155
+
1156
+ /**
1157
+ * Set or get the key accessor function. The key accessor function is used to retrieve the key
1158
+ * value from the crossfilter group. Key values are used differently in different charts, for
1159
+ * example keys correspond to slices in a pie chart and x axis positions in a grid coordinate chart.
1160
+ * @method keyAccessor
1161
+ * @memberof dc.baseMixin
1162
+ * @instance
1163
+ * @example
1164
+ * // default key accessor
1165
+ * chart.keyAccessor(function(d) { return d.key; });
1166
+ * // custom key accessor for a multi-value crossfilter reduction
1167
+ * chart.keyAccessor(function(p) { return p.value.absGain; });
1168
+ * @param {Function} [keyAccessor]
1169
+ * @return {Function}
1170
+ * @return {dc.baseMixin}
1171
+ */
1172
+ _chart.keyAccessor = function (keyAccessor) {
1173
+ if (!arguments.length) {
1174
+ return _keyAccessor;
1175
+ }
1176
+ _keyAccessor = keyAccessor;
1177
+ return _chart;
1178
+ };
1179
+
1180
+ /**
1181
+ * Set or get the value accessor function. The value accessor function is used to retrieve the
1182
+ * value from the crossfilter group. Group values are used differently in different charts, for
1183
+ * example values correspond to slice sizes in a pie chart and y axis positions in a grid
1184
+ * coordinate chart.
1185
+ * @method valueAccessor
1186
+ * @memberof dc.baseMixin
1187
+ * @instance
1188
+ * @example
1189
+ * // default value accessor
1190
+ * chart.valueAccessor(function(d) { return d.value; });
1191
+ * // custom value accessor for a multi-value crossfilter reduction
1192
+ * chart.valueAccessor(function(p) { return p.value.percentageGain; });
1193
+ * @param {Function} [valueAccessor]
1194
+ * @return {Function}
1195
+ * @return {dc.baseMixin}
1196
+ */
1197
+ _chart.valueAccessor = function (valueAccessor) {
1198
+ if (!arguments.length) {
1199
+ return _valueAccessor;
1200
+ }
1201
+ _valueAccessor = valueAccessor;
1202
+ return _chart;
1203
+ };
1204
+
1205
+ /**
1206
+ * Set or get the label function. The chart class will use this function to render labels for each
1207
+ * child element in the chart, e.g. slices in a pie chart or bubbles in a bubble chart. Not every
1208
+ * chart supports the label function, for example line chart does not use this function
1209
+ * at all. By default, enables labels; pass false for the second parameter if this is not desired.
1210
+ * @method label
1211
+ * @memberof dc.baseMixin
1212
+ * @instance
1213
+ * @example
1214
+ * // default label function just return the key
1215
+ * chart.label(function(d) { return d.key; });
1216
+ * // label function has access to the standard d3 data binding and can get quite complicated
1217
+ * chart.label(function(d) { return d.data.key + '(' + Math.floor(d.data.value / all.value() * 100) + '%)'; });
1218
+ * @param {Function} [labelFunction]
1219
+ * @param {Boolean} [enableLabels=true]
1220
+ * @return {Function}
1221
+ * @return {dc.baseMixin}
1222
+ */
1223
+ _chart.label = function (labelFunction, enableLabels) {
1224
+ if (!arguments.length) {
1225
+ return _label;
1226
+ }
1227
+ _label = labelFunction;
1228
+ if ((enableLabels === undefined) || enableLabels) {
1229
+ _renderLabel = true;
1230
+ }
1231
+ return _chart;
1232
+ };
1233
+
1234
+ /**
1235
+ * Turn on/off label rendering
1236
+ * @method renderLabel
1237
+ * @memberof dc.baseMixin
1238
+ * @instance
1239
+ * @param {Boolean} [renderLabel=false]
1240
+ * @return {Boolean}
1241
+ * @return {dc.baseMixin}
1242
+ */
1243
+ _chart.renderLabel = function (renderLabel) {
1244
+ if (!arguments.length) {
1245
+ return _renderLabel;
1246
+ }
1247
+ _renderLabel = renderLabel;
1248
+ return _chart;
1249
+ };
1250
+
1251
+ /**
1252
+ * Set or get the title function. The chart class will use this function to render the SVGElement title
1253
+ * (usually interpreted by browser as tooltips) for each child element in the chart, e.g. a slice
1254
+ * in a pie chart or a bubble in a bubble chart. Almost every chart supports the title function;
1255
+ * however in grid coordinate charts you need to turn off the brush in order to see titles, because
1256
+ * otherwise the brush layer will block tooltip triggering.
1257
+ * @method title
1258
+ * @memberof dc.baseMixin
1259
+ * @instance
1260
+ * @example
1261
+ * // default title function just return the key
1262
+ * chart.title(function(d) { return d.key + ': ' + d.value; });
1263
+ * // title function has access to the standard d3 data binding and can get quite complicated
1264
+ * chart.title(function(p) {
1265
+ * return p.key.getFullYear()
1266
+ * + '\n'
1267
+ * + 'Index Gain: ' + numberFormat(p.value.absGain) + '\n'
1268
+ * + 'Index Gain in Percentage: ' + numberFormat(p.value.percentageGain) + '%\n'
1269
+ * + 'Fluctuation / Index Ratio: ' + numberFormat(p.value.fluctuationPercentage) + '%';
1270
+ * });
1271
+ * @param {Function} [titleFunction]
1272
+ * @return {Function}
1273
+ * @return {dc.baseMixin}
1274
+ */
1275
+ _chart.title = function (titleFunction) {
1276
+ if (!arguments.length) {
1277
+ return _title;
1278
+ }
1279
+ _title = titleFunction;
1280
+ return _chart;
1281
+ };
1282
+
1283
+ /**
1284
+ * Turn on/off title rendering, or return the state of the render title flag if no arguments are
1285
+ * given.
1286
+ * @method renderTitle
1287
+ * @memberof dc.baseMixin
1288
+ * @instance
1289
+ * @param {Boolean} [renderTitle=true]
1290
+ * @return {Boolean}
1291
+ * @return {dc.baseMixin}
1292
+ */
1293
+ _chart.renderTitle = function (renderTitle) {
1294
+ if (!arguments.length) {
1295
+ return _renderTitle;
1296
+ }
1297
+ _renderTitle = renderTitle;
1298
+ return _chart;
1299
+ };
1300
+
1301
+ /**
1302
+ * A renderlet is similar to an event listener on rendering event. Multiple renderlets can be added
1303
+ * to an individual chart. Each time a chart is rerendered or redrawn the renderlets are invoked
1304
+ * right after the chart finishes its transitions, giving you a way to modify the SVGElements.
1305
+ * Renderlet functions take the chart instance as the only input parameter and you can
1306
+ * use the dc API or use raw d3 to achieve pretty much any effect.
1307
+ *
1308
+ * Use {@link dc.baseMixin#on on} with a 'renderlet' prefix.
1309
+ * Generates a random key for the renderlet, which makes it hard to remove.
1310
+ * @method renderlet
1311
+ * @memberof dc.baseMixin
1312
+ * @instance
1313
+ * @deprecated
1314
+ * @example
1315
+ * // do this instead of .renderlet(function(chart) { ... })
1316
+ * chart.on("renderlet", function(chart){
1317
+ * // mix of dc API and d3 manipulation
1318
+ * chart.select('g.y').style('display', 'none');
1319
+ * // its a closure so you can also access other chart variable available in the closure scope
1320
+ * moveChart.filter(chart.filter());
1321
+ * });
1322
+ * @param {Function} renderletFunction
1323
+ * @return {dc.baseMixin}
1324
+ */
1325
+ _chart.renderlet = dc.logger.deprecate(function (renderletFunction) {
1326
+ _chart.on('renderlet.' + dc.utils.uniqueId(), renderletFunction);
1327
+ return _chart;
1328
+ }, 'chart.renderlet has been deprecated. Please use chart.on("renderlet.<renderletKey>", renderletFunction)');
1329
+
1330
+ /**
1331
+ * Get or set the chart group to which this chart belongs. Chart groups are rendered or redrawn
1332
+ * together since it is expected they share the same underlying crossfilter data set.
1333
+ * @method chartGroup
1334
+ * @memberof dc.baseMixin
1335
+ * @instance
1336
+ * @param {String} [chartGroup]
1337
+ * @return {String}
1338
+ * @return {dc.baseMixin}
1339
+ */
1340
+ _chart.chartGroup = function (chartGroup) {
1341
+ if (!arguments.length) {
1342
+ return _chartGroup;
1343
+ }
1344
+ if (!_isChild) {
1345
+ dc.deregisterChart(_chart, _chartGroup);
1346
+ }
1347
+ _chartGroup = chartGroup;
1348
+ if (!_isChild) {
1349
+ dc.registerChart(_chart, _chartGroup);
1350
+ }
1351
+ return _chart;
1352
+ };
1353
+
1354
+ /**
1355
+ * Expire the internal chart cache. dc charts cache some data internally on a per chart basis to
1356
+ * speed up rendering and avoid unnecessary calculation; however it might be useful to clear the
1357
+ * cache if you have changed state which will affect rendering. For example if you invoke the
1358
+ * {@link https://github.com/square/crossfilter/wiki/API-Reference#crossfilter_add crossfilter.add}
1359
+ * function or reset group or dimension after rendering it is a good idea to
1360
+ * clear the cache to make sure charts are rendered properly.
1361
+ * @method expireCache
1362
+ * @memberof dc.baseMixin
1363
+ * @instance
1364
+ * @return {dc.baseMixin}
1365
+ */
1366
+ _chart.expireCache = function () {
1367
+ // do nothing in base, should be overridden by sub-function
1368
+ return _chart;
1369
+ };
1370
+
1371
+ /**
1372
+ * Attach a dc.legend widget to this chart. The legend widget will automatically draw legend labels
1373
+ * based on the color setting and names associated with each group.
1374
+ * @method legend
1375
+ * @memberof dc.baseMixin
1376
+ * @instance
1377
+ * @example
1378
+ * chart.legend(dc.legend().x(400).y(10).itemHeight(13).gap(5))
1379
+ * @param {dc.legend} [legend]
1380
+ * @return {dc.legend}
1381
+ * @return {dc.baseMixin}
1382
+ */
1383
+ _chart.legend = function (legend) {
1384
+ if (!arguments.length) {
1385
+ return _legend;
1386
+ }
1387
+ _legend = legend;
1388
+ _legend.parent(_chart);
1389
+ return _chart;
1390
+ };
1391
+
1392
+ /**
1393
+ * Returns the internal numeric ID of the chart.
1394
+ * @method chartID
1395
+ * @memberof dc.baseMixin
1396
+ * @instance
1397
+ * @return {String}
1398
+ */
1399
+ _chart.chartID = function () {
1400
+ return _chart.__dcFlag__;
1401
+ };
1402
+
1403
+ /**
1404
+ * Set chart options using a configuration object. Each key in the object will cause the method of
1405
+ * the same name to be called with the value to set that attribute for the chart.
1406
+ * @method options
1407
+ * @memberof dc.baseMixin
1408
+ * @instance
1409
+ * @example
1410
+ * chart.options({dimension: myDimension, group: myGroup});
1411
+ * @param {{}} opts
1412
+ * @return {dc.baseMixin}
1413
+ */
1414
+ _chart.options = function (opts) {
1415
+ var applyOptions = [
1416
+ 'anchor',
1417
+ 'group',
1418
+ 'xAxisLabel',
1419
+ 'yAxisLabel',
1420
+ 'stack',
1421
+ 'title',
1422
+ 'point',
1423
+ 'getColor',
1424
+ 'overlayGeoJson'
1425
+ ];
1426
+
1427
+ for (var o in opts) {
1428
+ if (typeof(_chart[o]) === 'function') {
1429
+ if (opts[o] instanceof Array && applyOptions.indexOf(o) !== -1) {
1430
+ _chart[o].apply(_chart, opts[o]);
1431
+ } else {
1432
+ _chart[o].call(_chart, opts[o]);
1433
+ }
1434
+ } else {
1435
+ dc.logger.debug('Not a valid option setter name: ' + o);
1436
+ }
1437
+ }
1438
+ return _chart;
1439
+ };
1440
+
1441
+ /**
1442
+ * All dc chart instance supports the following listeners.
1443
+ * Supports the following events:
1444
+ * * `renderlet` - This listener function will be invoked after transitions after redraw and render. Replaces the
1445
+ * deprecated {@link dc.baseMixin#renderlet renderlet} method.
1446
+ * * `pretransition` - Like `.on('renderlet', ...)` but the event is fired before transitions start.
1447
+ * * `preRender` - This listener function will be invoked before chart rendering.
1448
+ * * `postRender` - This listener function will be invoked after chart finish rendering including
1449
+ * all renderlets' logic.
1450
+ * * `preRedraw` - This listener function will be invoked before chart redrawing.
1451
+ * * `postRedraw` - This listener function will be invoked after chart finish redrawing
1452
+ * including all renderlets' logic.
1453
+ * * `filtered` - This listener function will be invoked after a filter is applied, added or removed.
1454
+ * * `zoomed` - This listener function will be invoked after a zoom is triggered.
1455
+ * @method on
1456
+ * @memberof dc.baseMixin
1457
+ * @instance
1458
+ * @see {@link https://github.com/mbostock/d3/wiki/Internals#dispatch_on d3.dispatch.on}
1459
+ * @example
1460
+ * .on('renderlet', function(chart, filter){...})
1461
+ * .on('pretransition', function(chart, filter){...})
1462
+ * .on('preRender', function(chart){...})
1463
+ * .on('postRender', function(chart){...})
1464
+ * .on('preRedraw', function(chart){...})
1465
+ * .on('postRedraw', function(chart){...})
1466
+ * .on('filtered', function(chart, filter){...})
1467
+ * .on('zoomed', function(chart, filter){...})
1468
+ * @param {String} event
1469
+ * @param {Function} listener
1470
+ * @return {dc.baseMixin}
1471
+ */
1472
+ _chart.on = function (event, listener) {
1473
+ _listeners.on(event, listener);
1474
+ return _chart;
1475
+ };
1476
+
1477
+ return _chart;
1478
+ };