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,23 @@
1
+ /*!
2
+ * dc 2.0.0-beta.30
3
+ * http://dc-js.github.io/dc.js/
4
+ * Copyright 2012-2016 Nick Zhu & the dc.js Developers
5
+ * https://github.com/dc-js/dc.js/blob/master/AUTHORS
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ !function(){function a(a,b){"use strict";var c={version:"2.0.0-beta.30",constants:{CHART_CLASS:"dc-chart",DEBUG_GROUP_CLASS:"debug",STACK_CLASS:"stack",DESELECTED_CLASS:"deselected",SELECTED_CLASS:"selected",NODE_INDEX_NAME:"__index__",GROUP_INDEX_NAME:"__group_index__",DEFAULT_CHART_GROUP:"__default_chart_group__",EVENT_DELAY:40,NEGLIGIBLE_NUMBER:1e-10},_renderlet:null};c.chartRegistry=function(){function a(a){return a||(a=c.constants.DEFAULT_CHART_GROUP),b[a]||(b[a]=[]),a}var b={};return{has:function(a){for(var c in b)if(b[c].indexOf(a)>=0)return!0;return!1},register:function(c,d){d=a(d),b[d].push(c)},deregister:function(c,d){d=a(d);for(var e=0;e<b[d].length;e++)if(b[d][e].anchorName()===c.anchorName()){b[d].splice(e,1);break}},clear:function(a){a?delete b[a]:b={}},list:function(c){return c=a(c),b[c]}}}(),c.registerChart=function(a,b){c.chartRegistry.register(a,b)},c.deregisterChart=function(a,b){c.chartRegistry.deregister(a,b)},c.hasChart=function(a){return c.chartRegistry.has(a)},c.deregisterAllCharts=function(a){c.chartRegistry.clear(a)},c.filterAll=function(a){for(var b=c.chartRegistry.list(a),d=0;d<b.length;++d)b[d].filterAll()},c.refocusAll=function(a){for(var b=c.chartRegistry.list(a),d=0;d<b.length;++d)b[d].focus&&b[d].focus()},c.renderAll=function(a){for(var b=c.chartRegistry.list(a),d=0;d<b.length;++d)b[d].render();null!==c._renderlet&&c._renderlet(a)},c.redrawAll=function(a){for(var b=c.chartRegistry.list(a),d=0;d<b.length;++d)b[d].redraw();null!==c._renderlet&&c._renderlet(a)},c.disableTransitions=!1,c.transition=function(a,b,d,e){if(0>=b||void 0===b||c.disableTransitions)return a;var f=a.transition(e).duration(b);return"function"==typeof d&&d(f),f},c.optionalTransition=function(a,b,d,e){return a?function(a){return c.transition(a,b,d,e)}:function(a){return a}},c.afterTransition=function(a,b){if(a.empty()||!a.duration)b.call(a);else{var c=0;a.each(function(){++c}).each("end",function(){--c||b.call(a)})}},c.units={},c.units.integers=function(a,b){return Math.abs(b-a)},c.units.ordinal=function(a,b,c){return c},c.units.fp={},c.units.fp.precision=function(a){var b=function(a,d){var e=Math.abs((d-a)/b.resolution);return c.utils.isNegligible(e-Math.floor(e))?Math.floor(e):Math.ceil(e)};return b.resolution=a,b},c.round={},c.round.floor=function(a){return Math.floor(a)},c.round.ceil=function(a){return Math.ceil(a)},c.round.round=function(a){return Math.round(a)},c.override=function(a,b,c){var d=a[b];a["_"+b]=d,a[b]=c},c.renderlet=function(a){return arguments.length?(c._renderlet=a,c):c._renderlet},c.instanceOfChart=function(a){return a instanceof Object&&a.__dcFlag__&&!0},c.errors={},c.errors.Exception=function(a){var b=a||"Unexpected internal error";this.message=b,this.toString=function(){return b},this.stack=(new Error).stack},c.errors.Exception.prototype=Object.create(Error.prototype),c.errors.Exception.prototype.constructor=c.errors.Exception,c.errors.InvalidStateException=function(){c.errors.Exception.apply(this,arguments)},c.errors.InvalidStateException.prototype=Object.create(c.errors.Exception.prototype),c.errors.InvalidStateException.prototype.constructor=c.errors.InvalidStateException,c.errors.BadArgumentException=function(){c.errors.Exception.apply(this,arguments)},c.errors.BadArgumentException.prototype=Object.create(c.errors.Exception.prototype),c.errors.BadArgumentException.prototype.constructor=c.errors.BadArgumentException,c.dateFormat=a.time.format("%m/%d/%Y"),c.printers={},c.printers.filters=function(a){for(var b="",d=0;d<a.length;++d)d>0&&(b+=", "),b+=c.printers.filter(a[d]);return b},c.printers.filter=function(a){var b="";return"undefined"!=typeof a&&null!==a&&(a instanceof Array?a.length>=2?b="["+c.utils.printSingleValue(a[0])+" -> "+c.utils.printSingleValue(a[1])+"]":a.length>=1&&(b=c.utils.printSingleValue(a[0])):b=c.utils.printSingleValue(a)),b},c.pluck=function(a,b){return b?function(c,d){return b.call(c,c[a],d)}:function(b){return b[a]}},c.utils={},c.utils.printSingleValue=function(a){var b=""+a;return a instanceof Date?b=c.dateFormat(a):"string"==typeof a?b=a:c.utils.isFloat(a)?b=c.utils.printSingleValue.fformat(a):c.utils.isInteger(a)&&(b=Math.round(a)),b},c.utils.printSingleValue.fformat=a.format(".2f"),c.utils.add=function(a,b){if("string"==typeof b&&(b=b.replace("%","")),a instanceof Date){"string"==typeof b&&(b=+b);var c=new Date;return c.setTime(a.getTime()),c.setDate(a.getDate()+b),c}if("string"==typeof b){var d=+b/100;return a>0?a*(1+d):a*(1-d)}return a+b},c.utils.subtract=function(a,b){if("string"==typeof b&&(b=b.replace("%","")),a instanceof Date){"string"==typeof b&&(b=+b);var c=new Date;return c.setTime(a.getTime()),c.setDate(a.getDate()-b),c}if("string"==typeof b){var d=+b/100;return 0>a?a*(1+d):a*(1-d)}return a-b},c.utils.isNumber=function(a){return a===+a},c.utils.isFloat=function(a){return a===+a&&a!==(0|a)},c.utils.isInteger=function(a){return a===+a&&a===(0|a)},c.utils.isNegligible=function(a){return!c.utils.isNumber(a)||a<c.constants.NEGLIGIBLE_NUMBER&&a>-c.constants.NEGLIGIBLE_NUMBER},c.utils.clamp=function(a,b,c){return b>a?b:a>c?c:a};var d=0;return c.utils.uniqueId=function(){return++d},c.utils.nameToId=function(a){return a.toLowerCase().replace(/[\s]/g,"_").replace(/[\.']/g,"")},c.utils.appendOrSelect=function(a,b,c){c=c||b;var d=a.select(b);return d.empty()&&(d=a.append(c)),d},c.utils.safeNumber=function(a){return c.utils.isNumber(+a)?+a:0},c.logger={},c.logger.enableDebugLog=!1,c.logger.warn=function(a){return console&&(console.warn?console.warn(a):console.log&&console.log(a)),c.logger},c.logger.debug=function(a){return c.logger.enableDebugLog&&console&&(console.debug?console.debug(a):console.log&&console.log(a)),c.logger},c.logger.deprecate=function(a,b){function d(){return e||(c.logger.warn(b),e=!0),a.apply(this,arguments)}var e=!1;return d},c.events={current:null},c.events.trigger=function(a,b){return b?(c.events.current=a,void setTimeout(function(){a===c.events.current&&a()},b)):void a()},c.filters={},c.filters.RangedFilter=function(a,b){var c=new Array(a,b);return c.isFiltered=function(a){return a>=this[0]&&a<this[1]},c.filterType="RangedFilter",c},c.filters.TwoDimensionalFilter=function(a){if(null===a)return null;var b=a;return b.isFiltered=function(a){return a.length&&a.length===b.length&&a[0]===b[0]&&a[1]===b[1]},b.filterType="TwoDimensionalFilter",b},c.filters.RangedTwoDimensionalFilter=function(a){if(null===a)return null;var b,c=a;return b=c[0]instanceof Array?[[Math.min(a[0][0],a[1][0]),Math.min(a[0][1],a[1][1])],[Math.max(a[0][0],a[1][0]),Math.max(a[0][1],a[1][1])]]:[[a[0],-(1/0)],[a[1],1/0]],c.isFiltered=function(a){var c,d;if(a instanceof Array){if(2!==a.length)return!1;c=a[0],d=a[1]}else c=a,d=b[0][1];return c>=b[0][0]&&c<b[1][0]&&d>=b[0][1]&&d<b[1][1]},c.filterType="RangedTwoDimensionalFilter",c},c.baseMixin=function(d){function e(){m&&m.attr("width",d.width()).attr("height",d.height())}function f(){return m=d.root().append("svg"),e(),m}function g(a){if(!d[a]||!d[a]())throw new c.errors.InvalidStateException("Mandatory attribute chart."+a+" is missing on chart[#"+d.anchorName()+"]")}function h(){if(d.dimension()&&d.dimension().filter){var a=N(d.dimension(),M);M=a?a:M}}d.__dcFlag__=c.utils.uniqueId();var i,j,k,l,m,n,o,p,q,r,s,t=200,u=function(a){var b=a&&a.getBoundingClientRect&&a.getBoundingClientRect().width;return b&&b>t?b:t},v=u,w=200,x=function(a){var b=a&&a.getBoundingClientRect&&a.getBoundingClientRect().height;return b&&b>w?b:w},y=x,z=c.pluck("key"),A=c.pluck("value"),B=c.pluck("key"),C=c.pluck("key"),D=!1,E=function(a){return d.keyAccessor()(a)+": "+d.valueAccessor()(a)},F=!0,G=!1,H=750,I=c.printers.filters,J=["dimension","group"],K=c.constants.DEFAULT_CHART_GROUP,L=a.dispatch("preRender","postRender","preRedraw","postRedraw","filtered","zoomed","renderlet","pretransition"),M=[],N=function(a,b){return 0===b.length?a.filter(null):1!==b.length||b[0].isFiltered?1===b.length&&"RangedFilter"===b[0].filterType?a.filterRange(b[0]):a.filterFunction(function(a){for(var c=0;c<b.length;c++){var d=b[c];if(d.isFiltered&&d.isFiltered(a))return!0;if(a>=d&&d>=a)return!0}return!1}):a.filterExact(b[0]),b},O=function(a){return a.all()};d.height=function(b){return arguments.length?(y=a.functor(b||x),p=void 0,d):(c.utils.isNumber(p)||(p=y(l.node())),p)},d.width=function(b){return arguments.length?(v=a.functor(b||u),o=void 0,d):(c.utils.isNumber(o)||(o=v(l.node())),o)},d.minWidth=function(a){return arguments.length?(t=a,d):t},d.minHeight=function(a){return arguments.length?(w=a,d):w},d.dimension=function(a){return arguments.length?(i=a,d.expireCache(),d):i},d.data=function(b){return arguments.length?(O=a.functor(b),d.expireCache(),d):O.call(d,j)},d.group=function(a,b){return arguments.length?(j=a,d._groupName=b,d.expireCache(),d):j},d.ordering=function(a){return arguments.length?(C=a,q=b.quicksort.by(C),d.expireCache(),d):C},d._computeOrderedGroups=function(a){var c=a.slice(0);return c.length<=1?c:(q||(q=b.quicksort.by(C)),q(c,0,c.length))},d.filterAll=function(){return d.filter(null)},d.select=function(a){return l.select(a)},d.selectAll=function(a){return l?l.selectAll(a):null},d.anchor=function(b,e){if(!arguments.length)return k;if(c.instanceOfChart(b))k=b.anchor(),l=b.root(),n=!0;else{if(!b)throw new c.errors.BadArgumentException("parent must be defined");k=b.select&&b.classed?b.node():b,l=a.select(k),l.classed(c.constants.CHART_CLASS,!0),c.registerChart(d,e),n=!1}return K=e,d},d.anchorName=function(){var a=d.anchor();return a&&a.id?a.id:a&&a.replace?a.replace("#",""):"dc-chart"+d.chartID()},d.root=function(a){return arguments.length?(l=a,d):l},d.svg=function(a){return arguments.length?(m=a,d):m},d.resetSvg=function(){return d.select("svg").remove(),f()},d.filterPrinter=function(a){return arguments.length?(I=a,d):I},d.controlsUseVisibility=function(a){return arguments.length?(G=a,d):G},d.turnOnControls=function(){if(l){var a=d.controlsUseVisibility()?"visibility":"display";d.selectAll(".reset").style(a,null),d.selectAll(".filter").text(I(d.filters())).style(a,null)}return d},d.turnOffControls=function(){if(l){var a=d.controlsUseVisibility()?"visibility":"display",b=d.controlsUseVisibility()?"hidden":"none";d.selectAll(".reset").style(a,b),d.selectAll(".filter").style(a,b).text(d.filter())}return d},d.transitionDuration=function(a){return arguments.length?(H=a,d):H},d._mandatoryAttributes=function(a){return arguments.length?(J=a,d):J},d.render=function(){p=o=void 0,L.preRender(d),J&&J.forEach(g);var a=d._doRender();return r&&r.render(),d._activateRenderlets("postRender"),a},d._activateRenderlets=function(a){L.pretransition(d),d.transitionDuration()>0&&m?m.transition().duration(d.transitionDuration()).each("end",function(){L.renderlet(d),a&&L[a](d)}):(L.renderlet(d),a&&L[a](d))},d.redraw=function(){e(),L.preRedraw(d);var a=d._doRedraw();return r&&r.render(),d._activateRenderlets("postRedraw"),a},d.commitHandler=function(a){return arguments.length?(s=a,d):s},d.redrawGroup=function(){return s?s(!1,function(a,b){a?console.log(a):c.redrawAll(d.chartGroup())}):c.redrawAll(d.chartGroup()),d},d.renderGroup=function(){return s?s(!1,function(a,b){a?console.log(a):c.renderAll(d.chartGroup())}):c.renderAll(d.chartGroup()),d},d._invokeFilteredListener=function(a){void 0!==a&&L.filtered(d,a)},d._invokeZoomedListener=function(){L.zoomed(d)};var P=function(a,b){return null===b||"undefined"==typeof b?a.length>0:a.some(function(a){return a>=b&&b>=a})};d.hasFilterHandler=function(a){return arguments.length?(P=a,d):P},d.hasFilter=function(a){return P(M,a)};var Q=function(a,b){for(var c=0;c<a.length;c++)if(a[c]<=b&&a[c]>=b){a.splice(c,1);break}return a};d.removeFilterHandler=function(a){return arguments.length?(Q=a,d):Q};var R=function(a,b){return a.push(b),a};d.addFilterHandler=function(a){return arguments.length?(R=a,d):R};var S=function(a){return[]};return d.resetFilterHandler=function(a){return arguments.length?(S=a,d):S},d.replaceFilter=function(a){M=[],d.filter(a)},d.filter=function(a){return arguments.length?(a instanceof Array&&a[0]instanceof Array&&!a.isFiltered?a[0].forEach(function(a){d.hasFilter(a)?Q(M,a):R(M,a)}):null===a?M=S(M):d.hasFilter(a)?Q(M,a):R(M,a),h(),d._invokeFilteredListener(a),null!==l&&d.hasFilter()?d.turnOnControls():d.turnOffControls(),d):M.length>0?M[0]:null},d.filters=function(){return M},d.highlightSelected=function(b){a.select(b).classed(c.constants.SELECTED_CLASS,!0),a.select(b).classed(c.constants.DESELECTED_CLASS,!1)},d.fadeDeselected=function(b){a.select(b).classed(c.constants.SELECTED_CLASS,!1),a.select(b).classed(c.constants.DESELECTED_CLASS,!0)},d.resetHighlight=function(b){a.select(b).classed(c.constants.SELECTED_CLASS,!1),a.select(b).classed(c.constants.DESELECTED_CLASS,!1)},d.onClick=function(a){var b=d.keyAccessor()(a);c.events.trigger(function(){d.filter(b),d.redrawGroup()})},d.filterHandler=function(a){return arguments.length?(N=a,d):N},d._doRender=function(){return d},d._doRedraw=function(){return d},d.legendables=function(){return[]},d.legendHighlight=function(){},d.legendReset=function(){},d.legendToggle=function(){},d.isLegendableHidden=function(){return!1},d.keyAccessor=function(a){return arguments.length?(z=a,d):z},d.valueAccessor=function(a){return arguments.length?(A=a,d):A},d.label=function(a,b){return arguments.length?(B=a,(void 0===b||b)&&(D=!0),d):B},d.renderLabel=function(a){return arguments.length?(D=a,d):D},d.title=function(a){return arguments.length?(E=a,d):E},d.renderTitle=function(a){return arguments.length?(F=a,d):F},d.renderlet=c.logger.deprecate(function(a){return d.on("renderlet."+c.utils.uniqueId(),a),d},'chart.renderlet has been deprecated. Please use chart.on("renderlet.<renderletKey>", renderletFunction)'),d.chartGroup=function(a){return arguments.length?(n||c.deregisterChart(d,K),K=a,n||c.registerChart(d,K),d):K},d.expireCache=function(){return d},d.legend=function(a){return arguments.length?(r=a,r.parent(d),d):r},d.chartID=function(){return d.__dcFlag__},d.options=function(a){var b=["anchor","group","xAxisLabel","yAxisLabel","stack","title","point","getColor","overlayGeoJson"];for(var e in a)"function"==typeof d[e]?a[e]instanceof Array&&-1!==b.indexOf(e)?d[e].apply(d,a[e]):d[e].call(d,a[e]):c.logger.debug("Not a valid option setter name: "+e);return d},d.on=function(a,b){return L.on(a,b),d},d},c.marginMixin=function(a){var b={top:10,right:50,bottom:30,left:30};return a.margins=function(c){return arguments.length?(b=c,a):b},a.effectiveWidth=function(){return a.width()-a.margins().left-a.margins().right},a.effectiveHeight=function(){return a.height()-a.margins().top-a.margins().bottom},a},c.colorMixin=function(b){var c=a.scale.category20c(),d=!0,e=function(a){return b.keyAccessor()(a)};return b.colors=function(d){return arguments.length?(c=d instanceof Array?a.scale.quantize().range(d):a.functor(d),b):c},b.ordinalColors=function(c){return b.colors(a.scale.ordinal().range(c))},b.linearColors=function(c){return b.colors(a.scale.linear().range(c).interpolate(a.interpolateHcl))},b.colorAccessor=function(a){return arguments.length?(e=a,d=!1,b):e},b.defaultColorAccessor=function(){return d},b.colorDomain=function(a){return arguments.length?(c.domain(a),b):c.domain()},b.calculateColorDomain=function(){var d=[a.min(b.data(),b.colorAccessor()),a.max(b.data(),b.colorAccessor())];return c.domain(d),b},b.getColor=function(a,b){return c(e.call(this,a,b))},b.colorCalculator=function(a){return arguments.length?(b.getColor=a,b):b.getColor},b},c.coordinateGridMixin=function(b){function d(){V=!0,Y&&(b.x().domain(m(b.x().domain(),z)),G&&b.x().domain(m(b.x().domain(),G.x().domain())));var a=b.x().domain(),d=c.filters.RangedFilter(a[0],a[1]);b.replaceFilter(d),b.rescale(),b.redraw(),G&&!n(b.filter(),G.filter())&&c.events.trigger(function(){G.replaceFilter(d),G.redraw()}),b._invokeZoomedListener(),c.events.trigger(function(){b.redrawGroup()},c.constants.EVENT_DELAY),V=!n(a,z)}function e(a,b){return!a||!b||a.length!==b.length||a.some(function(a,c){return a&&b[c]?a.toString()!==b[c].toString():a===b[c]})}function f(a,c){b.isOrdinal()?(b.elasticX()||0===y.domain().length)&&y.domain(b._ordinalXDomain()):b.elasticX()&&y.domain([b.xAxisMin(),b.xAxisMax()]);var d=y.domain();(c||e(B,d))&&b.rescale(),B=d,b.isOrdinal()?y.rangeBands([0,b.xAxisLength()],da,b._useOuterPadding()?ca:0):y.range([0,b.xAxisLength()]),I=I.scale(b.x()),g(a)}function g(a){var d=a.selectAll("g."+r);if(U){d.empty()&&(d=a.insert("g",":first-child").attr("class",p+" "+r).attr("transform","translate("+b.margins().left+","+b.margins().top+")"));var e=I.tickValues()?I.tickValues():"function"==typeof y.ticks?y.ticks(I.ticks()[0]):y.domain(),f=d.selectAll("line").data(e),g=f.enter().append("line").attr("x1",function(a){return y(a)}).attr("y1",b._xAxisY()-b.margins().top).attr("x2",function(a){return y(a)}).attr("y2",0).attr("opacity",0);c.transition(g,b.transitionDuration()).attr("opacity",1),c.transition(f,b.transitionDuration()).attr("x1",function(a){return y(a)}).attr("y1",b._xAxisY()-b.margins().top).attr("x2",function(a){return y(a)}).attr("y2",0),f.exit().remove()}else d.selectAll("line").remove()}function h(){return b._xAxisY()-b.margins().top}function i(){return b.anchorName().replace(/[ .#=\[\]]/g,"-")+"-clip"}function j(){var a=c.utils.appendOrSelect(v,"defs"),d=i(),e=c.utils.appendOrSelect(a,"#"+d,"clipPath").attr("id",d),f=2*ba;c.utils.appendOrSelect(e,"rect").attr("width",b.xAxisLength()+f).attr("height",b.yAxisHeight()+f).attr("transform","translate(-"+ba+", -"+ba+")")}function k(a){b.isOrdinal()&&(S=!1),f(b.g(),a),b._prepareYAxis(b.g()),b.plotData(),(b.elasticX()||W||a)&&b.renderXAxis(b.g()),(b.elasticY()||W||a)&&b.renderYAxis(b.g()),a?b.renderBrush(b.g(),!1):b.redrawBrush(b.g(),W),b.fadeDeselectedArea(),W=!1}function l(){aa?b._enableMouseZoom():_&&b._disableMouseZoom()}function m(b,c){var d=[];return d[0]=a.max([b[0],c[0]]),d[1]=a.min([b[1],c[1]]),d}function n(a,b){return a||b?a&&b?0===a.length&&0===b.length?!0:a[0].valueOf()===b[0].valueOf()&&a[1].valueOf()===b[1].valueOf():!1:!0}function o(a){return a instanceof Array&&a.length>1}var p="grid-line",q="horizontal",r="vertical",s="y-axis-label",t="x-axis-label",u=12;b=c.colorMixin(c.marginMixin(c.baseMixin(b))),b.colors(a.scale.category10()),b._mandatoryAttributes().push("x");var v,w,x,y,z,A,B,C,D,E,F,G,H,I=a.svg.axis().orient("bottom"),J=c.units.integers,K=0,L=!1,M=0,N=a.svg.axis().orient("left"),O=0,P=!1,Q=0,R=a.svg.brush(),S=!0,T=!1,U=!1,V=!1,W=!1,X=[1,1/0],Y=!0,Z=a.behavior.zoom().on("zoom",d),$=a.behavior.zoom().on("zoom",null),_=!1,aa=!1,ba=0,ca=.5,da=0,ea=!1;return b.rescale=function(){return F=void 0,W=!0,b},b.resizing=function(){return W},b.rangeChart=function(a){return arguments.length?(G=a,G.focusChart(b),b):G},b.zoomScale=function(a){return arguments.length?(X=a,b):X},b.zoomOutRestrict=function(a){return arguments.length?(X[0]=a?1:0,Y=a,b):Y},b._generateG=function(a){v=void 0===a?b.svg():a;var c=window.location.href.split("#")[0];return w=v.append("g"),x=w.append("g").attr("class","chart-body").attr("transform","translate("+b.margins().left+", "+b.margins().top+")").attr("clip-path","url("+c+"#"+i()+")"),w},b.g=function(a){return arguments.length?(w=a,b):w},b.mouseZoomable=function(a){return arguments.length?(aa=a,b):aa},b.chartBodyG=function(a){return arguments.length?(x=a,b):x},b.x=function(a){return arguments.length?(y=a,z=y.domain(),b.rescale(),b):y},b.xOriginalDomain=function(){return z},b.xUnits=function(a){return arguments.length?(J=a,b):J},b.xAxis=function(a){return arguments.length?(I=a,b):I},b.elasticX=function(a){return arguments.length?(L=a,b):L},b.xAxisPadding=function(a){return arguments.length?(K=a,b):K},b.xUnitCount=function(){if(void 0===F){var a=b.xUnits()(b.x().domain()[0],b.x().domain()[1],b.x().domain());F=a instanceof Array?a.length:a}return F},b.useRightYAxis=function(a){return arguments.length?(ea=a,b):ea},b.isOrdinal=function(){return b.xUnits()===c.units.ordinal},b._useOuterPadding=function(){return!0},b._ordinalXDomain=function(){var a=b._computeOrderedGroups(b.data());return a.map(b.keyAccessor())},b.renderXAxis=function(a){var d=a.selectAll("g.x");d.empty()&&(d=a.append("g").attr("class","axis x").attr("transform","translate("+b.margins().left+","+b._xAxisY()+")"));var e=a.selectAll("text."+t);e.empty()&&b.xAxisLabel()&&(e=a.append("text").attr("class",t).attr("transform","translate("+(b.margins().left+b.xAxisLength()/2)+","+(b.height()-M)+")").attr("text-anchor","middle")),b.xAxisLabel()&&e.text()!==b.xAxisLabel()&&e.text(b.xAxisLabel()),c.transition(d,b.transitionDuration()).attr("transform","translate("+b.margins().left+","+b._xAxisY()+")").call(I),c.transition(e,b.transitionDuration()).attr("transform","translate("+(b.margins().left+b.xAxisLength()/2)+","+(b.height()-M)+")")},b._xAxisY=function(){return b.height()-b.margins().bottom},b.xAxisLength=function(){return b.effectiveWidth()},b.xAxisLabel=function(a,c){return arguments.length?(A=a,b.margins().bottom-=M,M=void 0===c?u:c,b.margins().bottom+=M,b):A},b._prepareYAxis=function(c){if(void 0===C||b.elasticY()){void 0===C&&(C=a.scale.linear());var d=b.yAxisMin()||0,e=b.yAxisMax()||0;C.domain([d,e]).rangeRound([b.yAxisHeight(),0])}C.range([b.yAxisHeight(),0]),N=N.scale(C),ea&&N.orient("right"),b._renderHorizontalGridLinesForAxis(c,C,N)},b.renderYAxisLabel=function(a,d,e,f){f=f||Q;var g=b.g().selectAll("text."+s+"."+a+"-label"),h=b.margins().top+b.yAxisHeight()/2;g.empty()&&d&&(g=b.g().append("text").attr("transform","translate("+f+","+h+"),rotate("+e+")").attr("class",s+" "+a+"-label").attr("text-anchor","middle").text(d)),d&&g.text()!==d&&g.text(d),c.transition(g,b.transitionDuration()).attr("transform","translate("+f+","+h+"),rotate("+e+")")},b.renderYAxisAt=function(a,d,e){var f=b.g().selectAll("g."+a);f.empty()&&(f=b.g().append("g").attr("class","axis "+a).attr("transform","translate("+e+","+b.margins().top+")")),c.transition(f,b.transitionDuration()).attr("transform","translate("+e+","+b.margins().top+")").call(d)},b.renderYAxis=function(){var a=ea?b.width()-b.margins().right:b._yAxisX();b.renderYAxisAt("y",N,a);var c=ea?b.width()-Q:Q,d=ea?90:-90;b.renderYAxisLabel("y",b.yAxisLabel(),d,c)},b._renderHorizontalGridLinesForAxis=function(a,d,e){var f=a.selectAll("g."+q);if(T){var g=e.tickValues()?e.tickValues():d.ticks(e.ticks()[0]);f.empty()&&(f=a.insert("g",":first-child").attr("class",p+" "+q).attr("transform","translate("+b.margins().left+","+b.margins().top+")"));var h=f.selectAll("line").data(g),i=h.enter().append("line").attr("x1",1).attr("y1",function(a){return d(a)}).attr("x2",b.xAxisLength()).attr("y2",function(a){return d(a)}).attr("opacity",0);c.transition(i,b.transitionDuration()).attr("opacity",1),c.transition(h,b.transitionDuration()).attr("x1",1).attr("y1",function(a){return d(a)}).attr("x2",b.xAxisLength()).attr("y2",function(a){return d(a)}),h.exit().remove()}else f.selectAll("line").remove()},b._yAxisX=function(){return b.useRightYAxis()?b.width()-b.margins().right:b.margins().left},b.yAxisLabel=function(a,c){return arguments.length?(D=a,b.margins().left-=Q,Q=void 0===c?u:c,b.margins().left+=Q,b):D},b.y=function(a){return arguments.length?(C=a,b.rescale(),b):C},b.yAxis=function(a){return arguments.length?(N=a,b):N},b.elasticY=function(a){return arguments.length?(P=a,b):P},b.renderHorizontalGridLines=function(a){return arguments.length?(T=a,b):T},b.renderVerticalGridLines=function(a){return arguments.length?(U=a,b):U},b.xAxisMin=function(){var d=a.min(b.data(),function(a){return b.keyAccessor()(a)});return c.utils.subtract(d,K)},b.xAxisMax=function(){var d=a.max(b.data(),function(a){return b.keyAccessor()(a)});return c.utils.add(d,K)},b.yAxisMin=function(){var d=a.min(b.data(),function(a){return b.valueAccessor()(a)});return c.utils.subtract(d,O)},b.yAxisMax=function(){var d=a.max(b.data(),function(a){return b.valueAccessor()(a)});return c.utils.add(d,O)},b.yAxisPadding=function(a){return arguments.length?(O=a,b):O},b.yAxisHeight=function(){return b.effectiveHeight()},b.round=function(a){return arguments.length?(E=a,b):E},b._rangeBandPadding=function(a){return arguments.length?(da=a,b):da},b._outerRangeBandPadding=function(a){return arguments.length?(ca=a,b):ca},c.override(b,"filter",function(a){return arguments.length?(b._filter(a),a?b.brush().extent(a):b.brush().clear(),b):b._filter()}),b.brush=function(a){return arguments.length?(R=a,b):R},b.renderBrush=function(a){if(S){R.on("brush",b._brushing),R.on("brushstart",b._disableMouseZoom),R.on("brushend",l);var c=a.append("g").attr("class","brush").attr("transform","translate("+b.margins().left+","+b.margins().top+")").call(R.x(b.x()));b.setBrushY(c,!1),b.setHandlePaths(c),b.hasFilter()&&b.redrawBrush(a,!1)}},b.setHandlePaths=function(a){a.selectAll(".resize").append("path").attr("d",b.resizeHandlePath)},b.setBrushY=function(a){a.selectAll(".brush rect").attr("height",h()),a.selectAll(".resize path").attr("d",b.resizeHandlePath)},b.extendBrush=function(){var a=R.extent();return b.round()&&(a[0]=a.map(b.round())[0],a[1]=a.map(b.round())[1],w.select(".brush").call(R.extent(a))),a},b.brushIsEmpty=function(a){return R.empty()||!a||a[1]<=a[0]},b._brushing=function(){var a=b.extendBrush();if(b.redrawBrush(w,!1),b.brushIsEmpty(a))c.events.trigger(function(){b.filter(null),b.redrawGroup()},c.constants.EVENT_DELAY);else{var d=c.filters.RangedFilter(a[0],a[1]);c.events.trigger(function(){b.replaceFilter(d),b.redrawGroup()},c.constants.EVENT_DELAY)}},b.redrawBrush=function(a,d){if(S){b.filter()&&b.brush().empty()&&b.brush().extent(b.filter());var e=c.optionalTransition(d,b.transitionDuration())(a.select("g.brush"));b.setBrushY(e),e.call(b.brush().x(b.x()).extent(b.brush().extent()))}b.fadeDeselectedArea()},b.fadeDeselectedArea=function(){},b.resizeHandlePath=function(a){var b=+("e"===a),c=b?1:-1,d=h()/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"ZM"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)},b.clipPadding=function(a){return arguments.length?(ba=a,b):ba},b._preprocessData=function(){},b._doRender=function(){return b.resetSvg(),b._preprocessData(),b._generateG(),j(),k(!0),l(),b},b._doRedraw=function(){return b._preprocessData(),k(!1),j(),b},b._enableMouseZoom=function(){_=!0,Z.x(b.x()).scaleExtent(X).size([b.width(),b.height()]).duration(b.transitionDuration()),b.root().call(Z)},b._disableMouseZoom=function(){b.root().call($)},b.focus=function(a){o(a)?b.x().domain(a):b.x().domain(z),Z.x(b.x()),d()},b.refocused=function(){return V},b.focusChart=function(a){return arguments.length?(H=a,b.on("filtered",function(a){a.filter()?n(a.filter(),H.filter())||c.events.trigger(function(){H.focus(a.filter())}):c.events.trigger(function(){H.x().domain(H.xOriginalDomain())})}),b):H},b.brushOn=function(a){return arguments.length?(S=a,b):S},b},c.stackMixin=function(b){function d(a,c){var d=a.accessor||b.valueAccessor();return a.name=String(a.name||c),a.values=a.group.all().map(function(c,e){return{x:b.keyAccessor()(c,e),y:a.hidden?null:d(c,e),data:c,layer:a.name,hidden:a.hidden}}),a.values=a.values.filter(e()),a.values}function e(){if(!b.x())return a.functor(!0);var c=b.x().domain();return b.isOrdinal()?function(){return!0}:b.elasticX()?function(){return!0}:function(a){return a.x>=c[0]&&a.x<=c[c.length-1]}}function f(a){var b=j.map(c.pluck("name")).indexOf(a);return j[b]}function g(){var a=b.data().map(function(a){return a.values});return Array.prototype.concat.apply([],a)}function h(a){return!a.hidden}var i=a.layout.stack().values(d),j=[],k={},l=!1;return b.stack=function(a,c,d){if(!arguments.length)return j;arguments.length<=2&&(d=c);var e={group:a};return"string"==typeof c&&(e.name=c),"function"==typeof d&&(e.accessor=d),j.push(e),b},c.override(b,"group",function(a,c,d){return arguments.length?(j=[],k={},b.stack(a,c),d&&b.valueAccessor(d),b._group(a,c)):b._group()}),b.hidableStacks=function(a){return arguments.length?(l=a,b):l},b.hideStack=function(a){var c=f(a);return c&&(c.hidden=!0),b},b.showStack=function(a){var c=f(a);return c&&(c.hidden=!1),b},b.getValueAccessorByIndex=function(a){return j[a].accessor||b.valueAccessor()},b.yAxisMin=function(){var d=a.min(g(),function(a){return a.y+a.y0<a.y0?a.y+a.y0:a.y0});return c.utils.subtract(d,b.yAxisPadding())},b.yAxisMax=function(){var d=a.max(g(),function(a){return a.y+a.y0});return c.utils.add(d,b.yAxisPadding())},b.xAxisMin=function(){var d=a.min(g(),c.pluck("x"));return c.utils.subtract(d,b.xAxisPadding())},b.xAxisMax=function(){var d=a.max(g(),c.pluck("x"));return c.utils.add(d,b.xAxisPadding())},c.override(b,"title",function(a,c){return a?"function"==typeof a?b._title(a):a===b._groupName&&"function"==typeof c?b._title(c):"function"!=typeof c?k[a]||b._title():(k[a]=c,b):b._title()}),b.stackLayout=function(c){return arguments.length?(i=c,i.values()===a.layout.stack().values()&&i.values(d),b):i},b.data(function(){var a=j.filter(h);return a.length?b.stackLayout()(a):[]}),b._ordinalXDomain=function(){var a=g().map(c.pluck("data")),d=b._computeOrderedGroups(a);return d.map(b.keyAccessor())},b.colorAccessor(function(a){var b=this.layer||this.name||a.name||a.layer;return b}),b.legendables=function(){return j.map(function(a,c){return{chart:b,name:a.name,hidden:a.hidden||!1,color:b.getColor.call(a,a.values,c)}})},b.isLegendableHidden=function(a){var b=f(a.name);return b?b.hidden:!1},b.legendToggle=function(a){l&&(b.isLegendableHidden(a)?b.showStack(a.name):b.hideStack(a.name),b.renderGroup())},b},c.capMixin=function(b){var d=1/0,e="Others",f=function(c){var d=a.sum(c,b.valueAccessor()),f=b.group().all(),g=a.sum(f,b.valueAccessor()),h=c.map(b.keyAccessor()),i=f.map(b.keyAccessor()),j=a.set(h),k=i.filter(function(a){return!j.has(a)});return g>d?c.concat([{others:k,key:e,value:g-d}]):c};return b.cappedKeyAccessor=function(a,c){return a.others?a.key:b.keyAccessor()(a,c)},b.cappedValueAccessor=function(a,c){return a.others?a.value:b.valueAccessor()(a,c)},b.data(function(a){if(d===1/0)return b._computeOrderedGroups(a.all());var c=a.top(d);return c=b._computeOrderedGroups(c),f?f(c):c}),b.cap=function(a){return arguments.length?(d=a,b):d},b.othersLabel=function(a){return arguments.length?(e=a,b):e},b.othersGrouper=function(a){return arguments.length?(f=a,b):f},c.override(b,"onClick",function(a){a.others&&b.filter([a.others]),b._onClick(a)}),b},c.bubbleMixin=function(b){var d=.3,e=10;b.BUBBLE_NODE_CLASS="node",b.BUBBLE_CLASS="bubble",b.MIN_RADIUS=10,b=c.colorMixin(b),b.renderLabel(!0),b.data(function(a){return a.top(1/0)});var f=a.scale.linear().domain([0,100]),g=function(a){return a.r};b.r=function(a){return arguments.length?(f=a,b):f},b.radiusValueAccessor=function(a){return arguments.length?(g=a,b):g},b.rMin=function(){var c=a.min(b.data(),function(a){return b.radiusValueAccessor()(a)});return c},b.rMax=function(){var c=a.max(b.data(),function(a){return b.radiusValueAccessor()(a)});return c},b.bubbleR=function(a){var c=b.radiusValueAccessor()(a),d=b.r()(c);return(isNaN(d)||0>=c)&&(d=0),d};var h=function(a){return b.label()(a)},i=function(a){return b.bubbleR(a)>e},j=function(a){return i(a)?1:0},k=function(a){return i(a)?"all":"none"};b._doRenderLabel=function(a){if(b.renderLabel()){var d=a.select("text");d.empty()&&(d=a.append("text").attr("text-anchor","middle").attr("dy",".3em").on("click",b.onClick)),d.attr("opacity",0).attr("pointer-events",k).text(h),c.transition(d,b.transitionDuration()).attr("opacity",j)}},b.doUpdateLabels=function(a){if(b.renderLabel()){var d=a.selectAll("text").attr("pointer-events",k).text(h);c.transition(d,b.transitionDuration()).attr("opacity",j)}};var l=function(a){return b.title()(a)};return b._doRenderTitles=function(a){if(b.renderTitle()){var c=a.select("title");c.empty()&&a.append("title").text(l)}},b.doUpdateTitles=function(a){b.renderTitle()&&a.selectAll("title").text(l)},b.minRadius=function(a){return arguments.length?(b.MIN_RADIUS=a,b):b.MIN_RADIUS},b.minRadiusWithLabel=function(a){return arguments.length?(e=a,b):e},b.maxBubbleRelativeSize=function(a){return arguments.length?(d=a,b):d},b.fadeDeselectedArea=function(){
21
+ b.hasFilter()?b.selectAll("g."+b.BUBBLE_NODE_CLASS).each(function(a){b.isSelectedNode(a)?b.highlightSelected(this):b.fadeDeselected(this)}):b.selectAll("g."+b.BUBBLE_NODE_CLASS).each(function(){b.resetHighlight(this)})},b.isSelectedNode=function(a){return b.hasFilter(a.key)},b.onClick=function(a){var d=a.key;c.events.trigger(function(){b.filter(d),b.redrawGroup()})},b},c.pieChart=function(b,d){function e(){E=F?F:a.min([S.width(),S.height()])/2;var b,d=s(),e=u();if(a.sum(S.data(),S.valueAccessor())?(b=e(S.data()),G.classed(M,!1)):(b=e([{key:N,value:1,others:[N]}]),G.classed(M,!0)),G){var g=G.selectAll("g."+L).data(b);f(g,d,b),m(b,d),q(g),r(),c.transition(G,S.transitionDuration()).attr("transform","translate("+S.cx()+","+S.cy()+")")}}function f(a,b,c){var d=g(a);h(d,b),i(d),k(c,b)}function g(a){var b=a.enter().append("g").attr("class",function(a,b){return L+" _"+b});return b}function h(a,b){var d=a.append("path").attr("fill",z).on("click",A).attr("d",function(a,c){return B(a,c,b)});c.transition(d,S.transitionDuration(),function(a){a.attrTween("d",x)})}function i(a){S.renderTitle()&&a.append("title").text(function(a){return S.title()(a.data)})}function j(a,b){S._applyLabelText(a),c.transition(a,S.transitionDuration()).attr("transform",function(a){return C(a,b)}).attr("text-anchor","middle")}function k(a,b){if(S.renderLabel()){var c=G.selectAll("text."+L).data(a);c.exit().remove();var d=c.enter().append("text").attr("class",function(a,b){var c=L+" _"+b;return J&&(c+=" external"),c}).on("click",A);j(d,b),J&&R&&l(a,b)}}function l(b,d){var e=G.selectAll("polyline."+L).data(b);e.enter().append("polyline").attr("class",function(a,b){return"pie-path _"+b+" "+L}),e.exit().remove(),c.transition(e,S.transitionDuration()).attrTween("points",function(b){this._current=this._current||b;var c=a.interpolate(this._current,b);return this._current=c(0),function(b){var e=a.svg.arc().outerRadius(E-P+J).innerRadius(E-P),f=c(b);return[d.centroid(f),e.centroid(f)]}}).style("visibility",function(a){return a.endAngle-a.startAngle<1e-4?"hidden":"visible"})}function m(a,b){n(a,b),o(a,b),p(a)}function n(a,b){var d=G.selectAll("g."+L).data(a).select("path").attr("d",function(a,c){return B(a,c,b)});c.transition(d,S.transitionDuration(),function(a){a.attrTween("d",x)}).attr("fill",z)}function o(a,b){if(S.renderLabel()){var c=G.selectAll("text."+L).data(a);j(c,b),J&&R&&l(a,b)}}function p(a){S.renderTitle()&&G.selectAll("g."+L).data(a).select("title").text(function(a){return S.title()(a.data)})}function q(a){a.exit().remove()}function r(){S.hasFilter()?S.selectAll("g."+L).each(function(a){t(a)?S.highlightSelected(this):S.fadeDeselected(this)}):S.selectAll("g."+L).each(function(){S.resetHighlight(this)})}function s(){return a.svg.arc().outerRadius(E-P).innerRadius(O)}function t(a){return S.hasFilter(S.cappedKeyAccessor(a.data))}function u(){return a.layout.pie().sort(null).value(S.cappedValueAccessor)}function v(a){var b=a.endAngle-a.startAngle;return isNaN(b)||Q>b}function w(a){return 0===S.cappedValueAccessor(a)}function x(b){b.innerRadius=O;var c=this._current;c=y(c)?{startAngle:0,endAngle:0}:{startAngle:c.startAngle,endAngle:c.endAngle};var d=a.interpolate(c,b);return this._current=d(0),function(a){return B(d(a),0,s())}}function y(a){return!a||isNaN(a.startAngle)||isNaN(a.endAngle)}function z(a,b){return S.getColor(a.data,b)}function A(a,b){G.attr("class")!==M&&S.onClick(a.data,b)}function B(a,b,c){var d=c(a,b);return d.indexOf("NaN")>=0&&(d="M0,0"),d}function C(b,c){var d;return d=J?a.svg.arc().outerRadius(E-P+J).innerRadius(E-P+J).centroid(b):c.centroid(b),isNaN(d[0])||isNaN(d[1])?"translate(0,0)":"translate("+d+")"}function D(b,c){S.selectAll("g.pie-slice").each(function(d){b.name===d.data.key&&a.select(this).classed("highlight",c)})}var E,F,G,H,I,J,K=.5,L="pie-slice",M="empty-chart",N="empty",O=0,P=0,Q=K,R=!1,S=c.capMixin(c.colorMixin(c.baseMixin({})));return S.colorAccessor(S.cappedKeyAccessor),S.title(function(a){return S.cappedKeyAccessor(a)+": "+S.cappedValueAccessor(a)}),S.slicesCap=S.cap,S.label(S.cappedKeyAccessor),S.renderLabel(!0),S.transitionDuration(350),S._doRender=function(){return S.resetSvg(),G=S.svg().append("g").attr("transform","translate("+S.cx()+","+S.cy()+")"),e(),S},S._applyLabelText=function(a){a.text(function(a){var b=a.data;return!w(b)&&!v(a)||t(a)?S.label()(a.data):""})},S.externalRadiusPadding=function(a){return arguments.length?(P=a,S):P},S.innerRadius=function(a){return arguments.length?(O=a,S):O},S.radius=function(a){return arguments.length?(F=a,S):F},S.cx=function(a){return arguments.length?(H=a,S):H||S.width()/2},S.cy=function(a){return arguments.length?(I=a,S):I||S.height()/2},S._doRedraw=function(){return e(),S},S.minAngleForLabel=function(a){return arguments.length?(Q=a,S):Q},S.emptyTitle=function(a){return 0===arguments.length?N:(N=a,S)},S.externalLabels=function(a){return 0===arguments.length?J:(J=a?a:void 0,S)},S.drawPaths=function(a){return 0===arguments.length?R:(R=a,S)},S.legendables=function(){return S.data().map(function(a,b){var c={name:a.key,data:a.value,others:a.others,chart:S};return c.color=S.getColor(a,b),c})},S.legendHighlight=function(a){D(a,!0)},S.legendReset=function(a){D(a,!1)},S.legendToggle=function(a){S.onClick({key:a.name,others:a.others})},S.anchor(b,d)},c.barChart=function(b,d){function e(a){return c.utils.safeNumber(Math.abs(n.y()(a.y+a.y0)-n.y()(a.y0)))}function f(a,b,d){var f=a.selectAll("text.barLabel").data(d.values,c.pluck("x"));f.enter().append("text").attr("class","barLabel").attr("text-anchor","middle"),n.isOrdinal()&&(f.on("click",n.onClick),f.attr("cursor","pointer")),c.transition(f,n.transitionDuration()).attr("x",function(a){var b=n.x()(a.x);return p||(b+=j/2),c.utils.safeNumber(b)}).attr("y",function(a){var b=n.y()(a.y+a.y0);return a.y<0&&(b-=e(a)),c.utils.safeNumber(b-m)}).text(function(a){return n.label()(a)}),c.transition(f.exit(),n.transitionDuration()).attr("height",0).remove()}function g(a,b,d){var f=a.selectAll("rect.bar").data(d.values,c.pluck("x")),g=f.enter().append("rect").attr("class","bar").attr("fill",c.pluck("data",n.getColor)).attr("y",n.yAxisHeight()).attr("height",0);n.renderTitle()&&g.append("title").text(c.pluck("data",n.title(d.name))),n.isOrdinal()&&f.on("click",n.onClick),c.transition(f,n.transitionDuration()).attr("x",function(a){var b=n.x()(a.x);return p&&(b-=j/2),n.isOrdinal()&&void 0!==o&&(b+=o/2),c.utils.safeNumber(b)}).attr("y",function(a){var b=n.y()(a.y+a.y0);return a.y<0&&(b-=e(a)),c.utils.safeNumber(b)}).attr("width",j).attr("height",function(a){return e(a)}).attr("fill",c.pluck("data",n.getColor)).select("title").text(c.pluck("data",n.title(d.name))),c.transition(f.exit(),n.transitionDuration()).attr("height",0).remove()}function h(){if(void 0===j){var a=n.xUnitCount();j=n.isOrdinal()&&void 0===o?Math.floor(n.x().rangeBand()):o?Math.floor((n.xAxisLength()-(a-1)*o)/a):Math.floor(n.xAxisLength()/(1+n.barPadding())/a),(j===1/0||isNaN(j)||k>j)&&(j=k)}}function i(b,c){return function(){var d=a.select(this),e=d.attr("fill")===b;return c?!e:e}}var j,k=1,l=2,m=3,n=c.stackMixin(c.coordinateGridMixin({})),o=l,p=!1,q=!1;return c.override(n,"rescale",function(){return n._rescale(),j=void 0,n}),c.override(n,"render",function(){return n.round()&&p&&!q&&c.logger.warn("By default, brush rounding is disabled if bars are centered. See dc.js bar chart API documentation for details."),n._render()}),n.label(function(a){return c.utils.printSingleValue(a.y0+a.y)},!1),n.plotData=function(){var b=n.chartBodyG().selectAll("g.stack").data(n.data());h(),b.enter().append("g").attr("class",function(a,b){return"stack _"+b});var c=b.size()-1;b.each(function(b,d){var e=a.select(this);g(e,d,b),n.renderLabel()&&c===d&&f(e,d,b)})},n.fadeDeselectedArea=function(){var a=n.chartBodyG().selectAll("rect.bar"),b=n.brush().extent();if(n.isOrdinal())n.hasFilter()?(a.classed(c.constants.SELECTED_CLASS,function(a){return n.hasFilter(a.x)}),a.classed(c.constants.DESELECTED_CLASS,function(a){return!n.hasFilter(a.x)})):(a.classed(c.constants.SELECTED_CLASS,!1),a.classed(c.constants.DESELECTED_CLASS,!1));else if(n.brushIsEmpty(b))a.classed(c.constants.DESELECTED_CLASS,!1);else{var d=b[0],e=b[1];a.classed(c.constants.DESELECTED_CLASS,function(a){return a.x<d||a.x>=e})}},n.centerBar=function(a){return arguments.length?(p=a,n):p},c.override(n,"onClick",function(a){n._onClick(a.data)}),n.barPadding=function(a){return arguments.length?(n._rangeBandPadding(a),o=void 0,n):n._rangeBandPadding()},n._useOuterPadding=function(){return void 0===o},n.outerPadding=n._outerRangeBandPadding,n.gap=function(a){return arguments.length?(o=a,n):o},n.extendBrush=function(){var a=n.brush().extent();return!n.round()||p&&!q||(a[0]=a.map(n.round())[0],a[1]=a.map(n.round())[1],n.chartBodyG().select(".brush").call(n.brush().extent(a))),a},n.alwaysUseRounding=function(a){return arguments.length?(q=a,n):q},n.legendHighlight=function(a){n.isLegendableHidden(a)||n.g().selectAll("rect.bar").classed("highlight",i(a.color)).classed("fadeout",i(a.color,!0))},n.legendReset=function(){n.g().selectAll("rect.bar").classed("highlight",!1).classed("fadeout",!1)},c.override(n,"xAxisMax",function(){var a=this._xAxisMax();if("resolution"in n.xUnits()){var b=n.xUnits().resolution;a+=b}return a}),n.anchor(b,d)},c.lineChart=function(b,d){function e(a,b){return B.getColor.call(a,a.values,b)}function f(b,d){var f=a.svg.line().x(function(a){return B.x()(a.x)}).y(function(a){return B.y()(a.y+a.y0)}).interpolate(H).tension(I);s&&f.defined(s);var g=b.append("path").attr("class","line").attr("stroke",e);t&&g.attr("stroke-dasharray",t),c.transition(d.select("path.line"),B.transitionDuration()).attr("stroke",e).attr("d",function(a){return h(f(a.values))})}function g(b,d){if(C){var f=a.svg.area().x(function(a){return B.x()(a.x)}).y(function(a){return B.y()(a.y+a.y0)}).y0(function(a){return B.y()(a.y0)}).interpolate(H).tension(I);s&&f.defined(s),b.append("path").attr("class","area").attr("fill",e).attr("d",function(a){return h(f(a.values))}),c.transition(d.select("path.area"),B.transitionDuration()).attr("fill",e).attr("d",function(a){return h(f(a.values))})}}function h(a){return!a||a.indexOf("NaN")>=0?"M0,0":a}function i(b,d){if(!B.brushOn()&&B.xyTipsOn()){var e=v+"-list",f=b.select("g."+e);f.empty()&&(f=b.append("g").attr("class",e)),d.each(function(b,d){var e=b.values;s&&(e=e.filter(s));var g=f.select("g."+v+"._"+d);g.empty()&&(g=f.append("g").attr("class",v+" _"+d)),k(g);var h=g.selectAll("circle."+w).data(e,c.pluck("x"));h.enter().append("circle").attr("class",w).attr("r",n()).style("fill-opacity",F).style("stroke-opacity",G).on("mousemove",function(){var b=a.select(this);l(b),m(b,g)}).on("mouseout",function(){var b=a.select(this);o(b),p(g)}),h.attr("cx",function(a){return c.utils.safeNumber(B.x()(a.x))}).attr("cy",function(a){return c.utils.safeNumber(B.y()(a.y+a.y0))}).attr("fill",B.getColor).call(q,b),h.exit().remove()})}}function j(b){b.each(function(b,d){var e=a.select(this),f=e.selectAll("text.lineLabel").data(b.values,c.pluck("x"));f.enter().append("text").attr("class","lineLabel").attr("text-anchor","middle"),c.transition(f,B.transitionDuration()).attr("x",function(a){return c.utils.safeNumber(B.x()(a.x))}).attr("y",function(a){var b=B.y()(a.y+a.y0)-A;return c.utils.safeNumber(b)}).text(function(a){return B.label()(a)}),c.transition(f.exit(),B.transitionDuration()).attr("height",0).remove()})}function k(a){var b=a.select("path."+x).empty()?a.append("path").attr("class",x):a.select("path."+x);b.style("display","none").attr("stroke-dasharray","5,5");var c=a.select("path."+y).empty()?a.append("path").attr("class",y):a.select("path."+y);c.style("display","none").attr("stroke-dasharray","5,5")}function l(a){return a.style("fill-opacity",.8),a.style("stroke-opacity",.8),a.attr("r",D),a}function m(a,b){var c=a.attr("cx"),d=a.attr("cy"),e=B._yAxisX()-B.margins().left,f="M"+e+" "+d+"L"+c+" "+d,g="M"+c+" "+B.yAxisHeight()+"L"+c+" "+d;b.select("path."+x).style("display","").attr("d",f),b.select("path."+y).style("display","").attr("d",g)}function n(){return E||D}function o(a){a.style("fill-opacity",F).style("stroke-opacity",G).attr("r",n())}function p(a){a.select("path."+x).style("display","none"),a.select("path."+y).style("display","none")}function q(a,b){B.renderTitle()&&(a.selectAll("title").remove(),a.append("title").text(c.pluck("data",B.title(b.name))))}function r(b,c,d){return function(){var e=a.select(this),f=e.attr("stroke")===b&&e.attr("stroke-dasharray")===(c instanceof Array?c.join(","):null)||e.attr("fill")===b;return d?!f:f}}var s,t,u=5,v="dc-tooltip",w="dot",x="yRef",y="xRef",z=1e-6,A=3,B=c.stackMixin(c.coordinateGridMixin({})),C=!1,D=u,E=null,F=z,G=z,H="linear",I=.7,J=!0;return B.transitionDuration(500),B._rangeBandPadding(1),B.plotData=function(){var a=B.chartBodyG(),b=a.selectAll("g.stack-list");b.empty()&&(b=a.append("g").attr("class","stack-list"));var c=b.selectAll("g.stack").data(B.data()),d=c.enter().append("g").attr("class",function(a,b){return"stack _"+b});f(d,c),g(d,c),i(a,c),B.renderLabel()&&j(c)},B.interpolate=function(a){return arguments.length?(H=a,B):H},B.tension=function(a){return arguments.length?(I=a,B):I},B.defined=function(a){return arguments.length?(s=a,B):s},B.dashStyle=function(a){return arguments.length?(t=a,B):t},B.renderArea=function(a){return arguments.length?(C=a,B):C},B.label(function(a){return c.utils.printSingleValue(a.y0+a.y)},!1),B.xyTipsOn=function(a){return arguments.length?(J=a,B):J},B.dotRadius=function(a){return arguments.length?(D=a,B):D},B.renderDataPoints=function(a){return arguments.length?(a?(F=a.fillOpacity||.8,G=a.strokeOpacity||.8,E=a.radius||2):(F=z,G=z,E=null),B):{fillOpacity:F,strokeOpacity:G,radius:E}},B.legendHighlight=function(a){B.isLegendableHidden(a)||B.g().selectAll("path.line, path.area").classed("highlight",r(a.color,a.dashstyle)).classed("fadeout",r(a.color,a.dashstyle,!0))},B.legendReset=function(){B.g().selectAll("path.line, path.area").classed("highlight",!1).classed("fadeout",!1)},c.override(B,"legendables",function(){var a=B._legendables();return t?a.map(function(a){return a.dashstyle=t,a}):a}),B.anchor(b,d)},c.dataCount=function(b,d){var e=a.format(",d"),f=c.baseMixin({}),g={some:"",all:""};return f.html=function(a){return arguments.length?(a.all&&(g.all=a.all),a.some&&(g.some=a.some),f):g},f.formatNumber=function(a){return arguments.length?(e=a,f):e},f._doRender=function(){var a=f.dimension().size(),b=f.group().value(),c=e(a),d=e(b);return a===b&&""!==g.all?f.root().html(g.all.replace("%total-count",c).replace("%filter-count",d)):""!==g.some?f.root().html(g.some.replace("%total-count",c).replace("%filter-count",d)):(f.selectAll(".total-count").text(c),f.selectAll(".filter-count").text(d)),f},f._doRedraw=function(){return f._doRender()},f.anchor(b,d)},c.dataTable=function(b,d){function e(){var a=!0;if(p.forEach(function(b){a&="function"==typeof b}),!a){var b=n.selectAll("thead").data([0]);b.enter().append("thead"),b.exit().remove();var c=b.selectAll("tr").data([0]);c.enter().append("tr"),c.exit().remove();var d=c.selectAll("th").data(p);d.enter().append("th"),d.exit().remove(),d.attr("class",m).html(function(a){return n._doColumnHeaderFormat(a)})}var e=n.root().selectAll("tbody").data(f(),function(a){return n.keyAccessor()(a)}),g=e.enter().append("tbody");return t===!0&&g.append("tr").attr("class",l).append("td").attr("class",i).attr("colspan",p.length).html(function(a){return n.keyAccessor()(a)}),e.exit().remove(),g}function f(){var b;return b=r===a.ascending?n.dimension().bottom(o):n.dimension().top(o),a.nest().key(n.group()).sortKeys(r).entries(b.sort(function(a,b){return r(q(a),q(b))}).slice(s,h))}function g(a){var b=a.order().selectAll("tr."+j).data(function(a){return a.values}),c=b.enter().append("tr").attr("class",j);return p.forEach(function(a,b){c.append("td").attr("class",k+" _"+b).html(function(b){return n._doColumnValueFormat(a,b)})}),b.exit().remove(),b}var h,i="dc-table-label",j="dc-table-row",k="dc-table-column",l="dc-table-group",m="dc-table-head",n=c.baseMixin({}),o=25,p=[],q=function(a){return a},r=a.ascending,s=0,t=!0;return n._doRender=function(){return n.selectAll("tbody").remove(),g(e()),n},n._doColumnValueFormat=function(a,b){return"function"==typeof a?a(b):"string"==typeof a?b[a]:a.format(b)},n._doColumnHeaderFormat=function(a){return"function"==typeof a?n._doColumnHeaderFnToString(a):"string"==typeof a?n._doColumnHeaderCapitalize(a):String(a.label)},n._doColumnHeaderCapitalize=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},n._doColumnHeaderFnToString=function(a){var b=String(a),c=b.indexOf("return ");if(c>=0){var d=b.lastIndexOf(";");if(d>=0){b=b.substring(c+7,d);var e=b.indexOf("numberFormat");e>=0&&(b=b.replace("numberFormat",""))}}return b},n._doRedraw=function(){return n._doRender()},n.size=function(a){return arguments.length?(o=a,n):o},n.beginSlice=function(a){return arguments.length?(s=a,n):s},n.endSlice=function(a){return arguments.length?(h=a,n):h},n.columns=function(a){return arguments.length?(p=a,n):p},n.sortBy=function(a){return arguments.length?(q=a,n):q},n.order=function(a){return arguments.length?(r=a,n):r},n.showGroups=function(a){return arguments.length?(t=a,n):t},n.anchor(b,d)},c.dataGrid=function(b,d){function e(){var a=m.root().selectAll("div."+l).data(f(),function(a){return m.keyAccessor()(a)}),b=a.enter().append("div").attr("class",l);return s&&b.html(function(a){return s(a)}),a.exit().remove(),b}function f(){var b=m.dimension().top(n);return a.nest().key(m.group()).sortKeys(q).entries(b.sort(function(a,b){return q(p(a),p(b))}).slice(r,h))}function g(a){var b=a.order().selectAll("div."+j).data(function(a){return a.values});return b.enter().append("div").attr("class",j).html(function(a){return o(a)}),b.exit().remove(),b}var h,i="dc-grid-label",j="dc-grid-item",k="dc-grid-group",l="dc-grid-top",m=c.baseMixin({}),n=999,o=function(a){return"you need to provide an html() handling param: "+JSON.stringify(a)},p=function(a){return a},q=a.ascending,r=0,s=function(a){return"<div class='"+k+"'><h1 class='"+i+"'>"+m.keyAccessor()(a)+"</h1></div>"};return m._doRender=function(){return m.selectAll("div."+l).remove(),g(e()),m},m._doRedraw=function(){return m._doRender()},m.beginSlice=function(a){return arguments.length?(r=a,m):r},m.endSlice=function(a){return arguments.length?(h=a,m):h},m.size=function(a){return arguments.length?(n=a,m):n},m.html=function(a){return arguments.length?(o=a,m):o},m.htmlGroup=function(a){return arguments.length?(s=a,m):s},m.sortBy=function(a){return arguments.length?(p=a,m):p},m.order=function(a){return arguments.length?(q=a,m):q},m.anchor(b,d)},c.bubbleChart=function(b,d){function e(a){var b=a.enter().append("g");b.attr("class",j.BUBBLE_NODE_CLASS).attr("transform",m).append("circle").attr("class",function(a,b){return j.BUBBLE_CLASS+" _"+b}).on("click",j.onClick).attr("fill",j.getColor).attr("r",0),c.transition(a,j.transitionDuration()).selectAll("circle."+j.BUBBLE_CLASS).attr("r",function(a){return j.bubbleR(a)}).attr("opacity",function(a){return j.bubbleR(a)>0?1:0}),j._doRenderLabel(b),j._doRenderTitles(b)}function f(a){c.transition(a,j.transitionDuration()).attr("transform",m).selectAll("circle."+j.BUBBLE_CLASS).attr("fill",j.getColor).attr("r",function(a){return j.bubbleR(a)}).attr("opacity",function(a){return j.bubbleR(a)>0?1:0}),j.doUpdateLabels(a),j.doUpdateTitles(a)}function g(a){a.exit().remove()}function h(a){var b=j.x()(j.keyAccessor()(a));return isNaN(b)&&(b=0),b}function i(a){var b=j.y()(j.valueAccessor()(a));return isNaN(b)&&(b=0),b}var j=c.bubbleMixin(c.coordinateGridMixin({})),k=!1,l=!1;j.transitionDuration(750);var m=function(a){return"translate("+h(a)+","+i(a)+")"};return j.elasticRadius=function(a){return arguments.length?(k=a,j):k},j.sortBubbleSize=function(a){return arguments.length?(l=a,j):l},j.plotData=function(){k&&j.r().domain([j.rMin(),j.rMax()]),j.r().range([j.MIN_RADIUS,j.xAxisLength()*j.maxBubbleRelativeSize()]);var b=j.data();if(l){var c=j.radiusValueAccessor();b.sort(function(b,d){return a.descending(c(b),c(d))})}var d=j.chartBodyG().selectAll("g."+j.BUBBLE_NODE_CLASS).data(b,function(a){return a.key});l&&d.order(),e(d),f(d),g(d),j.fadeDeselectedArea()},j.renderBrush=function(){},j.redrawBrush=function(){j.fadeDeselectedArea()},j.anchor(b,d)},c.compositeChart=function(b,d){function e(a,b){var c,d,e,f;if(a&&(c=l(),d=o()),b&&(e=m(),f=p()),v.alignYAxes()&&a&&b&&(0>c||0>e)){var g,h;0>c&&(g=d/c),0>e&&(h=f/e),0>c&&0>e?h>g?f=e*g:d=c*h:0>c?e=f/g:c=d/(f/e)}return{lyAxisMin:c,lyAxisMax:d,ryAxisMin:e,ryAxisMax:f}}function f(b){var c=void 0===v.rightY()||v.elasticY(),d=c||v.resizing();void 0===v.rightY()&&v.rightY(a.scale.linear()),c&&v.rightY().domain([b.ryAxisMin,b.ryAxisMax]),d&&v.rightY().rangeRound([v.yAxisHeight(),0]),v.rightY().range([v.yAxisHeight(),0]),v.rightYAxis(v.rightYAxis().scale(v.rightY())),v.rightYAxis().orient("right")}function g(b){var c=void 0===v.y()||v.elasticY(),d=c||v.resizing();void 0===v.y()&&v.y(a.scale.linear()),c&&v.y().domain([b.lyAxisMin,b.lyAxisMax]),d&&v.y().rangeRound([v.yAxisHeight(),0]),v.y().range([v.yAxisHeight(),0]),v.yAxis(v.yAxis().scale(v.y())),v.yAxis().orient("left")}function h(a,b){a._generateG(v.g()),a.g().attr("class",t+" _"+b)}function i(){return w.filter(function(a){return!a.useRightYAxis()})}function j(){return w.filter(function(a){return a.useRightYAxis()})}function k(a){return a.map(function(a){return a.yAxisMin()})}function l(){return a.min(k(i()))}function m(){return a.min(k(j()))}function n(a){return a.map(function(a){return a.yAxisMax()})}function o(){return c.utils.add(a.max(n(i())),v.yAxisPadding())}function p(){return c.utils.add(a.max(n(j())),v.yAxisPadding())}function q(){return w.map(function(a){return a.xAxisMin()})}function r(){return w.map(function(a){return a.xAxisMax()})}var s,t="sub",u=12,v=c.coordinateGridMixin({}),w=[],x={},y=!1,z=!0,A=!1,B=a.svg.axis(),C=0,D=u,E=!1;return v._mandatoryAttributes([]),v.transitionDuration(500),c.override(v,"_generateG",function(){for(var a=this.__generateG(),b=0;b<w.length;++b){var c=w[b];h(c,b),c.dimension()||c.dimension(v.dimension()),c.group()||c.group(v.group()),c.chartGroup(v.chartGroup()),c.svg(v.svg()),c.xUnits(v.xUnits()),c.transitionDuration(v.transitionDuration()),c.brushOn(v.brushOn()),c.renderTitle(v.renderTitle()),c.elasticX(v.elasticX())}return a}),v._brushing=function(){for(var a=v.extendBrush(),b=v.brushIsEmpty(a),c=0;c<w.length;++c)w[c].filter(null),b||w[c].filter(a)},v._prepareYAxis=function(){var a=0!==i().length,b=0!==j().length,c=e(a,b);a&&g(c),b&&f(c),i().length>0&&!E?v._renderHorizontalGridLinesForAxis(v.g(),v.y(),v.yAxis()):j().length>0&&v._renderHorizontalGridLinesForAxis(v.g(),s,B)},v.renderYAxis=function(){0!==i().length&&(v.renderYAxisAt("y",v.yAxis(),v.margins().left),v.renderYAxisLabel("y",v.yAxisLabel(),-90)),0!==j().length&&(v.renderYAxisAt("yr",v.rightYAxis(),v.width()-v.margins().right),v.renderYAxisLabel("yr",v.rightYAxisLabel(),90,v.width()-D))},v.plotData=function(){for(var a=0;a<w.length;++a){var b=w[a];b.g()||h(b,a),y&&b.colors(v.colors()),b.x(v.x()),b.xAxis(v.xAxis()),b.useRightYAxis()?(b.y(v.rightY()),b.yAxis(v.rightYAxis())):(b.y(v.y()),b.yAxis(v.yAxis())),b.plotData(),b._activateRenderlets()}},v.useRightAxisGridLines=function(a){return arguments?(E=a,v):E},v.childOptions=function(a){return arguments.length?(x=a,w.forEach(function(a){a.options(x)}),v):x},v.fadeDeselectedArea=function(){for(var a=0;a<w.length;++a){var b=w[a];b.brush(v.brush()),b.fadeDeselectedArea()}},v.rightYAxisLabel=function(a,b){return arguments.length?(C=a,v.margins().right-=D,D=void 0===b?u:b,v.margins().right+=D,v):C},v.compose=function(a){return w=a,w.forEach(function(a){a.height(v.height()),a.width(v.width()),a.margins(v.margins()),z&&a.title(v.title()),a.options(x)}),v},v.children=function(){return w},v.shareColors=function(a){return arguments.length?(y=a,v):y},v.shareTitle=function(a){return arguments.length?(z=a,v):z},v.rightY=function(a){return arguments.length?(s=a,v.rescale(),v):s},v.alignYAxes=function(a){return arguments.length?(A=a,v.rescale(),v):A},delete v.yAxisMin,delete v.yAxisMax,c.override(v,"xAxisMin",function(){return c.utils.subtract(a.min(q()),v.xAxisPadding())}),c.override(v,"xAxisMax",function(){return c.utils.add(a.max(r()),v.xAxisPadding())}),v.legendables=function(){return w.reduce(function(a,b){return y&&b.colors(v.colors()),a.push.apply(a,b.legendables()),a},[])},v.legendHighlight=function(a){for(var b=0;b<w.length;++b){var c=w[b];c.legendHighlight(a)}},v.legendReset=function(a){for(var b=0;b<w.length;++b){var c=w[b];c.legendReset(a)}},v.legendToggle=function(){console.log("composite should not be getting legendToggle itself")},v.rightYAxis=function(a){return arguments.length?(B=a,v):B},v.anchor(b,d)},c.seriesChart=function(b,d){function e(b,c){return a.ascending(i.keyAccessor()(b),i.keyAccessor()(c))}function f(a){j[a].g()&&j[a].g().remove(),delete j[a]}function g(){Object.keys(j).map(f),j={}}var h,i=c.compositeChart(b,d),j={},k=c.lineChart,l=a.ascending,m=e;return i._mandatoryAttributes().push("seriesAccessor","chart"),i.shareColors(!0),i._preprocessData=function(){var b,c=[],e=a.nest().key(h);l&&e.sortKeys(l),m&&e.sortValues(m);var g=e.entries(i.data()),n=g.map(function(e,f){var g=j[e.key]||k.call(i,i,d,e.key,f);return j[e.key]||(b=!0),j[e.key]=g,c.push(e.key),g.dimension(i.dimension()).group({all:a.functor(e.values)},e.key).keyAccessor(i.keyAccessor()).valueAccessor(i.valueAccessor()).brushOn(i.brushOn())});Object.keys(j).filter(function(a){return-1===c.indexOf(a)}).forEach(function(a){f(a),b=!0}),i._compose(n),b&&i.legend()&&i.legend().render()},i.chart=function(a){return arguments.length?(k=a,g(),i):k},i.seriesAccessor=function(a){return arguments.length?(h=a,g(),i):h},i.seriesSort=function(a){return arguments.length?(l=a,g(),i):l},i.valueSort=function(a){return arguments.length?(m=a,g(),i):m},i._compose=i.compose,delete i.compose,i},c.geoChoroplethChart=function(b,d){function e(a){var b=f();if(g(a)){var c=h(a);n(c,a,b),o(c,a,b)}}function f(){for(var a={},b=p.data(),c=0;c<b.length;++c)a[p.keyAccessor()(b[c])]=p.valueAccessor()(b[c]);return a}function g(a){return m(a).keyAccessor}function h(a){var b=p.svg().selectAll(i(a)).classed("selected",function(b){return j(a,b)}).classed("deselected",function(b){return k(a,b)}).attr("class",function(b){var d=m(a).name,e=c.utils.nameToId(m(a).keyAccessor(b)),f=d+" "+e;return j(a,b)&&(f+=" selected"),k(a,b)&&(f+=" deselected"),f});return b}function i(a){return"g.layer"+a+" g."+m(a).name}function j(a,b){return p.hasFilter()&&p.hasFilter(l(a,b))}function k(a,b){return p.hasFilter()&&!p.hasFilter(l(a,b))}function l(a,b){return m(a).keyAccessor(b)}function m(a){return s[a]}function n(b,d,e){var f=b.select("path").attr("fill",function(){var b=a.select(this).attr("fill");return b?b:"none"}).on("click",function(a){return p.onClick(a,d)});c.transition(f,p.transitionDuration()).attr("fill",function(a,b){return p.getColor(e[m(d).keyAccessor(a)],b)})}function o(a,b,c){p.renderTitle()&&a.selectAll("title").text(function(a){var d=l(b,a),e=c[d];return p.title()({key:d,value:e})})}var p=c.colorMixin(c.baseMixin({}));p.colorAccessor(function(a){return a||0});var q,r=a.geo.path(),s=[];return p._doRender=function(){p.resetSvg();for(var a=0;a<s.length;++a){var b=p.svg().append("g").attr("class","layer"+a),c=b.selectAll("g."+m(a).name).data(m(a).data).enter().append("g").attr("class",m(a).name);c.append("path").attr("fill","white").attr("d",r),c.append("title"),e(a)}q=!1},p.onClick=function(a,b){var d=m(b).keyAccessor(a);c.events.trigger(function(){p.filter(d),p.redrawGroup()})},p._doRedraw=function(){for(var a=0;a<s.length;++a)e(a),q&&p.svg().selectAll("g."+m(a).name+" path").attr("d",r);q=!1},p.overlayGeoJson=function(a,b,c){for(var d=0;d<s.length;++d)if(s[d].name===b)return s[d].data=a,s[d].keyAccessor=c,p;return s.push({name:b,data:a,keyAccessor:c}),p},p.projection=function(a){return r.projection(a),q=!0,p},p.geoJsons=function(){return s},p.geoPath=function(){return r},p.removeGeoJson=function(a){for(var b=[],c=0;c<s.length;++c){var d=s[c];d.name!==a&&b.push(d)}return s=b,p},p.anchor(b,d)},c.bubbleOverlay=function(b,d){function e(){return j=n.select("g."+k),j.empty()&&(j=n.svg().append("g").attr("class",k)),j}function f(){var a=g();o.forEach(function(b){var d=h(b,a),e=d.select("circle."+m);e.empty()&&(e=d.append("circle").attr("class",m).attr("r",0).attr("fill",n.getColor).on("click",n.onClick)),c.transition(e,n.transitionDuration()).attr("r",function(a){return n.bubbleR(a)}),n._doRenderLabel(d),n._doRenderTitles(d)})}function g(){var a={};return n.data().forEach(function(b){a[n.keyAccessor()(b)]=b}),a}function h(a,b){var d=l+" "+c.utils.nameToId(a.name),e=j.select("g."+c.utils.nameToId(a.name));return e.empty()&&(e=j.append("g").attr("class",d).attr("transform","translate("+a.x+","+a.y+")")),e.datum(b[a.name]),e}function i(){var a=g();o.forEach(function(b){var d=h(b,a),e=d.select("circle."+m);c.transition(e,n.transitionDuration()).attr("r",function(a){return n.bubbleR(a)}).attr("fill",n.getColor),n.doUpdateLabels(d),n.doUpdateTitles(d)})}var j,k="bubble-overlay",l="node",m="bubble",n=c.bubbleMixin(c.baseMixin({})),o=[];return n.transitionDuration(750),n.radiusValueAccessor(function(a){return a.value}),n.point=function(a,b,c){return o.push({name:a,x:b,y:c}),n},n._doRender=function(){return j=e(),n.r().range([n.MIN_RADIUS,n.width()*n.maxBubbleRelativeSize()]),f(),n.fadeDeselectedArea(),n},n._doRedraw=function(){return i(),n.fadeDeselectedArea(),n},n.debug=function(b){if(b){var d=n.select("g."+c.constants.DEBUG_GROUP_CLASS);d.empty()&&(d=n.svg().append("g").attr("class",c.constants.DEBUG_GROUP_CLASS));var e=d.append("text").attr("x",10).attr("y",20);d.append("rect").attr("width",n.width()).attr("height",n.height()).on("mousemove",function(){var b=a.mouse(d.node()),c=b[0]+", "+b[1];e.text(c)})}else n.selectAll(".debug").remove();return n},n.anchor(b,d),n},c.rowChart=function(b,d){function e(){if(!t||u){var b=a.extent(v,G.cappedValueAccessor);b[0]>0&&(b[0]=0),t=a.scale.linear().domain(b).range([0,G.effectiveWidth()])}H.scale(t)}function f(){var a=s.select("g.axis");e(),a.empty()&&(a=s.append("g").attr("class","axis")),a.attr("transform","translate(0, "+G.effectiveHeight()+")"),c.transition(a,G.transitionDuration()).call(H)}function g(){s.selectAll("g.tick").select("line.grid-line").remove(),s.selectAll("g.tick").append("line").attr("class","grid-line").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",function(){return-G.effectiveHeight()})}function h(){v=G.data(),f(),g();var a=s.selectAll("g."+D).data(v);i(a),j(a),l(a)}function i(a){var b=a.enter().append("g").attr("class",function(a,b){return D+" _"+b});b.append("rect").attr("width",0),n(b),o(a)}function j(a){a.exit().remove()}function k(){var a=t(0);return a===-(1/0)||a!==a?t(1):a}function l(a){var b,d=v.length;b=C?C:(G.effectiveHeight()-(d+1)*B)/d,y||(x=b/2);var e=a.attr("transform",function(a,c){return"translate(0,"+((c+1)*B+c*b)+")"}).select("rect").attr("height",b).attr("fill",G.getColor).on("click",p).classed("deselected",function(a){return G.hasFilter()?!r(a):!1}).classed("selected",function(a){return G.hasFilter()?r(a):!1});c.transition(e,G.transitionDuration()).attr("width",function(a){return Math.abs(k()-t(G.valueAccessor()(a)))}).attr("transform",q),m(a),o(a)}function m(a){G.renderTitle()&&(a.selectAll("title").remove(),a.append("title").text(G.title()))}function n(a){G.renderLabel()&&a.append("text").on("click",p),G.renderTitleLabel()&&a.append("text").attr("class",E).on("click",p)}function o(a){if(G.renderLabel()){var b=a.select("text").attr("x",w).attr("y",x).attr("dy",z).on("click",p).attr("class",function(a,b){return D+" _"+b}).text(function(a){return G.label()(a)});c.transition(b,G.transitionDuration()).attr("transform",q)}if(G.renderTitleLabel()){var d=a.select("."+E).attr("x",G.effectiveWidth()-A).attr("y",x).attr("dy",z).attr("text-anchor","end").on("click",p).attr("class",function(a,b){return E+" _"+b}).text(function(a){
22
+ return G.title()(a)});c.transition(d,G.transitionDuration()).attr("transform",q)}}function p(a){G.onClick(a)}function q(a){var b=t(G.cappedValueAccessor(a)),c=k(),d=b>c?c:b;return"translate("+d+",0)"}function r(a){return G.hasFilter(G.cappedKeyAccessor(a))}var s,t,u,v,w=10,x=15,y=!1,z="0.35em",A=2,B=5,C=!1,D="row",E="titlerow",F=!1,G=c.capMixin(c.marginMixin(c.colorMixin(c.baseMixin({})))),H=a.svg.axis().orient("bottom");return G.rowsCap=G.cap,G._doRender=function(){return G.resetSvg(),s=G.svg().append("g").attr("transform","translate("+G.margins().left+","+G.margins().top+")"),h(),G},G.title(function(a){return G.cappedKeyAccessor(a)+": "+G.cappedValueAccessor(a)}),G.label(G.cappedKeyAccessor),G.x=function(a){return arguments.length?(t=a,G):t},G.renderTitleLabel=function(a){return arguments.length?(F=a,G):F},G._doRedraw=function(){return h(),G},G.xAxis=function(){return H},G.fixedBarHeight=function(a){return arguments.length?(C=a,G):C},G.gap=function(a){return arguments.length?(B=a,G):B},G.elasticX=function(a){return arguments.length?(u=a,G):u},G.labelOffsetX=function(a){return arguments.length?(w=a,G):w},G.labelOffsetY=function(a){return arguments.length?(x=a,y=!0,G):x},G.titleLabelOffsetX=function(a){return arguments.length?(A=a,G):A},G.anchor(b,d)},c.legend=function(){function a(){return j+i}var b,d,e=2,f={},g=0,h=0,i=12,j=5,k=!1,l=560,m=70,n=!1,o=c.pluck("name");return f.parent=function(a){return arguments.length?(b=a,f):b},f.render=function(){b.svg().select("g.dc-legend").remove(),d=b.svg().append("g").attr("class","dc-legend").attr("transform","translate("+g+","+h+")");var f=b.legendables(),p=d.selectAll("g.dc-legend-item").data(f).enter().append("g").attr("class","dc-legend-item").on("mouseover",function(a){b.legendHighlight(a)}).on("mouseout",function(a){b.legendReset(a)}).on("click",function(a){a.chart.legendToggle(a)});d.selectAll("g.dc-legend-item").classed("fadeout",function(a){return a.chart.isLegendableHidden(a)}),f.some(c.pluck("dashstyle"))?p.append("line").attr("x1",0).attr("y1",i/2).attr("x2",i).attr("y2",i/2).attr("stroke-width",2).attr("stroke-dasharray",c.pluck("dashstyle")).attr("stroke",c.pluck("color")):p.append("rect").attr("width",i).attr("height",i).attr("fill",function(a){return a?a.color:"blue"}),p.append("text").text(o).attr("x",i+e).attr("y",function(){return i/2+(this.clientHeight?this.clientHeight:13)/2-2});var q=0,r=0;p.attr("transform",function(b,c){if(k){var d="translate("+q+","+r*a()+")",e=n===!0?this.getBBox().width+j:m;return q+e>=l?(++r,q=0):q+=e,d}return"translate(0,"+c*a()+")"})},f.x=function(a){return arguments.length?(g=a,f):g},f.y=function(a){return arguments.length?(h=a,f):h},f.gap=function(a){return arguments.length?(j=a,f):j},f.itemHeight=function(a){return arguments.length?(i=a,f):i},f.horizontal=function(a){return arguments.length?(k=a,f):k},f.legendWidth=function(a){return arguments.length?(l=a,f):l},f.itemWidth=function(a){return arguments.length?(m=a,f):m},f.autoItemWidth=function(a){return arguments.length?(n=a,f):n},f.legendText=function(a){return arguments.length?(o=a,f):o},f},c.scatterPlot=function(b,d){function e(b,d){var e=f.selectAll(".chart-body path.symbol").filter(function(){return b(a.select(this))}),h=g.size();g.size(Math.pow(d,2)),c.transition(e,f.transitionDuration()).attr("d",g),g.size(h)}var f=c.coordinateGridMixin({}),g=a.svg.symbol(),h=function(a){return a.value},i=f.keyAccessor();f.keyAccessor(function(a){return i(a)[0]}),f.valueAccessor(function(a){return i(a)[1]}),f.colorAccessor(function(){return f._groupName});var j=function(a){return"translate("+f.x()(f.keyAccessor()(a))+","+f.y()(f.valueAccessor()(a))+")"},k=7,l=5,m=3,n=null,o=1,p=0,q=[];return g.size(function(a,b){return h(a)?q[b]?Math.pow(l,2):Math.pow(m,2):p}),c.override(f,"_filter",function(a){return arguments.length?f.__filter(c.filters.RangedTwoDimensionalFilter(a)):f.__filter()}),f.plotData=function(){var a=f.chartBodyG().selectAll("path.symbol").data(f.data());a.enter().append("path").attr("class","symbol").attr("opacity",0).attr("fill",f.getColor).attr("transform",j),a.each(function(a,b){q[b]=!f.filter()||f.filter().isFiltered([a.key[0],a.key[1]])}),c.transition(a,f.transitionDuration()).attr("opacity",function(a,b){return h(a)?q[b]?1:f.excludedOpacity():0}).attr("fill",function(a,b){return f.excludedColor()&&!q[b]?f.excludedColor():f.getColor(a)}).attr("transform",j).attr("d",g),c.transition(a.exit(),f.transitionDuration()).attr("opacity",0).remove()},f.existenceAccessor=function(a){return arguments.length?(h=a,this):h},f.symbol=function(a){return arguments.length?(g.type(a),f):g.type()},f.symbolSize=function(a){return arguments.length?(l=a,f):l},f.highlightedSize=function(a){return arguments.length?(k=a,f):k},f.excludedSize=function(a){return arguments.length?(m=a,f):m},f.excludedColor=function(a){return arguments.length?(n=a,f):n},f.excludedOpacity=function(a){return arguments.length?(o=a,f):o},f.hiddenSize=f.emptySize=function(a){return arguments.length?(p=a,f):p},f.legendables=function(){return[{chart:f,name:f._groupName,color:f.getColor()}]},f.legendHighlight=function(b){e(function(a){return a.attr("fill")===b.color},k),f.selectAll(".chart-body path.symbol").filter(function(){return a.select(this).attr("fill")!==b.color}).classed("fadeout",!0)},f.legendReset=function(b){e(function(a){return a.attr("fill")===b.color},l),f.selectAll(".chart-body path.symbol").filter(function(){return a.select(this).attr("fill")!==b.color}).classed("fadeout",!1)},f.setHandlePaths=function(){},f.extendBrush=function(){var a=f.brush().extent();return f.round()&&(a[0]=a[0].map(f.round()),a[1]=a[1].map(f.round()),f.g().select(".brush").call(f.brush().extent(a))),a},f.brushIsEmpty=function(a){return f.brush().empty()||!a||a[0][0]>=a[1][0]||a[0][1]>=a[1][1]},f._brushing=function(){var a=f.extendBrush();if(f.redrawBrush(f.g()),f.brushIsEmpty(a))c.events.trigger(function(){f.filter(null),f.redrawGroup()});else{var b=c.filters.RangedTwoDimensionalFilter(a);c.events.trigger(function(){f.filter(null),f.filter(b),f.redrawGroup()},c.constants.EVENT_DELAY)}},f.setBrushY=function(a){a.call(f.brush().y(f.y()))},f.anchor(b,d)},c.numberDisplay=function(b,d){var e="number-display",f=a.format(".2s"),g=c.baseMixin({}),h={one:"",some:"",none:""};return g._mandatoryAttributes(["group"]),g.html=function(a){return arguments.length?(a.none?h.none=a.none:a.one?h.none=a.one:a.some&&(h.none=a.some),a.one?h.one=a.one:a.some&&(h.one=a.some),a.some?h.some=a.some:a.one&&(h.some=a.one),g):h},g.value=function(){return g.data()},g.data(function(a){var b=a.value?a.value():a.top(1)[0];return g.valueAccessor()(b)}),g.transitionDuration(250),g._doRender=function(){var b=g.value(),c=g.selectAll("."+e);c.empty()&&(c=c.data([0]).enter().append("span").attr("class",e)),c.transition().duration(g.transitionDuration()).ease("quad-out-in").tween("text",function(){var c=a.interpolateNumber(this.lastValue||0,b);return this.lastValue=b,function(a){var d=null,e=g.formatNumber()(c(a));0===b&&""!==h.none?d=h.none:1===b&&""!==h.one?d=h.one:""!==h.some&&(d=h.some),this.innerHTML=d?d.replace("%number",e):e}})},g._doRedraw=function(){return g._doRender()},g.formatNumber=function(a){return arguments.length?(f=a,g):f},g.anchor(b,d)},c.heatMap=function(b,d){function e(a,b){var d=m.selectAll(".box-group").filter(function(c){return c.key[a]===b}),e=d.filter(function(a){return!m.hasFilter(a.key)});c.events.trigger(function(){e.empty()?d.each(function(a){m.filter(a.key)}):e.each(function(a){m.filter(a.key)}),m.redrawGroup()})}function f(a,b,c){return!b||c[b-1]!==a}var g,h,i,j=6.75,k=j,l=j,m=c.colorMixin(c.marginMixin(c.baseMixin({})));m._mandatoryAttributes(["group"]),m.title(m.colorAccessor());var n=function(a){return a},o=function(a){return a};m.colsLabel=function(a){return arguments.length?(n=a,m):n},m.rowsLabel=function(a){return arguments.length?(o=a,m):o};var p=function(a){e(0,a)},q=function(a){e(1,a)},r=function(a){var b=a.key;c.events.trigger(function(){m.filter(b),m.redrawGroup()})};return c.override(m,"filter",function(a){return arguments.length?m._filter(c.filters.TwoDimensionalFilter(a)):m._filter()}),m.rows=function(b){if(arguments.length)return i=b,m;if(i)return i;var c=m.data().map(m.valueAccessor());return c.sort(a.ascending),a.scale.ordinal().domain(c.filter(f))},m.cols=function(b){if(arguments.length)return h=b,m;if(h)return h;var c=m.data().map(m.keyAccessor());return c.sort(a.ascending),a.scale.ordinal().domain(c.filter(f))},m._doRender=function(){return m.resetSvg(),g=m.svg().append("g").attr("class","heatmap").attr("transform","translate("+m.margins().left+","+m.margins().top+")"),m._doRedraw()},m._doRedraw=function(){var a=m.rows(),b=m.cols(),d=a.domain().length,e=b.domain().length,f=Math.floor(m.effectiveWidth()/e),h=Math.floor(m.effectiveHeight()/d);b.rangeRoundBands([0,m.effectiveWidth()]),a.rangeRoundBands([m.effectiveHeight(),0]);var i=g.selectAll("g.box-group").data(m.data(),function(a,b){return m.keyAccessor()(a,b)+"\x00"+m.valueAccessor()(a,b)}),j=i.enter().append("g").attr("class","box-group");j.append("rect").attr("class","heat-box").attr("fill","white").on("click",m.boxOnClick()),m.renderTitle()&&(j.append("title"),i.selectAll("title").text(m.title())),c.transition(i.selectAll("rect"),m.transitionDuration()).attr("x",function(a,c){return b(m.keyAccessor()(a,c))}).attr("y",function(b,c){return a(m.valueAccessor()(b,c))}).attr("rx",k).attr("ry",l).attr("fill",m.getColor).attr("width",f).attr("height",h),i.exit().remove();var n=g.selectAll("g.cols");n.empty()&&(n=g.append("g").attr("class","cols axis"));var o=n.selectAll("text").data(b.domain());o.enter().append("text").attr("x",function(a){return b(a)+f/2}).style("text-anchor","middle").attr("y",m.effectiveHeight()).attr("dy",12).on("click",m.xAxisOnClick()).text(m.colsLabel()),c.transition(o,m.transitionDuration()).text(m.colsLabel()).attr("x",function(a){return b(a)+f/2}).attr("y",m.effectiveHeight()),o.exit().remove();var p=g.selectAll("g.rows");p.empty()&&(p=g.append("g").attr("class","rows axis"));var q=p.selectAll("text").data(a.domain());return q.enter().append("text").attr("dy",6).style("text-anchor","end").attr("x",0).attr("dx",-2).on("click",m.yAxisOnClick()).text(m.rowsLabel()),c.transition(q,m.transitionDuration()).text(m.rowsLabel()).attr("y",function(b){return a(b)+h/2}),q.exit().remove(),m.hasFilter()?m.selectAll("g.box-group").each(function(a){m.isSelectedNode(a)?m.highlightSelected(this):m.fadeDeselected(this)}):m.selectAll("g.box-group").each(function(){m.resetHighlight(this)}),m},m.boxOnClick=function(a){return arguments.length?(r=a,m):r},m.xAxisOnClick=function(a){return arguments.length?(p=a,m):p},m.yAxisOnClick=function(a){return arguments.length?(q=a,m):q},m.xBorderRadius=function(a){return arguments.length?(k=a,m):k},m.yBorderRadius=function(a){return arguments.length?(l=a,m):l},m.isSelectedNode=function(a){return m.hasFilter(a.key)},m.anchor(b,d)},function(){function b(a){return[0,a.length-1]}function c(b){return[a.quantile(b,.25),a.quantile(b,.5),a.quantile(b,.75)]}a.box=function(){function d(b){b.each(function(b,c){b=b.map(i).sort(a.ascending);var d=a.select(this),m=b.length,n=b[0],o=b[m-1],p=b.quartiles=k(b),q=j&&j.call(this,b,c),r=q&&q.map(function(a){return b[a]}),s=q?a.range(0,q[0]).concat(a.range(q[1]+1,m)):a.range(m),t=a.scale.linear().domain(h&&h.call(this,b,c)||[n,o]).range([f,0]),u=this.__chart__||a.scale.linear().domain([0,1/0]).range(t.range());this.__chart__=t;var v=d.selectAll("line.center").data(r?[r]:[]);v.enter().insert("line","rect").attr("class","center").attr("x1",e/2).attr("y1",function(a){return u(a[0])}).attr("x2",e/2).attr("y2",function(a){return u(a[1])}).style("opacity",1e-6).transition().duration(g).style("opacity",1).attr("y1",function(a){return t(a[0])}).attr("y2",function(a){return t(a[1])}),v.transition().duration(g).style("opacity",1).attr("y1",function(a){return t(a[0])}).attr("y2",function(a){return t(a[1])}),v.exit().transition().duration(g).style("opacity",1e-6).attr("y1",function(a){return t(a[0])}).attr("y2",function(a){return t(a[1])}).remove();var w=d.selectAll("rect.box").data([p]);w.enter().append("rect").attr("class","box").attr("x",0).attr("y",function(a){return u(a[2])}).attr("width",e).attr("height",function(a){return u(a[0])-u(a[2])}).transition().duration(g).attr("y",function(a){return t(a[2])}).attr("height",function(a){return t(a[0])-t(a[2])}),w.transition().duration(g).attr("y",function(a){return t(a[2])}).attr("height",function(a){return t(a[0])-t(a[2])});var x=d.selectAll("line.median").data([p[1]]);x.enter().append("line").attr("class","median").attr("x1",0).attr("y1",u).attr("x2",e).attr("y2",u).transition().duration(g).attr("y1",t).attr("y2",t),x.transition().duration(g).attr("y1",t).attr("y2",t);var y=d.selectAll("line.whisker").data(r||[]);y.enter().insert("line","circle, text").attr("class","whisker").attr("x1",0).attr("y1",u).attr("x2",e).attr("y2",u).style("opacity",1e-6).transition().duration(g).attr("y1",t).attr("y2",t).style("opacity",1),y.transition().duration(g).attr("y1",t).attr("y2",t).style("opacity",1),y.exit().transition().duration(g).attr("y1",t).attr("y2",t).style("opacity",1e-6).remove();var z=d.selectAll("circle.outlier").data(s,Number);z.enter().insert("circle","text").attr("class","outlier").attr("r",5).attr("cx",e/2).attr("cy",function(a){return u(b[a])}).style("opacity",1e-6).transition().duration(g).attr("cy",function(a){return t(b[a])}).style("opacity",1),z.transition().duration(g).attr("cy",function(a){return t(b[a])}).style("opacity",1),z.exit().transition().duration(g).attr("cy",function(a){return t(b[a])}).style("opacity",1e-6).remove();var A=l||t.tickFormat(8),B=d.selectAll("text.box").data(p);B.enter().append("text").attr("class","box").attr("dy",".3em").attr("dx",function(a,b){return 1&b?6:-6}).attr("x",function(a,b){return 1&b?e:0}).attr("y",u).attr("text-anchor",function(a,b){return 1&b?"start":"end"}).text(A).transition().duration(g).attr("y",t),B.transition().duration(g).text(A).attr("y",t);var C=d.selectAll("text.whisker").data(r||[]);C.enter().append("text").attr("class","whisker").attr("dy",".3em").attr("dx",6).attr("x",e).attr("y",u).text(A).style("opacity",1e-6).transition().duration(g).attr("y",t).style("opacity",1),C.transition().duration(g).text(A).attr("y",t).style("opacity",1),C.exit().transition().duration(g).attr("y",t).style("opacity",1e-6).remove()}),a.timer.flush()}var e=1,f=1,g=0,h=null,i=Number,j=b,k=c,l=null;return d.width=function(a){return arguments.length?(e=a,d):e},d.height=function(a){return arguments.length?(f=a,d):f},d.tickFormat=function(a){return arguments.length?(l=a,d):l},d.duration=function(a){return arguments.length?(g=a,d):g},d.domain=function(b){return arguments.length?(h=null===b?b:a.functor(b),d):h},d.value=function(a){return arguments.length?(i=a,d):i},d.whiskers=function(a){return arguments.length?(j=a,d):j},d.quartiles=function(a){return arguments.length?(k=a,d):k},d}}(),c.boxPlot=function(b,d){function e(a){return function(b){var c=b.quartiles[0],d=b.quartiles[2],e=(d-c)*a,f=-1,g=b.length;do++f;while(b[f]<c-e);do--g;while(b[g]>d+e);return[f,g]}}function f(a){var b=a.enter().append("g");b.attr("class","box").attr("transform",p).call(m).on("click",function(a){i.filter(a.key),i.redrawGroup()})}function g(b){c.transition(b,i.transitionDuration()).attr("transform",p).call(m).each(function(){a.select(this).select("rect.box").attr("fill",i.getColor)})}function h(a){a.exit().remove().call(m)}var i=c.coordinateGridMixin({}),j=1.5,k=e,l=k(j),m=a.box(),n=null,o=function(a,b){return i.isOrdinal()?i.x().rangeBand():a/(1+i.boxPadding())/b};i.yAxisPadding(12),i.x(a.scale.ordinal()),i.xUnits(c.units.ordinal),i.data(function(a){return a.all().map(function(a){return a.map=function(b){return b.call(a,a)},a}).filter(function(a){var b=i.valueAccessor()(a);return 0!==b.length})}),i.boxPadding=i._rangeBandPadding,i.boxPadding(.8),i.outerPadding=i._outerRangeBandPadding,i.outerPadding(.5),i.boxWidth=function(b){return arguments.length?(o=a.functor(b),i):o};var p=function(a,b){var c=i.x()(i.keyAccessor()(a,b));return"translate("+c+", 0)"};return i._preprocessData=function(){i.elasticX()&&i.x().domain([])},i.plotData=function(){var a=o(i.effectiveWidth(),i.xUnitCount());m.whiskers(l).width(a).height(i.effectiveHeight()).value(i.valueAccessor()).domain(i.y().domain()).duration(i.transitionDuration()).tickFormat(n);var b=i.chartBodyG().selectAll("g.box").data(i.data(),function(a){return a.key});f(b),g(b),h(b),i.fadeDeselectedArea()},i.fadeDeselectedArea=function(){i.hasFilter()?i.g().selectAll("g.box").each(function(a){i.isSelectedNode(a)?i.highlightSelected(this):i.fadeDeselected(this)}):i.g().selectAll("g.box").each(function(){i.resetHighlight(this)})},i.isSelectedNode=function(a){return i.hasFilter(a.key)},i.yAxisMin=function(){var b=a.min(i.data(),function(b){return a.min(i.valueAccessor()(b))});return c.utils.subtract(b,i.yAxisPadding())},i.yAxisMax=function(){var b=a.max(i.data(),function(b){return a.max(i.valueAccessor()(b))});return c.utils.add(b,i.yAxisPadding())},i.tickFormat=function(a){return arguments.length?(n=a,i):n},i.anchor(b,d)},c.abstractBubbleChart=c.bubbleMixin,c.baseChart=c.baseMixin,c.capped=c.capMixin,c.colorChart=c.colorMixin,c.coordinateGridChart=c.coordinateGridMixin,c.marginable=c.marginMixin,c.stackableChart=c.stackMixin,c.d3=a,c.crossfilter=b,c}if("function"==typeof define&&define.amd)define(["d3","crossfilter"],a);else if("object"==typeof module&&module.exports){var b=require("d3"),c=require("crossfilter2");"function"!=typeof c&&(c=c.crossfilter),module.exports=a(b,c)}else this.dc=a(d3,crossfilter)}();
23
+ //# sourceMappingURL=dc.min.js.map
@@ -0,0 +1,203 @@
1
+ /*
2
+ Try to discover which methods have not been documented.
3
+ This instruments the dc source so that every constructor marks
4
+ the methods it contains comments for. Then it constructs every
5
+ chart type and sees whether the resulting object has methods on it
6
+ that are not marked.
7
+
8
+ Unfortunately this has a few false positives, and even worse, we have
9
+ LOTS of methods which are actually internal but aren't prefixed with _,
10
+ so it's hard to wade through the 400+ results.
11
+ */
12
+
13
+ var mixinDocs = (function () {
14
+ 'use strict';
15
+
16
+ var esprima = require('esprima'),
17
+ escodegen = require('escodegen'),
18
+ md = {};
19
+
20
+ var DOC = md.DOC = '__doc__';
21
+
22
+ md.insert = function (str, fragments) {
23
+ var i, fragment, pos;
24
+
25
+ // Sort in descending order since a fragment needs to be
26
+ // inserted from the last one, to prevent offsetting the others.
27
+ fragments.sort(function (a, b) {
28
+ return b.index - a.index;
29
+ });
30
+
31
+ for (i = 0; i < fragments.length; i += 1) {
32
+ fragment = fragments[i];
33
+ pos = Math.floor(fragment.index);
34
+ str = str.slice(0, pos) + fragment.text + str.slice(pos);
35
+ }
36
+
37
+ return str;
38
+ };
39
+
40
+ md.extractComments = function (nodeRoot) {
41
+ var comments = [];
42
+
43
+ function extractComments(node, parentComment, within) {
44
+ var comment = node.leadingComments && node.leadingComments[0];
45
+ comment = (comment && comment.type == 'Block' &&
46
+ comment.value[0] == '*' &&
47
+ comment.value[comment.value.length - 1] == '*') ?
48
+ comment.value : undefined;
49
+
50
+ if (parentComment && node.type == 'AssignmentExpression') {
51
+ var left = escodegen.generate(node.left);
52
+ comments.push({
53
+ value: parentComment,
54
+ for: left,
55
+ in : within,
56
+ range: node.range,
57
+ loc: node.left.loc.start.line
58
+ });
59
+ extractComments(node.right, comment, left);
60
+ } else {
61
+ for (var i in node) {
62
+ if (typeof (node[i]) == 'object' && node[i]) {
63
+ extractComments(node[i], comment || parentComment, within);
64
+ }
65
+ }
66
+ }
67
+ }
68
+
69
+ extractComments(nodeRoot);
70
+ return comments;
71
+ };
72
+
73
+ md.instrumentSource = function (source, fileName) {
74
+ var syntax = esprima.parse(source, {
75
+ raw: true,
76
+ tokens: true,
77
+ range: true,
78
+ loc: true,
79
+ comment: true
80
+ });
81
+ syntax = escodegen.attachComments(syntax, syntax.comments, syntax.tokens);
82
+
83
+ var comments = md.extractComments(syntax);
84
+
85
+ var fragments = comments.map(function (c) {
86
+ var s = +(c.value[0] == '*'),
87
+ e = +(c.value[c.value.length - 1] == '*'),
88
+ value = c.value.slice(s, c.value.length - e).replace(/\s+$/, ''),
89
+ r = /(\n[ \t]+)[^ \t\n]/g,
90
+ prefix,
91
+ result;
92
+
93
+ while ((result = r.exec(value))) {
94
+ if (prefix === undefined || result[1].length < prefix.length)
95
+ prefix = result[1];
96
+ }
97
+
98
+ var aligned = value.split(prefix).join('\n').replace(/^\n+/, ''),
99
+ assignment = c.for +"." + DOC + "=",
100
+ doc = {
101
+ value: aligned,
102
+ for: c.for,
103
+ from: c.in
104
+ };
105
+
106
+ if (fileName) {
107
+ doc.file = fileName;
108
+ doc.line = c.loc;
109
+ }
110
+
111
+ return {
112
+ index: c.range[1] + 1,
113
+ text: "\n" + assignment + JSON.stringify(doc) + ";\n" // + "console.log('" + c.for + "', '" + c.in + "');"
114
+ };
115
+ });
116
+
117
+ return md.insert(source, fragments);
118
+ };
119
+
120
+ return md;
121
+ })();
122
+
123
+ //##### dc specific code
124
+
125
+ require('d3');
126
+ var fs = require('fs'),
127
+ dc, // ignore dc from test/env, we just want the d3/crossfilter environment
128
+ charts = [
129
+ 'barChart',
130
+ 'boxPlot',
131
+ 'bubbleChart',
132
+ 'compositeChart',
133
+ 'dataCount',
134
+ 'dataTable',
135
+ 'geoChoroplethChart',
136
+ 'heatMap',
137
+ 'lineChart',
138
+ 'numberDisplay',
139
+ 'pieChart',
140
+ 'rowChart',
141
+ 'scatterPlot',
142
+ 'seriesChart'
143
+ ],
144
+ files = require("../Gruntfile").jsFiles; //fs.readdirSync(dir).map(function(f){return dir + f;});
145
+
146
+ var instrumented = [];
147
+ files.forEach(function (file) {
148
+ console.log("Instrumenting " + file);
149
+ var rawSource = fs.readFileSync(file, 'utf-8');
150
+ try {
151
+ var src = mixinDocs.instrumentSource(rawSource, file);
152
+ instrumented.push(src);
153
+ } catch (e) {
154
+ console.log(" Ignoring: " + file + " (unable to parse)");
155
+ }
156
+ });
157
+ //console.log(instrumented.join("\n"));
158
+ eval(instrumented.join("\n"));
159
+
160
+ // does not work because it is trying to instantiate the functions as charts with ('#doc')
161
+ //Object.keys(dc).filter(function(p) {
162
+ // return typeof dc[p] == 'function';
163
+ //}).forEach(documentChart);
164
+
165
+ charts.forEach(documentChart);
166
+
167
+ function extend(obj, copy) {
168
+ for (var k in copy) {
169
+ obj[k] = copy[k];
170
+ }
171
+ return obj;
172
+ }
173
+
174
+ function documentChart(chartName) {
175
+ var DOC = mixinDocs.DOC,
176
+ chartFun = dc[chartName],
177
+ chart = chartFun("#doc"),
178
+ model = {
179
+ name: "dc." + chartName,
180
+ covered: [],
181
+ missing: []
182
+ };
183
+ if (!chart || chart.render === undefined) return;
184
+ Object.keys(chart).filter(function(m) {
185
+ return typeof chart[m] == 'function' &&
186
+ (m[0] != '_' || chart[m][mixinDocs.DOC]);
187
+ }).forEach(function(m) {
188
+ var method = m[0] == '_' ? m.substr(1) : m;
189
+ if (chart[m][mixinDocs.DOC])
190
+ model.covered.push(method);
191
+ else {
192
+ model.missing.push(method);
193
+ }
194
+ });
195
+ model.covered.sort();
196
+ model.missing.sort();
197
+ model.coverage = model.covered.length / (model.covered.length + model.missing.length);
198
+
199
+ //console.log(JSON.stringify(model));
200
+ model.missing.forEach(function(m) {
201
+ console.log(chartName + "." + m);
202
+ });
203
+ }
@@ -0,0 +1,33 @@
1
+ module.exports = function (grunt) {
2
+ return function (list, opts) {
3
+ var files = list.sort().map(function (entry) {
4
+ var f = entry.replace(/.*\//, '');
5
+ return [f.replace('.html', '').replace(/-/g, ' '), f];
6
+ }).filter(function (e) { return e[0] !== 'index'; });
7
+ var rows = [];
8
+ for (var i = 0; i < files.length; i += 5) {
9
+ var cols = [];
10
+ for (var j = 0; j < 5; ++j) {
11
+ if (i + j >= files.length) {
12
+ break;
13
+ }
14
+ var file = files[i + j];
15
+ cols.push(' <td><a href="' + file[1] + '">' + file[0] + '</a></td>');
16
+ }
17
+ rows.push(' <tr>\n' + cols.join('\n') + '\n<tr>');
18
+ }
19
+ var body = '<table class="table">\n' + rows.join('\n') + '\n</table>';
20
+ return [
21
+ '<html><head><title>' + opts.title + '</title>',
22
+ '<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css"></head>',
23
+ '<body><div class="container">',
24
+ '<h2>' + opts.heading + '</h2>',
25
+ '<p>' + opts.description + '</p>',
26
+ '<p>Contributions <a href="https://github.com/dc-js/dc.js/blob/master/CONTRIBUTING.md">' + 'welcome</a>.',
27
+ 'Source <a href="' + opts.sourceLink + '">',
28
+ 'here</a>.</p>',
29
+ body,
30
+ '</div></body></html>'
31
+ ].join('\n');
32
+ };
33
+ };
@@ -0,0 +1,5 @@
1
+ // Import DC and dependencies
2
+
3
+ d3 = require("d3");
4
+ crossfilter = require("crossfilter");
5
+ module.exports = require("./dc");
@@ -0,0 +1,1401 @@
1
+ (function(exports){
2
+ crossfilter.version = "1.3.14";
3
+ function crossfilter_identity(d) {
4
+ return d;
5
+ }
6
+ crossfilter.permute = permute;
7
+
8
+ function permute(array, index) {
9
+ for (var i = 0, n = index.length, copy = new Array(n); i < n; ++i) {
10
+ copy[i] = array[index[i]];
11
+ }
12
+ return copy;
13
+ }
14
+ var bisect = crossfilter.bisect = bisect_by(crossfilter_identity);
15
+
16
+ bisect.by = bisect_by;
17
+
18
+ function bisect_by(f) {
19
+
20
+ // Locate the insertion point for x in a to maintain sorted order. The
21
+ // arguments lo and hi may be used to specify a subset of the array which
22
+ // should be considered; by default the entire array is used. If x is already
23
+ // present in a, the insertion point will be before (to the left of) any
24
+ // existing entries. The return value is suitable for use as the first
25
+ // argument to `array.splice` assuming that a is already sorted.
26
+ //
27
+ // The returned insertion point i partitions the array a into two halves so
28
+ // that all v < x for v in a[lo:i] for the left side and all v >= x for v in
29
+ // a[i:hi] for the right side.
30
+ function bisectLeft(a, x, lo, hi) {
31
+ while (lo < hi) {
32
+ var mid = lo + hi >>> 1;
33
+ if (f(a[mid]) < x) lo = mid + 1;
34
+ else hi = mid;
35
+ }
36
+ return lo;
37
+ }
38
+
39
+ // Similar to bisectLeft, but returns an insertion point which comes after (to
40
+ // the right of) any existing entries of x in a.
41
+ //
42
+ // The returned insertion point i partitions the array into two halves so that
43
+ // all v <= x for v in a[lo:i] for the left side and all v > x for v in
44
+ // a[i:hi] for the right side.
45
+ function bisectRight(a, x, lo, hi) {
46
+ while (lo < hi) {
47
+ var mid = lo + hi >>> 1;
48
+ if (x < f(a[mid])) hi = mid;
49
+ else lo = mid + 1;
50
+ }
51
+ return lo;
52
+ }
53
+
54
+ bisectRight.right = bisectRight;
55
+ bisectRight.left = bisectLeft;
56
+ return bisectRight;
57
+ }
58
+ var heap = crossfilter.heap = heap_by(crossfilter_identity);
59
+
60
+ heap.by = heap_by;
61
+
62
+ function heap_by(f) {
63
+
64
+ // Builds a binary heap within the specified array a[lo:hi]. The heap has the
65
+ // property such that the parent a[lo+i] is always less than or equal to its
66
+ // two children: a[lo+2*i+1] and a[lo+2*i+2].
67
+ function heap(a, lo, hi) {
68
+ var n = hi - lo,
69
+ i = (n >>> 1) + 1;
70
+ while (--i > 0) sift(a, i, n, lo);
71
+ return a;
72
+ }
73
+
74
+ // Sorts the specified array a[lo:hi] in descending order, assuming it is
75
+ // already a heap.
76
+ function sort(a, lo, hi) {
77
+ var n = hi - lo,
78
+ t;
79
+ while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo);
80
+ return a;
81
+ }
82
+
83
+ // Sifts the element a[lo+i-1] down the heap, where the heap is the contiguous
84
+ // slice of array a[lo:lo+n]. This method can also be used to update the heap
85
+ // incrementally, without incurring the full cost of reconstructing the heap.
86
+ function sift(a, i, n, lo) {
87
+ var d = a[--lo + i],
88
+ x = f(d),
89
+ child;
90
+ while ((child = i << 1) <= n) {
91
+ if (child < n && f(a[lo + child]) > f(a[lo + child + 1])) child++;
92
+ if (x <= f(a[lo + child])) break;
93
+ a[lo + i] = a[lo + child];
94
+ i = child;
95
+ }
96
+ a[lo + i] = d;
97
+ }
98
+
99
+ heap.sort = sort;
100
+ return heap;
101
+ }
102
+ var heapselect = crossfilter.heapselect = heapselect_by(crossfilter_identity);
103
+
104
+ heapselect.by = heapselect_by;
105
+
106
+ function heapselect_by(f) {
107
+ var heap = heap_by(f);
108
+
109
+ // Returns a new array containing the top k elements in the array a[lo:hi].
110
+ // The returned array is not sorted, but maintains the heap property. If k is
111
+ // greater than hi - lo, then fewer than k elements will be returned. The
112
+ // order of elements in a is unchanged by this operation.
113
+ function heapselect(a, lo, hi, k) {
114
+ var queue = new Array(k = Math.min(hi - lo, k)),
115
+ min,
116
+ i,
117
+ x,
118
+ d;
119
+
120
+ for (i = 0; i < k; ++i) queue[i] = a[lo++];
121
+ heap(queue, 0, k);
122
+
123
+ if (lo < hi) {
124
+ min = f(queue[0]);
125
+ do {
126
+ if (x = f(d = a[lo]) > min) {
127
+ queue[0] = d;
128
+ min = f(heap(queue, 0, k)[0]);
129
+ }
130
+ } while (++lo < hi);
131
+ }
132
+
133
+ return queue;
134
+ }
135
+
136
+ return heapselect;
137
+ }
138
+ var insertionsort = crossfilter.insertionsort = insertionsort_by(crossfilter_identity);
139
+
140
+ insertionsort.by = insertionsort_by;
141
+
142
+ function insertionsort_by(f) {
143
+
144
+ function insertionsort(a, lo, hi) {
145
+ for (var i = lo + 1; i < hi; ++i) {
146
+ for (var j = i, t = a[i], x = f(t); j > lo && f(a[j - 1]) > x; --j) {
147
+ a[j] = a[j - 1];
148
+ }
149
+ a[j] = t;
150
+ }
151
+ return a;
152
+ }
153
+
154
+ return insertionsort;
155
+ }
156
+ // Algorithm designed by Vladimir Yaroslavskiy.
157
+ // Implementation based on the Dart project; see lib/dart/LICENSE for details.
158
+
159
+ var quicksort = crossfilter.quicksort = quicksort_by(crossfilter_identity);
160
+
161
+ quicksort.by = quicksort_by;
162
+
163
+ function quicksort_by(f) {
164
+ var insertionsort = insertionsort_by(f);
165
+
166
+ function sort(a, lo, hi) {
167
+ return (hi - lo < quicksort_sizeThreshold
168
+ ? insertionsort
169
+ : quicksort)(a, lo, hi);
170
+ }
171
+
172
+ function quicksort(a, lo, hi) {
173
+ // Compute the two pivots by looking at 5 elements.
174
+ var sixth = (hi - lo) / 6 | 0,
175
+ i1 = lo + sixth,
176
+ i5 = hi - 1 - sixth,
177
+ i3 = lo + hi - 1 >> 1, // The midpoint.
178
+ i2 = i3 - sixth,
179
+ i4 = i3 + sixth;
180
+
181
+ var e1 = a[i1], x1 = f(e1),
182
+ e2 = a[i2], x2 = f(e2),
183
+ e3 = a[i3], x3 = f(e3),
184
+ e4 = a[i4], x4 = f(e4),
185
+ e5 = a[i5], x5 = f(e5);
186
+
187
+ var t;
188
+
189
+ // Sort the selected 5 elements using a sorting network.
190
+ if (x1 > x2) t = e1, e1 = e2, e2 = t, t = x1, x1 = x2, x2 = t;
191
+ if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;
192
+ if (x1 > x3) t = e1, e1 = e3, e3 = t, t = x1, x1 = x3, x3 = t;
193
+ if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;
194
+ if (x1 > x4) t = e1, e1 = e4, e4 = t, t = x1, x1 = x4, x4 = t;
195
+ if (x3 > x4) t = e3, e3 = e4, e4 = t, t = x3, x3 = x4, x4 = t;
196
+ if (x2 > x5) t = e2, e2 = e5, e5 = t, t = x2, x2 = x5, x5 = t;
197
+ if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;
198
+ if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;
199
+
200
+ var pivot1 = e2, pivotValue1 = x2,
201
+ pivot2 = e4, pivotValue2 = x4;
202
+
203
+ // e2 and e4 have been saved in the pivot variables. They will be written
204
+ // back, once the partitioning is finished.
205
+ a[i1] = e1;
206
+ a[i2] = a[lo];
207
+ a[i3] = e3;
208
+ a[i4] = a[hi - 1];
209
+ a[i5] = e5;
210
+
211
+ var less = lo + 1, // First element in the middle partition.
212
+ great = hi - 2; // Last element in the middle partition.
213
+
214
+ // Note that for value comparison, <, <=, >= and > coerce to a primitive via
215
+ // Object.prototype.valueOf; == and === do not, so in order to be consistent
216
+ // with natural order (such as for Date objects), we must do two compares.
217
+ var pivotsEqual = pivotValue1 <= pivotValue2 && pivotValue1 >= pivotValue2;
218
+ if (pivotsEqual) {
219
+
220
+ // Degenerated case where the partitioning becomes a dutch national flag
221
+ // problem.
222
+ //
223
+ // [ | < pivot | == pivot | unpartitioned | > pivot | ]
224
+ // ^ ^ ^ ^ ^
225
+ // left less k great right
226
+ //
227
+ // a[left] and a[right] are undefined and are filled after the
228
+ // partitioning.
229
+ //
230
+ // Invariants:
231
+ // 1) for x in ]left, less[ : x < pivot.
232
+ // 2) for x in [less, k[ : x == pivot.
233
+ // 3) for x in ]great, right[ : x > pivot.
234
+ for (var k = less; k <= great; ++k) {
235
+ var ek = a[k], xk = f(ek);
236
+ if (xk < pivotValue1) {
237
+ if (k !== less) {
238
+ a[k] = a[less];
239
+ a[less] = ek;
240
+ }
241
+ ++less;
242
+ } else if (xk > pivotValue1) {
243
+
244
+ // Find the first element <= pivot in the range [k - 1, great] and
245
+ // put [:ek:] there. We know that such an element must exist:
246
+ // When k == less, then el3 (which is equal to pivot) lies in the
247
+ // interval. Otherwise a[k - 1] == pivot and the search stops at k-1.
248
+ // Note that in the latter case invariant 2 will be violated for a
249
+ // short amount of time. The invariant will be restored when the
250
+ // pivots are put into their final positions.
251
+ while (true) {
252
+ var greatValue = f(a[great]);
253
+ if (greatValue > pivotValue1) {
254
+ great--;
255
+ // This is the only location in the while-loop where a new
256
+ // iteration is started.
257
+ continue;
258
+ } else if (greatValue < pivotValue1) {
259
+ // Triple exchange.
260
+ a[k] = a[less];
261
+ a[less++] = a[great];
262
+ a[great--] = ek;
263
+ break;
264
+ } else {
265
+ a[k] = a[great];
266
+ a[great--] = ek;
267
+ // Note: if great < k then we will exit the outer loop and fix
268
+ // invariant 2 (which we just violated).
269
+ break;
270
+ }
271
+ }
272
+ }
273
+ }
274
+ } else {
275
+
276
+ // We partition the list into three parts:
277
+ // 1. < pivot1
278
+ // 2. >= pivot1 && <= pivot2
279
+ // 3. > pivot2
280
+ //
281
+ // During the loop we have:
282
+ // [ | < pivot1 | >= pivot1 && <= pivot2 | unpartitioned | > pivot2 | ]
283
+ // ^ ^ ^ ^ ^
284
+ // left less k great right
285
+ //
286
+ // a[left] and a[right] are undefined and are filled after the
287
+ // partitioning.
288
+ //
289
+ // Invariants:
290
+ // 1. for x in ]left, less[ : x < pivot1
291
+ // 2. for x in [less, k[ : pivot1 <= x && x <= pivot2
292
+ // 3. for x in ]great, right[ : x > pivot2
293
+ for (var k = less; k <= great; k++) {
294
+ var ek = a[k], xk = f(ek);
295
+ if (xk < pivotValue1) {
296
+ if (k !== less) {
297
+ a[k] = a[less];
298
+ a[less] = ek;
299
+ }
300
+ ++less;
301
+ } else {
302
+ if (xk > pivotValue2) {
303
+ while (true) {
304
+ var greatValue = f(a[great]);
305
+ if (greatValue > pivotValue2) {
306
+ great--;
307
+ if (great < k) break;
308
+ // This is the only location inside the loop where a new
309
+ // iteration is started.
310
+ continue;
311
+ } else {
312
+ // a[great] <= pivot2.
313
+ if (greatValue < pivotValue1) {
314
+ // Triple exchange.
315
+ a[k] = a[less];
316
+ a[less++] = a[great];
317
+ a[great--] = ek;
318
+ } else {
319
+ // a[great] >= pivot1.
320
+ a[k] = a[great];
321
+ a[great--] = ek;
322
+ }
323
+ break;
324
+ }
325
+ }
326
+ }
327
+ }
328
+ }
329
+ }
330
+
331
+ // Move pivots into their final positions.
332
+ // We shrunk the list from both sides (a[left] and a[right] have
333
+ // meaningless values in them) and now we move elements from the first
334
+ // and third partition into these locations so that we can store the
335
+ // pivots.
336
+ a[lo] = a[less - 1];
337
+ a[less - 1] = pivot1;
338
+ a[hi - 1] = a[great + 1];
339
+ a[great + 1] = pivot2;
340
+
341
+ // The list is now partitioned into three partitions:
342
+ // [ < pivot1 | >= pivot1 && <= pivot2 | > pivot2 ]
343
+ // ^ ^ ^ ^
344
+ // left less great right
345
+
346
+ // Recursive descent. (Don't include the pivot values.)
347
+ sort(a, lo, less - 1);
348
+ sort(a, great + 2, hi);
349
+
350
+ if (pivotsEqual) {
351
+ // All elements in the second partition are equal to the pivot. No
352
+ // need to sort them.
353
+ return a;
354
+ }
355
+
356
+ // In theory it should be enough to call _doSort recursively on the second
357
+ // partition.
358
+ // The Android source however removes the pivot elements from the recursive
359
+ // call if the second partition is too large (more than 2/3 of the list).
360
+ if (less < i1 && great > i5) {
361
+ var lessValue, greatValue;
362
+ while ((lessValue = f(a[less])) <= pivotValue1 && lessValue >= pivotValue1) ++less;
363
+ while ((greatValue = f(a[great])) <= pivotValue2 && greatValue >= pivotValue2) --great;
364
+
365
+ // Copy paste of the previous 3-way partitioning with adaptions.
366
+ //
367
+ // We partition the list into three parts:
368
+ // 1. == pivot1
369
+ // 2. > pivot1 && < pivot2
370
+ // 3. == pivot2
371
+ //
372
+ // During the loop we have:
373
+ // [ == pivot1 | > pivot1 && < pivot2 | unpartitioned | == pivot2 ]
374
+ // ^ ^ ^
375
+ // less k great
376
+ //
377
+ // Invariants:
378
+ // 1. for x in [ *, less[ : x == pivot1
379
+ // 2. for x in [less, k[ : pivot1 < x && x < pivot2
380
+ // 3. for x in ]great, * ] : x == pivot2
381
+ for (var k = less; k <= great; k++) {
382
+ var ek = a[k], xk = f(ek);
383
+ if (xk <= pivotValue1 && xk >= pivotValue1) {
384
+ if (k !== less) {
385
+ a[k] = a[less];
386
+ a[less] = ek;
387
+ }
388
+ less++;
389
+ } else {
390
+ if (xk <= pivotValue2 && xk >= pivotValue2) {
391
+ while (true) {
392
+ var greatValue = f(a[great]);
393
+ if (greatValue <= pivotValue2 && greatValue >= pivotValue2) {
394
+ great--;
395
+ if (great < k) break;
396
+ // This is the only location inside the loop where a new
397
+ // iteration is started.
398
+ continue;
399
+ } else {
400
+ // a[great] < pivot2.
401
+ if (greatValue < pivotValue1) {
402
+ // Triple exchange.
403
+ a[k] = a[less];
404
+ a[less++] = a[great];
405
+ a[great--] = ek;
406
+ } else {
407
+ // a[great] == pivot1.
408
+ a[k] = a[great];
409
+ a[great--] = ek;
410
+ }
411
+ break;
412
+ }
413
+ }
414
+ }
415
+ }
416
+ }
417
+ }
418
+
419
+ // The second partition has now been cleared of pivot elements and looks
420
+ // as follows:
421
+ // [ * | > pivot1 && < pivot2 | * ]
422
+ // ^ ^
423
+ // less great
424
+ // Sort the second partition using recursive descent.
425
+
426
+ // The second partition looks as follows:
427
+ // [ * | >= pivot1 && <= pivot2 | * ]
428
+ // ^ ^
429
+ // less great
430
+ // Simply sort it by recursive descent.
431
+
432
+ return sort(a, less, great + 1);
433
+ }
434
+
435
+ return sort;
436
+ }
437
+
438
+ var quicksort_sizeThreshold = 32;
439
+ var crossfilter_array8 = crossfilter_arrayUntyped,
440
+ crossfilter_array16 = crossfilter_arrayUntyped,
441
+ crossfilter_array32 = crossfilter_arrayUntyped,
442
+ crossfilter_arrayLengthen = crossfilter_arrayLengthenUntyped,
443
+ crossfilter_arrayWiden = crossfilter_arrayWidenUntyped;
444
+
445
+ if (typeof Uint8Array !== "undefined") {
446
+ crossfilter_array8 = function(n) { return new Uint8Array(n); };
447
+ crossfilter_array16 = function(n) { return new Uint16Array(n); };
448
+ crossfilter_array32 = function(n) { return new Uint32Array(n); };
449
+
450
+ crossfilter_arrayLengthen = function(array, length) {
451
+ if (array.length >= length) return array;
452
+ var copy = new array.constructor(length);
453
+ copy.set(array);
454
+ return copy;
455
+ };
456
+
457
+ crossfilter_arrayWiden = function(array, width) {
458
+ var copy;
459
+ switch (width) {
460
+ case 16: copy = crossfilter_array16(array.length); break;
461
+ case 32: copy = crossfilter_array32(array.length); break;
462
+ default: throw new Error("invalid array width!");
463
+ }
464
+ copy.set(array);
465
+ return copy;
466
+ };
467
+ }
468
+
469
+ function crossfilter_arrayUntyped(n) {
470
+ var array = new Array(n), i = -1;
471
+ while (++i < n) array[i] = 0;
472
+ return array;
473
+ }
474
+
475
+ function crossfilter_arrayLengthenUntyped(array, length) {
476
+ var n = array.length;
477
+ while (n < length) array[n++] = 0;
478
+ return array;
479
+ }
480
+
481
+ function crossfilter_arrayWidenUntyped(array, width) {
482
+ if (width > 32) throw new Error("invalid array width!");
483
+ return array;
484
+ }
485
+ function crossfilter_filterExact(bisect, value) {
486
+ return function(values) {
487
+ var n = values.length;
488
+ return [bisect.left(values, value, 0, n), bisect.right(values, value, 0, n)];
489
+ };
490
+ }
491
+
492
+ function crossfilter_filterRange(bisect, range) {
493
+ var min = range[0],
494
+ max = range[1];
495
+ return function(values) {
496
+ var n = values.length;
497
+ return [bisect.left(values, min, 0, n), bisect.left(values, max, 0, n)];
498
+ };
499
+ }
500
+
501
+ function crossfilter_filterAll(values) {
502
+ return [0, values.length];
503
+ }
504
+ function crossfilter_null() {
505
+ return null;
506
+ }
507
+ function crossfilter_zero() {
508
+ return 0;
509
+ }
510
+ function crossfilter_reduceIncrement(p) {
511
+ return p + 1;
512
+ }
513
+
514
+ function crossfilter_reduceDecrement(p) {
515
+ return p - 1;
516
+ }
517
+
518
+ function crossfilter_reduceAdd(f) {
519
+ return function(p, v) {
520
+ return p + +f(v);
521
+ };
522
+ }
523
+
524
+ function crossfilter_reduceSubtract(f) {
525
+ return function(p, v) {
526
+ return p - f(v);
527
+ };
528
+ }
529
+ exports.crossfilter = crossfilter;
530
+
531
+ function crossfilter() {
532
+ var crossfilter = {
533
+ add: add,
534
+ remove: removeData,
535
+ dimension: dimension,
536
+ groupAll: groupAll,
537
+ size: size
538
+ };
539
+
540
+ var data = [], // the records
541
+ n = 0, // the number of records; data.length
542
+ m = 0, // a bit mask representing which dimensions are in use
543
+ M = 8, // number of dimensions that can fit in `filters`
544
+ filters = crossfilter_array8(0), // M bits per record; 1 is filtered out
545
+ filterListeners = [], // when the filters change
546
+ dataListeners = [], // when data is added
547
+ removeDataListeners = []; // when data is removed
548
+
549
+ // Adds the specified new records to this crossfilter.
550
+ function add(newData) {
551
+ var n0 = n,
552
+ n1 = newData.length;
553
+
554
+ // If there's actually new data to add…
555
+ // Merge the new data into the existing data.
556
+ // Lengthen the filter bitset to handle the new records.
557
+ // Notify listeners (dimensions and groups) that new data is available.
558
+ if (n1) {
559
+ data = data.concat(newData);
560
+ filters = crossfilter_arrayLengthen(filters, n += n1);
561
+ dataListeners.forEach(function(l) { l(newData, n0, n1); });
562
+ }
563
+
564
+ return crossfilter;
565
+ }
566
+
567
+ // Removes all records that match the current filters.
568
+ function removeData() {
569
+ var newIndex = crossfilter_index(n, n),
570
+ removed = [];
571
+ for (var i = 0, j = 0; i < n; ++i) {
572
+ if (filters[i]) newIndex[i] = j++;
573
+ else removed.push(i);
574
+ }
575
+
576
+ // Remove all matching records from groups.
577
+ filterListeners.forEach(function(l) { l(0, [], removed); });
578
+
579
+ // Update indexes.
580
+ removeDataListeners.forEach(function(l) { l(newIndex); });
581
+
582
+ // Remove old filters and data by overwriting.
583
+ for (var i = 0, j = 0, k; i < n; ++i) {
584
+ if (k = filters[i]) {
585
+ if (i !== j) filters[j] = k, data[j] = data[i];
586
+ ++j;
587
+ }
588
+ }
589
+ data.length = j;
590
+ while (n > j) filters[--n] = 0;
591
+ }
592
+
593
+ // Adds a new dimension with the specified value accessor function.
594
+ function dimension(value) {
595
+ var dimension = {
596
+ filter: filter,
597
+ filterExact: filterExact,
598
+ filterRange: filterRange,
599
+ filterFunction: filterFunction,
600
+ filterAll: filterAll,
601
+ top: top,
602
+ bottom: bottom,
603
+ group: group,
604
+ groupAll: groupAll,
605
+ dispose: dispose,
606
+ remove: dispose // for backwards-compatibility
607
+ };
608
+
609
+ var one = ~m & -~m, // lowest unset bit as mask, e.g., 00001000
610
+ zero = ~one, // inverted one, e.g., 11110111
611
+ values, // sorted, cached array
612
+ index, // value rank ↦ object id
613
+ newValues, // temporary array storing newly-added values
614
+ newIndex, // temporary array storing newly-added index
615
+ sort = quicksort_by(function(i) { return newValues[i]; }),
616
+ refilter = crossfilter_filterAll, // for recomputing filter
617
+ refilterFunction, // the custom filter function in use
618
+ indexListeners = [], // when data is added
619
+ dimensionGroups = [],
620
+ lo0 = 0,
621
+ hi0 = 0;
622
+
623
+ // Updating a dimension is a two-stage process. First, we must update the
624
+ // associated filters for the newly-added records. Once all dimensions have
625
+ // updated their filters, the groups are notified to update.
626
+ dataListeners.unshift(preAdd);
627
+ dataListeners.push(postAdd);
628
+
629
+ removeDataListeners.push(removeData);
630
+
631
+ // Incorporate any existing data into this dimension, and make sure that the
632
+ // filter bitset is wide enough to handle the new dimension.
633
+ m |= one;
634
+ if (M >= 32 ? !one : m & -(1 << M)) {
635
+ filters = crossfilter_arrayWiden(filters, M <<= 1);
636
+ }
637
+ preAdd(data, 0, n);
638
+ postAdd(data, 0, n);
639
+
640
+ // Incorporates the specified new records into this dimension.
641
+ // This function is responsible for updating filters, values, and index.
642
+ function preAdd(newData, n0, n1) {
643
+
644
+ // Permute new values into natural order using a sorted index.
645
+ newValues = newData.map(value);
646
+ newIndex = sort(crossfilter_range(n1), 0, n1);
647
+ newValues = permute(newValues, newIndex);
648
+
649
+ // Bisect newValues to determine which new records are selected.
650
+ var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i;
651
+ if (refilterFunction) {
652
+ for (i = 0; i < n1; ++i) {
653
+ if (!refilterFunction(newValues[i], i)) filters[newIndex[i] + n0] |= one;
654
+ }
655
+ } else {
656
+ for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one;
657
+ for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one;
658
+ }
659
+
660
+ // If this dimension previously had no data, then we don't need to do the
661
+ // more expensive merge operation; use the new values and index as-is.
662
+ if (!n0) {
663
+ values = newValues;
664
+ index = newIndex;
665
+ lo0 = lo1;
666
+ hi0 = hi1;
667
+ return;
668
+ }
669
+
670
+ var oldValues = values,
671
+ oldIndex = index,
672
+ i0 = 0,
673
+ i1 = 0;
674
+
675
+ // Otherwise, create new arrays into which to merge new and old.
676
+ values = new Array(n);
677
+ index = crossfilter_index(n, n);
678
+
679
+ // Merge the old and new sorted values, and old and new index.
680
+ for (i = 0; i0 < n0 && i1 < n1; ++i) {
681
+ if (oldValues[i0] < newValues[i1]) {
682
+ values[i] = oldValues[i0];
683
+ index[i] = oldIndex[i0++];
684
+ } else {
685
+ values[i] = newValues[i1];
686
+ index[i] = newIndex[i1++] + n0;
687
+ }
688
+ }
689
+
690
+ // Add any remaining old values.
691
+ for (; i0 < n0; ++i0, ++i) {
692
+ values[i] = oldValues[i0];
693
+ index[i] = oldIndex[i0];
694
+ }
695
+
696
+ // Add any remaining new values.
697
+ for (; i1 < n1; ++i1, ++i) {
698
+ values[i] = newValues[i1];
699
+ index[i] = newIndex[i1] + n0;
700
+ }
701
+
702
+ // Bisect again to recompute lo0 and hi0.
703
+ bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];
704
+ }
705
+
706
+ // When all filters have updated, notify index listeners of the new values.
707
+ function postAdd(newData, n0, n1) {
708
+ indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });
709
+ newValues = newIndex = null;
710
+ }
711
+
712
+ function removeData(reIndex) {
713
+ for (var i = 0, j = 0, k; i < n; ++i) {
714
+ if (filters[k = index[i]]) {
715
+ if (i !== j) values[j] = values[i];
716
+ index[j] = reIndex[k];
717
+ ++j;
718
+ }
719
+ }
720
+ values.length = j;
721
+ while (j < n) index[j++] = 0;
722
+
723
+ // Bisect again to recompute lo0 and hi0.
724
+ var bounds = refilter(values);
725
+ lo0 = bounds[0], hi0 = bounds[1];
726
+ }
727
+
728
+ // Updates the selected values based on the specified bounds [lo, hi].
729
+ // This implementation is used by all the public filter methods.
730
+ function filterIndexBounds(bounds) {
731
+ var lo1 = bounds[0],
732
+ hi1 = bounds[1];
733
+
734
+ if (refilterFunction) {
735
+ refilterFunction = null;
736
+ filterIndexFunction(function(d, i) { return lo1 <= i && i < hi1; });
737
+ lo0 = lo1;
738
+ hi0 = hi1;
739
+ return dimension;
740
+ }
741
+
742
+ var i,
743
+ j,
744
+ k,
745
+ added = [],
746
+ removed = [];
747
+
748
+ // Fast incremental update based on previous lo index.
749
+ if (lo1 < lo0) {
750
+ for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {
751
+ filters[k = index[i]] ^= one;
752
+ added.push(k);
753
+ }
754
+ } else if (lo1 > lo0) {
755
+ for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {
756
+ filters[k = index[i]] ^= one;
757
+ removed.push(k);
758
+ }
759
+ }
760
+
761
+ // Fast incremental update based on previous hi index.
762
+ if (hi1 > hi0) {
763
+ for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {
764
+ filters[k = index[i]] ^= one;
765
+ added.push(k);
766
+ }
767
+ } else if (hi1 < hi0) {
768
+ for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {
769
+ filters[k = index[i]] ^= one;
770
+ removed.push(k);
771
+ }
772
+ }
773
+
774
+ lo0 = lo1;
775
+ hi0 = hi1;
776
+ filterListeners.forEach(function(l) { l(one, added, removed); });
777
+ return dimension;
778
+ }
779
+
780
+ // Filters this dimension using the specified range, value, or null.
781
+ // If the range is null, this is equivalent to filterAll.
782
+ // If the range is an array, this is equivalent to filterRange.
783
+ // Otherwise, this is equivalent to filterExact.
784
+ function filter(range) {
785
+ return range == null
786
+ ? filterAll() : Array.isArray(range)
787
+ ? filterRange(range) : typeof range === "function"
788
+ ? filterFunction(range)
789
+ : filterExact(range);
790
+ }
791
+
792
+ // Filters this dimension to select the exact value.
793
+ function filterExact(value) {
794
+ return filterIndexBounds((refilter = crossfilter_filterExact(bisect, value))(values));
795
+ }
796
+
797
+ // Filters this dimension to select the specified range [lo, hi].
798
+ // The lower bound is inclusive, and the upper bound is exclusive.
799
+ function filterRange(range) {
800
+ return filterIndexBounds((refilter = crossfilter_filterRange(bisect, range))(values));
801
+ }
802
+
803
+ // Clears any filters on this dimension.
804
+ function filterAll() {
805
+ return filterIndexBounds((refilter = crossfilter_filterAll)(values));
806
+ }
807
+
808
+ // Filters this dimension using an arbitrary function.
809
+ function filterFunction(f) {
810
+ refilter = crossfilter_filterAll;
811
+
812
+ filterIndexFunction(refilterFunction = f);
813
+
814
+ lo0 = 0;
815
+ hi0 = n;
816
+
817
+ return dimension;
818
+ }
819
+
820
+ function filterIndexFunction(f) {
821
+ var i,
822
+ k,
823
+ x,
824
+ added = [],
825
+ removed = [];
826
+
827
+ for (i = 0; i < n; ++i) {
828
+ if (!(filters[k = index[i]] & one) ^ !!(x = f(values[i], i))) {
829
+ if (x) filters[k] &= zero, added.push(k);
830
+ else filters[k] |= one, removed.push(k);
831
+ }
832
+ }
833
+ filterListeners.forEach(function(l) { l(one, added, removed); });
834
+ }
835
+
836
+ // Returns the top K selected records based on this dimension's order.
837
+ // Note: observes this dimension's filter, unlike group and groupAll.
838
+ function top(k) {
839
+ var array = [],
840
+ i = hi0,
841
+ j;
842
+
843
+ while (--i >= lo0 && k > 0) {
844
+ if (!filters[j = index[i]]) {
845
+ array.push(data[j]);
846
+ --k;
847
+ }
848
+ }
849
+
850
+ return array;
851
+ }
852
+
853
+ // Returns the bottom K selected records based on this dimension's order.
854
+ // Note: observes this dimension's filter, unlike group and groupAll.
855
+ function bottom(k) {
856
+ var array = [],
857
+ i = lo0,
858
+ j;
859
+
860
+ while (i < hi0 && k > 0) {
861
+ if (!filters[j = index[i]]) {
862
+ array.push(data[j]);
863
+ --k;
864
+ }
865
+ i++;
866
+ }
867
+
868
+ return array;
869
+ }
870
+
871
+ // Adds a new group to this dimension, using the specified key function.
872
+ function group(key) {
873
+ var group = {
874
+ top: top,
875
+ all: all,
876
+ reduce: reduce,
877
+ reduceCount: reduceCount,
878
+ reduceSum: reduceSum,
879
+ order: order,
880
+ orderNatural: orderNatural,
881
+ size: size,
882
+ dispose: dispose,
883
+ remove: dispose // for backwards-compatibility
884
+ };
885
+
886
+ // Ensure that this group will be removed when the dimension is removed.
887
+ dimensionGroups.push(group);
888
+
889
+ var groups, // array of {key, value}
890
+ groupIndex, // object id ↦ group id
891
+ groupWidth = 8,
892
+ groupCapacity = crossfilter_capacity(groupWidth),
893
+ k = 0, // cardinality
894
+ select,
895
+ heap,
896
+ reduceAdd,
897
+ reduceRemove,
898
+ reduceInitial,
899
+ update = crossfilter_null,
900
+ reset = crossfilter_null,
901
+ resetNeeded = true,
902
+ groupAll = key === crossfilter_null;
903
+
904
+ if (arguments.length < 1) key = crossfilter_identity;
905
+
906
+ // The group listens to the crossfilter for when any dimension changes, so
907
+ // that it can update the associated reduce values. It must also listen to
908
+ // the parent dimension for when data is added, and compute new keys.
909
+ filterListeners.push(update);
910
+ indexListeners.push(add);
911
+ removeDataListeners.push(removeData);
912
+
913
+ // Incorporate any existing data into the grouping.
914
+ add(values, index, 0, n);
915
+
916
+ // Incorporates the specified new values into this group.
917
+ // This function is responsible for updating groups and groupIndex.
918
+ function add(newValues, newIndex, n0, n1) {
919
+ var oldGroups = groups,
920
+ reIndex = crossfilter_index(k, groupCapacity),
921
+ add = reduceAdd,
922
+ initial = reduceInitial,
923
+ k0 = k, // old cardinality
924
+ i0 = 0, // index of old group
925
+ i1 = 0, // index of new record
926
+ j, // object id
927
+ g0, // old group
928
+ x0, // old key
929
+ x1, // new key
930
+ g, // group to add
931
+ x; // key of group to add
932
+
933
+ // If a reset is needed, we don't need to update the reduce values.
934
+ if (resetNeeded) add = initial = crossfilter_null;
935
+
936
+ // Reset the new groups (k is a lower bound).
937
+ // Also, make sure that groupIndex exists and is long enough.
938
+ groups = new Array(k), k = 0;
939
+ groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);
940
+
941
+ // Get the first old key (x0 of g0), if it exists.
942
+ if (k0) x0 = (g0 = oldGroups[0]).key;
943
+
944
+ // Find the first new key (x1), skipping NaN keys.
945
+ while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;
946
+
947
+ // While new keys remain…
948
+ while (i1 < n1) {
949
+
950
+ // Determine the lesser of the two current keys; new and old.
951
+ // If there are no old keys remaining, then always add the new key.
952
+ if (g0 && x0 <= x1) {
953
+ g = g0, x = x0;
954
+
955
+ // Record the new index of the old group.
956
+ reIndex[i0] = k;
957
+
958
+ // Retrieve the next old key.
959
+ if (g0 = oldGroups[++i0]) x0 = g0.key;
960
+ } else {
961
+ g = {key: x1, value: initial()}, x = x1;
962
+ }
963
+
964
+ // Add the lesser group.
965
+ groups[k] = g;
966
+
967
+ // Add any selected records belonging to the added group, while
968
+ // advancing the new key and populating the associated group index.
969
+ while (!(x1 > x)) {
970
+ groupIndex[j = newIndex[i1] + n0] = k;
971
+ if (!(filters[j] & zero)) g.value = add(g.value, data[j]);
972
+ if (++i1 >= n1) break;
973
+ x1 = key(newValues[i1]);
974
+ }
975
+
976
+ groupIncrement();
977
+ }
978
+
979
+ // Add any remaining old groups that were greater than all new keys.
980
+ // No incremental reduce is needed; these groups have no new records.
981
+ // Also record the new index of the old group.
982
+ while (i0 < k0) {
983
+ groups[reIndex[i0] = k] = oldGroups[i0++];
984
+ groupIncrement();
985
+ }
986
+
987
+ // If we added any new groups before any old groups,
988
+ // update the group index of all the old records.
989
+ if (k > i0) for (i0 = 0; i0 < n0; ++i0) {
990
+ groupIndex[i0] = reIndex[groupIndex[i0]];
991
+ }
992
+
993
+ // Modify the update and reset behavior based on the cardinality.
994
+ // If the cardinality is less than or equal to one, then the groupIndex
995
+ // is not needed. If the cardinality is zero, then there are no records
996
+ // and therefore no groups to update or reset. Note that we also must
997
+ // change the registered listener to point to the new method.
998
+ j = filterListeners.indexOf(update);
999
+ if (k > 1) {
1000
+ update = updateMany;
1001
+ reset = resetMany;
1002
+ } else {
1003
+ if (!k && groupAll) {
1004
+ k = 1;
1005
+ groups = [{key: null, value: initial()}];
1006
+ }
1007
+ if (k === 1) {
1008
+ update = updateOne;
1009
+ reset = resetOne;
1010
+ } else {
1011
+ update = crossfilter_null;
1012
+ reset = crossfilter_null;
1013
+ }
1014
+ groupIndex = null;
1015
+ }
1016
+ filterListeners[j] = update;
1017
+
1018
+ // Count the number of added groups,
1019
+ // and widen the group index as needed.
1020
+ function groupIncrement() {
1021
+ if (++k === groupCapacity) {
1022
+ reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1);
1023
+ groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth);
1024
+ groupCapacity = crossfilter_capacity(groupWidth);
1025
+ }
1026
+ }
1027
+ }
1028
+
1029
+ function removeData() {
1030
+ if (k > 1) {
1031
+ var oldK = k,
1032
+ oldGroups = groups,
1033
+ seenGroups = crossfilter_index(oldK, oldK);
1034
+
1035
+ // Filter out non-matches by copying matching group index entries to
1036
+ // the beginning of the array.
1037
+ for (var i = 0, j = 0; i < n; ++i) {
1038
+ if (filters[i]) {
1039
+ seenGroups[groupIndex[j] = groupIndex[i]] = 1;
1040
+ ++j;
1041
+ }
1042
+ }
1043
+
1044
+ // Reassemble groups including only those groups that were referred
1045
+ // to by matching group index entries. Note the new group index in
1046
+ // seenGroups.
1047
+ groups = [], k = 0;
1048
+ for (i = 0; i < oldK; ++i) {
1049
+ if (seenGroups[i]) {
1050
+ seenGroups[i] = k++;
1051
+ groups.push(oldGroups[i]);
1052
+ }
1053
+ }
1054
+
1055
+ if (k > 1) {
1056
+ // Reindex the group index using seenGroups to find the new index.
1057
+ for (var i = 0; i < j; ++i) groupIndex[i] = seenGroups[groupIndex[i]];
1058
+ } else {
1059
+ groupIndex = null;
1060
+ }
1061
+ filterListeners[filterListeners.indexOf(update)] = k > 1
1062
+ ? (reset = resetMany, update = updateMany)
1063
+ : k === 1 ? (reset = resetOne, update = updateOne)
1064
+ : reset = update = crossfilter_null;
1065
+ } else if (k === 1) {
1066
+ if (groupAll) return;
1067
+ for (var i = 0; i < n; ++i) if (filters[i]) return;
1068
+ groups = [], k = 0;
1069
+ filterListeners[filterListeners.indexOf(update)] =
1070
+ update = reset = crossfilter_null;
1071
+ }
1072
+ }
1073
+
1074
+ // Reduces the specified selected or deselected records.
1075
+ // This function is only used when the cardinality is greater than 1.
1076
+ function updateMany(filterOne, added, removed) {
1077
+ if (filterOne === one || resetNeeded) return;
1078
+
1079
+ var i,
1080
+ k,
1081
+ n,
1082
+ g;
1083
+
1084
+ // Add the added values.
1085
+ for (i = 0, n = added.length; i < n; ++i) {
1086
+ if (!(filters[k = added[i]] & zero)) {
1087
+ g = groups[groupIndex[k]];
1088
+ g.value = reduceAdd(g.value, data[k]);
1089
+ }
1090
+ }
1091
+
1092
+ // Remove the removed values.
1093
+ for (i = 0, n = removed.length; i < n; ++i) {
1094
+ if ((filters[k = removed[i]] & zero) === filterOne) {
1095
+ g = groups[groupIndex[k]];
1096
+ g.value = reduceRemove(g.value, data[k]);
1097
+ }
1098
+ }
1099
+ }
1100
+
1101
+ // Reduces the specified selected or deselected records.
1102
+ // This function is only used when the cardinality is 1.
1103
+ function updateOne(filterOne, added, removed) {
1104
+ if (filterOne === one || resetNeeded) return;
1105
+
1106
+ var i,
1107
+ k,
1108
+ n,
1109
+ g = groups[0];
1110
+
1111
+ // Add the added values.
1112
+ for (i = 0, n = added.length; i < n; ++i) {
1113
+ if (!(filters[k = added[i]] & zero)) {
1114
+ g.value = reduceAdd(g.value, data[k]);
1115
+ }
1116
+ }
1117
+
1118
+ // Remove the removed values.
1119
+ for (i = 0, n = removed.length; i < n; ++i) {
1120
+ if ((filters[k = removed[i]] & zero) === filterOne) {
1121
+ g.value = reduceRemove(g.value, data[k]);
1122
+ }
1123
+ }
1124
+ }
1125
+
1126
+ // Recomputes the group reduce values from scratch.
1127
+ // This function is only used when the cardinality is greater than 1.
1128
+ function resetMany() {
1129
+ var i,
1130
+ g;
1131
+
1132
+ // Reset all group values.
1133
+ for (i = 0; i < k; ++i) {
1134
+ groups[i].value = reduceInitial();
1135
+ }
1136
+
1137
+ // Add any selected records.
1138
+ for (i = 0; i < n; ++i) {
1139
+ if (!(filters[i] & zero)) {
1140
+ g = groups[groupIndex[i]];
1141
+ g.value = reduceAdd(g.value, data[i]);
1142
+ }
1143
+ }
1144
+ }
1145
+
1146
+ // Recomputes the group reduce values from scratch.
1147
+ // This function is only used when the cardinality is 1.
1148
+ function resetOne() {
1149
+ var i,
1150
+ g = groups[0];
1151
+
1152
+ // Reset the singleton group values.
1153
+ g.value = reduceInitial();
1154
+
1155
+ // Add any selected records.
1156
+ for (i = 0; i < n; ++i) {
1157
+ if (!(filters[i] & zero)) {
1158
+ g.value = reduceAdd(g.value, data[i]);
1159
+ }
1160
+ }
1161
+ }
1162
+
1163
+ // Returns the array of group values, in the dimension's natural order.
1164
+ function all() {
1165
+ if (resetNeeded) reset(), resetNeeded = false;
1166
+ return groups;
1167
+ }
1168
+
1169
+ // Returns a new array containing the top K group values, in reduce order.
1170
+ function top(k) {
1171
+ var top = select(all(), 0, groups.length, k);
1172
+ return heap.sort(top, 0, top.length);
1173
+ }
1174
+
1175
+ // Sets the reduce behavior for this group to use the specified functions.
1176
+ // This method lazily recomputes the reduce values, waiting until needed.
1177
+ function reduce(add, remove, initial) {
1178
+ reduceAdd = add;
1179
+ reduceRemove = remove;
1180
+ reduceInitial = initial;
1181
+ resetNeeded = true;
1182
+ return group;
1183
+ }
1184
+
1185
+ // A convenience method for reducing by count.
1186
+ function reduceCount() {
1187
+ return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);
1188
+ }
1189
+
1190
+ // A convenience method for reducing by sum(value).
1191
+ function reduceSum(value) {
1192
+ return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);
1193
+ }
1194
+
1195
+ // Sets the reduce order, using the specified accessor.
1196
+ function order(value) {
1197
+ select = heapselect_by(valueOf);
1198
+ heap = heap_by(valueOf);
1199
+ function valueOf(d) { return value(d.value); }
1200
+ return group;
1201
+ }
1202
+
1203
+ // A convenience method for natural ordering by reduce value.
1204
+ function orderNatural() {
1205
+ return order(crossfilter_identity);
1206
+ }
1207
+
1208
+ // Returns the cardinality of this group, irrespective of any filters.
1209
+ function size() {
1210
+ return k;
1211
+ }
1212
+
1213
+ // Removes this group and associated event listeners.
1214
+ function dispose() {
1215
+ var i = filterListeners.indexOf(update);
1216
+ if (i >= 0) filterListeners.splice(i, 1);
1217
+ i = indexListeners.indexOf(add);
1218
+ if (i >= 0) indexListeners.splice(i, 1);
1219
+ i = removeDataListeners.indexOf(removeData);
1220
+ if (i >= 0) removeDataListeners.splice(i, 1);
1221
+ return group;
1222
+ }
1223
+
1224
+ return reduceCount().orderNatural();
1225
+ }
1226
+
1227
+ // A convenience function for generating a singleton group.
1228
+ function groupAll() {
1229
+ var g = group(crossfilter_null), all = g.all;
1230
+ delete g.all;
1231
+ delete g.top;
1232
+ delete g.order;
1233
+ delete g.orderNatural;
1234
+ delete g.size;
1235
+ g.value = function() { return all()[0].value; };
1236
+ return g;
1237
+ }
1238
+
1239
+ // Removes this dimension and associated groups and event listeners.
1240
+ function dispose() {
1241
+ dimensionGroups.forEach(function(group) { group.dispose(); });
1242
+ var i = dataListeners.indexOf(preAdd);
1243
+ if (i >= 0) dataListeners.splice(i, 1);
1244
+ i = dataListeners.indexOf(postAdd);
1245
+ if (i >= 0) dataListeners.splice(i, 1);
1246
+ i = removeDataListeners.indexOf(removeData);
1247
+ if (i >= 0) removeDataListeners.splice(i, 1);
1248
+ m &= zero;
1249
+ return filterAll();
1250
+ }
1251
+
1252
+ return dimension;
1253
+ }
1254
+
1255
+ // A convenience method for groupAll on a dummy dimension.
1256
+ // This implementation can be optimized since it always has cardinality 1.
1257
+ function groupAll() {
1258
+ var group = {
1259
+ reduce: reduce,
1260
+ reduceCount: reduceCount,
1261
+ reduceSum: reduceSum,
1262
+ value: value,
1263
+ dispose: dispose,
1264
+ remove: dispose // for backwards-compatibility
1265
+ };
1266
+
1267
+ var reduceValue,
1268
+ reduceAdd,
1269
+ reduceRemove,
1270
+ reduceInitial,
1271
+ resetNeeded = true;
1272
+
1273
+ // The group listens to the crossfilter for when any dimension changes, so
1274
+ // that it can update the reduce value. It must also listen to the parent
1275
+ // dimension for when data is added.
1276
+ filterListeners.push(update);
1277
+ dataListeners.push(add);
1278
+
1279
+ // For consistency; actually a no-op since resetNeeded is true.
1280
+ add(data, 0, n);
1281
+
1282
+ // Incorporates the specified new values into this group.
1283
+ function add(newData, n0) {
1284
+ var i;
1285
+
1286
+ if (resetNeeded) return;
1287
+
1288
+ // Add the added values.
1289
+ for (i = n0; i < n; ++i) {
1290
+ if (!filters[i]) {
1291
+ reduceValue = reduceAdd(reduceValue, data[i]);
1292
+ }
1293
+ }
1294
+ }
1295
+
1296
+ // Reduces the specified selected or deselected records.
1297
+ function update(filterOne, added, removed) {
1298
+ var i,
1299
+ k,
1300
+ n;
1301
+
1302
+ if (resetNeeded) return;
1303
+
1304
+ // Add the added values.
1305
+ for (i = 0, n = added.length; i < n; ++i) {
1306
+ if (!filters[k = added[i]]) {
1307
+ reduceValue = reduceAdd(reduceValue, data[k]);
1308
+ }
1309
+ }
1310
+
1311
+ // Remove the removed values.
1312
+ for (i = 0, n = removed.length; i < n; ++i) {
1313
+ if (filters[k = removed[i]] === filterOne) {
1314
+ reduceValue = reduceRemove(reduceValue, data[k]);
1315
+ }
1316
+ }
1317
+ }
1318
+
1319
+ // Recomputes the group reduce value from scratch.
1320
+ function reset() {
1321
+ var i;
1322
+
1323
+ reduceValue = reduceInitial();
1324
+
1325
+ for (i = 0; i < n; ++i) {
1326
+ if (!filters[i]) {
1327
+ reduceValue = reduceAdd(reduceValue, data[i]);
1328
+ }
1329
+ }
1330
+ }
1331
+
1332
+ // Sets the reduce behavior for this group to use the specified functions.
1333
+ // This method lazily recomputes the reduce value, waiting until needed.
1334
+ function reduce(add, remove, initial) {
1335
+ reduceAdd = add;
1336
+ reduceRemove = remove;
1337
+ reduceInitial = initial;
1338
+ resetNeeded = true;
1339
+ return group;
1340
+ }
1341
+
1342
+ // A convenience method for reducing by count.
1343
+ function reduceCount() {
1344
+ return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);
1345
+ }
1346
+
1347
+ // A convenience method for reducing by sum(value).
1348
+ function reduceSum(value) {
1349
+ return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);
1350
+ }
1351
+
1352
+ // Returns the computed reduce value.
1353
+ function value() {
1354
+ if (resetNeeded) reset(), resetNeeded = false;
1355
+ return reduceValue;
1356
+ }
1357
+
1358
+ // Removes this group and associated event listeners.
1359
+ function dispose() {
1360
+ var i = filterListeners.indexOf(update);
1361
+ if (i >= 0) filterListeners.splice(i);
1362
+ i = dataListeners.indexOf(add);
1363
+ if (i >= 0) dataListeners.splice(i);
1364
+ return group;
1365
+ }
1366
+
1367
+ return reduceCount();
1368
+ }
1369
+
1370
+ // Returns the number of records in this crossfilter, irrespective of any filters.
1371
+ function size() {
1372
+ return n;
1373
+ }
1374
+
1375
+ return arguments.length
1376
+ ? add(arguments[0])
1377
+ : crossfilter;
1378
+ }
1379
+
1380
+ // Returns an array of size n, big enough to store ids up to m.
1381
+ function crossfilter_index(n, m) {
1382
+ return (m < 0x101
1383
+ ? crossfilter_array8 : m < 0x10001
1384
+ ? crossfilter_array16
1385
+ : crossfilter_array32)(n);
1386
+ }
1387
+
1388
+ // Constructs a new array of size n, with sequential values from 0 to n - 1.
1389
+ function crossfilter_range(n) {
1390
+ var range = crossfilter_index(n, n);
1391
+ for (var i = -1; ++i < n;) range[i] = i;
1392
+ return range;
1393
+ }
1394
+
1395
+ function crossfilter_capacity(w) {
1396
+ return w === 8
1397
+ ? 0x100 : w === 16
1398
+ ? 0x10000
1399
+ : 0x100000000;
1400
+ }
1401
+ })(typeof exports !== 'undefined' && exports || this);