mdarray-sol 0.1.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,1300 @@
1
+ /**
2
+ * Coordinate Grid is an abstract base chart designed to support a number of coordinate grid based
3
+ * concrete chart types, e.g. bar chart, line chart, and bubble chart.
4
+ * @name coordinateGridMixin
5
+ * @memberof dc
6
+ * @mixin
7
+ * @mixes dc.colorMixin
8
+ * @mixes dc.marginMixin
9
+ * @mixes dc.baseMixin
10
+ * @param {Object} _chart
11
+ * @return {dc.coordinateGridMixin}
12
+ */
13
+ dc.coordinateGridMixin = function (_chart) {
14
+ var GRID_LINE_CLASS = 'grid-line';
15
+ var HORIZONTAL_CLASS = 'horizontal';
16
+ var VERTICAL_CLASS = 'vertical';
17
+ var Y_AXIS_LABEL_CLASS = 'y-axis-label';
18
+ var X_AXIS_LABEL_CLASS = 'x-axis-label';
19
+ var DEFAULT_AXIS_LABEL_PADDING = 12;
20
+
21
+ _chart = dc.colorMixin(dc.marginMixin(dc.baseMixin(_chart)));
22
+
23
+ _chart.colors(d3.scale.category10());
24
+ _chart._mandatoryAttributes().push('x');
25
+
26
+ function zoomHandler () {
27
+ _refocused = true;
28
+ if (_zoomOutRestrict) {
29
+ _chart.x().domain(constrainRange(_chart.x().domain(), _xOriginalDomain));
30
+ if (_rangeChart) {
31
+ _chart.x().domain(constrainRange(_chart.x().domain(), _rangeChart.x().domain()));
32
+ }
33
+ }
34
+
35
+ var domain = _chart.x().domain();
36
+ var domFilter = dc.filters.RangedFilter(domain[0], domain[1]);
37
+
38
+ _chart.replaceFilter(domFilter);
39
+ _chart.rescale();
40
+ _chart.redraw();
41
+
42
+ if (_rangeChart && !rangesEqual(_chart.filter(), _rangeChart.filter())) {
43
+ dc.events.trigger(function () {
44
+ _rangeChart.replaceFilter(domFilter);
45
+ _rangeChart.redraw();
46
+ });
47
+ }
48
+
49
+ _chart._invokeZoomedListener();
50
+
51
+ dc.events.trigger(function () {
52
+ _chart.redrawGroup();
53
+ }, dc.constants.EVENT_DELAY);
54
+
55
+ _refocused = !rangesEqual(domain, _xOriginalDomain);
56
+ }
57
+
58
+ var _parent;
59
+ var _g;
60
+ var _chartBodyG;
61
+
62
+ var _x;
63
+ var _xOriginalDomain;
64
+ var _xAxis = d3.svg.axis().orient('bottom');
65
+ var _xUnits = dc.units.integers;
66
+ var _xAxisPadding = 0;
67
+ var _xElasticity = false;
68
+ var _xAxisLabel;
69
+ var _xAxisLabelPadding = 0;
70
+ var _lastXDomain;
71
+
72
+ var _y;
73
+ var _yAxis = d3.svg.axis().orient('left');
74
+ var _yAxisPadding = 0;
75
+ var _yElasticity = false;
76
+ var _yAxisLabel;
77
+ var _yAxisLabelPadding = 0;
78
+
79
+ var _brush = d3.svg.brush();
80
+ var _brushOn = true;
81
+ var _round;
82
+
83
+ var _renderHorizontalGridLine = false;
84
+ var _renderVerticalGridLine = false;
85
+
86
+ var _refocused = false, _resizing = false;
87
+ var _unitCount;
88
+
89
+ var _zoomScale = [1, Infinity];
90
+ var _zoomOutRestrict = true;
91
+
92
+ var _zoom = d3.behavior.zoom().on('zoom', zoomHandler);
93
+ var _nullZoom = d3.behavior.zoom().on('zoom', null);
94
+ var _hasBeenMouseZoomable = false;
95
+
96
+ var _rangeChart;
97
+ var _focusChart;
98
+
99
+ var _mouseZoomable = false;
100
+ var _clipPadding = 0;
101
+
102
+ var _outerRangeBandPadding = 0.5;
103
+ var _rangeBandPadding = 0;
104
+
105
+ var _useRightYAxis = false;
106
+
107
+ /**
108
+ * When changing the domain of the x or y scale, it is necessary to tell the chart to recalculate
109
+ * and redraw the axes. (`.rescale()` is called automatically when the x or y scale is replaced
110
+ * with {@link dc.coordinateGridMixin+x .x()} or {@link dc.coordinateGridMixin#y .y()}, and has
111
+ * no effect on elastic scales.)
112
+ * @method rescale
113
+ * @memberof dc.coordinateGridMixin
114
+ * @instance
115
+ * @return {dc.coordinateGridMixin}
116
+ */
117
+ _chart.rescale = function () {
118
+ _unitCount = undefined;
119
+ _resizing = true;
120
+ return _chart;
121
+ };
122
+
123
+ _chart.resizing = function () {
124
+ return _resizing;
125
+ };
126
+
127
+ /**
128
+ * Get or set the range selection chart associated with this instance. Setting the range selection
129
+ * chart using this function will automatically update its selection brush when the current chart
130
+ * zooms in. In return the given range chart will also automatically attach this chart as its focus
131
+ * chart hence zoom in when range brush updates.
132
+ *
133
+ * Usually the range and focus charts will share a dimension. The range chart will set the zoom
134
+ * boundaries for the focus chart, so its dimension values must be compatible with the domain of
135
+ * the focus chart.
136
+ *
137
+ * See the [Nasdaq 100 Index](http://dc-js.github.com/dc.js/) example for this effect in action.
138
+ * @method rangeChart
139
+ * @memberof dc.coordinateGridMixin
140
+ * @instance
141
+ * @param {dc.coordinateGridMixin} [rangeChart]
142
+ * @return {dc.coordinateGridMixin}
143
+ */
144
+ _chart.rangeChart = function (rangeChart) {
145
+ if (!arguments.length) {
146
+ return _rangeChart;
147
+ }
148
+ _rangeChart = rangeChart;
149
+ _rangeChart.focusChart(_chart);
150
+ return _chart;
151
+ };
152
+
153
+ /**
154
+ * Get or set the scale extent for mouse zooms.
155
+ * @method zoomScale
156
+ * @memberof dc.coordinateGridMixin
157
+ * @instance
158
+ * @param {Array<Number|Date>} [extent=[1, Infinity]]
159
+ * @return {Array<Number|Date>}
160
+ * @return {dc.coordinateGridMixin}
161
+ */
162
+ _chart.zoomScale = function (extent) {
163
+ if (!arguments.length) {
164
+ return _zoomScale;
165
+ }
166
+ _zoomScale = extent;
167
+ return _chart;
168
+ };
169
+
170
+ /**
171
+ * Get or set the zoom restriction for the chart. If true limits the zoom to origional domain of the chart.
172
+ * @method zoomOutRestrict
173
+ * @memberof dc.coordinateGridMixin
174
+ * @instance
175
+ * @param {Boolean} [zoomOutRestrict=true]
176
+ * @return {Boolean}
177
+ * @return {dc.coordinateGridMixin}
178
+ */
179
+ _chart.zoomOutRestrict = function (zoomOutRestrict) {
180
+ if (!arguments.length) {
181
+ return _zoomOutRestrict;
182
+ }
183
+ _zoomScale[0] = zoomOutRestrict ? 1 : 0;
184
+ _zoomOutRestrict = zoomOutRestrict;
185
+ return _chart;
186
+ };
187
+
188
+ _chart._generateG = function (parent) {
189
+ if (parent === undefined) {
190
+ _parent = _chart.svg();
191
+ } else {
192
+ _parent = parent;
193
+ }
194
+
195
+ var href = window.location.href.split('#')[0];
196
+
197
+ _g = _parent.append('g');
198
+
199
+ _chartBodyG = _g.append('g').attr('class', 'chart-body')
200
+ .attr('transform', 'translate(' + _chart.margins().left + ', ' + _chart.margins().top + ')')
201
+ .attr('clip-path', 'url(' + href + '#' + getClipPathId() + ')');
202
+
203
+ return _g;
204
+ };
205
+
206
+ /**
207
+ * Get or set the root g element. This method is usually used to retrieve the g element in order to
208
+ * overlay custom svg drawing programatically. **Caution**: The root g element is usually generated
209
+ * by dc.js internals, and resetting it might produce unpredictable result.
210
+ * @method g
211
+ * @memberof dc.coordinateGridMixin
212
+ * @instance
213
+ * @param {SVGElement} [gElement]
214
+ * @return {SVGElement}
215
+ * @return {dc.coordinateGridMixin}
216
+ */
217
+ _chart.g = function (gElement) {
218
+ if (!arguments.length) {
219
+ return _g;
220
+ }
221
+ _g = gElement;
222
+ return _chart;
223
+ };
224
+
225
+ /**
226
+ * Set or get mouse zoom capability flag (default: false). When turned on the chart will be
227
+ * zoomable using the mouse wheel. If the range selector chart is attached zooming will also update
228
+ * the range selection brush on the associated range selector chart.
229
+ * @method mouseZoomable
230
+ * @memberof dc.coordinateGridMixin
231
+ * @instance
232
+ * @param {Boolean} [mouseZoomable=false]
233
+ * @return {Boolean}
234
+ * @return {dc.coordinateGridMixin}
235
+ */
236
+ _chart.mouseZoomable = function (mouseZoomable) {
237
+ if (!arguments.length) {
238
+ return _mouseZoomable;
239
+ }
240
+ _mouseZoomable = mouseZoomable;
241
+ return _chart;
242
+ };
243
+
244
+ /**
245
+ * Retrieve the svg group for the chart body.
246
+ * @method chartBodyG
247
+ * @memberof dc.coordinateGridMixin
248
+ * @instance
249
+ * @param {SVGElement} [chartBodyG]
250
+ * @return {SVGElement}
251
+ */
252
+ _chart.chartBodyG = function (chartBodyG) {
253
+ if (!arguments.length) {
254
+ return _chartBodyG;
255
+ }
256
+ _chartBodyG = chartBodyG;
257
+ return _chart;
258
+ };
259
+
260
+ /**
261
+ * **mandatory**
262
+ *
263
+ * Get or set the x scale. The x scale can be any d3
264
+ * {@link https://github.com/mbostock/d3/wiki/Quantitative-Scales quantitive scale} or
265
+ * {@link https://github.com/mbostock/d3/wiki/Ordinal-Scales ordinal scale}.
266
+ * @method x
267
+ * @memberof dc.coordinateGridMixin
268
+ * @instance
269
+ * @see {@link http://github.com/mbostock/d3/wiki/Scales d3.scale}
270
+ * @example
271
+ * // set x to a linear scale
272
+ * chart.x(d3.scale.linear().domain([-2500, 2500]))
273
+ * // set x to a time scale to generate histogram
274
+ * chart.x(d3.time.scale().domain([new Date(1985, 0, 1), new Date(2012, 11, 31)]))
275
+ * @param {d3.scale} [xScale]
276
+ * @return {d3.scale}
277
+ * @return {dc.coordinateGridMixin}
278
+ */
279
+ _chart.x = function (xScale) {
280
+ if (!arguments.length) {
281
+ return _x;
282
+ }
283
+ _x = xScale;
284
+ _xOriginalDomain = _x.domain();
285
+ _chart.rescale();
286
+ return _chart;
287
+ };
288
+
289
+ _chart.xOriginalDomain = function () {
290
+ return _xOriginalDomain;
291
+ };
292
+
293
+ /**
294
+ * Set or get the xUnits function. The coordinate grid chart uses the xUnits function to calculate
295
+ * the number of data projections on x axis such as the number of bars for a bar chart or the
296
+ * number of dots for a line chart. This function is expected to return a Javascript array of all
297
+ * data points on x axis, or the number of points on the axis. [d3 time range functions
298
+ * d3.time.days, d3.time.months, and
299
+ * d3.time.years](https://github.com/mbostock/d3/wiki/Time-Intervals#aliases) are all valid xUnits
300
+ * function. dc.js also provides a few units function, see the {@link dc.utils Utilities} section for
301
+ * a list of built-in units functions. The default xUnits function is dc.units.integers.
302
+ * @method xUnits
303
+ * @memberof dc.coordinateGridMixin
304
+ * @instance
305
+ * @todo Add docs for utilities
306
+ * @example
307
+ * // set x units to count days
308
+ * chart.xUnits(d3.time.days);
309
+ * // set x units to count months
310
+ * chart.xUnits(d3.time.months);
311
+ *
312
+ * // A custom xUnits function can be used as long as it follows the following interface:
313
+ * // units in integer
314
+ * function(start, end, xDomain) {
315
+ * // simply calculates how many integers in the domain
316
+ * return Math.abs(end - start);
317
+ * };
318
+ *
319
+ * // fixed units
320
+ * function(start, end, xDomain) {
321
+ * // be aware using fixed units will disable the focus/zoom ability on the chart
322
+ * return 1000;
323
+ * @param {Function} [xUnits]
324
+ * @return {Function}
325
+ * @return {dc.coordinateGridMixin}
326
+ */
327
+ _chart.xUnits = function (xUnits) {
328
+ if (!arguments.length) {
329
+ return _xUnits;
330
+ }
331
+ _xUnits = xUnits;
332
+ return _chart;
333
+ };
334
+
335
+ /**
336
+ * Set or get the x axis used by a particular coordinate grid chart instance. This function is most
337
+ * useful when x axis customization is required. The x axis in dc.js is an instance of a [d3
338
+ * axis object](https://github.com/mbostock/d3/wiki/SVG-Axes#wiki-axis); therefore it supports any
339
+ * valid d3 axis manipulation. **Caution**: The x axis is usually generated internally by dc;
340
+ * resetting it may cause unexpected results.
341
+ * @method xAxis
342
+ * @memberof dc.coordinateGridMixin
343
+ * @instance
344
+ * @see {@link http://github.com/mbostock/d3/wiki/SVG-Axes d3.svg.axis}
345
+ * @example
346
+ * // customize x axis tick format
347
+ * chart.xAxis().tickFormat(function(v) {return v + '%';});
348
+ * // customize x axis tick values
349
+ * chart.xAxis().tickValues([0, 100, 200, 300]);
350
+ * @param {d3.svg.axis} [xAxis=d3.svg.axis().orient('bottom')]
351
+ * @return {d3.svg.axis}
352
+ * @return {dc.coordinateGridMixin}
353
+ */
354
+ _chart.xAxis = function (xAxis) {
355
+ if (!arguments.length) {
356
+ return _xAxis;
357
+ }
358
+ _xAxis = xAxis;
359
+ return _chart;
360
+ };
361
+
362
+ /**
363
+ * Turn on/off elastic x axis behavior. If x axis elasticity is turned on, then the grid chart will
364
+ * attempt to recalculate the x axis range whenever a redraw event is triggered.
365
+ * @method elasticX
366
+ * @memberof dc.coordinateGridMixin
367
+ * @instance
368
+ * @param {Boolean} [elasticX=false]
369
+ * @return {Boolean}
370
+ * @return {dc.coordinateGridMixin}
371
+ */
372
+ _chart.elasticX = function (elasticX) {
373
+ if (!arguments.length) {
374
+ return _xElasticity;
375
+ }
376
+ _xElasticity = elasticX;
377
+ return _chart;
378
+ };
379
+
380
+ /**
381
+ * Set or get x axis padding for the elastic x axis. The padding will be added to both end of the x
382
+ * axis if elasticX is turned on; otherwise it is ignored.
383
+ *
384
+ * padding can be an integer or percentage in string (e.g. '10%'). Padding can be applied to
385
+ * number or date x axes. When padding a date axis, an integer represents number of days being padded
386
+ * and a percentage string will be treated the same as an integer.
387
+ * @method xAxisPadding
388
+ * @memberof dc.coordinateGridMixin
389
+ * @instance
390
+ * @param {Number|String} [padding=0]
391
+ * @return {Number|String}
392
+ * @return {dc.coordinateGridMixin}
393
+ */
394
+ _chart.xAxisPadding = function (padding) {
395
+ if (!arguments.length) {
396
+ return _xAxisPadding;
397
+ }
398
+ _xAxisPadding = padding;
399
+ return _chart;
400
+ };
401
+
402
+ /**
403
+ * Returns the number of units displayed on the x axis using the unit measure configured by
404
+ * .xUnits.
405
+ * @method xUnitCount
406
+ * @memberof dc.coordinateGridMixin
407
+ * @instance
408
+ * @return {Number}
409
+ */
410
+ _chart.xUnitCount = function () {
411
+ if (_unitCount === undefined) {
412
+ var units = _chart.xUnits()(_chart.x().domain()[0], _chart.x().domain()[1], _chart.x().domain());
413
+
414
+ if (units instanceof Array) {
415
+ _unitCount = units.length;
416
+ } else {
417
+ _unitCount = units;
418
+ }
419
+ }
420
+
421
+ return _unitCount;
422
+ };
423
+
424
+ /**
425
+ * Gets or sets whether the chart should be drawn with a right axis instead of a left axis. When
426
+ * used with a chart in a composite chart, allows both left and right Y axes to be shown on a
427
+ * chart.
428
+ * @method useRightYAxis
429
+ * @memberof dc.coordinateGridMixin
430
+ * @instance
431
+ * @param {Boolean} [useRightYAxis=false]
432
+ * @return {Boolean}
433
+ * @return {dc.coordinateGridMixin}
434
+ */
435
+ _chart.useRightYAxis = function (useRightYAxis) {
436
+ if (!arguments.length) {
437
+ return _useRightYAxis;
438
+ }
439
+ _useRightYAxis = useRightYAxis;
440
+ return _chart;
441
+ };
442
+
443
+ /**
444
+ * Returns true if the chart is using ordinal xUnits ({@link dc.units.ordinal dc.units.ordinal}, or false
445
+ * otherwise. Most charts behave differently with ordinal data and use the result of this method to
446
+ * trigger the appropriate logic.
447
+ * @method isOrdinal
448
+ * @memberof dc.coordinateGridMixin
449
+ * @instance
450
+ * @return {Boolean}
451
+ */
452
+ _chart.isOrdinal = function () {
453
+ return _chart.xUnits() === dc.units.ordinal;
454
+ };
455
+
456
+ _chart._useOuterPadding = function () {
457
+ return true;
458
+ };
459
+
460
+ _chart._ordinalXDomain = function () {
461
+ var groups = _chart._computeOrderedGroups(_chart.data());
462
+ return groups.map(_chart.keyAccessor());
463
+ };
464
+
465
+ function compareDomains (d1, d2) {
466
+ return !d1 || !d2 || d1.length !== d2.length ||
467
+ d1.some(function (elem, i) { return (elem && d2[i]) ? elem.toString() !== d2[i].toString() : elem === d2[i]; });
468
+ }
469
+
470
+ function prepareXAxis (g, render) {
471
+ if (!_chart.isOrdinal()) {
472
+ if (_chart.elasticX()) {
473
+ _x.domain([_chart.xAxisMin(), _chart.xAxisMax()]);
474
+ }
475
+ } else { // _chart.isOrdinal()
476
+ if (_chart.elasticX() || _x.domain().length === 0) {
477
+ _x.domain(_chart._ordinalXDomain());
478
+ }
479
+ }
480
+
481
+ // has the domain changed?
482
+ var xdom = _x.domain();
483
+ if (render || compareDomains(_lastXDomain, xdom)) {
484
+ _chart.rescale();
485
+ }
486
+ _lastXDomain = xdom;
487
+
488
+ // please can't we always use rangeBands for bar charts?
489
+ if (_chart.isOrdinal()) {
490
+ _x.rangeBands([0, _chart.xAxisLength()], _rangeBandPadding,
491
+ _chart._useOuterPadding() ? _outerRangeBandPadding : 0);
492
+ } else {
493
+ _x.range([0, _chart.xAxisLength()]);
494
+ }
495
+
496
+ _xAxis = _xAxis.scale(_chart.x());
497
+
498
+ renderVerticalGridLines(g);
499
+ }
500
+
501
+ _chart.renderXAxis = function (g) {
502
+ var axisXG = g.selectAll('g.x');
503
+
504
+ if (axisXG.empty()) {
505
+ axisXG = g.append('g')
506
+ .attr('class', 'axis x')
507
+ .attr('transform', 'translate(' + _chart.margins().left + ',' + _chart._xAxisY() + ')');
508
+ }
509
+
510
+ var axisXLab = g.selectAll('text.' + X_AXIS_LABEL_CLASS);
511
+ if (axisXLab.empty() && _chart.xAxisLabel()) {
512
+ axisXLab = g.append('text')
513
+ .attr('class', X_AXIS_LABEL_CLASS)
514
+ .attr('transform', 'translate(' + (_chart.margins().left + _chart.xAxisLength() / 2) + ',' +
515
+ (_chart.height() - _xAxisLabelPadding) + ')')
516
+ .attr('text-anchor', 'middle');
517
+ }
518
+ if (_chart.xAxisLabel() && axisXLab.text() !== _chart.xAxisLabel()) {
519
+ axisXLab.text(_chart.xAxisLabel());
520
+ }
521
+
522
+ dc.transition(axisXG, _chart.transitionDuration())
523
+ .attr('transform', 'translate(' + _chart.margins().left + ',' + _chart._xAxisY() + ')')
524
+ .call(_xAxis);
525
+ dc.transition(axisXLab, _chart.transitionDuration())
526
+ .attr('transform', 'translate(' + (_chart.margins().left + _chart.xAxisLength() / 2) + ',' +
527
+ (_chart.height() - _xAxisLabelPadding) + ')');
528
+ };
529
+
530
+ function renderVerticalGridLines (g) {
531
+ var gridLineG = g.selectAll('g.' + VERTICAL_CLASS);
532
+
533
+ if (_renderVerticalGridLine) {
534
+ if (gridLineG.empty()) {
535
+ gridLineG = g.insert('g', ':first-child')
536
+ .attr('class', GRID_LINE_CLASS + ' ' + VERTICAL_CLASS)
537
+ .attr('transform', 'translate(' + _chart.margins().left + ',' + _chart.margins().top + ')');
538
+ }
539
+
540
+ var ticks = _xAxis.tickValues() ? _xAxis.tickValues() :
541
+ (typeof _x.ticks === 'function' ? _x.ticks(_xAxis.ticks()[0]) : _x.domain());
542
+
543
+ var lines = gridLineG.selectAll('line')
544
+ .data(ticks);
545
+
546
+ // enter
547
+ var linesGEnter = lines.enter()
548
+ .append('line')
549
+ .attr('x1', function (d) {
550
+ return _x(d);
551
+ })
552
+ .attr('y1', _chart._xAxisY() - _chart.margins().top)
553
+ .attr('x2', function (d) {
554
+ return _x(d);
555
+ })
556
+ .attr('y2', 0)
557
+ .attr('opacity', 0);
558
+ dc.transition(linesGEnter, _chart.transitionDuration())
559
+ .attr('opacity', 1);
560
+
561
+ // update
562
+ dc.transition(lines, _chart.transitionDuration())
563
+ .attr('x1', function (d) {
564
+ return _x(d);
565
+ })
566
+ .attr('y1', _chart._xAxisY() - _chart.margins().top)
567
+ .attr('x2', function (d) {
568
+ return _x(d);
569
+ })
570
+ .attr('y2', 0);
571
+
572
+ // exit
573
+ lines.exit().remove();
574
+ } else {
575
+ gridLineG.selectAll('line').remove();
576
+ }
577
+ }
578
+
579
+ _chart._xAxisY = function () {
580
+ return (_chart.height() - _chart.margins().bottom);
581
+ };
582
+
583
+ _chart.xAxisLength = function () {
584
+ return _chart.effectiveWidth();
585
+ };
586
+
587
+ /**
588
+ * Set or get the x axis label. If setting the label, you may optionally include additional padding to
589
+ * the margin to make room for the label. By default the padded is set to 12 to accomodate the text height.
590
+ * @method xAxisLabel
591
+ * @memberof dc.coordinateGridMixin
592
+ * @instance
593
+ * @param {String} [labelText]
594
+ * @param {Number} [padding=12]
595
+ * @return {String}
596
+ */
597
+ _chart.xAxisLabel = function (labelText, padding) {
598
+ if (!arguments.length) {
599
+ return _xAxisLabel;
600
+ }
601
+ _xAxisLabel = labelText;
602
+ _chart.margins().bottom -= _xAxisLabelPadding;
603
+ _xAxisLabelPadding = (padding === undefined) ? DEFAULT_AXIS_LABEL_PADDING : padding;
604
+ _chart.margins().bottom += _xAxisLabelPadding;
605
+ return _chart;
606
+ };
607
+
608
+ _chart._prepareYAxis = function (g) {
609
+ if (_y === undefined || _chart.elasticY()) {
610
+ if (_y === undefined) {
611
+ _y = d3.scale.linear();
612
+ }
613
+ var min = _chart.yAxisMin() || 0,
614
+ max = _chart.yAxisMax() || 0;
615
+ _y.domain([min, max]).rangeRound([_chart.yAxisHeight(), 0]);
616
+ }
617
+
618
+ _y.range([_chart.yAxisHeight(), 0]);
619
+ _yAxis = _yAxis.scale(_y);
620
+
621
+ if (_useRightYAxis) {
622
+ _yAxis.orient('right');
623
+ }
624
+
625
+ _chart._renderHorizontalGridLinesForAxis(g, _y, _yAxis);
626
+ };
627
+
628
+ _chart.renderYAxisLabel = function (axisClass, text, rotation, labelXPosition) {
629
+ labelXPosition = labelXPosition || _yAxisLabelPadding;
630
+
631
+ var axisYLab = _chart.g().selectAll('text.' + Y_AXIS_LABEL_CLASS + '.' + axisClass + '-label');
632
+ var labelYPosition = (_chart.margins().top + _chart.yAxisHeight() / 2);
633
+ if (axisYLab.empty() && text) {
634
+ axisYLab = _chart.g().append('text')
635
+ .attr('transform', 'translate(' + labelXPosition + ',' + labelYPosition + '),rotate(' + rotation + ')')
636
+ .attr('class', Y_AXIS_LABEL_CLASS + ' ' + axisClass + '-label')
637
+ .attr('text-anchor', 'middle')
638
+ .text(text);
639
+ }
640
+ if (text && axisYLab.text() !== text) {
641
+ axisYLab.text(text);
642
+ }
643
+ dc.transition(axisYLab, _chart.transitionDuration())
644
+ .attr('transform', 'translate(' + labelXPosition + ',' + labelYPosition + '),rotate(' + rotation + ')');
645
+ };
646
+
647
+ _chart.renderYAxisAt = function (axisClass, axis, position) {
648
+ var axisYG = _chart.g().selectAll('g.' + axisClass);
649
+ if (axisYG.empty()) {
650
+ axisYG = _chart.g().append('g')
651
+ .attr('class', 'axis ' + axisClass)
652
+ .attr('transform', 'translate(' + position + ',' + _chart.margins().top + ')');
653
+ }
654
+
655
+ dc.transition(axisYG, _chart.transitionDuration())
656
+ .attr('transform', 'translate(' + position + ',' + _chart.margins().top + ')')
657
+ .call(axis);
658
+ };
659
+
660
+ _chart.renderYAxis = function () {
661
+ var axisPosition = _useRightYAxis ? (_chart.width() - _chart.margins().right) : _chart._yAxisX();
662
+ _chart.renderYAxisAt('y', _yAxis, axisPosition);
663
+ var labelPosition = _useRightYAxis ? (_chart.width() - _yAxisLabelPadding) : _yAxisLabelPadding;
664
+ var rotation = _useRightYAxis ? 90 : -90;
665
+ _chart.renderYAxisLabel('y', _chart.yAxisLabel(), rotation, labelPosition);
666
+ };
667
+
668
+ _chart._renderHorizontalGridLinesForAxis = function (g, scale, axis) {
669
+ var gridLineG = g.selectAll('g.' + HORIZONTAL_CLASS);
670
+
671
+ if (_renderHorizontalGridLine) {
672
+ var ticks = axis.tickValues() ? axis.tickValues() : scale.ticks(axis.ticks()[0]);
673
+
674
+ if (gridLineG.empty()) {
675
+ gridLineG = g.insert('g', ':first-child')
676
+ .attr('class', GRID_LINE_CLASS + ' ' + HORIZONTAL_CLASS)
677
+ .attr('transform', 'translate(' + _chart.margins().left + ',' + _chart.margins().top + ')');
678
+ }
679
+
680
+ var lines = gridLineG.selectAll('line')
681
+ .data(ticks);
682
+
683
+ // enter
684
+ var linesGEnter = lines.enter()
685
+ .append('line')
686
+ .attr('x1', 1)
687
+ .attr('y1', function (d) {
688
+ return scale(d);
689
+ })
690
+ .attr('x2', _chart.xAxisLength())
691
+ .attr('y2', function (d) {
692
+ return scale(d);
693
+ })
694
+ .attr('opacity', 0);
695
+ dc.transition(linesGEnter, _chart.transitionDuration())
696
+ .attr('opacity', 1);
697
+
698
+ // update
699
+ dc.transition(lines, _chart.transitionDuration())
700
+ .attr('x1', 1)
701
+ .attr('y1', function (d) {
702
+ return scale(d);
703
+ })
704
+ .attr('x2', _chart.xAxisLength())
705
+ .attr('y2', function (d) {
706
+ return scale(d);
707
+ });
708
+
709
+ // exit
710
+ lines.exit().remove();
711
+ } else {
712
+ gridLineG.selectAll('line').remove();
713
+ }
714
+ };
715
+
716
+ _chart._yAxisX = function () {
717
+ return _chart.useRightYAxis() ? _chart.width() - _chart.margins().right : _chart.margins().left;
718
+ };
719
+
720
+ /**
721
+ * Set or get the y axis label. If setting the label, you may optionally include additional padding
722
+ * to the margin to make room for the label. By default the padded is set to 12 to accomodate the
723
+ * text height.
724
+ * @method yAxisLabel
725
+ * @memberof dc.coordinateGridMixin
726
+ * @instance
727
+ * @param {String} [labelText]
728
+ * @param {Number} [padding=12]
729
+ * @return {String}
730
+ * @return {dc.coordinateGridMixin}
731
+ */
732
+ _chart.yAxisLabel = function (labelText, padding) {
733
+ if (!arguments.length) {
734
+ return _yAxisLabel;
735
+ }
736
+ _yAxisLabel = labelText;
737
+ _chart.margins().left -= _yAxisLabelPadding;
738
+ _yAxisLabelPadding = (padding === undefined) ? DEFAULT_AXIS_LABEL_PADDING : padding;
739
+ _chart.margins().left += _yAxisLabelPadding;
740
+ return _chart;
741
+ };
742
+
743
+ /**
744
+ * Get or set the y scale. The y scale is typically automatically determined by the chart implementation.
745
+ * @method y
746
+ * @memberof dc.coordinateGridMixin
747
+ * @instance
748
+ * @see {@link http://github.com/mbostock/d3/wiki/Scales d3.scale}
749
+ * @param {d3.scale} [yScale]
750
+ * @return {d3.scale}
751
+ * @return {dc.coordinateGridMixin}
752
+ */
753
+ _chart.y = function (yScale) {
754
+ if (!arguments.length) {
755
+ return _y;
756
+ }
757
+ _y = yScale;
758
+ _chart.rescale();
759
+ return _chart;
760
+ };
761
+
762
+ /**
763
+ * Set or get the y axis used by the coordinate grid chart instance. This function is most useful
764
+ * when y axis customization is required. The y axis in dc.js is simply an instance of a [d3 axis
765
+ * object](https://github.com/mbostock/d3/wiki/SVG-Axes#wiki-_axis); therefore it supports any
766
+ * valid d3 axis manipulation. **Caution**: The y axis is usually generated internally by dc;
767
+ * resetting it may cause unexpected results.
768
+ * @method yAxis
769
+ * @memberof dc.coordinateGridMixin
770
+ * @instance
771
+ * @see {@link http://github.com/mbostock/d3/wiki/SVG-Axes d3.svg.axis}
772
+ * @example
773
+ * // customize y axis tick format
774
+ * chart.yAxis().tickFormat(function(v) {return v + '%';});
775
+ * // customize y axis tick values
776
+ * chart.yAxis().tickValues([0, 100, 200, 300]);
777
+ * @param {d3.svg.axis} [yAxis=d3.svg.axis().orient('left')]
778
+ * @return {d3.svg.axis}
779
+ * @return {dc.coordinateGridMixin}
780
+ */
781
+ _chart.yAxis = function (yAxis) {
782
+ if (!arguments.length) {
783
+ return _yAxis;
784
+ }
785
+ _yAxis = yAxis;
786
+ return _chart;
787
+ };
788
+
789
+ /**
790
+ * Turn on/off elastic y axis behavior. If y axis elasticity is turned on, then the grid chart will
791
+ * attempt to recalculate the y axis range whenever a redraw event is triggered.
792
+ * @method elasticY
793
+ * @memberof dc.coordinateGridMixin
794
+ * @instance
795
+ * @param {Boolean} [elasticY=false]
796
+ * @return {Boolean}
797
+ * @return {dc.coordinateGridMixin}
798
+ */
799
+ _chart.elasticY = function (elasticY) {
800
+ if (!arguments.length) {
801
+ return _yElasticity;
802
+ }
803
+ _yElasticity = elasticY;
804
+ return _chart;
805
+ };
806
+
807
+ /**
808
+ * Turn on/off horizontal grid lines.
809
+ * @method renderHorizontalGridLines
810
+ * @memberof dc.coordinateGridMixin
811
+ * @instance
812
+ * @param {Boolean} [renderHorizontalGridLines=false]
813
+ * @return {Boolean}
814
+ * @return {dc.coordinateGridMixin}
815
+ */
816
+ _chart.renderHorizontalGridLines = function (renderHorizontalGridLines) {
817
+ if (!arguments.length) {
818
+ return _renderHorizontalGridLine;
819
+ }
820
+ _renderHorizontalGridLine = renderHorizontalGridLines;
821
+ return _chart;
822
+ };
823
+
824
+ /**
825
+ * Turn on/off vertical grid lines.
826
+ * @method renderVerticalGridLines
827
+ * @memberof dc.coordinateGridMixin
828
+ * @instance
829
+ * @param {Boolean} [renderVerticalGridLines=false]
830
+ * @return {Boolean}
831
+ * @return {dc.coordinateGridMixin}
832
+ */
833
+ _chart.renderVerticalGridLines = function (renderVerticalGridLines) {
834
+ if (!arguments.length) {
835
+ return _renderVerticalGridLine;
836
+ }
837
+ _renderVerticalGridLine = renderVerticalGridLines;
838
+ return _chart;
839
+ };
840
+
841
+ /**
842
+ * Calculates the minimum x value to display in the chart. Includes xAxisPadding if set.
843
+ * @method xAxisMin
844
+ * @memberof dc.coordinateGridMixin
845
+ * @instance
846
+ * @return {*}
847
+ */
848
+ _chart.xAxisMin = function () {
849
+ var min = d3.min(_chart.data(), function (e) {
850
+ return _chart.keyAccessor()(e);
851
+ });
852
+ return dc.utils.subtract(min, _xAxisPadding);
853
+ };
854
+
855
+ /**
856
+ * Calculates the maximum x value to display in the chart. Includes xAxisPadding if set.
857
+ * @method xAxisMax
858
+ * @memberof dc.coordinateGridMixin
859
+ * @instance
860
+ * @return {*}
861
+ */
862
+ _chart.xAxisMax = function () {
863
+ var max = d3.max(_chart.data(), function (e) {
864
+ return _chart.keyAccessor()(e);
865
+ });
866
+ return dc.utils.add(max, _xAxisPadding);
867
+ };
868
+
869
+ /**
870
+ * Calculates the minimum y value to display in the chart. Includes yAxisPadding if set.
871
+ * @method yAxisMin
872
+ * @memberof dc.coordinateGridMixin
873
+ * @instance
874
+ * @return {*}
875
+ */
876
+ _chart.yAxisMin = function () {
877
+ var min = d3.min(_chart.data(), function (e) {
878
+ return _chart.valueAccessor()(e);
879
+ });
880
+ return dc.utils.subtract(min, _yAxisPadding);
881
+ };
882
+
883
+ /**
884
+ * Calculates the maximum y value to display in the chart. Includes yAxisPadding if set.
885
+ * @method yAxisMax
886
+ * @memberof dc.coordinateGridMixin
887
+ * @instance
888
+ * @return {*}
889
+ */
890
+ _chart.yAxisMax = function () {
891
+ var max = d3.max(_chart.data(), function (e) {
892
+ return _chart.valueAccessor()(e);
893
+ });
894
+ return dc.utils.add(max, _yAxisPadding);
895
+ };
896
+
897
+ /**
898
+ * Set or get y axis padding for the elastic y axis. The padding will be added to the top of the y
899
+ * axis if elasticY is turned on; otherwise it is ignored.
900
+ *
901
+ * padding can be an integer or percentage in string (e.g. '10%'). Padding can be applied to
902
+ * number or date axes. When padding a date axis, an integer represents number of days being padded
903
+ * and a percentage string will be treated the same as an integer.
904
+ * @method yAxisPadding
905
+ * @memberof dc.coordinateGridMixin
906
+ * @instance
907
+ * @param {Number|String} [padding=0]
908
+ * @return {Number}
909
+ * @return {dc.coordinateGridMixin}
910
+ */
911
+ _chart.yAxisPadding = function (padding) {
912
+ if (!arguments.length) {
913
+ return _yAxisPadding;
914
+ }
915
+ _yAxisPadding = padding;
916
+ return _chart;
917
+ };
918
+
919
+ _chart.yAxisHeight = function () {
920
+ return _chart.effectiveHeight();
921
+ };
922
+
923
+ /**
924
+ * Set or get the rounding function used to quantize the selection when brushing is enabled.
925
+ * @method round
926
+ * @memberof dc.coordinateGridMixin
927
+ * @instance
928
+ * @example
929
+ * // set x unit round to by month, this will make sure range selection brush will
930
+ * // select whole months
931
+ * chart.round(d3.time.month.round);
932
+ * @param {Function} [round]
933
+ * @return {Function}
934
+ * @return {dc.coordinateGridMixin}
935
+ */
936
+ _chart.round = function (round) {
937
+ if (!arguments.length) {
938
+ return _round;
939
+ }
940
+ _round = round;
941
+ return _chart;
942
+ };
943
+
944
+ _chart._rangeBandPadding = function (_) {
945
+ if (!arguments.length) {
946
+ return _rangeBandPadding;
947
+ }
948
+ _rangeBandPadding = _;
949
+ return _chart;
950
+ };
951
+
952
+ _chart._outerRangeBandPadding = function (_) {
953
+ if (!arguments.length) {
954
+ return _outerRangeBandPadding;
955
+ }
956
+ _outerRangeBandPadding = _;
957
+ return _chart;
958
+ };
959
+
960
+ dc.override(_chart, 'filter', function (_) {
961
+ if (!arguments.length) {
962
+ return _chart._filter();
963
+ }
964
+
965
+ _chart._filter(_);
966
+
967
+ if (_) {
968
+ _chart.brush().extent(_);
969
+ } else {
970
+ _chart.brush().clear();
971
+ }
972
+
973
+ return _chart;
974
+ });
975
+
976
+ _chart.brush = function (_) {
977
+ if (!arguments.length) {
978
+ return _brush;
979
+ }
980
+ _brush = _;
981
+ return _chart;
982
+ };
983
+
984
+ function brushHeight () {
985
+ return _chart._xAxisY() - _chart.margins().top;
986
+ }
987
+
988
+ _chart.renderBrush = function (g) {
989
+ if (_brushOn) {
990
+ _brush.on('brush', _chart._brushing);
991
+ _brush.on('brushstart', _chart._disableMouseZoom);
992
+ _brush.on('brushend', configureMouseZoom);
993
+
994
+ var gBrush = g.append('g')
995
+ .attr('class', 'brush')
996
+ .attr('transform', 'translate(' + _chart.margins().left + ',' + _chart.margins().top + ')')
997
+ .call(_brush.x(_chart.x()));
998
+ _chart.setBrushY(gBrush, false);
999
+ _chart.setHandlePaths(gBrush);
1000
+
1001
+ if (_chart.hasFilter()) {
1002
+ _chart.redrawBrush(g, false);
1003
+ }
1004
+ }
1005
+ };
1006
+
1007
+ _chart.setHandlePaths = function (gBrush) {
1008
+ gBrush.selectAll('.resize').append('path').attr('d', _chart.resizeHandlePath);
1009
+ };
1010
+
1011
+ _chart.setBrushY = function (gBrush) {
1012
+ gBrush.selectAll('.brush rect')
1013
+ .attr('height', brushHeight());
1014
+ gBrush.selectAll('.resize path')
1015
+ .attr('d', _chart.resizeHandlePath);
1016
+ };
1017
+
1018
+ _chart.extendBrush = function () {
1019
+ var extent = _brush.extent();
1020
+ if (_chart.round()) {
1021
+ extent[0] = extent.map(_chart.round())[0];
1022
+ extent[1] = extent.map(_chart.round())[1];
1023
+
1024
+ _g.select('.brush')
1025
+ .call(_brush.extent(extent));
1026
+ }
1027
+ return extent;
1028
+ };
1029
+
1030
+ _chart.brushIsEmpty = function (extent) {
1031
+ return _brush.empty() || !extent || extent[1] <= extent[0];
1032
+ };
1033
+
1034
+ _chart._brushing = function () {
1035
+ var extent = _chart.extendBrush();
1036
+
1037
+ _chart.redrawBrush(_g, false);
1038
+
1039
+ if (_chart.brushIsEmpty(extent)) {
1040
+ dc.events.trigger(function () {
1041
+ _chart.filter(null);
1042
+ _chart.redrawGroup();
1043
+ }, dc.constants.EVENT_DELAY);
1044
+ } else {
1045
+ var rangedFilter = dc.filters.RangedFilter(extent[0], extent[1]);
1046
+
1047
+ dc.events.trigger(function () {
1048
+ _chart.replaceFilter(rangedFilter);
1049
+ _chart.redrawGroup();
1050
+ }, dc.constants.EVENT_DELAY);
1051
+ }
1052
+ };
1053
+
1054
+ _chart.redrawBrush = function (g, doTransition) {
1055
+ if (_brushOn) {
1056
+ if (_chart.filter() && _chart.brush().empty()) {
1057
+ _chart.brush().extent(_chart.filter());
1058
+ }
1059
+
1060
+ var gBrush = dc.optionalTransition(doTransition, _chart.transitionDuration())(g.select('g.brush'));
1061
+ _chart.setBrushY(gBrush);
1062
+ gBrush.call(_chart.brush()
1063
+ .x(_chart.x())
1064
+ .extent(_chart.brush().extent()));
1065
+ }
1066
+
1067
+ _chart.fadeDeselectedArea();
1068
+ };
1069
+
1070
+ _chart.fadeDeselectedArea = function () {
1071
+ // do nothing, sub-chart should override this function
1072
+ };
1073
+
1074
+ // borrowed from Crossfilter example
1075
+ _chart.resizeHandlePath = function (d) {
1076
+ var e = +(d === 'e'), x = e ? 1 : -1, y = brushHeight() / 3;
1077
+ return 'M' + (0.5 * x) + ',' + y +
1078
+ 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6) +
1079
+ 'V' + (2 * y - 6) +
1080
+ 'A6,6 0 0 ' + e + ' ' + (0.5 * x) + ',' + (2 * y) +
1081
+ 'Z' +
1082
+ 'M' + (2.5 * x) + ',' + (y + 8) +
1083
+ 'V' + (2 * y - 8) +
1084
+ 'M' + (4.5 * x) + ',' + (y + 8) +
1085
+ 'V' + (2 * y - 8);
1086
+ };
1087
+
1088
+ function getClipPathId () {
1089
+ return _chart.anchorName().replace(/[ .#=\[\]]/g, '-') + '-clip';
1090
+ }
1091
+
1092
+ /**
1093
+ * Get or set the padding in pixels for the clip path. Once set padding will be applied evenly to
1094
+ * the top, left, right, and bottom when the clip path is generated. If set to zero, the clip area
1095
+ * will be exactly the chart body area minus the margins.
1096
+ * @method clipPadding
1097
+ * @memberof dc.coordinateGridMixin
1098
+ * @instance
1099
+ * @param {Number} [padding=5]
1100
+ * @return {Number}
1101
+ * @return {dc.coordinateGridMixin}
1102
+ */
1103
+ _chart.clipPadding = function (padding) {
1104
+ if (!arguments.length) {
1105
+ return _clipPadding;
1106
+ }
1107
+ _clipPadding = padding;
1108
+ return _chart;
1109
+ };
1110
+
1111
+ function generateClipPath () {
1112
+ var defs = dc.utils.appendOrSelect(_parent, 'defs');
1113
+ // cannot select <clippath> elements; bug in WebKit, must select by id
1114
+ // https://groups.google.com/forum/#!topic/d3-js/6EpAzQ2gU9I
1115
+ var id = getClipPathId();
1116
+ var chartBodyClip = dc.utils.appendOrSelect(defs, '#' + id, 'clipPath').attr('id', id);
1117
+
1118
+ var padding = _clipPadding * 2;
1119
+
1120
+ dc.utils.appendOrSelect(chartBodyClip, 'rect')
1121
+ .attr('width', _chart.xAxisLength() + padding)
1122
+ .attr('height', _chart.yAxisHeight() + padding)
1123
+ .attr('transform', 'translate(-' + _clipPadding + ', -' + _clipPadding + ')');
1124
+ }
1125
+
1126
+ _chart._preprocessData = function () {};
1127
+
1128
+ _chart._doRender = function () {
1129
+ _chart.resetSvg();
1130
+
1131
+ _chart._preprocessData();
1132
+
1133
+ _chart._generateG();
1134
+ generateClipPath();
1135
+
1136
+ drawChart(true);
1137
+
1138
+ configureMouseZoom();
1139
+
1140
+ return _chart;
1141
+ };
1142
+
1143
+ _chart._doRedraw = function () {
1144
+ _chart._preprocessData();
1145
+
1146
+ drawChart(false);
1147
+ generateClipPath();
1148
+
1149
+ return _chart;
1150
+ };
1151
+
1152
+ function drawChart (render) {
1153
+ if (_chart.isOrdinal()) {
1154
+ _brushOn = false;
1155
+ }
1156
+
1157
+ prepareXAxis(_chart.g(), render);
1158
+ _chart._prepareYAxis(_chart.g());
1159
+
1160
+ _chart.plotData();
1161
+
1162
+ if (_chart.elasticX() || _resizing || render) {
1163
+ _chart.renderXAxis(_chart.g());
1164
+ }
1165
+
1166
+ if (_chart.elasticY() || _resizing || render) {
1167
+ _chart.renderYAxis(_chart.g());
1168
+ }
1169
+
1170
+ if (render) {
1171
+ _chart.renderBrush(_chart.g(), false);
1172
+ } else {
1173
+ _chart.redrawBrush(_chart.g(), _resizing);
1174
+ }
1175
+ _chart.fadeDeselectedArea();
1176
+ _resizing = false;
1177
+ }
1178
+
1179
+ function configureMouseZoom () {
1180
+ if (_mouseZoomable) {
1181
+ _chart._enableMouseZoom();
1182
+ } else if (_hasBeenMouseZoomable) {
1183
+ _chart._disableMouseZoom();
1184
+ }
1185
+ }
1186
+
1187
+ _chart._enableMouseZoom = function () {
1188
+ _hasBeenMouseZoomable = true;
1189
+ _zoom.x(_chart.x())
1190
+ .scaleExtent(_zoomScale)
1191
+ .size([_chart.width(), _chart.height()])
1192
+ .duration(_chart.transitionDuration());
1193
+ _chart.root().call(_zoom);
1194
+ };
1195
+
1196
+ _chart._disableMouseZoom = function () {
1197
+ _chart.root().call(_nullZoom);
1198
+ };
1199
+
1200
+ function constrainRange (range, constraint) {
1201
+ var constrainedRange = [];
1202
+ constrainedRange[0] = d3.max([range[0], constraint[0]]);
1203
+ constrainedRange[1] = d3.min([range[1], constraint[1]]);
1204
+ return constrainedRange;
1205
+ }
1206
+
1207
+ /**
1208
+ * Zoom this chart to focus on the given range. The given range should be an array containing only
1209
+ * 2 elements (`[start, end]`) defining a range in the x domain. If the range is not given or set
1210
+ * to null, then the zoom will be reset. _For focus to work elasticX has to be turned off;
1211
+ * otherwise focus will be ignored.
1212
+ * @method focus
1213
+ * @memberof dc.coordinateGridMixin
1214
+ * @instance
1215
+ * @example
1216
+ * chart.on('renderlet', function(chart) {
1217
+ * // smooth the rendering through event throttling
1218
+ * dc.events.trigger(function(){
1219
+ * // focus some other chart to the range selected by user on this chart
1220
+ * someOtherChart.focus(chart.filter());
1221
+ * });
1222
+ * })
1223
+ * @param {Array<Number>} [range]
1224
+ */
1225
+ _chart.focus = function (range) {
1226
+ if (hasRangeSelected(range)) {
1227
+ _chart.x().domain(range);
1228
+ } else {
1229
+ _chart.x().domain(_xOriginalDomain);
1230
+ }
1231
+
1232
+ _zoom.x(_chart.x());
1233
+ zoomHandler();
1234
+ };
1235
+
1236
+ _chart.refocused = function () {
1237
+ return _refocused;
1238
+ };
1239
+
1240
+ _chart.focusChart = function (c) {
1241
+ if (!arguments.length) {
1242
+ return _focusChart;
1243
+ }
1244
+ _focusChart = c;
1245
+ _chart.on('filtered', function (chart) {
1246
+ if (!chart.filter()) {
1247
+ dc.events.trigger(function () {
1248
+ _focusChart.x().domain(_focusChart.xOriginalDomain());
1249
+ });
1250
+ } else if (!rangesEqual(chart.filter(), _focusChart.filter())) {
1251
+ dc.events.trigger(function () {
1252
+ _focusChart.focus(chart.filter());
1253
+ });
1254
+ }
1255
+ });
1256
+ return _chart;
1257
+ };
1258
+
1259
+ function rangesEqual (range1, range2) {
1260
+ if (!range1 && !range2) {
1261
+ return true;
1262
+ } else if (!range1 || !range2) {
1263
+ return false;
1264
+ } else if (range1.length === 0 && range2.length === 0) {
1265
+ return true;
1266
+ } else if (range1[0].valueOf() === range2[0].valueOf() &&
1267
+ range1[1].valueOf() === range2[1].valueOf()) {
1268
+ return true;
1269
+ }
1270
+ return false;
1271
+ }
1272
+
1273
+ /**
1274
+ * Turn on/off the brush-based range filter. When brushing is on then user can drag the mouse
1275
+ * across a chart with a quantitative scale to perform range filtering based on the extent of the
1276
+ * brush, or click on the bars of an ordinal bar chart or slices of a pie chart to filter and
1277
+ * un-filter them. However turning on the brush filter will disable other interactive elements on
1278
+ * the chart such as highlighting, tool tips, and reference lines. Zooming will still be possible
1279
+ * if enabled, but only via scrolling (panning will be disabled.)
1280
+ * @method brushOn
1281
+ * @memberof dc.coordinateGridMixin
1282
+ * @instance
1283
+ * @param {Boolean} [brushOn=true]
1284
+ * @return {Boolean}
1285
+ * @return {dc.coordinateGridMixin}
1286
+ */
1287
+ _chart.brushOn = function (brushOn) {
1288
+ if (!arguments.length) {
1289
+ return _brushOn;
1290
+ }
1291
+ _brushOn = brushOn;
1292
+ return _chart;
1293
+ };
1294
+
1295
+ function hasRangeSelected (range) {
1296
+ return range instanceof Array && range.length > 1;
1297
+ }
1298
+
1299
+ return _chart;
1300
+ };