picky-statistics 4.0.0pre3 → 4.0.0pre5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (596) hide show
  1. data/lib/picky-statistics/application/javascripts/d3/LICENSE +26 -0
  2. data/lib/picky-statistics/application/javascripts/d3/Makefile +268 -0
  3. data/lib/picky-statistics/application/javascripts/d3/README.md +51 -0
  4. data/lib/picky-statistics/application/javascripts/d3/d3.chart.js +984 -0
  5. data/lib/picky-statistics/application/javascripts/d3/d3.chart.min.js +1 -0
  6. data/lib/picky-statistics/application/javascripts/d3/d3.csv.js +92 -0
  7. data/lib/picky-statistics/application/javascripts/d3/d3.csv.min.js +1 -0
  8. data/lib/picky-statistics/application/javascripts/d3/d3.geo.js +938 -0
  9. data/lib/picky-statistics/application/javascripts/d3/d3.geo.min.js +1 -0
  10. data/lib/picky-statistics/application/javascripts/d3/d3.geom.js +835 -0
  11. data/lib/picky-statistics/application/javascripts/d3/d3.geom.min.js +1 -0
  12. data/lib/picky-statistics/application/javascripts/d3/d3.js +4690 -0
  13. data/lib/picky-statistics/application/javascripts/d3/d3.layout.js +1891 -0
  14. data/lib/picky-statistics/application/javascripts/d3/d3.layout.min.js +1 -0
  15. data/lib/picky-statistics/application/javascripts/d3/d3.min.js +2 -0
  16. data/lib/picky-statistics/application/javascripts/d3/d3.time.js +687 -0
  17. data/lib/picky-statistics/application/javascripts/d3/d3.time.min.js +1 -0
  18. data/lib/picky-statistics/application/javascripts/d3/examples/albers/albers.html +168 -0
  19. data/lib/picky-statistics/application/javascripts/d3/examples/area/area-radial.html +48 -0
  20. data/lib/picky-statistics/application/javascripts/d3/examples/area/area.html +113 -0
  21. data/lib/picky-statistics/application/javascripts/d3/examples/axis/axis-alternating.html +50 -0
  22. data/lib/picky-statistics/application/javascripts/d3/examples/axis/axis-ggplot2.html +68 -0
  23. data/lib/picky-statistics/application/javascripts/d3/examples/axis/axis-multiples.html +117 -0
  24. data/lib/picky-statistics/application/javascripts/d3/examples/axis/axis-orientations.html +63 -0
  25. data/lib/picky-statistics/application/javascripts/d3/examples/axis/axis-transition.html +153 -0
  26. data/lib/picky-statistics/application/javascripts/d3/examples/azimuthal/azimuthal.css +21 -0
  27. data/lib/picky-statistics/application/javascripts/d3/examples/azimuthal/azimuthal.html +99 -0
  28. data/lib/picky-statistics/application/javascripts/d3/examples/azimuthal/azimuthal.js +29 -0
  29. data/lib/picky-statistics/application/javascripts/d3/examples/bar/bar-hierarchy.html +223 -0
  30. data/lib/picky-statistics/application/javascripts/d3/examples/bar/bar.html +101 -0
  31. data/lib/picky-statistics/application/javascripts/d3/examples/bar/sample-data.csv +53 -0
  32. data/lib/picky-statistics/application/javascripts/d3/examples/bonne/bonne.html +159 -0
  33. data/lib/picky-statistics/application/javascripts/d3/examples/box/box.css +4 -0
  34. data/lib/picky-statistics/application/javascripts/d3/examples/box/box.html +19 -0
  35. data/lib/picky-statistics/application/javascripts/d3/examples/box/box.js +68 -0
  36. data/lib/picky-statistics/application/javascripts/d3/examples/brush/brush-ordinal.html +92 -0
  37. data/lib/picky-statistics/application/javascripts/d3/examples/brush/brush-x.html +92 -0
  38. data/lib/picky-statistics/application/javascripts/d3/examples/brush/brush-y.html +91 -0
  39. data/lib/picky-statistics/application/javascripts/d3/examples/brush/brush.html +98 -0
  40. data/lib/picky-statistics/application/javascripts/d3/examples/bubble/bubble.css +8 -0
  41. data/lib/picky-statistics/application/javascripts/d3/examples/bubble/bubble.html +14 -0
  42. data/lib/picky-statistics/application/javascripts/d3/examples/bubble/bubble.js +46 -0
  43. data/lib/picky-statistics/application/javascripts/d3/examples/bullet/bullet.css +10 -0
  44. data/lib/picky-statistics/application/javascripts/d3/examples/bullet/bullet.html +18 -0
  45. data/lib/picky-statistics/application/javascripts/d3/examples/bullet/bullet.js +53 -0
  46. data/lib/picky-statistics/application/javascripts/d3/examples/bullet/bullets.json +7 -0
  47. data/lib/picky-statistics/application/javascripts/d3/examples/bundle/bundle-radial.css +9 -0
  48. data/lib/picky-statistics/application/javascripts/d3/examples/bundle/bundle-radial.html +15 -0
  49. data/lib/picky-statistics/application/javascripts/d3/examples/bundle/bundle-radial.js +50 -0
  50. data/lib/picky-statistics/application/javascripts/d3/examples/bundle/bundle-treemap.css +14 -0
  51. data/lib/picky-statistics/application/javascripts/d3/examples/bundle/bundle-treemap.html +16 -0
  52. data/lib/picky-statistics/application/javascripts/d3/examples/bundle/bundle-treemap.js +53 -0
  53. data/lib/picky-statistics/application/javascripts/d3/examples/bundle/packages.js +49 -0
  54. data/lib/picky-statistics/application/javascripts/d3/examples/button.css +35 -0
  55. data/lib/picky-statistics/application/javascripts/d3/examples/calendar/calendar.css +15 -0
  56. data/lib/picky-statistics/application/javascripts/d3/examples/calendar/dji-area.html +120 -0
  57. data/lib/picky-statistics/application/javascripts/d3/examples/calendar/dji.csv +5233 -0
  58. data/lib/picky-statistics/application/javascripts/d3/examples/calendar/dji.html +15 -0
  59. data/lib/picky-statistics/application/javascripts/d3/examples/calendar/dji.js +65 -0
  60. data/lib/picky-statistics/application/javascripts/d3/examples/calendar/vix.csv +5231 -0
  61. data/lib/picky-statistics/application/javascripts/d3/examples/calendar/vix.html +15 -0
  62. data/lib/picky-statistics/application/javascripts/d3/examples/calendar/vix.js +65 -0
  63. data/lib/picky-statistics/application/javascripts/d3/examples/cartogram/cartogram.css +20 -0
  64. data/lib/picky-statistics/application/javascripts/d3/examples/cartogram/cartogram.html +15 -0
  65. data/lib/picky-statistics/application/javascripts/d3/examples/cartogram/cartogram.js +51 -0
  66. data/lib/picky-statistics/application/javascripts/d3/examples/cartogram/demers.css +9 -0
  67. data/lib/picky-statistics/application/javascripts/d3/examples/cartogram/demers.html +16 -0
  68. data/lib/picky-statistics/application/javascripts/d3/examples/cartogram/demers.js +79 -0
  69. data/lib/picky-statistics/application/javascripts/d3/examples/cartogram/dorling.css +9 -0
  70. data/lib/picky-statistics/application/javascripts/d3/examples/cartogram/dorling.html +16 -0
  71. data/lib/picky-statistics/application/javascripts/d3/examples/cartogram/dorling.js +80 -0
  72. data/lib/picky-statistics/application/javascripts/d3/examples/chord/chord-flare.html +109 -0
  73. data/lib/picky-statistics/application/javascripts/d3/examples/chord/chord.css +9 -0
  74. data/lib/picky-statistics/application/javascripts/d3/examples/chord/chord.html +14 -0
  75. data/lib/picky-statistics/application/javascripts/d3/examples/chord/chord.js +98 -0
  76. data/lib/picky-statistics/application/javascripts/d3/examples/choropleth/choropleth-area.html +51 -0
  77. data/lib/picky-statistics/application/javascripts/d3/examples/choropleth/choropleth-bounds.html +46 -0
  78. data/lib/picky-statistics/application/javascripts/d3/examples/choropleth/choropleth.css +16 -0
  79. data/lib/picky-statistics/application/javascripts/d3/examples/choropleth/choropleth.html +15 -0
  80. data/lib/picky-statistics/application/javascripts/d3/examples/choropleth/choropleth.js +38 -0
  81. data/lib/picky-statistics/application/javascripts/d3/examples/choropleth/unemployment.json +1 -0
  82. data/lib/picky-statistics/application/javascripts/d3/examples/clock/clock.css +23 -0
  83. data/lib/picky-statistics/application/javascripts/d3/examples/clock/clock.html +17 -0
  84. data/lib/picky-statistics/application/javascripts/d3/examples/clock/clock.js +87 -0
  85. data/lib/picky-statistics/application/javascripts/d3/examples/cluster/cluster-radial.html +14 -0
  86. data/lib/picky-statistics/application/javascripts/d3/examples/cluster/cluster-radial.js +39 -0
  87. data/lib/picky-statistics/application/javascripts/d3/examples/cluster/cluster.css +15 -0
  88. data/lib/picky-statistics/application/javascripts/d3/examples/cluster/cluster.html +14 -0
  89. data/lib/picky-statistics/application/javascripts/d3/examples/cluster/cluster.js +39 -0
  90. data/lib/picky-statistics/application/javascripts/d3/examples/contour/contour.html +108 -0
  91. data/lib/picky-statistics/application/javascripts/d3/examples/crimea/crimea-stacked-area.html +109 -0
  92. data/lib/picky-statistics/application/javascripts/d3/examples/crimea/crimea-stacked-bar.html +98 -0
  93. data/lib/picky-statistics/application/javascripts/d3/examples/crimea/crimea.csv +24 -0
  94. data/lib/picky-statistics/application/javascripts/d3/examples/custom/custom.html +83 -0
  95. data/lib/picky-statistics/application/javascripts/d3/examples/data/README.md +13 -0
  96. data/lib/picky-statistics/application/javascripts/d3/examples/data/faithful.json +8 -0
  97. data/lib/picky-statistics/application/javascripts/d3/examples/data/flare-imports.json +222 -0
  98. data/lib/picky-statistics/application/javascripts/d3/examples/data/flare.json +380 -0
  99. data/lib/picky-statistics/application/javascripts/d3/examples/data/morley.csv +101 -0
  100. data/lib/picky-statistics/application/javascripts/d3/examples/data/sample.csv +2 -0
  101. data/lib/picky-statistics/application/javascripts/d3/examples/data/sample.html +5 -0
  102. data/lib/picky-statistics/application/javascripts/d3/examples/data/sample.json +1 -0
  103. data/lib/picky-statistics/application/javascripts/d3/examples/data/sample.txt +1 -0
  104. data/lib/picky-statistics/application/javascripts/d3/examples/data/sample.xml +4 -0
  105. data/lib/picky-statistics/application/javascripts/d3/examples/data/stocks.csv +807 -0
  106. data/lib/picky-statistics/application/javascripts/d3/examples/data/unemployment.csv +1709 -0
  107. data/lib/picky-statistics/application/javascripts/d3/examples/data/us-borders.json +1 -0
  108. data/lib/picky-statistics/application/javascripts/d3/examples/data/us-counties.json +3216 -0
  109. data/lib/picky-statistics/application/javascripts/d3/examples/data/us-state-centroids.json +54 -0
  110. data/lib/picky-statistics/application/javascripts/d3/examples/data/us-states.json +54 -0
  111. data/lib/picky-statistics/application/javascripts/d3/examples/data/world-countries.json +179 -0
  112. data/lib/picky-statistics/application/javascripts/d3/examples/delaunay/delaunay.html +44 -0
  113. data/lib/picky-statistics/application/javascripts/d3/examples/donut/donut.html +124 -0
  114. data/lib/picky-statistics/application/javascripts/d3/examples/dot/dot.html +103 -0
  115. data/lib/picky-statistics/application/javascripts/d3/examples/drag/drag.html +44 -0
  116. data/lib/picky-statistics/application/javascripts/d3/examples/force/README +10 -0
  117. data/lib/picky-statistics/application/javascripts/d3/examples/force/force-bounds.html +70 -0
  118. data/lib/picky-statistics/application/javascripts/d3/examples/force/force-cluster.html +249 -0
  119. data/lib/picky-statistics/application/javascripts/d3/examples/force/force-collapsible.html +144 -0
  120. data/lib/picky-statistics/application/javascripts/d3/examples/force/force-dynamic.html +118 -0
  121. data/lib/picky-statistics/application/javascripts/d3/examples/force/force-map.html +104 -0
  122. data/lib/picky-statistics/application/javascripts/d3/examples/force/force-multi-foci.html +68 -0
  123. data/lib/picky-statistics/application/javascripts/d3/examples/force/force.css +9 -0
  124. data/lib/picky-statistics/application/javascripts/d3/examples/force/force.html +14 -0
  125. data/lib/picky-statistics/application/javascripts/d3/examples/force/force.js +50 -0
  126. data/lib/picky-statistics/application/javascripts/d3/examples/force/miserables.json +1 -0
  127. data/lib/picky-statistics/application/javascripts/d3/examples/great-arc/great-arc.html +78 -0
  128. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/hello-data-key.html +60 -0
  129. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/hello-data-nested-key.html +75 -0
  130. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/hello-data-nested.html +77 -0
  131. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/hello-data.html +46 -0
  132. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/hello-event.html +53 -0
  133. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/hello-node-key.html +25 -0
  134. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/hello-order.html +25 -0
  135. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/hello-sort.html +75 -0
  136. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/hello-transform.html +41 -0
  137. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/hello-transition-undefined.html +43 -0
  138. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/hello-transition.html +47 -0
  139. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/hello-webkit-transition.html +64 -0
  140. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/select-enter-add.html +29 -0
  141. data/lib/picky-statistics/application/javascripts/d3/examples/hello-world/selectAll-enter-add.html +20 -0
  142. data/lib/picky-statistics/application/javascripts/d3/examples/histogram/histogram.html +80 -0
  143. data/lib/picky-statistics/application/javascripts/d3/examples/horizon/horizon.css +9 -0
  144. data/lib/picky-statistics/application/javascripts/d3/examples/horizon/horizon.html +25 -0
  145. data/lib/picky-statistics/application/javascripts/d3/examples/horizon/horizon.js +43 -0
  146. data/lib/picky-statistics/application/javascripts/d3/examples/horizon/unemployment.json +1 -0
  147. data/lib/picky-statistics/application/javascripts/d3/examples/hull/hull.html +75 -0
  148. data/lib/picky-statistics/application/javascripts/d3/examples/kde/kde.css +9 -0
  149. data/lib/picky-statistics/application/javascripts/d3/examples/kde/kde.html +14 -0
  150. data/lib/picky-statistics/application/javascripts/d3/examples/kde/kde.js +40 -0
  151. data/lib/picky-statistics/application/javascripts/d3/examples/line/line.css +22 -0
  152. data/lib/picky-statistics/application/javascripts/d3/examples/line/line.html +11 -0
  153. data/lib/picky-statistics/application/javascripts/d3/examples/line/line.js +63 -0
  154. data/lib/picky-statistics/application/javascripts/d3/examples/marimekko/marimekko.html +116 -0
  155. data/lib/picky-statistics/application/javascripts/d3/examples/marimekko/marimekko.json +18 -0
  156. data/lib/picky-statistics/application/javascripts/d3/examples/marker/marker.html +169 -0
  157. data/lib/picky-statistics/application/javascripts/d3/examples/mercator/mercator.html +133 -0
  158. data/lib/picky-statistics/application/javascripts/d3/examples/moire/moire.html +53 -0
  159. data/lib/picky-statistics/application/javascripts/d3/examples/node-canvas/us-counties.js +70 -0
  160. data/lib/picky-statistics/application/javascripts/d3/examples/pack/pack.css +15 -0
  161. data/lib/picky-statistics/application/javascripts/d3/examples/pack/pack.html +14 -0
  162. data/lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js +33 -0
  163. data/lib/picky-statistics/application/javascripts/d3/examples/parallel/cars.csv +407 -0
  164. data/lib/picky-statistics/application/javascripts/d3/examples/parallel/parallel.html +134 -0
  165. data/lib/picky-statistics/application/javascripts/d3/examples/partition/partition-icicle-zoom.html +59 -0
  166. data/lib/picky-statistics/application/javascripts/d3/examples/partition/partition-icicle.html +45 -0
  167. data/lib/picky-statistics/application/javascripts/d3/examples/partition/partition-sunburst-zoom.html +72 -0
  168. data/lib/picky-statistics/application/javascripts/d3/examples/partition/partition-sunburst.html +21 -0
  169. data/lib/picky-statistics/application/javascripts/d3/examples/partition/partition-sunburst.js +72 -0
  170. data/lib/picky-statistics/application/javascripts/d3/examples/pie/pie-transition.html +69 -0
  171. data/lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html +51 -0
  172. data/lib/picky-statistics/application/javascripts/d3/examples/population/population.css +28 -0
  173. data/lib/picky-statistics/application/javascripts/d3/examples/population/population.csv +571 -0
  174. data/lib/picky-statistics/application/javascripts/d3/examples/population/population.html +13 -0
  175. data/lib/picky-statistics/application/javascripts/d3/examples/population/population.js +126 -0
  176. data/lib/picky-statistics/application/javascripts/d3/examples/qq/qq.css +18 -0
  177. data/lib/picky-statistics/application/javascripts/d3/examples/qq/qq.html +21 -0
  178. data/lib/picky-statistics/application/javascripts/d3/examples/qq/qq.js +66 -0
  179. data/lib/picky-statistics/application/javascripts/d3/examples/qq/stats.js +28 -0
  180. data/lib/picky-statistics/application/javascripts/d3/examples/qq/turkers.json +1 -0
  181. data/lib/picky-statistics/application/javascripts/d3/examples/quadtree/quadtree.html +114 -0
  182. data/lib/picky-statistics/application/javascripts/d3/examples/showreel/showreel.html +661 -0
  183. data/lib/picky-statistics/application/javascripts/d3/examples/sizzle/sizzle.html +27 -0
  184. data/lib/picky-statistics/application/javascripts/d3/examples/sort/sort.css +4 -0
  185. data/lib/picky-statistics/application/javascripts/d3/examples/sort/sort.html +12 -0
  186. data/lib/picky-statistics/application/javascripts/d3/examples/sort/sort.js +112 -0
  187. data/lib/picky-statistics/application/javascripts/d3/examples/spline/spline.css +30 -0
  188. data/lib/picky-statistics/application/javascripts/d3/examples/spline/spline.html +14 -0
  189. data/lib/picky-statistics/application/javascripts/d3/examples/spline/spline.js +113 -0
  190. data/lib/picky-statistics/application/javascripts/d3/examples/splom/flowers.json +1 -0
  191. data/lib/picky-statistics/application/javascripts/d3/examples/splom/splom.css +49 -0
  192. data/lib/picky-statistics/application/javascripts/d3/examples/splom/splom.html +13 -0
  193. data/lib/picky-statistics/application/javascripts/d3/examples/splom/splom.js +119 -0
  194. data/lib/picky-statistics/application/javascripts/d3/examples/stream/stack.css +7 -0
  195. data/lib/picky-statistics/application/javascripts/d3/examples/stream/stack.html +22 -0
  196. data/lib/picky-statistics/application/javascripts/d3/examples/stream/stack.js +119 -0
  197. data/lib/picky-statistics/application/javascripts/d3/examples/stream/stream.css +3 -0
  198. data/lib/picky-statistics/application/javascripts/d3/examples/stream/stream.html +19 -0
  199. data/lib/picky-statistics/application/javascripts/d3/examples/stream/stream.js +42 -0
  200. data/lib/picky-statistics/application/javascripts/d3/examples/stream/stream_layers.js +33 -0
  201. data/lib/picky-statistics/application/javascripts/d3/examples/superformula/dot.html +104 -0
  202. data/lib/picky-statistics/application/javascripts/d3/examples/superformula/explorer.html +120 -0
  203. data/lib/picky-statistics/application/javascripts/d3/examples/superformula/superformula.html +70 -0
  204. data/lib/picky-statistics/application/javascripts/d3/examples/superformula/superformula.js +98 -0
  205. data/lib/picky-statistics/application/javascripts/d3/examples/symbol-map/symbol-map.html +67 -0
  206. data/lib/picky-statistics/application/javascripts/d3/examples/touch/touch.html +65 -0
  207. data/lib/picky-statistics/application/javascripts/d3/examples/transform/test.html +85 -0
  208. data/lib/picky-statistics/application/javascripts/d3/examples/transform/transform.html +60 -0
  209. data/lib/picky-statistics/application/javascripts/d3/examples/tree/tree-dynamic.html +111 -0
  210. data/lib/picky-statistics/application/javascripts/d3/examples/tree/tree-interactive.html +172 -0
  211. data/lib/picky-statistics/application/javascripts/d3/examples/tree/tree-radial.html +14 -0
  212. data/lib/picky-statistics/application/javascripts/d3/examples/tree/tree-radial.js +40 -0
  213. data/lib/picky-statistics/application/javascripts/d3/examples/tree/tree.css +15 -0
  214. data/lib/picky-statistics/application/javascripts/d3/examples/tree/tree.html +14 -0
  215. data/lib/picky-statistics/application/javascripts/d3/examples/tree/tree.js +39 -0
  216. data/lib/picky-statistics/application/javascripts/d3/examples/treemap/treemap-svg.html +22 -0
  217. data/lib/picky-statistics/application/javascripts/d3/examples/treemap/treemap-svg.js +34 -0
  218. data/lib/picky-statistics/application/javascripts/d3/examples/treemap/treemap.css +8 -0
  219. data/lib/picky-statistics/application/javascripts/d3/examples/treemap/treemap.html +22 -0
  220. data/lib/picky-statistics/application/javascripts/d3/examples/treemap/treemap.js +53 -0
  221. data/lib/picky-statistics/application/javascripts/d3/examples/voroboids/boid.js +235 -0
  222. data/lib/picky-statistics/application/javascripts/d3/examples/voroboids/voroboids.css +15 -0
  223. data/lib/picky-statistics/application/javascripts/d3/examples/voroboids/voroboids.html +14 -0
  224. data/lib/picky-statistics/application/javascripts/d3/examples/voroboids/voroboids.js +65 -0
  225. data/lib/picky-statistics/application/javascripts/d3/examples/voronoi/voronoi.css +16 -0
  226. data/lib/picky-statistics/application/javascripts/d3/examples/voronoi/voronoi.html +15 -0
  227. data/lib/picky-statistics/application/javascripts/d3/examples/voronoi/voronoi.js +34 -0
  228. data/lib/picky-statistics/application/javascripts/d3/examples/zoom-pan/zoom-pan-transform.html +96 -0
  229. data/lib/picky-statistics/application/javascripts/d3/examples/zoom-pan/zoom-pan.html +120 -0
  230. data/lib/picky-statistics/application/javascripts/d3/examples/zoom/dji.csv +5233 -0
  231. data/lib/picky-statistics/application/javascripts/d3/examples/zoom/zoom.html +162 -0
  232. data/lib/picky-statistics/application/javascripts/d3/lib/colorbrewer/LICENSE +38 -0
  233. data/lib/picky-statistics/application/javascripts/d3/lib/colorbrewer/colorbrewer.css +1327 -0
  234. data/lib/picky-statistics/application/javascripts/d3/lib/colorbrewer/colorbrewer.js +32 -0
  235. data/lib/picky-statistics/application/javascripts/d3/lib/jit/LICENSE +27 -0
  236. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/LICENSE +25 -0
  237. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  238. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  239. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-bg_flat_10_000000_40x100.png +0 -0
  240. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  241. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  242. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  243. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  244. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  245. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  246. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-icons_222222_256x240.png +0 -0
  247. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-icons_228ef1_256x240.png +0 -0
  248. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-icons_ef8c08_256x240.png +0 -0
  249. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-icons_ffd27a_256x240.png +0 -0
  250. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
  251. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/jquery-ui.css +318 -0
  252. data/lib/picky-statistics/application/javascripts/d3/lib/jquery-ui/jquery-ui.min.js +83 -0
  253. data/lib/picky-statistics/application/javascripts/d3/lib/jquery/LICENSE +20 -0
  254. data/lib/picky-statistics/application/javascripts/d3/lib/jquery/jquery.js +6883 -0
  255. data/lib/picky-statistics/application/javascripts/d3/lib/jquery/jquery.min.js +166 -0
  256. data/lib/picky-statistics/application/javascripts/d3/lib/polymaps/LICENSE +28 -0
  257. data/lib/picky-statistics/application/javascripts/d3/lib/protovis/LICENSE +27 -0
  258. data/lib/picky-statistics/application/javascripts/d3/lib/science/LICENSE +26 -0
  259. data/lib/picky-statistics/application/javascripts/d3/lib/science/science.js +225 -0
  260. data/lib/picky-statistics/application/javascripts/d3/lib/science/science.lin.js +27 -0
  261. data/lib/picky-statistics/application/javascripts/d3/lib/science/science.lin.min.js +1 -0
  262. data/lib/picky-statistics/application/javascripts/d3/lib/science/science.min.js +1 -0
  263. data/lib/picky-statistics/application/javascripts/d3/lib/science/science.stats.js +720 -0
  264. data/lib/picky-statistics/application/javascripts/d3/lib/science/science.stats.min.js +1 -0
  265. data/lib/picky-statistics/application/javascripts/d3/lib/sizzle/LICENSE +24 -0
  266. data/lib/picky-statistics/application/javascripts/d3/lib/sizzle/sizzle.js +1376 -0
  267. data/lib/picky-statistics/application/javascripts/d3/lib/sizzle/sizzle.min.js +28 -0
  268. data/lib/picky-statistics/application/javascripts/d3/package.json +28 -0
  269. data/lib/picky-statistics/application/javascripts/d3/src/behavior/behavior.js +1 -0
  270. data/lib/picky-statistics/application/javascripts/d3/src/behavior/drag.js +125 -0
  271. data/lib/picky-statistics/application/javascripts/d3/src/behavior/zoom.js +242 -0
  272. data/lib/picky-statistics/application/javascripts/d3/src/chart/box.js +297 -0
  273. data/lib/picky-statistics/application/javascripts/d3/src/chart/bullet.js +237 -0
  274. data/lib/picky-statistics/application/javascripts/d3/src/chart/chart.js +1 -0
  275. data/lib/picky-statistics/application/javascripts/d3/src/chart/horizon.js +203 -0
  276. data/lib/picky-statistics/application/javascripts/d3/src/chart/qq.js +245 -0
  277. data/lib/picky-statistics/application/javascripts/d3/src/compat/date.js +3 -0
  278. data/lib/picky-statistics/application/javascripts/d3/src/compat/style.js +9 -0
  279. data/lib/picky-statistics/application/javascripts/d3/src/core/array.js +29 -0
  280. data/lib/picky-statistics/application/javascripts/d3/src/core/ascending.js +3 -0
  281. data/lib/picky-statistics/application/javascripts/d3/src/core/bisect.js +38 -0
  282. data/lib/picky-statistics/application/javascripts/d3/src/core/collapse.js +3 -0
  283. data/lib/picky-statistics/application/javascripts/d3/src/core/core.js +1 -0
  284. data/lib/picky-statistics/application/javascripts/d3/src/core/descending.js +3 -0
  285. data/lib/picky-statistics/application/javascripts/d3/src/core/dispatch.js +60 -0
  286. data/lib/picky-statistics/application/javascripts/d3/src/core/ease.js +128 -0
  287. data/lib/picky-statistics/application/javascripts/d3/src/core/entries.js +5 -0
  288. data/lib/picky-statistics/application/javascripts/d3/src/core/event.js +6 -0
  289. data/lib/picky-statistics/application/javascripts/d3/src/core/extent.js +21 -0
  290. data/lib/picky-statistics/application/javascripts/d3/src/core/first.js +13 -0
  291. data/lib/picky-statistics/application/javascripts/d3/src/core/format.js +100 -0
  292. data/lib/picky-statistics/application/javascripts/d3/src/core/formatPrefix.js +20 -0
  293. data/lib/picky-statistics/application/javascripts/d3/src/core/functor.js +3 -0
  294. data/lib/picky-statistics/application/javascripts/d3/src/core/hsl.js +63 -0
  295. data/lib/picky-statistics/application/javascripts/d3/src/core/html.js +10 -0
  296. data/lib/picky-statistics/application/javascripts/d3/src/core/interpolate.js +183 -0
  297. data/lib/picky-statistics/application/javascripts/d3/src/core/json.js +5 -0
  298. data/lib/picky-statistics/application/javascripts/d3/src/core/keys.js +5 -0
  299. data/lib/picky-statistics/application/javascripts/d3/src/core/last.js +13 -0
  300. data/lib/picky-statistics/application/javascripts/d3/src/core/max.js +14 -0
  301. data/lib/picky-statistics/application/javascripts/d3/src/core/mean.js +13 -0
  302. data/lib/picky-statistics/application/javascripts/d3/src/core/median.js +5 -0
  303. data/lib/picky-statistics/application/javascripts/d3/src/core/merge.js +3 -0
  304. data/lib/picky-statistics/application/javascripts/d3/src/core/min.js +14 -0
  305. data/lib/picky-statistics/application/javascripts/d3/src/core/nest.js +87 -0
  306. data/lib/picky-statistics/application/javascripts/d3/src/core/noop.js +1 -0
  307. data/lib/picky-statistics/application/javascripts/d3/src/core/ns.js +17 -0
  308. data/lib/picky-statistics/application/javascripts/d3/src/core/number.js +3 -0
  309. data/lib/picky-statistics/application/javascripts/d3/src/core/permute.js +7 -0
  310. data/lib/picky-statistics/application/javascripts/d3/src/core/quantile.js +8 -0
  311. data/lib/picky-statistics/application/javascripts/d3/src/core/random.js +15 -0
  312. data/lib/picky-statistics/application/javascripts/d3/src/core/range.js +21 -0
  313. data/lib/picky-statistics/application/javascripts/d3/src/core/rebind.js +16 -0
  314. data/lib/picky-statistics/application/javascripts/d3/src/core/requote.js +5 -0
  315. data/lib/picky-statistics/application/javascripts/d3/src/core/rgb.js +287 -0
  316. data/lib/picky-statistics/application/javascripts/d3/src/core/round.js +5 -0
  317. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-append.js +15 -0
  318. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-attr.js +44 -0
  319. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-call.js +13 -0
  320. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-classed.js +61 -0
  321. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-data.js +110 -0
  322. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-each.js +9 -0
  323. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-empty.js +3 -0
  324. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-enter-select.js +24 -0
  325. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-enter.js +11 -0
  326. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-filter.js +26 -0
  327. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-html.js +6 -0
  328. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-insert.js +20 -0
  329. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-map.js +5 -0
  330. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-node.js +9 -0
  331. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-on.js +34 -0
  332. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-order.js +11 -0
  333. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-property.js +23 -0
  334. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-remove.js +9 -0
  335. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-root.js +18 -0
  336. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-select.js +30 -0
  337. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-selectAll.js +24 -0
  338. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-sort.js +12 -0
  339. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-style.js +26 -0
  340. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-text.js +6 -0
  341. data/lib/picky-statistics/application/javascripts/d3/src/core/selection-transition.js +14 -0
  342. data/lib/picky-statistics/application/javascripts/d3/src/core/selection.js +25 -0
  343. data/lib/picky-statistics/application/javascripts/d3/src/core/split.js +21 -0
  344. data/lib/picky-statistics/application/javascripts/d3/src/core/sum.js +14 -0
  345. data/lib/picky-statistics/application/javascripts/d3/src/core/text.js +10 -0
  346. data/lib/picky-statistics/application/javascripts/d3/src/core/this.js +3 -0
  347. data/lib/picky-statistics/application/javascripts/d3/src/core/timer.js +104 -0
  348. data/lib/picky-statistics/application/javascripts/d3/src/core/transform.js +58 -0
  349. data/lib/picky-statistics/application/javascripts/d3/src/core/transition-attr.js +23 -0
  350. data/lib/picky-statistics/application/javascripts/d3/src/core/transition-delay.js +6 -0
  351. data/lib/picky-statistics/application/javascripts/d3/src/core/transition-duration.js +6 -0
  352. data/lib/picky-statistics/application/javascripts/d3/src/core/transition-each.js +9 -0
  353. data/lib/picky-statistics/application/javascripts/d3/src/core/transition-remove.js +6 -0
  354. data/lib/picky-statistics/application/javascripts/d3/src/core/transition-select.js +22 -0
  355. data/lib/picky-statistics/application/javascripts/d3/src/core/transition-selectAll.js +22 -0
  356. data/lib/picky-statistics/application/javascripts/d3/src/core/transition-style.js +14 -0
  357. data/lib/picky-statistics/application/javascripts/d3/src/core/transition-text.js +7 -0
  358. data/lib/picky-statistics/application/javascripts/d3/src/core/transition-transition.js +3 -0
  359. data/lib/picky-statistics/application/javascripts/d3/src/core/transition.js +125 -0
  360. data/lib/picky-statistics/application/javascripts/d3/src/core/transpose.js +3 -0
  361. data/lib/picky-statistics/application/javascripts/d3/src/core/uninterpolate.js +9 -0
  362. data/lib/picky-statistics/application/javascripts/d3/src/core/values.js +5 -0
  363. data/lib/picky-statistics/application/javascripts/d3/src/core/xhr.js +10 -0
  364. data/lib/picky-statistics/application/javascripts/d3/src/core/xml.js +10 -0
  365. data/lib/picky-statistics/application/javascripts/d3/src/core/zip.js +13 -0
  366. data/lib/picky-statistics/application/javascripts/d3/src/csv/csv.js +5 -0
  367. data/lib/picky-statistics/application/javascripts/d3/src/csv/format.js +13 -0
  368. data/lib/picky-statistics/application/javascripts/d3/src/csv/parse.js +73 -0
  369. data/lib/picky-statistics/application/javascripts/d3/src/end.js +1 -0
  370. data/lib/picky-statistics/application/javascripts/d3/src/externs.js +6 -0
  371. data/lib/picky-statistics/application/javascripts/d3/src/geo/albers.js +126 -0
  372. data/lib/picky-statistics/application/javascripts/d3/src/geo/azimuthal.js +80 -0
  373. data/lib/picky-statistics/application/javascripts/d3/src/geo/bonne.js +70 -0
  374. data/lib/picky-statistics/application/javascripts/d3/src/geo/bounds.js +83 -0
  375. data/lib/picky-statistics/application/javascripts/d3/src/geo/circle.js +146 -0
  376. data/lib/picky-statistics/application/javascripts/d3/src/geo/equirectangular.js +36 -0
  377. data/lib/picky-statistics/application/javascripts/d3/src/geo/geo.js +3 -0
  378. data/lib/picky-statistics/application/javascripts/d3/src/geo/greatArc.js +80 -0
  379. data/lib/picky-statistics/application/javascripts/d3/src/geo/greatCircle.js +1 -0
  380. data/lib/picky-statistics/application/javascripts/d3/src/geo/mercator.js +36 -0
  381. data/lib/picky-statistics/application/javascripts/d3/src/geo/path.js +271 -0
  382. data/lib/picky-statistics/application/javascripts/d3/src/geo/type.js +5 -0
  383. data/lib/picky-statistics/application/javascripts/d3/src/geom/contour.js +78 -0
  384. data/lib/picky-statistics/application/javascripts/d3/src/geom/delaunay.js +31 -0
  385. data/lib/picky-statistics/application/javascripts/d3/src/geom/geom.js +1 -0
  386. data/lib/picky-statistics/application/javascripts/d3/src/geom/hull.js +98 -0
  387. data/lib/picky-statistics/application/javascripts/d3/src/geom/polygon.js +88 -0
  388. data/lib/picky-statistics/application/javascripts/d3/src/geom/quadtree.js +129 -0
  389. data/lib/picky-statistics/application/javascripts/d3/src/geom/voronoi.js +409 -0
  390. data/lib/picky-statistics/application/javascripts/d3/src/layout/bundle.js +57 -0
  391. data/lib/picky-statistics/application/javascripts/d3/src/layout/chord.js +153 -0
  392. data/lib/picky-statistics/application/javascripts/d3/src/layout/cluster.js +78 -0
  393. data/lib/picky-statistics/application/javascripts/d3/src/layout/force.js +342 -0
  394. data/lib/picky-statistics/application/javascripts/d3/src/layout/hierarchy.js +120 -0
  395. data/lib/picky-statistics/application/javascripts/d3/src/layout/histogram.js +102 -0
  396. data/lib/picky-statistics/application/javascripts/d3/src/layout/layout.js +1 -0
  397. data/lib/picky-statistics/application/javascripts/d3/src/layout/pack.js +203 -0
  398. data/lib/picky-statistics/application/javascripts/d3/src/layout/partition.js +48 -0
  399. data/lib/picky-statistics/application/javascripts/d3/src/layout/pie.js +95 -0
  400. data/lib/picky-statistics/application/javascripts/d3/src/layout/stack.js +237 -0
  401. data/lib/picky-statistics/application/javascripts/d3/src/layout/tree.js +237 -0
  402. data/lib/picky-statistics/application/javascripts/d3/src/layout/treemap.js +217 -0
  403. data/lib/picky-statistics/application/javascripts/d3/src/package.js +18 -0
  404. data/lib/picky-statistics/application/javascripts/d3/src/scale/bilinear.js +7 -0
  405. data/lib/picky-statistics/application/javascripts/d3/src/scale/category.js +54 -0
  406. data/lib/picky-statistics/application/javascripts/d3/src/scale/linear.js +111 -0
  407. data/lib/picky-statistics/application/javascripts/d3/src/scale/log.js +85 -0
  408. data/lib/picky-statistics/application/javascripts/d3/src/scale/nice.js +24 -0
  409. data/lib/picky-statistics/application/javascripts/d3/src/scale/ordinal.js +81 -0
  410. data/lib/picky-statistics/application/javascripts/d3/src/scale/polylinear.js +16 -0
  411. data/lib/picky-statistics/application/javascripts/d3/src/scale/pow.js +54 -0
  412. data/lib/picky-statistics/application/javascripts/d3/src/scale/quantile.js +43 -0
  413. data/lib/picky-statistics/application/javascripts/d3/src/scale/quantize.js +36 -0
  414. data/lib/picky-statistics/application/javascripts/d3/src/scale/scale.js +10 -0
  415. data/lib/picky-statistics/application/javascripts/d3/src/scale/sqrt.js +3 -0
  416. data/lib/picky-statistics/application/javascripts/d3/src/start.js +1 -0
  417. data/lib/picky-statistics/application/javascripts/d3/src/svg/arc.js +95 -0
  418. data/lib/picky-statistics/application/javascripts/d3/src/svg/area-radial.js +10 -0
  419. data/lib/picky-statistics/application/javascripts/d3/src/svg/area.js +89 -0
  420. data/lib/picky-statistics/application/javascripts/d3/src/svg/axis.js +200 -0
  421. data/lib/picky-statistics/application/javascripts/d3/src/svg/brush.js +334 -0
  422. data/lib/picky-statistics/application/javascripts/d3/src/svg/chord.js +99 -0
  423. data/lib/picky-statistics/application/javascripts/d3/src/svg/diagonal-radial.js +22 -0
  424. data/lib/picky-statistics/application/javascripts/d3/src/svg/diagonal.js +38 -0
  425. data/lib/picky-statistics/application/javascripts/d3/src/svg/line-radial.js +22 -0
  426. data/lib/picky-statistics/application/javascripts/d3/src/svg/line.js +415 -0
  427. data/lib/picky-statistics/application/javascripts/d3/src/svg/mouse.js +29 -0
  428. data/lib/picky-statistics/application/javascripts/d3/src/svg/svg.js +1 -0
  429. data/lib/picky-statistics/application/javascripts/d3/src/svg/symbol.js +98 -0
  430. data/lib/picky-statistics/application/javascripts/d3/src/svg/touches.js +9 -0
  431. data/lib/picky-statistics/application/javascripts/d3/src/time/day.js +7 -0
  432. data/lib/picky-statistics/application/javascripts/d3/src/time/days.js +11 -0
  433. data/lib/picky-statistics/application/javascripts/d3/src/time/format-iso.js +13 -0
  434. data/lib/picky-statistics/application/javascripts/d3/src/time/format-utc.js +53 -0
  435. data/lib/picky-statistics/application/javascripts/d3/src/time/format.js +327 -0
  436. data/lib/picky-statistics/application/javascripts/d3/src/time/hour.js +8 -0
  437. data/lib/picky-statistics/application/javascripts/d3/src/time/hours.js +11 -0
  438. data/lib/picky-statistics/application/javascripts/d3/src/time/minute.js +5 -0
  439. data/lib/picky-statistics/application/javascripts/d3/src/time/minutes.js +11 -0
  440. data/lib/picky-statistics/application/javascripts/d3/src/time/month.js +7 -0
  441. data/lib/picky-statistics/application/javascripts/d3/src/time/months.js +11 -0
  442. data/lib/picky-statistics/application/javascripts/d3/src/time/range.js +16 -0
  443. data/lib/picky-statistics/application/javascripts/d3/src/time/scale-utc.js +36 -0
  444. data/lib/picky-statistics/application/javascripts/d3/src/time/scale.js +118 -0
  445. data/lib/picky-statistics/application/javascripts/d3/src/time/second.js +5 -0
  446. data/lib/picky-statistics/application/javascripts/d3/src/time/seconds.js +7 -0
  447. data/lib/picky-statistics/application/javascripts/d3/src/time/time.js +3 -0
  448. data/lib/picky-statistics/application/javascripts/d3/src/time/week.js +9 -0
  449. data/lib/picky-statistics/application/javascripts/d3/src/time/weeks.js +11 -0
  450. data/lib/picky-statistics/application/javascripts/d3/src/time/year.js +7 -0
  451. data/lib/picky-statistics/application/javascripts/d3/src/time/years.js +11 -0
  452. data/lib/picky-statistics/application/javascripts/d3/test/core/ascending-test.js +47 -0
  453. data/lib/picky-statistics/application/javascripts/d3/test/core/bisect-test.js +103 -0
  454. data/lib/picky-statistics/application/javascripts/d3/test/core/descending-test.js +47 -0
  455. data/lib/picky-statistics/application/javascripts/d3/test/core/dispatch-test.js +129 -0
  456. data/lib/picky-statistics/application/javascripts/d3/test/core/ease-test.js +129 -0
  457. data/lib/picky-statistics/application/javascripts/d3/test/core/entries-test.js +43 -0
  458. data/lib/picky-statistics/application/javascripts/d3/test/core/extent-test.js +51 -0
  459. data/lib/picky-statistics/application/javascripts/d3/test/core/first-test.js +42 -0
  460. data/lib/picky-statistics/application/javascripts/d3/test/core/format-test.js +239 -0
  461. data/lib/picky-statistics/application/javascripts/d3/test/core/formatPrefix-test.js +108 -0
  462. data/lib/picky-statistics/application/javascripts/d3/test/core/functor-test.js +29 -0
  463. data/lib/picky-statistics/application/javascripts/d3/test/core/hsl-test.js +82 -0
  464. data/lib/picky-statistics/application/javascripts/d3/test/core/html-test.js +37 -0
  465. data/lib/picky-statistics/application/javascripts/d3/test/core/interpolate-test.js +209 -0
  466. data/lib/picky-statistics/application/javascripts/d3/test/core/json-test.js +37 -0
  467. data/lib/picky-statistics/application/javascripts/d3/test/core/keys-test.js +31 -0
  468. data/lib/picky-statistics/application/javascripts/d3/test/core/last-test.js +42 -0
  469. data/lib/picky-statistics/application/javascripts/d3/test/core/max-test.js +51 -0
  470. data/lib/picky-statistics/application/javascripts/d3/test/core/mean-test.js +43 -0
  471. data/lib/picky-statistics/application/javascripts/d3/test/core/median-test.js +43 -0
  472. data/lib/picky-statistics/application/javascripts/d3/test/core/merge-test.js +27 -0
  473. data/lib/picky-statistics/application/javascripts/d3/test/core/min-test.js +50 -0
  474. data/lib/picky-statistics/application/javascripts/d3/test/core/nest-test.js +236 -0
  475. data/lib/picky-statistics/application/javascripts/d3/test/core/ns-test.js +58 -0
  476. data/lib/picky-statistics/application/javascripts/d3/test/core/permute-test.js +53 -0
  477. data/lib/picky-statistics/application/javascripts/d3/test/core/quantile-test.js +50 -0
  478. data/lib/picky-statistics/application/javascripts/d3/test/core/range-test.js +93 -0
  479. data/lib/picky-statistics/application/javascripts/d3/test/core/rebind-test.js +52 -0
  480. data/lib/picky-statistics/application/javascripts/d3/test/core/requote-test.js +53 -0
  481. data/lib/picky-statistics/application/javascripts/d3/test/core/rgb-test.js +89 -0
  482. data/lib/picky-statistics/application/javascripts/d3/test/core/round-test.js +70 -0
  483. data/lib/picky-statistics/application/javascripts/d3/test/core/select-test.js +42 -0
  484. data/lib/picky-statistics/application/javascripts/d3/test/core/selectAll-test.js +46 -0
  485. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-append-test.js +123 -0
  486. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-attr-test.js +153 -0
  487. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-call-test.js +71 -0
  488. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-classed-test.js +219 -0
  489. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-data-test.js +168 -0
  490. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-each-test.js +83 -0
  491. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-empty-test.js +51 -0
  492. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-filter-test.js +70 -0
  493. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-html-test.js +121 -0
  494. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-insert-test.js +136 -0
  495. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-map-test.js +47 -0
  496. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-node-test.js +50 -0
  497. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-on-test.js +95 -0
  498. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-order-test.js +32 -0
  499. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-property-test.js +91 -0
  500. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-remove-test.js +39 -0
  501. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-select-test.js +125 -0
  502. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-selectAll-test.js +128 -0
  503. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-sort-test.js +59 -0
  504. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-style-test.js +100 -0
  505. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-test.js +35 -0
  506. data/lib/picky-statistics/application/javascripts/d3/test/core/selection-text-test.js +109 -0
  507. data/lib/picky-statistics/application/javascripts/d3/test/core/split-test.js +34 -0
  508. data/lib/picky-statistics/application/javascripts/d3/test/core/sum-test.js +47 -0
  509. data/lib/picky-statistics/application/javascripts/d3/test/core/text-test.js +48 -0
  510. data/lib/picky-statistics/application/javascripts/d3/test/core/timer-test.js +62 -0
  511. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-attr.js +54 -0
  512. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-attrTween.js +67 -0
  513. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-call.js +33 -0
  514. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-delay.js +41 -0
  515. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-duration.js +41 -0
  516. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-each.js +166 -0
  517. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-id.js +20 -0
  518. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-remove.js +46 -0
  519. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-select.js +63 -0
  520. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-selectAll.js +59 -0
  521. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-style.js +49 -0
  522. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-styleTween.js +73 -0
  523. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-text.js +30 -0
  524. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-time.js +36 -0
  525. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-transition.js +60 -0
  526. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test-tween.js +71 -0
  527. data/lib/picky-statistics/application/javascripts/d3/test/core/transition-test.js +66 -0
  528. data/lib/picky-statistics/application/javascripts/d3/test/core/transpose-test.js +32 -0
  529. data/lib/picky-statistics/application/javascripts/d3/test/core/values-test.js +35 -0
  530. data/lib/picky-statistics/application/javascripts/d3/test/core/version-test.js +18 -0
  531. data/lib/picky-statistics/application/javascripts/d3/test/core/xhr-test.js +56 -0
  532. data/lib/picky-statistics/application/javascripts/d3/test/core/xml-test.js +48 -0
  533. data/lib/picky-statistics/application/javascripts/d3/test/core/zip-test.js +32 -0
  534. data/lib/picky-statistics/application/javascripts/d3/test/csv/csv-test.js +38 -0
  535. data/lib/picky-statistics/application/javascripts/d3/test/csv/format-test.js +39 -0
  536. data/lib/picky-statistics/application/javascripts/d3/test/csv/parse-test.js +101 -0
  537. data/lib/picky-statistics/application/javascripts/d3/test/env-assert.js +96 -0
  538. data/lib/picky-statistics/application/javascripts/d3/test/env-fragment.js +8 -0
  539. data/lib/picky-statistics/application/javascripts/d3/test/env-xhr.js +56 -0
  540. data/lib/picky-statistics/application/javascripts/d3/test/env.js +13 -0
  541. data/lib/picky-statistics/application/javascripts/d3/test/geo/albers-test.js +57 -0
  542. data/lib/picky-statistics/application/javascripts/d3/test/geo/azimuthal-test.js +261 -0
  543. data/lib/picky-statistics/application/javascripts/d3/test/geo/bonne-test.js +116 -0
  544. data/lib/picky-statistics/application/javascripts/d3/test/geo/equirectangular-test.js +50 -0
  545. data/lib/picky-statistics/application/javascripts/d3/test/geo/greatArc-test.js +41 -0
  546. data/lib/picky-statistics/application/javascripts/d3/test/geo/mercator-test.js +57 -0
  547. data/lib/picky-statistics/application/javascripts/d3/test/geo/path-test.js +25 -0
  548. data/lib/picky-statistics/application/javascripts/d3/test/geom/polygon-test.js +57 -0
  549. data/lib/picky-statistics/application/javascripts/d3/test/layout/cluster-test.js +39 -0
  550. data/lib/picky-statistics/application/javascripts/d3/test/layout/hierarchy-test.js +30 -0
  551. data/lib/picky-statistics/application/javascripts/d3/test/layout/histogram-test.js +91 -0
  552. data/lib/picky-statistics/application/javascripts/d3/test/layout/pack-test.js +67 -0
  553. data/lib/picky-statistics/application/javascripts/d3/test/layout/partition-test.js +50 -0
  554. data/lib/picky-statistics/application/javascripts/d3/test/layout/tree-test.js +41 -0
  555. data/lib/picky-statistics/application/javascripts/d3/test/layout/treemap-test.js +190 -0
  556. data/lib/picky-statistics/application/javascripts/d3/test/scale/category-test.js +74 -0
  557. data/lib/picky-statistics/application/javascripts/d3/test/scale/linear-test.js +243 -0
  558. data/lib/picky-statistics/application/javascripts/d3/test/scale/log-test.js +266 -0
  559. data/lib/picky-statistics/application/javascripts/d3/test/scale/ordinal-test.js +207 -0
  560. data/lib/picky-statistics/application/javascripts/d3/test/scale/pow-test.js +263 -0
  561. data/lib/picky-statistics/application/javascripts/d3/test/scale/quantile-test.js +64 -0
  562. data/lib/picky-statistics/application/javascripts/d3/test/scale/quantize-test.js +69 -0
  563. data/lib/picky-statistics/application/javascripts/d3/test/scale/sqrt-test.js +256 -0
  564. data/lib/picky-statistics/application/javascripts/d3/test/svg/arc-test.js +147 -0
  565. data/lib/picky-statistics/application/javascripts/d3/test/svg/area-radial-test.js +200 -0
  566. data/lib/picky-statistics/application/javascripts/d3/test/svg/area-test.js +192 -0
  567. data/lib/picky-statistics/application/javascripts/d3/test/svg/axis-test.js +353 -0
  568. data/lib/picky-statistics/application/javascripts/d3/test/svg/line-radial-test.js +125 -0
  569. data/lib/picky-statistics/application/javascripts/d3/test/svg/line-test.js +189 -0
  570. data/lib/picky-statistics/application/javascripts/d3/test/svg/symbol-test.js +96 -0
  571. data/lib/picky-statistics/application/javascripts/d3/test/time/day-test.js +65 -0
  572. data/lib/picky-statistics/application/javascripts/d3/test/time/days-test.js +105 -0
  573. data/lib/picky-statistics/application/javascripts/d3/test/time/format-test.js +467 -0
  574. data/lib/picky-statistics/application/javascripts/d3/test/time/hour-test.js +103 -0
  575. data/lib/picky-statistics/application/javascripts/d3/test/time/hours-test.js +135 -0
  576. data/lib/picky-statistics/application/javascripts/d3/test/time/minute-test.js +43 -0
  577. data/lib/picky-statistics/application/javascripts/d3/test/time/minutes-test.js +101 -0
  578. data/lib/picky-statistics/application/javascripts/d3/test/time/month-test.js +53 -0
  579. data/lib/picky-statistics/application/javascripts/d3/test/time/months-test.js +105 -0
  580. data/lib/picky-statistics/application/javascripts/d3/test/time/scale-test.js +525 -0
  581. data/lib/picky-statistics/application/javascripts/d3/test/time/second-test.js +41 -0
  582. data/lib/picky-statistics/application/javascripts/d3/test/time/seconds-test.js +101 -0
  583. data/lib/picky-statistics/application/javascripts/d3/test/time/week-test.js +59 -0
  584. data/lib/picky-statistics/application/javascripts/d3/test/time/weeks-test.js +105 -0
  585. data/lib/picky-statistics/application/javascripts/d3/test/time/year-test.js +41 -0
  586. data/lib/picky-statistics/application/javascripts/d3/test/time/years-test.js +73 -0
  587. data/lib/picky-statistics/application/javascripts/full_live.js +60 -0
  588. data/lib/picky-statistics/application/javascripts/graph.js +83 -0
  589. data/lib/picky-statistics/application/javascripts/results.js +86 -0
  590. data/lib/picky-statistics/application/javascripts/rickshaw.js +1 -0
  591. data/lib/picky-statistics/application/javascripts/statistics.js +30 -55
  592. data/lib/picky-statistics/application/stylesheets/statistics.css +83 -27
  593. data/lib/picky-statistics/application/views/index.haml +29 -39
  594. data/lib/picky-statistics/statistics/logfile_reader.rb +43 -32
  595. data/spec/lib/picky-statistics/statistics/logfile_reader_spec.rb +28 -25
  596. metadata +596 -6
@@ -0,0 +1 @@
1
+ (function(){function c(a){var b=0,c=0;for(;;){if(a(b,c))return[b,c];b===0?(b=c+1,c=0):(b-=1,c+=1)}}function d(a,b,c,d){var e,f,g,h,i,j,k;return e=d[a],f=e[0],g=e[1],e=d[b],h=e[0],i=e[1],e=d[c],j=e[0],k=e[1],(k-g)*(h-f)-(i-g)*(j-f)>0}function e(a,b,c){return(c[0]-b[0])*(a[1]-b[1])<(c[1]-b[1])*(a[0]-b[0])}function f(a,b,c,d){var e=a[0],f=b[0],g=c[0],h=d[0],i=a[1],j=b[1],k=c[1],l=d[1],m=e-g,n=f-e,o=h-g,p=i-k,q=j-i,r=l-k,s=(o*p-r*m)/(r*n-o*q);return[e+s*n,i+s*q]}function h(a,b){var c={list:a.map(function(a,b){return{index:b,x:a[0],y:a[1]}}).sort(function(a,b){return a.y<b.y?-1:a.y>b.y?1:a.x<b.x?-1:a.x>b.x?1:0}),bottomSite:null},d={list:[],leftEnd:null,rightEnd:null,init:function(){d.leftEnd=d.createHalfEdge(null,"l"),d.rightEnd=d.createHalfEdge(null,"l"),d.leftEnd.r=d.rightEnd,d.rightEnd.l=d.leftEnd,d.list.unshift(d.leftEnd,d.rightEnd)},createHalfEdge:function(a,b){return{edge:a,side:b,vertex:null,l:null,r:null}},insert:function(a,b){b.l=a,b.r=a.r,a.r.l=b,a.r=b},leftBound:function(a){var b=d.leftEnd;do b=b.r;while(b!=d.rightEnd&&e.rightOf(b,a));return b=b.l,b},del:function(a){a.l.r=a.r,a.r.l=a.l,a.edge=null},right:function(a){return a.r},left:function(a){return a.l},leftRegion:function(a){return a.edge==null?c.bottomSite:a.edge.region[a.side]},rightRegion:function(a){return a.edge==null?c.bottomSite:a.edge.region[g[a.side]]}},e={bisect:function(a,b){var c={region:{l:a,r:b},ep:{l:null,r:null}},d=b.x-a.x,e=b.y-a.y,f=d>0?d:-d,g=e>0?e:-e;return c.c=a.x*d+a.y*e+(d*d+e*e)*.5,f>g?(c.a=1,c.b=e/d,c.c/=d):(c.b=1,c.a=d/e,c.c/=e),c},intersect:function(a,b){var c=a.edge,d=b.edge;if(!c||!d||c.region.r==d.region.r)return null;var e=c.a*d.b-c.b*d.a;if(Math.abs(e)<1e-10)return null;var f=(c.c*d.b-d.c*c.b)/e,g=(d.c*c.a-c.c*d.a)/e,h=c.region.r,i=d.region.r,j,k;h.y<i.y||h.y==i.y&&h.x<i.x?(j=a,k=c):(j=b,k=d);var l=f>=k.region.r.x;return l&&j.side==="l"||!l&&j.side==="r"?null:{x:f,y:g}},rightOf:function(a,b){var c=a.edge,d=c.region.r,e=b.x>d.x;if(e&&a.side==="l")return 1;if(!e&&a.side==="r")return 0;if(c.a===1){var f=b.y-d.y,g=b.x-d.x,h=0,i=0;!e&&c.b<0||e&&c.b>=0?i=h=f>=c.b*g:(i=b.x+b.y*c.b>c.c,c.b<0&&(i=!i),i||(h=1));if(!h){var j=d.x-c.region.l.x;i=c.b*(g*g-f*f)<j*f*(1+2*g/j+c.b*c.b),c.b<0&&(i=!i)}}else{var k=c.c-c.a*b.x,l=b.y-k,m=b.x-d.x,n=k-d.y;i=l*l>m*m+n*n}return a.side==="l"?i:!i},endPoint:function(a,c,d){a.ep[c]=d;if(!a.ep[g[c]])return;b(a)},distance:function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)}},f={list:[],insert:function(a,b,c){a.vertex=b,a.ystar=b.y+c;for(var d=0,e=f.list,g=e.length;d<g;d++){var h=e[d];if(a.ystar>h.ystar||a.ystar==h.ystar&&b.x>h.vertex.x)continue;break}e.splice(d,0,a)},del:function(a){for(var b=0,c=f.list,d=c.length;b<d&&c[b]!=a;++b);c.splice(b,1)},empty:function(){return f.list.length===0},nextEvent:function(a){for(var b=0,c=f.list,d=c.length;b<d;++b)if(c[b]==a)return c[b+1];return null},min:function(){var a=f.list[0];return{x:a.vertex.x,y:a.ystar}},extractMin:function(){return f.list.shift()}};d.init(),c.bottomSite=c.list.shift();var h=c.list.shift(),i,j,k,l,m,n,o,p,q,r,s,t,u;for(;;){f.empty()||(i=f.min());if(h&&(f.empty()||h.y<i.y||h.y==i.y&&h.x<i.x))j=d.leftBound(h),k=d.right(j),o=d.rightRegion(j),t=e.bisect(o,h),n=d.createHalfEdge(t,"l"),d.insert(j,n),r=e.intersect(j,n),r&&(f.del(j),f.insert(j,r,e.distance(r,h))),j=n,n=d.createHalfEdge(t,"r"),d.insert(j,n),r=e.intersect(n,k),r&&f.insert(n,r,e.distance(r,h)),h=c.list.shift();else if(!f.empty())j=f.extractMin(),l=d.left(j),k=d.right(j),m=d.right(k),o=d.leftRegion(j),p=d.rightRegion(k),s=j.vertex,e.endPoint(j.edge,j.side,s),e.endPoint(k.edge,k.side,s),d.del(j),f.del(k),d.del(k),u="l",o.y>p.y&&(q=o,o=p,p=q,u="r"),t=e.bisect(o,p),n=d.createHalfEdge(t,u),d.insert(l,n),e.endPoint(t,g[u],s),r=e.intersect(l,n),r&&(f.del(l),f.insert(l,r,e.distance(r,o))),r=e.intersect(n,m),r&&f.insert(n,r,e.distance(r,o));else break}for(j=d.right(d.leftEnd);j!=d.rightEnd;j=d.right(j))b(j.edge)}function i(){return{leaf:!0,nodes:[],point:null}}function j(a,b,c,d,e,f){if(!a(b,c,d,e,f)){var g=(c+e)*.5,h=(d+f)*.5,i=b.nodes;i[0]&&j(a,i[0],c,d,g,h),i[1]&&j(a,i[1],g,d,e,h),i[2]&&j(a,i[2],c,h,g,f),i[3]&&j(a,i[3],g,h,e,f)}}function k(a){return{x:a[0],y:a[1]}}d3.geom={},d3.geom.contour=function(d,e){var f=e||c(d),g=[],h=f[0],i=f[1],j=0,k=0,l=NaN,m=NaN,n=0;do n=0,d(h-1,i-1)&&(n+=1),d(h,i-1)&&(n+=2),d(h-1,i)&&(n+=4),d(h,i)&&(n+=8),n===6?(j=m===-1?-1:1,k=0):n===9?(j=0,k=l===1?-1:1):(j=a[n],k=b[n]),j!=l&&k!=m&&(g.push([h,i]),l=j,m=k),h+=j,i+=k;while(f[0]!=h||f[1]!=i);return g};var a=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],b=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];d3.geom.hull=function(a){if(a.length<3)return[];var b=a.length,c=b-1,e=[],f=[],g,h,i=0,j,k,l,m,n,o,p,q;for(g=1;g<b;++g)a[g][1]<a[i][1]?i=g:a[g][1]==a[i][1]&&(i=a[g][0]<a[i][0]?g:i);for(g=0;g<b;++g){if(g===i)continue;k=a[g][1]-a[i][1],j=a[g][0]-a[i][0],e.push({angle:Math.atan2(k,j),index:g})}e.sort(function(a,b){return a.angle-b.angle}),p=e[0].angle,o=e[0].index,n=0;for(g=1;g<c;++g)h=e[g].index,p==e[g].angle?(j=a[o][0]-a[i][0],k=a[o][1]-a[i][1],l=a[h][0]-a[i][0],m=a[h][1]-a[i][1],j*j+k*k>=l*l+m*m?e[g].index=-1:(e[n].index=-1,p=e[g].angle,n=g,o=h)):(p=e[g].angle,n=g,o=h);f.push(i);for(g=0,h=0;g<2;++h)e[h].index!==-1&&(f.push(e[h].index),g++);q=f.length;for(;h<c;++h){if(e[h].index===-1)continue;while(!d(f[q-2],f[q-1],e[h].index,a))--q;f[q++]=e[h].index}var r=[];for(g=0;g<q;++g)r.push(a[f[g]]);return r},d3.geom.polygon=function(a){return a.area=function(){var b=0,c=a.length,d=a[c-1][0]*a[0][1],e=a[c-1][1]*a[0][0];while(++b<c)d+=a[b-1][0]*a[b][1],e+=a[b-1][1]*a[b][0];return(e-d)*.5},a.centroid=function(b){var c=-1,d=a.length-1,e=0,f=0,g,h,i;arguments.length||(b=-1/(6*a.area()));while(++c<d)g=a[c],h=a[c+1],i=g[0]*h[1]-h[0]*g[1],e+=(g[0]+h[0])*i,f+=(g[1]+h[1])*i;return[e*b,f*b]},a.clip=function(b){var c,d=-1,g=a.length,h,i,j=a[g-1],k,l,m;while(++d<g){c=b.slice(),b.length=0,k=a[d],l=c[(i=c.length)-1],h=-1;while(++h<i)m=c[h],e(m,j,k)?(e(l,j,k)||b.push(f(l,m,j,k)),b.push(m)):e(l,j,k)&&b.push(f(l,m,j,k)),l=m;j=k}return b},a},d3.geom.voronoi=function(a){var b=a.map(function(){return[]});return h(a,function(a){var c,d,e,f,g,h;a.a===1&&a.b>=0?(c=a.ep.r,d=a.ep.l):(c=a.ep.l,d=a.ep.r),a.a===1?(g=c?c.y:-1e6,e=a.c-a.b*g,h=d?d.y:1e6,f=a.c-a.b*h):(e=c?c.x:-1e6,g=a.c-a.a*e,f=d?d.x:1e6,h=a.c-a.a*f);var i=[e,g],j=[f,h];b[a.region.l.index].push(i,j),b[a.region.r.index].push(i,j)}),b.map(function(b,c){var d=a[c][0],e=a[c][1];return b.forEach(function(a){a.angle=Math.atan2(a[0]-d,a[1]-e)}),b.sort(function(a,b){return a.angle-b.angle}).filter(function(a,c){return!c||a.angle-b[c-1].angle>1e-10})})};var g={l:"r",r:"l"};d3.geom.delaunay=function(a){var b=a.map(function(){return[]}),c=[];return h(a,function(c){b[c.region.l.index].push(a[c.region.r.index])}),b.forEach(function(b,d){var e=a[d],f=e[0],g=e[1];b.forEach(function(a){a.angle=Math.atan2(a[0]-f,a[1]-g)}),b.sort(function(a,b){return a.angle-b.angle});for(var h=0,i=b.length-1;h<i;h++)c.push([e,b[h],b[h+1]])}),c},d3.geom.quadtree=function(a,b,c,d,e){function n(a,b,c,d,e,f){if(isNaN(b.x)||isNaN(b.y))return;if(a.leaf){var g=a.point;g?Math.abs(g.x-b.x)+Math.abs(g.y-b.y)<.01?o(a,b,c,d,e,f):(a.point=null,o(a,g,c,d,e,f),o(a,b,c,d,e,f)):a.point=b}else o(a,b,c,d,e,f)}function o(a,b,c,d,e,f){var g=(c+e)*.5,h=(d+f)*.5,j=b.x>=g,k=b.y>=h,l=(k<<1)+j;a.leaf=!1,a=a.nodes[l]||(a.nodes[l]=i()),j?c=g:e=g,k?d=h:f=h,n(a,b,c,d,e,f)}var f,g=-1,h=a.length;h&&isNaN(a[0].x)&&(a=a.map(k));if(arguments.length<5)if(arguments.length===3)e=d=c,c=b;else{b=c=Infinity,d=e=-Infinity;while(++g<h)f=a[g],f.x<b&&(b=f.x),f.y<c&&(c=f.y),f.x>d&&(d=f.x),f.y>e&&(e=f.y);var l=d-b,m=e-c;l>m?e=c+l:d=b+m}var p=i();return p.add=function(a){n(p,a,b,c,d,e)},p.visit=function(a){j(a,p,b,c,d,e)},a.forEach(p.add),p}})();
@@ -0,0 +1,4690 @@
1
+ (function(){if (!Date.now) Date.now = function() {
2
+ return +new Date;
3
+ };
4
+ try {
5
+ document.createElement("div").style.setProperty("opacity", 0, "");
6
+ } catch (error) {
7
+ var d3_style_prototype = CSSStyleDeclaration.prototype,
8
+ d3_style_setProperty = d3_style_prototype.setProperty;
9
+ d3_style_prototype.setProperty = function(name, value, priority) {
10
+ d3_style_setProperty.call(this, name, value + "", priority);
11
+ };
12
+ }
13
+ d3 = {version: "2.7.0"}; // semver
14
+ var d3_array = d3_arraySlice; // conversion for NodeLists
15
+
16
+ function d3_arrayCopy(pseudoarray) {
17
+ var i = -1, n = pseudoarray.length, array = [];
18
+ while (++i < n) array.push(pseudoarray[i]);
19
+ return array;
20
+ }
21
+
22
+ function d3_arraySlice(pseudoarray) {
23
+ return Array.prototype.slice.call(pseudoarray);
24
+ }
25
+
26
+ try {
27
+ d3_array(document.documentElement.childNodes)[0].nodeType;
28
+ } catch(e) {
29
+ d3_array = d3_arrayCopy;
30
+ }
31
+
32
+ var d3_arraySubclass = [].__proto__?
33
+
34
+ // Until ECMAScript supports array subclassing, prototype injection works well.
35
+ function(array, prototype) {
36
+ array.__proto__ = prototype;
37
+ }:
38
+
39
+ // And if your browser doesn't support __proto__, we'll use direct extension.
40
+ function(array, prototype) {
41
+ for (var property in prototype) array[property] = prototype[property];
42
+ };
43
+ function d3_this() {
44
+ return this;
45
+ }
46
+ d3.functor = function(v) {
47
+ return typeof v === "function" ? v : function() { return v; };
48
+ };
49
+ // Copies a variable number of methods from source to target.
50
+ d3.rebind = function(target, source) {
51
+ var i = 1, n = arguments.length, method;
52
+ while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
53
+ return target;
54
+ };
55
+
56
+ // Method is assumed to be a standard D3 getter-setter:
57
+ // If passed with no arguments, gets the value.
58
+ // If passed with arguments, sets the value and returns the target.
59
+ function d3_rebind(target, source, method) {
60
+ return function() {
61
+ var value = method.apply(source, arguments);
62
+ return arguments.length ? target : value;
63
+ };
64
+ }
65
+ d3.ascending = function(a, b) {
66
+ return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
67
+ };
68
+ d3.descending = function(a, b) {
69
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
70
+ };
71
+ d3.mean = function(array, f) {
72
+ var n = array.length,
73
+ a,
74
+ m = 0,
75
+ i = -1,
76
+ j = 0;
77
+ if (arguments.length === 1) {
78
+ while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
79
+ } else {
80
+ while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
81
+ }
82
+ return j ? m : undefined;
83
+ };
84
+ d3.median = function(array, f) {
85
+ if (arguments.length > 1) array = array.map(f);
86
+ array = array.filter(d3_number);
87
+ return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
88
+ };
89
+ d3.min = function(array, f) {
90
+ var i = -1,
91
+ n = array.length,
92
+ a,
93
+ b;
94
+ if (arguments.length === 1) {
95
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
96
+ while (++i < n) if ((b = array[i]) != null && a > b) a = b;
97
+ } else {
98
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
99
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
100
+ }
101
+ return a;
102
+ };
103
+ d3.max = function(array, f) {
104
+ var i = -1,
105
+ n = array.length,
106
+ a,
107
+ b;
108
+ if (arguments.length === 1) {
109
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
110
+ while (++i < n) if ((b = array[i]) != null && b > a) a = b;
111
+ } else {
112
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
113
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
114
+ }
115
+ return a;
116
+ };
117
+ d3.extent = function(array, f) {
118
+ var i = -1,
119
+ n = array.length,
120
+ a,
121
+ b,
122
+ c;
123
+ if (arguments.length === 1) {
124
+ while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
125
+ while (++i < n) if ((b = array[i]) != null) {
126
+ if (a > b) a = b;
127
+ if (c < b) c = b;
128
+ }
129
+ } else {
130
+ while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
131
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
132
+ if (a > b) a = b;
133
+ if (c < b) c = b;
134
+ }
135
+ }
136
+ return [a, c];
137
+ };
138
+ d3.random = {
139
+ normal: function(mean, deviation) {
140
+ if (arguments.length < 2) deviation = 1;
141
+ if (arguments.length < 1) mean = 0;
142
+ return function() {
143
+ var x, y, r;
144
+ do {
145
+ x = Math.random() * 2 - 1;
146
+ y = Math.random() * 2 - 1;
147
+ r = x * x + y * y;
148
+ } while (!r || r > 1);
149
+ return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r);
150
+ };
151
+ }
152
+ };
153
+ function d3_number(x) {
154
+ return x != null && !isNaN(x);
155
+ }
156
+ d3.sum = function(array, f) {
157
+ var s = 0,
158
+ n = array.length,
159
+ a,
160
+ i = -1;
161
+
162
+ if (arguments.length === 1) {
163
+ while (++i < n) if (!isNaN(a = +array[i])) s += a;
164
+ } else {
165
+ while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
166
+ }
167
+
168
+ return s;
169
+ };
170
+ // R-7 per <http://en.wikipedia.org/wiki/Quantile>
171
+ d3.quantile = function(values, p) {
172
+ var H = (values.length - 1) * p + 1,
173
+ h = Math.floor(H),
174
+ v = values[h - 1],
175
+ e = H - h;
176
+ return e ? v + e * (values[h] - v) : v;
177
+ };
178
+ d3.transpose = function(matrix) {
179
+ return d3.zip.apply(d3, matrix);
180
+ };
181
+ d3.zip = function() {
182
+ if (!(n = arguments.length)) return [];
183
+ for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) {
184
+ for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n;) {
185
+ zip[j] = arguments[j][i];
186
+ }
187
+ }
188
+ return zips;
189
+ };
190
+
191
+ function d3_zipLength(d) {
192
+ return d.length;
193
+ }
194
+ // Locate the insertion point for x in a to maintain sorted order. The
195
+ // arguments lo and hi may be used to specify a subset of the array which should
196
+ // be considered; by default the entire array is used. If x is already present
197
+ // in a, the insertion point will be before (to the left of) any existing
198
+ // entries. The return value is suitable for use as the first argument to
199
+ // `array.splice` assuming that a is already sorted.
200
+ //
201
+ // The returned insertion point i partitions the array a into two halves so that
202
+ // all v < x for v in a[lo:i] for the left side and all v >= x for v in a[i:hi]
203
+ // for the right side.
204
+ d3.bisectLeft = function(a, x, lo, hi) {
205
+ if (arguments.length < 3) lo = 0;
206
+ if (arguments.length < 4) hi = a.length;
207
+ while (lo < hi) {
208
+ var mid = (lo + hi) >> 1;
209
+ if (a[mid] < x) lo = mid + 1;
210
+ else hi = mid;
211
+ }
212
+ return lo;
213
+ };
214
+
215
+ // Similar to bisectLeft, but returns an insertion point which comes after (to
216
+ // the right of) any existing entries of x in a.
217
+ //
218
+ // The returned insertion point i partitions the array into two halves so that
219
+ // all v <= x for v in a[lo:i] for the left side and all v > x for v in a[i:hi]
220
+ // for the right side.
221
+ d3.bisect =
222
+ d3.bisectRight = function(a, x, lo, hi) {
223
+ if (arguments.length < 3) lo = 0;
224
+ if (arguments.length < 4) hi = a.length;
225
+ while (lo < hi) {
226
+ var mid = (lo + hi) >> 1;
227
+ if (x < a[mid]) hi = mid;
228
+ else lo = mid + 1;
229
+ }
230
+ return lo;
231
+ };
232
+ d3.first = function(array, f) {
233
+ var i = 0,
234
+ n = array.length,
235
+ a = array[0],
236
+ b;
237
+ if (arguments.length === 1) f = d3.ascending;
238
+ while (++i < n) {
239
+ if (f.call(array, a, b = array[i]) > 0) {
240
+ a = b;
241
+ }
242
+ }
243
+ return a;
244
+ };
245
+ d3.last = function(array, f) {
246
+ var i = 0,
247
+ n = array.length,
248
+ a = array[0],
249
+ b;
250
+ if (arguments.length === 1) f = d3.ascending;
251
+ while (++i < n) {
252
+ if (f.call(array, a, b = array[i]) <= 0) {
253
+ a = b;
254
+ }
255
+ }
256
+ return a;
257
+ };
258
+ d3.nest = function() {
259
+ var nest = {},
260
+ keys = [],
261
+ sortKeys = [],
262
+ sortValues,
263
+ rollup;
264
+
265
+ function map(array, depth) {
266
+ if (depth >= keys.length) return rollup
267
+ ? rollup.call(nest, array) : (sortValues
268
+ ? array.sort(sortValues)
269
+ : array);
270
+
271
+ var i = -1,
272
+ n = array.length,
273
+ key = keys[depth++],
274
+ keyValue,
275
+ object,
276
+ o = {};
277
+
278
+ while (++i < n) {
279
+ if ((keyValue = key(object = array[i])) in o) {
280
+ o[keyValue].push(object);
281
+ } else {
282
+ o[keyValue] = [object];
283
+ }
284
+ }
285
+
286
+ for (keyValue in o) {
287
+ o[keyValue] = map(o[keyValue], depth);
288
+ }
289
+
290
+ return o;
291
+ }
292
+
293
+ function entries(map, depth) {
294
+ if (depth >= keys.length) return map;
295
+
296
+ var a = [],
297
+ sortKey = sortKeys[depth++],
298
+ key;
299
+
300
+ for (key in map) {
301
+ a.push({key: key, values: entries(map[key], depth)});
302
+ }
303
+
304
+ if (sortKey) a.sort(function(a, b) {
305
+ return sortKey(a.key, b.key);
306
+ });
307
+
308
+ return a;
309
+ }
310
+
311
+ nest.map = function(array) {
312
+ return map(array, 0);
313
+ };
314
+
315
+ nest.entries = function(array) {
316
+ return entries(map(array, 0), 0);
317
+ };
318
+
319
+ nest.key = function(d) {
320
+ keys.push(d);
321
+ return nest;
322
+ };
323
+
324
+ // Specifies the order for the most-recently specified key.
325
+ // Note: only applies to entries. Map keys are unordered!
326
+ nest.sortKeys = function(order) {
327
+ sortKeys[keys.length - 1] = order;
328
+ return nest;
329
+ };
330
+
331
+ // Specifies the order for leaf values.
332
+ // Applies to both maps and entries array.
333
+ nest.sortValues = function(order) {
334
+ sortValues = order;
335
+ return nest;
336
+ };
337
+
338
+ nest.rollup = function(f) {
339
+ rollup = f;
340
+ return nest;
341
+ };
342
+
343
+ return nest;
344
+ };
345
+ d3.keys = function(map) {
346
+ var keys = [];
347
+ for (var key in map) keys.push(key);
348
+ return keys;
349
+ };
350
+ d3.values = function(map) {
351
+ var values = [];
352
+ for (var key in map) values.push(map[key]);
353
+ return values;
354
+ };
355
+ d3.entries = function(map) {
356
+ var entries = [];
357
+ for (var key in map) entries.push({key: key, value: map[key]});
358
+ return entries;
359
+ };
360
+ d3.permute = function(array, indexes) {
361
+ var permutes = [],
362
+ i = -1,
363
+ n = indexes.length;
364
+ while (++i < n) permutes[i] = array[indexes[i]];
365
+ return permutes;
366
+ };
367
+ d3.merge = function(arrays) {
368
+ return Array.prototype.concat.apply([], arrays);
369
+ };
370
+ d3.split = function(array, f) {
371
+ var arrays = [],
372
+ values = [],
373
+ value,
374
+ i = -1,
375
+ n = array.length;
376
+ if (arguments.length < 2) f = d3_splitter;
377
+ while (++i < n) {
378
+ if (f.call(values, value = array[i], i)) {
379
+ values = [];
380
+ } else {
381
+ if (!values.length) arrays.push(values);
382
+ values.push(value);
383
+ }
384
+ }
385
+ return arrays;
386
+ };
387
+
388
+ function d3_splitter(d) {
389
+ return d == null;
390
+ }
391
+ function d3_collapse(s) {
392
+ return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " ");
393
+ }
394
+ /**
395
+ * @param {number} start
396
+ * @param {number=} stop
397
+ * @param {number=} step
398
+ */
399
+ d3.range = function(start, stop, step) {
400
+ if (arguments.length < 3) {
401
+ step = 1;
402
+ if (arguments.length < 2) {
403
+ stop = start;
404
+ start = 0;
405
+ }
406
+ }
407
+ if ((stop - start) / step == Infinity) throw new Error("infinite range");
408
+ var range = [],
409
+ i = -1,
410
+ j;
411
+ if (step < 0) while ((j = start + step * ++i) > stop) range.push(j);
412
+ else while ((j = start + step * ++i) < stop) range.push(j);
413
+ return range;
414
+ };
415
+ d3.requote = function(s) {
416
+ return s.replace(d3_requote_re, "\\$&");
417
+ };
418
+
419
+ var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
420
+ d3.round = function(x, n) {
421
+ return n
422
+ ? Math.round(x * Math.pow(10, n)) * Math.pow(10, -n)
423
+ : Math.round(x);
424
+ };
425
+ d3.xhr = function(url, mime, callback) {
426
+ var req = new XMLHttpRequest;
427
+ if (arguments.length < 3) callback = mime;
428
+ else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
429
+ req.open("GET", url, true);
430
+ req.onreadystatechange = function() {
431
+ if (req.readyState === 4) callback(req.status < 300 ? req : null);
432
+ };
433
+ req.send(null);
434
+ };
435
+ d3.text = function(url, mime, callback) {
436
+ function ready(req) {
437
+ callback(req && req.responseText);
438
+ }
439
+ if (arguments.length < 3) {
440
+ callback = mime;
441
+ mime = null;
442
+ }
443
+ d3.xhr(url, mime, ready);
444
+ };
445
+ d3.json = function(url, callback) {
446
+ d3.text(url, "application/json", function(text) {
447
+ callback(text ? JSON.parse(text) : null);
448
+ });
449
+ };
450
+ d3.html = function(url, callback) {
451
+ d3.text(url, "text/html", function(text) {
452
+ if (text != null) { // Treat empty string as valid HTML.
453
+ var range = document.createRange();
454
+ range.selectNode(document.body);
455
+ text = range.createContextualFragment(text);
456
+ }
457
+ callback(text);
458
+ });
459
+ };
460
+ d3.xml = function(url, mime, callback) {
461
+ function ready(req) {
462
+ callback(req && req.responseXML);
463
+ }
464
+ if (arguments.length < 3) {
465
+ callback = mime;
466
+ mime = null;
467
+ }
468
+ d3.xhr(url, mime, ready);
469
+ };
470
+ var d3_nsPrefix = {
471
+ svg: "http://www.w3.org/2000/svg",
472
+ xhtml: "http://www.w3.org/1999/xhtml",
473
+ xlink: "http://www.w3.org/1999/xlink",
474
+ xml: "http://www.w3.org/XML/1998/namespace",
475
+ xmlns: "http://www.w3.org/2000/xmlns/"
476
+ };
477
+
478
+ d3.ns = {
479
+ prefix: d3_nsPrefix,
480
+ qualify: function(name) {
481
+ var i = name.indexOf(":");
482
+ return i < 0 ? (name in d3_nsPrefix
483
+ ? {space: d3_nsPrefix[name], local: name} : name)
484
+ : {space: d3_nsPrefix[name.substring(0, i)], local: name.substring(i + 1)};
485
+ }
486
+ };
487
+ d3.dispatch = function() {
488
+ var dispatch = new d3_dispatch(),
489
+ i = -1,
490
+ n = arguments.length;
491
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event();
492
+ return dispatch;
493
+ };
494
+
495
+ function d3_dispatch() {}
496
+
497
+ d3_dispatch.prototype.on = function(type, listener) {
498
+ var i = type.indexOf("."),
499
+ name = "";
500
+
501
+ // Extract optional namespace, e.g., "click.foo"
502
+ if (i > 0) {
503
+ name = type.substring(i + 1);
504
+ type = type.substring(0, i);
505
+ }
506
+
507
+ return arguments.length < 2
508
+ ? this[type].on(name)
509
+ : (this[type].on(name, listener), this);
510
+ };
511
+
512
+ function d3_dispatch_event() {
513
+ var listeners = [],
514
+ listenerByName = {};
515
+
516
+ function dispatch() {
517
+ var z = listeners, // defensive reference
518
+ i = -1,
519
+ n = z.length,
520
+ l;
521
+ while (++i < n) if (l = z[i].on) l.apply(this, arguments);
522
+ }
523
+
524
+ dispatch.on = function(name, listener) {
525
+ var l, i;
526
+
527
+ // return the current listener, if any
528
+ if (arguments.length < 2) return (l = listenerByName[name]) && l.on;
529
+
530
+ // remove the old listener, if any (with copy-on-write)
531
+ if (l = listenerByName[name]) {
532
+ l.on = null;
533
+ listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
534
+ delete listenerByName[name];
535
+ }
536
+
537
+ // add the new listener, if any
538
+ if (listener) {
539
+ listeners.push(listenerByName[name] = {on: listener});
540
+ }
541
+
542
+ return dispatch;
543
+ };
544
+
545
+ return dispatch;
546
+ };
547
+ // TODO align
548
+ d3.format = function(specifier) {
549
+ var match = d3_format_re.exec(specifier),
550
+ fill = match[1] || " ",
551
+ sign = match[3] || "",
552
+ zfill = match[5],
553
+ width = +match[6],
554
+ comma = match[7],
555
+ precision = match[8],
556
+ type = match[9],
557
+ scale = 1,
558
+ suffix = "",
559
+ integer = false;
560
+
561
+ if (precision) precision = +precision.substring(1);
562
+
563
+ if (zfill) {
564
+ fill = "0"; // TODO align = "=";
565
+ if (comma) width -= Math.floor((width - 1) / 4);
566
+ }
567
+
568
+ switch (type) {
569
+ case "n": comma = true; type = "g"; break;
570
+ case "%": scale = 100; suffix = "%"; type = "f"; break;
571
+ case "p": scale = 100; suffix = "%"; type = "r"; break;
572
+ case "d": integer = true; precision = 0; break;
573
+ case "s": scale = -1; type = "r"; break;
574
+ }
575
+
576
+ // If no precision is specified for r, fallback to general notation.
577
+ if (type == "r" && !precision) type = "g";
578
+
579
+ type = d3_format_types[type] || d3_format_typeDefault;
580
+
581
+ return function(value) {
582
+
583
+ // Return the empty string for floats formatted as ints.
584
+ if (integer && (value % 1)) return "";
585
+
586
+ // Convert negative to positive, and record the sign prefix.
587
+ var negative = (value < 0) && (value = -value) ? "\u2212" : sign;
588
+
589
+ // Apply the scale, computing it from the value's exponent for si format.
590
+ if (scale < 0) {
591
+ var prefix = d3.formatPrefix(value, precision);
592
+ value *= prefix.scale;
593
+ suffix = prefix.symbol;
594
+ } else {
595
+ value *= scale;
596
+ }
597
+
598
+ // Convert to the desired precision.
599
+ value = type(value, precision);
600
+
601
+ // If the fill character is 0, the sign and group is applied after the fill.
602
+ if (zfill) {
603
+ var length = value.length + negative.length;
604
+ if (length < width) value = new Array(width - length + 1).join(fill) + value;
605
+ if (comma) value = d3_format_group(value);
606
+ value = negative + value;
607
+ }
608
+
609
+ // Otherwise (e.g., space-filling), the sign and group is applied before.
610
+ else {
611
+ if (comma) value = d3_format_group(value);
612
+ value = negative + value;
613
+ var length = value.length;
614
+ if (length < width) value = new Array(width - length + 1).join(fill) + value;
615
+ }
616
+
617
+ return value + suffix;
618
+ };
619
+ };
620
+
621
+ // [[fill]align][sign][#][0][width][,][.precision][type]
622
+ var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
623
+
624
+ var d3_format_types = {
625
+ g: function(x, p) { return x.toPrecision(p); },
626
+ e: function(x, p) { return x.toExponential(p); },
627
+ f: function(x, p) { return x.toFixed(p); },
628
+ r: function(x, p) { return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); }
629
+ };
630
+
631
+ function d3_format_precision(x, p) {
632
+ return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1);
633
+ }
634
+
635
+ function d3_format_typeDefault(x) {
636
+ return x + "";
637
+ }
638
+
639
+ // Apply comma grouping for thousands.
640
+ function d3_format_group(value) {
641
+ var i = value.lastIndexOf("."),
642
+ f = i >= 0 ? value.substring(i) : (i = value.length, ""),
643
+ t = [];
644
+ while (i > 0) t.push(value.substring(i -= 3, i + 3));
645
+ return t.reverse().join(",") + f;
646
+ }
647
+ var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix);
648
+
649
+ d3.formatPrefix = function(value, precision) {
650
+ var i = 0;
651
+ if (value) {
652
+ if (value < 0) value *= -1;
653
+ if (precision) value = d3.round(value, d3_format_precision(value, precision));
654
+ i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
655
+ i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
656
+ }
657
+ return d3_formatPrefixes[8 + i / 3];
658
+ };
659
+
660
+ function d3_formatPrefix(d, i) {
661
+ return {
662
+ scale: Math.pow(10, (8 - i) * 3),
663
+ symbol: d
664
+ };
665
+ }
666
+
667
+ /*
668
+ * TERMS OF USE - EASING EQUATIONS
669
+ *
670
+ * Open source under the BSD License.
671
+ *
672
+ * Copyright 2001 Robert Penner
673
+ * All rights reserved.
674
+ *
675
+ * Redistribution and use in source and binary forms, with or without
676
+ * modification, are permitted provided that the following conditions are met:
677
+ *
678
+ * - Redistributions of source code must retain the above copyright notice, this
679
+ * list of conditions and the following disclaimer.
680
+ *
681
+ * - Redistributions in binary form must reproduce the above copyright notice,
682
+ * this list of conditions and the following disclaimer in the documentation
683
+ * and/or other materials provided with the distribution.
684
+ *
685
+ * - Neither the name of the author nor the names of contributors may be used to
686
+ * endorse or promote products derived from this software without specific
687
+ * prior written permission.
688
+ *
689
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
690
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
691
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
692
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
693
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
694
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
695
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
696
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
697
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
698
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
699
+ * POSSIBILITY OF SUCH DAMAGE.
700
+ */
701
+
702
+ var d3_ease_quad = d3_ease_poly(2),
703
+ d3_ease_cubic = d3_ease_poly(3);
704
+
705
+ var d3_ease = {
706
+ linear: function() { return d3_ease_linear; },
707
+ poly: d3_ease_poly,
708
+ quad: function() { return d3_ease_quad; },
709
+ cubic: function() { return d3_ease_cubic; },
710
+ sin: function() { return d3_ease_sin; },
711
+ exp: function() { return d3_ease_exp; },
712
+ circle: function() { return d3_ease_circle; },
713
+ elastic: d3_ease_elastic,
714
+ back: d3_ease_back,
715
+ bounce: function() { return d3_ease_bounce; }
716
+ };
717
+
718
+ var d3_ease_mode = {
719
+ "in": function(f) { return f; },
720
+ "out": d3_ease_reverse,
721
+ "in-out": d3_ease_reflect,
722
+ "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); }
723
+ };
724
+
725
+ d3.ease = function(name) {
726
+ var i = name.indexOf("-"),
727
+ t = i >= 0 ? name.substring(0, i) : name,
728
+ m = i >= 0 ? name.substring(i + 1) : "in";
729
+ return d3_ease_clamp(d3_ease_mode[m](d3_ease[t].apply(null, Array.prototype.slice.call(arguments, 1))));
730
+ };
731
+
732
+ function d3_ease_clamp(f) {
733
+ return function(t) {
734
+ return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
735
+ };
736
+ }
737
+
738
+ function d3_ease_reverse(f) {
739
+ return function(t) {
740
+ return 1 - f(1 - t);
741
+ };
742
+ }
743
+
744
+ function d3_ease_reflect(f) {
745
+ return function(t) {
746
+ return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t)));
747
+ };
748
+ }
749
+
750
+ function d3_ease_linear(t) {
751
+ return t;
752
+ }
753
+
754
+ function d3_ease_poly(e) {
755
+ return function(t) {
756
+ return Math.pow(t, e);
757
+ }
758
+ }
759
+
760
+ function d3_ease_sin(t) {
761
+ return 1 - Math.cos(t * Math.PI / 2);
762
+ }
763
+
764
+ function d3_ease_exp(t) {
765
+ return Math.pow(2, 10 * (t - 1));
766
+ }
767
+
768
+ function d3_ease_circle(t) {
769
+ return 1 - Math.sqrt(1 - t * t);
770
+ }
771
+
772
+ function d3_ease_elastic(a, p) {
773
+ var s;
774
+ if (arguments.length < 2) p = 0.45;
775
+ if (arguments.length < 1) { a = 1; s = p / 4; }
776
+ else s = p / (2 * Math.PI) * Math.asin(1 / a);
777
+ return function(t) {
778
+ return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p);
779
+ };
780
+ }
781
+
782
+ function d3_ease_back(s) {
783
+ if (!s) s = 1.70158;
784
+ return function(t) {
785
+ return t * t * ((s + 1) * t - s);
786
+ };
787
+ }
788
+
789
+ function d3_ease_bounce(t) {
790
+ return t < 1 / 2.75 ? 7.5625 * t * t
791
+ : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75
792
+ : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375
793
+ : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
794
+ }
795
+ d3.event = null;
796
+
797
+ function d3_eventCancel() {
798
+ d3.event.stopPropagation();
799
+ d3.event.preventDefault();
800
+ }
801
+ d3.interpolate = function(a, b) {
802
+ var i = d3.interpolators.length, f;
803
+ while (--i >= 0 && !(f = d3.interpolators[i](a, b)));
804
+ return f;
805
+ };
806
+
807
+ d3.interpolateNumber = function(a, b) {
808
+ b -= a;
809
+ return function(t) { return a + b * t; };
810
+ };
811
+
812
+ d3.interpolateRound = function(a, b) {
813
+ b -= a;
814
+ return function(t) { return Math.round(a + b * t); };
815
+ };
816
+
817
+ d3.interpolateString = function(a, b) {
818
+ var m, // current match
819
+ i, // current index
820
+ j, // current index (for coallescing)
821
+ s0 = 0, // start index of current string prefix
822
+ s1 = 0, // end index of current string prefix
823
+ s = [], // string constants and placeholders
824
+ q = [], // number interpolators
825
+ n, // q.length
826
+ o;
827
+
828
+ // Reset our regular expression!
829
+ d3_interpolate_number.lastIndex = 0;
830
+
831
+ // Find all numbers in b.
832
+ for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
833
+ if (m.index) s.push(b.substring(s0, s1 = m.index));
834
+ q.push({i: s.length, x: m[0]});
835
+ s.push(null);
836
+ s0 = d3_interpolate_number.lastIndex;
837
+ }
838
+ if (s0 < b.length) s.push(b.substring(s0));
839
+
840
+ // Find all numbers in a.
841
+ for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
842
+ o = q[i];
843
+ if (o.x == m[0]) { // The numbers match, so coallesce.
844
+ if (o.i) {
845
+ if (s[o.i + 1] == null) { // This match is followed by another number.
846
+ s[o.i - 1] += o.x;
847
+ s.splice(o.i, 1);
848
+ for (j = i + 1; j < n; ++j) q[j].i--;
849
+ } else { // This match is followed by a string, so coallesce twice.
850
+ s[o.i - 1] += o.x + s[o.i + 1];
851
+ s.splice(o.i, 2);
852
+ for (j = i + 1; j < n; ++j) q[j].i -= 2;
853
+ }
854
+ } else {
855
+ if (s[o.i + 1] == null) { // This match is followed by another number.
856
+ s[o.i] = o.x;
857
+ } else { // This match is followed by a string, so coallesce twice.
858
+ s[o.i] = o.x + s[o.i + 1];
859
+ s.splice(o.i + 1, 1);
860
+ for (j = i + 1; j < n; ++j) q[j].i--;
861
+ }
862
+ }
863
+ q.splice(i, 1);
864
+ n--;
865
+ i--;
866
+ } else {
867
+ o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
868
+ }
869
+ }
870
+
871
+ // Remove any numbers in b not found in a.
872
+ while (i < n) {
873
+ o = q.pop();
874
+ if (s[o.i + 1] == null) { // This match is followed by another number.
875
+ s[o.i] = o.x;
876
+ } else { // This match is followed by a string, so coallesce twice.
877
+ s[o.i] = o.x + s[o.i + 1];
878
+ s.splice(o.i + 1, 1);
879
+ }
880
+ n--;
881
+ }
882
+
883
+ // Special optimization for only a single match.
884
+ if (s.length === 1) {
885
+ return s[0] == null ? q[0].x : function() { return b; };
886
+ }
887
+
888
+ // Otherwise, interpolate each of the numbers and rejoin the string.
889
+ return function(t) {
890
+ for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
891
+ return s.join("");
892
+ };
893
+ };
894
+
895
+ d3.interpolateTransform = function(a, b) {
896
+ return d3.interpolateString(d3.transform(a) + "", d3.transform(b) + "");
897
+ };
898
+
899
+ d3.interpolateRgb = function(a, b) {
900
+ a = d3.rgb(a);
901
+ b = d3.rgb(b);
902
+ var ar = a.r,
903
+ ag = a.g,
904
+ ab = a.b,
905
+ br = b.r - ar,
906
+ bg = b.g - ag,
907
+ bb = b.b - ab;
908
+ return function(t) {
909
+ return "#"
910
+ + d3_rgb_hex(Math.round(ar + br * t))
911
+ + d3_rgb_hex(Math.round(ag + bg * t))
912
+ + d3_rgb_hex(Math.round(ab + bb * t));
913
+ };
914
+ };
915
+
916
+ // interpolates HSL space, but outputs RGB string (for compatibility)
917
+ d3.interpolateHsl = function(a, b) {
918
+ a = d3.hsl(a);
919
+ b = d3.hsl(b);
920
+ var h0 = a.h,
921
+ s0 = a.s,
922
+ l0 = a.l,
923
+ h1 = b.h - h0,
924
+ s1 = b.s - s0,
925
+ l1 = b.l - l0;
926
+ return function(t) {
927
+ return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString();
928
+ };
929
+ };
930
+
931
+ d3.interpolateArray = function(a, b) {
932
+ var x = [],
933
+ c = [],
934
+ na = a.length,
935
+ nb = b.length,
936
+ n0 = Math.min(a.length, b.length),
937
+ i;
938
+ for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
939
+ for (; i < na; ++i) c[i] = a[i];
940
+ for (; i < nb; ++i) c[i] = b[i];
941
+ return function(t) {
942
+ for (i = 0; i < n0; ++i) c[i] = x[i](t);
943
+ return c;
944
+ };
945
+ };
946
+
947
+ d3.interpolateObject = function(a, b) {
948
+ var i = {},
949
+ c = {},
950
+ k;
951
+ for (k in a) {
952
+ if (k in b) {
953
+ i[k] = d3_interpolateByName(k)(a[k], b[k]);
954
+ } else {
955
+ c[k] = a[k];
956
+ }
957
+ }
958
+ for (k in b) {
959
+ if (!(k in a)) {
960
+ c[k] = b[k];
961
+ }
962
+ }
963
+ return function(t) {
964
+ for (k in i) c[k] = i[k](t);
965
+ return c;
966
+ };
967
+ }
968
+
969
+ var d3_interpolate_number = /[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g;
970
+
971
+ function d3_interpolateByName(n) {
972
+ return n == "transform"
973
+ ? d3.interpolateTransform
974
+ : d3.interpolate;
975
+ }
976
+
977
+ d3.interpolators = [
978
+ d3.interpolateObject,
979
+ function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); },
980
+ function(a, b) { return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); },
981
+ function(a, b) { return (typeof b === "string" ? b in d3_rgb_names || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); },
982
+ function(a, b) { return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); }
983
+ ];
984
+ function d3_uninterpolateNumber(a, b) {
985
+ b = b - (a = +a) ? 1 / (b - a) : 0;
986
+ return function(x) { return (x - a) * b; };
987
+ }
988
+
989
+ function d3_uninterpolateClamp(a, b) {
990
+ b = b - (a = +a) ? 1 / (b - a) : 0;
991
+ return function(x) { return Math.max(0, Math.min(1, (x - a) * b)); };
992
+ }
993
+ d3.rgb = function(r, g, b) {
994
+ return arguments.length === 1
995
+ ? (r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b)
996
+ : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb))
997
+ : d3_rgb(~~r, ~~g, ~~b);
998
+ };
999
+
1000
+ function d3_rgb(r, g, b) {
1001
+ return new d3_Rgb(r, g, b);
1002
+ }
1003
+
1004
+ function d3_Rgb(r, g, b) {
1005
+ this.r = r;
1006
+ this.g = g;
1007
+ this.b = b;
1008
+ }
1009
+
1010
+ d3_Rgb.prototype.brighter = function(k) {
1011
+ k = Math.pow(0.7, arguments.length ? k : 1);
1012
+ var r = this.r,
1013
+ g = this.g,
1014
+ b = this.b,
1015
+ i = 30;
1016
+ if (!r && !g && !b) return d3_rgb(i, i, i);
1017
+ if (r && r < i) r = i;
1018
+ if (g && g < i) g = i;
1019
+ if (b && b < i) b = i;
1020
+ return d3_rgb(
1021
+ Math.min(255, Math.floor(r / k)),
1022
+ Math.min(255, Math.floor(g / k)),
1023
+ Math.min(255, Math.floor(b / k)));
1024
+ };
1025
+
1026
+ d3_Rgb.prototype.darker = function(k) {
1027
+ k = Math.pow(0.7, arguments.length ? k : 1);
1028
+ return d3_rgb(
1029
+ Math.floor(k * this.r),
1030
+ Math.floor(k * this.g),
1031
+ Math.floor(k * this.b));
1032
+ };
1033
+
1034
+ d3_Rgb.prototype.hsl = function() {
1035
+ return d3_rgb_hsl(this.r, this.g, this.b);
1036
+ };
1037
+
1038
+ d3_Rgb.prototype.toString = function() {
1039
+ return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
1040
+ };
1041
+
1042
+ function d3_rgb_hex(v) {
1043
+ return v < 0x10
1044
+ ? "0" + Math.max(0, v).toString(16)
1045
+ : Math.min(255, v).toString(16);
1046
+ }
1047
+
1048
+ function d3_rgb_parse(format, rgb, hsl) {
1049
+ var r = 0, // red channel; int in [0, 255]
1050
+ g = 0, // green channel; int in [0, 255]
1051
+ b = 0, // blue channel; int in [0, 255]
1052
+ m1, // CSS color specification match
1053
+ m2, // CSS color specification type (e.g., rgb)
1054
+ name;
1055
+
1056
+ /* Handle hsl, rgb. */
1057
+ m1 = /([a-z]+)\((.*)\)/i.exec(format);
1058
+ if (m1) {
1059
+ m2 = m1[2].split(",");
1060
+ switch (m1[1]) {
1061
+ case "hsl": {
1062
+ return hsl(
1063
+ parseFloat(m2[0]), // degrees
1064
+ parseFloat(m2[1]) / 100, // percentage
1065
+ parseFloat(m2[2]) / 100 // percentage
1066
+ );
1067
+ }
1068
+ case "rgb": {
1069
+ return rgb(
1070
+ d3_rgb_parseNumber(m2[0]),
1071
+ d3_rgb_parseNumber(m2[1]),
1072
+ d3_rgb_parseNumber(m2[2])
1073
+ );
1074
+ }
1075
+ }
1076
+ }
1077
+
1078
+ /* Named colors. */
1079
+ if (name = d3_rgb_names[format]) return rgb(name.r, name.g, name.b);
1080
+
1081
+ /* Hexadecimal colors: #rgb and #rrggbb. */
1082
+ if (format != null && format.charAt(0) === "#") {
1083
+ if (format.length === 4) {
1084
+ r = format.charAt(1); r += r;
1085
+ g = format.charAt(2); g += g;
1086
+ b = format.charAt(3); b += b;
1087
+ } else if (format.length === 7) {
1088
+ r = format.substring(1, 3);
1089
+ g = format.substring(3, 5);
1090
+ b = format.substring(5, 7);
1091
+ }
1092
+ r = parseInt(r, 16);
1093
+ g = parseInt(g, 16);
1094
+ b = parseInt(b, 16);
1095
+ }
1096
+
1097
+ return rgb(r, g, b);
1098
+ }
1099
+
1100
+ function d3_rgb_hsl(r, g, b) {
1101
+ var min = Math.min(r /= 255, g /= 255, b /= 255),
1102
+ max = Math.max(r, g, b),
1103
+ d = max - min,
1104
+ h,
1105
+ s,
1106
+ l = (max + min) / 2;
1107
+ if (d) {
1108
+ s = l < .5 ? d / (max + min) : d / (2 - max - min);
1109
+ if (r == max) h = (g - b) / d + (g < b ? 6 : 0);
1110
+ else if (g == max) h = (b - r) / d + 2;
1111
+ else h = (r - g) / d + 4;
1112
+ h *= 60;
1113
+ } else {
1114
+ s = h = 0;
1115
+ }
1116
+ return d3_hsl(h, s, l);
1117
+ }
1118
+
1119
+ function d3_rgb_parseNumber(c) { // either integer or percentage
1120
+ var f = parseFloat(c);
1121
+ return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
1122
+ }
1123
+
1124
+ var d3_rgb_names = {
1125
+ aliceblue: "#f0f8ff",
1126
+ antiquewhite: "#faebd7",
1127
+ aqua: "#00ffff",
1128
+ aquamarine: "#7fffd4",
1129
+ azure: "#f0ffff",
1130
+ beige: "#f5f5dc",
1131
+ bisque: "#ffe4c4",
1132
+ black: "#000000",
1133
+ blanchedalmond: "#ffebcd",
1134
+ blue: "#0000ff",
1135
+ blueviolet: "#8a2be2",
1136
+ brown: "#a52a2a",
1137
+ burlywood: "#deb887",
1138
+ cadetblue: "#5f9ea0",
1139
+ chartreuse: "#7fff00",
1140
+ chocolate: "#d2691e",
1141
+ coral: "#ff7f50",
1142
+ cornflowerblue: "#6495ed",
1143
+ cornsilk: "#fff8dc",
1144
+ crimson: "#dc143c",
1145
+ cyan: "#00ffff",
1146
+ darkblue: "#00008b",
1147
+ darkcyan: "#008b8b",
1148
+ darkgoldenrod: "#b8860b",
1149
+ darkgray: "#a9a9a9",
1150
+ darkgreen: "#006400",
1151
+ darkgrey: "#a9a9a9",
1152
+ darkkhaki: "#bdb76b",
1153
+ darkmagenta: "#8b008b",
1154
+ darkolivegreen: "#556b2f",
1155
+ darkorange: "#ff8c00",
1156
+ darkorchid: "#9932cc",
1157
+ darkred: "#8b0000",
1158
+ darksalmon: "#e9967a",
1159
+ darkseagreen: "#8fbc8f",
1160
+ darkslateblue: "#483d8b",
1161
+ darkslategray: "#2f4f4f",
1162
+ darkslategrey: "#2f4f4f",
1163
+ darkturquoise: "#00ced1",
1164
+ darkviolet: "#9400d3",
1165
+ deeppink: "#ff1493",
1166
+ deepskyblue: "#00bfff",
1167
+ dimgray: "#696969",
1168
+ dimgrey: "#696969",
1169
+ dodgerblue: "#1e90ff",
1170
+ firebrick: "#b22222",
1171
+ floralwhite: "#fffaf0",
1172
+ forestgreen: "#228b22",
1173
+ fuchsia: "#ff00ff",
1174
+ gainsboro: "#dcdcdc",
1175
+ ghostwhite: "#f8f8ff",
1176
+ gold: "#ffd700",
1177
+ goldenrod: "#daa520",
1178
+ gray: "#808080",
1179
+ green: "#008000",
1180
+ greenyellow: "#adff2f",
1181
+ grey: "#808080",
1182
+ honeydew: "#f0fff0",
1183
+ hotpink: "#ff69b4",
1184
+ indianred: "#cd5c5c",
1185
+ indigo: "#4b0082",
1186
+ ivory: "#fffff0",
1187
+ khaki: "#f0e68c",
1188
+ lavender: "#e6e6fa",
1189
+ lavenderblush: "#fff0f5",
1190
+ lawngreen: "#7cfc00",
1191
+ lemonchiffon: "#fffacd",
1192
+ lightblue: "#add8e6",
1193
+ lightcoral: "#f08080",
1194
+ lightcyan: "#e0ffff",
1195
+ lightgoldenrodyellow: "#fafad2",
1196
+ lightgray: "#d3d3d3",
1197
+ lightgreen: "#90ee90",
1198
+ lightgrey: "#d3d3d3",
1199
+ lightpink: "#ffb6c1",
1200
+ lightsalmon: "#ffa07a",
1201
+ lightseagreen: "#20b2aa",
1202
+ lightskyblue: "#87cefa",
1203
+ lightslategray: "#778899",
1204
+ lightslategrey: "#778899",
1205
+ lightsteelblue: "#b0c4de",
1206
+ lightyellow: "#ffffe0",
1207
+ lime: "#00ff00",
1208
+ limegreen: "#32cd32",
1209
+ linen: "#faf0e6",
1210
+ magenta: "#ff00ff",
1211
+ maroon: "#800000",
1212
+ mediumaquamarine: "#66cdaa",
1213
+ mediumblue: "#0000cd",
1214
+ mediumorchid: "#ba55d3",
1215
+ mediumpurple: "#9370db",
1216
+ mediumseagreen: "#3cb371",
1217
+ mediumslateblue: "#7b68ee",
1218
+ mediumspringgreen: "#00fa9a",
1219
+ mediumturquoise: "#48d1cc",
1220
+ mediumvioletred: "#c71585",
1221
+ midnightblue: "#191970",
1222
+ mintcream: "#f5fffa",
1223
+ mistyrose: "#ffe4e1",
1224
+ moccasin: "#ffe4b5",
1225
+ navajowhite: "#ffdead",
1226
+ navy: "#000080",
1227
+ oldlace: "#fdf5e6",
1228
+ olive: "#808000",
1229
+ olivedrab: "#6b8e23",
1230
+ orange: "#ffa500",
1231
+ orangered: "#ff4500",
1232
+ orchid: "#da70d6",
1233
+ palegoldenrod: "#eee8aa",
1234
+ palegreen: "#98fb98",
1235
+ paleturquoise: "#afeeee",
1236
+ palevioletred: "#db7093",
1237
+ papayawhip: "#ffefd5",
1238
+ peachpuff: "#ffdab9",
1239
+ peru: "#cd853f",
1240
+ pink: "#ffc0cb",
1241
+ plum: "#dda0dd",
1242
+ powderblue: "#b0e0e6",
1243
+ purple: "#800080",
1244
+ red: "#ff0000",
1245
+ rosybrown: "#bc8f8f",
1246
+ royalblue: "#4169e1",
1247
+ saddlebrown: "#8b4513",
1248
+ salmon: "#fa8072",
1249
+ sandybrown: "#f4a460",
1250
+ seagreen: "#2e8b57",
1251
+ seashell: "#fff5ee",
1252
+ sienna: "#a0522d",
1253
+ silver: "#c0c0c0",
1254
+ skyblue: "#87ceeb",
1255
+ slateblue: "#6a5acd",
1256
+ slategray: "#708090",
1257
+ slategrey: "#708090",
1258
+ snow: "#fffafa",
1259
+ springgreen: "#00ff7f",
1260
+ steelblue: "#4682b4",
1261
+ tan: "#d2b48c",
1262
+ teal: "#008080",
1263
+ thistle: "#d8bfd8",
1264
+ tomato: "#ff6347",
1265
+ turquoise: "#40e0d0",
1266
+ violet: "#ee82ee",
1267
+ wheat: "#f5deb3",
1268
+ white: "#ffffff",
1269
+ whitesmoke: "#f5f5f5",
1270
+ yellow: "#ffff00",
1271
+ yellowgreen: "#9acd32"
1272
+ };
1273
+
1274
+ for (var d3_rgb_name in d3_rgb_names) {
1275
+ d3_rgb_names[d3_rgb_name] = d3_rgb_parse(
1276
+ d3_rgb_names[d3_rgb_name],
1277
+ d3_rgb,
1278
+ d3_hsl_rgb);
1279
+ }
1280
+ d3.hsl = function(h, s, l) {
1281
+ return arguments.length === 1
1282
+ ? (h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l)
1283
+ : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl))
1284
+ : d3_hsl(+h, +s, +l);
1285
+ };
1286
+
1287
+ function d3_hsl(h, s, l) {
1288
+ return new d3_Hsl(h, s, l);
1289
+ }
1290
+
1291
+ function d3_Hsl(h, s, l) {
1292
+ this.h = h;
1293
+ this.s = s;
1294
+ this.l = l;
1295
+ }
1296
+
1297
+ d3_Hsl.prototype.brighter = function(k) {
1298
+ k = Math.pow(0.7, arguments.length ? k : 1);
1299
+ return d3_hsl(this.h, this.s, this.l / k);
1300
+ };
1301
+
1302
+ d3_Hsl.prototype.darker = function(k) {
1303
+ k = Math.pow(0.7, arguments.length ? k : 1);
1304
+ return d3_hsl(this.h, this.s, k * this.l);
1305
+ };
1306
+
1307
+ d3_Hsl.prototype.rgb = function() {
1308
+ return d3_hsl_rgb(this.h, this.s, this.l);
1309
+ };
1310
+
1311
+ d3_Hsl.prototype.toString = function() {
1312
+ return this.rgb().toString();
1313
+ };
1314
+
1315
+ function d3_hsl_rgb(h, s, l) {
1316
+ var m1,
1317
+ m2;
1318
+
1319
+ /* Some simple corrections for h, s and l. */
1320
+ h = h % 360; if (h < 0) h += 360;
1321
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
1322
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
1323
+
1324
+ /* From FvD 13.37, CSS Color Module Level 3 */
1325
+ m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
1326
+ m1 = 2 * l - m2;
1327
+
1328
+ function v(h) {
1329
+ if (h > 360) h -= 360;
1330
+ else if (h < 0) h += 360;
1331
+ if (h < 60) return m1 + (m2 - m1) * h / 60;
1332
+ if (h < 180) return m2;
1333
+ if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
1334
+ return m1;
1335
+ }
1336
+
1337
+ function vv(h) {
1338
+ return Math.round(v(h) * 255);
1339
+ }
1340
+
1341
+ return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
1342
+ }
1343
+ function d3_selection(groups) {
1344
+ d3_arraySubclass(groups, d3_selectionPrototype);
1345
+ return groups;
1346
+ }
1347
+
1348
+ var d3_select = function(s, n) { return n.querySelector(s); },
1349
+ d3_selectAll = function(s, n) { return n.querySelectorAll(s); },
1350
+ d3_selectRoot = document.documentElement,
1351
+ d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector,
1352
+ d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); };
1353
+
1354
+ // Prefer Sizzle, if available.
1355
+ if (typeof Sizzle === "function") {
1356
+ d3_select = function(s, n) { return Sizzle(s, n)[0]; };
1357
+ d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); };
1358
+ d3_selectMatches = Sizzle.matchesSelector;
1359
+ }
1360
+
1361
+ var d3_selectionPrototype = [];
1362
+
1363
+ d3.selection = function() {
1364
+ return d3_selectionRoot;
1365
+ };
1366
+
1367
+ d3.selection.prototype = d3_selectionPrototype;
1368
+ d3_selectionPrototype.select = function(selector) {
1369
+ var subgroups = [],
1370
+ subgroup,
1371
+ subnode,
1372
+ group,
1373
+ node;
1374
+
1375
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
1376
+
1377
+ for (var j = -1, m = this.length; ++j < m;) {
1378
+ subgroups.push(subgroup = []);
1379
+ subgroup.parentNode = (group = this[j]).parentNode;
1380
+ for (var i = -1, n = group.length; ++i < n;) {
1381
+ if (node = group[i]) {
1382
+ subgroup.push(subnode = selector.call(node, node.__data__, i));
1383
+ if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
1384
+ } else {
1385
+ subgroup.push(null);
1386
+ }
1387
+ }
1388
+ }
1389
+
1390
+ return d3_selection(subgroups);
1391
+ };
1392
+
1393
+ function d3_selection_selector(selector) {
1394
+ return function() {
1395
+ return d3_select(selector, this);
1396
+ };
1397
+ }
1398
+ d3_selectionPrototype.selectAll = function(selector) {
1399
+ var subgroups = [],
1400
+ subgroup,
1401
+ node;
1402
+
1403
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
1404
+
1405
+ for (var j = -1, m = this.length; ++j < m;) {
1406
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
1407
+ if (node = group[i]) {
1408
+ subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
1409
+ subgroup.parentNode = node;
1410
+ }
1411
+ }
1412
+ }
1413
+
1414
+ return d3_selection(subgroups);
1415
+ };
1416
+
1417
+ function d3_selection_selectorAll(selector) {
1418
+ return function() {
1419
+ return d3_selectAll(selector, this);
1420
+ };
1421
+ }
1422
+ d3_selectionPrototype.attr = function(name, value) {
1423
+ name = d3.ns.qualify(name);
1424
+
1425
+ // If no value is specified, return the first value.
1426
+ if (arguments.length < 2) {
1427
+ var node = this.node();
1428
+ return name.local
1429
+ ? node.getAttributeNS(name.space, name.local)
1430
+ : node.getAttribute(name);
1431
+ }
1432
+
1433
+ function attrNull() {
1434
+ this.removeAttribute(name);
1435
+ }
1436
+
1437
+ function attrNullNS() {
1438
+ this.removeAttributeNS(name.space, name.local);
1439
+ }
1440
+
1441
+ function attrConstant() {
1442
+ this.setAttribute(name, value);
1443
+ }
1444
+
1445
+ function attrConstantNS() {
1446
+ this.setAttributeNS(name.space, name.local, value);
1447
+ }
1448
+
1449
+ function attrFunction() {
1450
+ var x = value.apply(this, arguments);
1451
+ if (x == null) this.removeAttribute(name);
1452
+ else this.setAttribute(name, x);
1453
+ }
1454
+
1455
+ function attrFunctionNS() {
1456
+ var x = value.apply(this, arguments);
1457
+ if (x == null) this.removeAttributeNS(name.space, name.local);
1458
+ else this.setAttributeNS(name.space, name.local, x);
1459
+ }
1460
+
1461
+ return this.each(value == null
1462
+ ? (name.local ? attrNullNS : attrNull) : (typeof value === "function"
1463
+ ? (name.local ? attrFunctionNS : attrFunction)
1464
+ : (name.local ? attrConstantNS : attrConstant)));
1465
+ };
1466
+ d3_selectionPrototype.classed = function(name, value) {
1467
+ var names = name.split(d3_selection_classedWhitespace),
1468
+ n = names.length,
1469
+ i = -1;
1470
+ if (arguments.length > 1) {
1471
+ while (++i < n) d3_selection_classed.call(this, names[i], value);
1472
+ return this;
1473
+ } else {
1474
+ while (++i < n) if (!d3_selection_classed.call(this, names[i])) return false;
1475
+ return true;
1476
+ }
1477
+ };
1478
+
1479
+ var d3_selection_classedWhitespace = /\s+/g;
1480
+
1481
+ function d3_selection_classed(name, value) {
1482
+ var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g");
1483
+
1484
+ // If no value is specified, return the first value.
1485
+ if (arguments.length < 2) {
1486
+ var node = this.node();
1487
+ if (c = node.classList) return c.contains(name);
1488
+ var c = node.className;
1489
+ re.lastIndex = 0;
1490
+ return re.test(c.baseVal != null ? c.baseVal : c);
1491
+ }
1492
+
1493
+ function classedAdd() {
1494
+ if (c = this.classList) return c.add(name);
1495
+ var c = this.className,
1496
+ cb = c.baseVal != null,
1497
+ cv = cb ? c.baseVal : c;
1498
+ re.lastIndex = 0;
1499
+ if (!re.test(cv)) {
1500
+ cv = d3_collapse(cv + " " + name);
1501
+ if (cb) c.baseVal = cv;
1502
+ else this.className = cv;
1503
+ }
1504
+ }
1505
+
1506
+ function classedRemove() {
1507
+ if (c = this.classList) return c.remove(name);
1508
+ var c = this.className,
1509
+ cb = c.baseVal != null,
1510
+ cv = cb ? c.baseVal : c;
1511
+ cv = d3_collapse(cv.replace(re, " "));
1512
+ if (cb) c.baseVal = cv;
1513
+ else this.className = cv;
1514
+ }
1515
+
1516
+ function classedFunction() {
1517
+ (value.apply(this, arguments)
1518
+ ? classedAdd
1519
+ : classedRemove).call(this);
1520
+ }
1521
+
1522
+ return this.each(typeof value === "function"
1523
+ ? classedFunction : value
1524
+ ? classedAdd
1525
+ : classedRemove);
1526
+ }
1527
+ d3_selectionPrototype.style = function(name, value, priority) {
1528
+ if (arguments.length < 3) priority = "";
1529
+
1530
+ // If no value is specified, return the first value.
1531
+ if (arguments.length < 2) return window
1532
+ .getComputedStyle(this.node(), null)
1533
+ .getPropertyValue(name);
1534
+
1535
+ function styleNull() {
1536
+ this.style.removeProperty(name);
1537
+ }
1538
+
1539
+ function styleConstant() {
1540
+ this.style.setProperty(name, value, priority);
1541
+ }
1542
+
1543
+ function styleFunction() {
1544
+ var x = value.apply(this, arguments);
1545
+ if (x == null) this.style.removeProperty(name);
1546
+ else this.style.setProperty(name, x, priority);
1547
+ }
1548
+
1549
+ return this.each(value == null
1550
+ ? styleNull : (typeof value === "function"
1551
+ ? styleFunction : styleConstant));
1552
+ };
1553
+ d3_selectionPrototype.property = function(name, value) {
1554
+
1555
+ // If no value is specified, return the first value.
1556
+ if (arguments.length < 2) return this.node()[name];
1557
+
1558
+ function propertyNull() {
1559
+ delete this[name];
1560
+ }
1561
+
1562
+ function propertyConstant() {
1563
+ this[name] = value;
1564
+ }
1565
+
1566
+ function propertyFunction() {
1567
+ var x = value.apply(this, arguments);
1568
+ if (x == null) delete this[name];
1569
+ else this[name] = x;
1570
+ }
1571
+
1572
+ return this.each(value == null
1573
+ ? propertyNull : (typeof value === "function"
1574
+ ? propertyFunction : propertyConstant));
1575
+ };
1576
+ d3_selectionPrototype.text = function(value) {
1577
+ return arguments.length < 1 ? this.node().textContent
1578
+ : (this.each(typeof value === "function"
1579
+ ? function() { this.textContent = value.apply(this, arguments); }
1580
+ : function() { this.textContent = value; }));
1581
+ };
1582
+ d3_selectionPrototype.html = function(value) {
1583
+ return arguments.length < 1 ? this.node().innerHTML
1584
+ : (this.each(typeof value === "function"
1585
+ ? function() { this.innerHTML = value.apply(this, arguments); }
1586
+ : function() { this.innerHTML = value; }));
1587
+ };
1588
+ // TODO append(node)?
1589
+ // TODO append(function)?
1590
+ d3_selectionPrototype.append = function(name) {
1591
+ name = d3.ns.qualify(name);
1592
+
1593
+ function append() {
1594
+ return this.appendChild(document.createElementNS(this.namespaceURI, name));
1595
+ }
1596
+
1597
+ function appendNS() {
1598
+ return this.appendChild(document.createElementNS(name.space, name.local));
1599
+ }
1600
+
1601
+ return this.select(name.local ? appendNS : append);
1602
+ };
1603
+ // TODO insert(node, function)?
1604
+ // TODO insert(function, string)?
1605
+ // TODO insert(function, function)?
1606
+ d3_selectionPrototype.insert = function(name, before) {
1607
+ name = d3.ns.qualify(name);
1608
+
1609
+ function insert() {
1610
+ return this.insertBefore(
1611
+ document.createElementNS(this.namespaceURI, name),
1612
+ d3_select(before, this));
1613
+ }
1614
+
1615
+ function insertNS() {
1616
+ return this.insertBefore(
1617
+ document.createElementNS(name.space, name.local),
1618
+ d3_select(before, this));
1619
+ }
1620
+
1621
+ return this.select(name.local ? insertNS : insert);
1622
+ };
1623
+ // TODO remove(selector)?
1624
+ // TODO remove(node)?
1625
+ // TODO remove(function)?
1626
+ d3_selectionPrototype.remove = function() {
1627
+ return this.each(function() {
1628
+ var parent = this.parentNode;
1629
+ if (parent) parent.removeChild(this);
1630
+ });
1631
+ };
1632
+ // TODO data(null) for clearing data?
1633
+ d3_selectionPrototype.data = function(data, join) {
1634
+ var enter = [],
1635
+ update = [],
1636
+ exit = [];
1637
+
1638
+ function bind(group, groupData) {
1639
+ var i,
1640
+ n = group.length,
1641
+ m = groupData.length,
1642
+ n0 = Math.min(n, m),
1643
+ n1 = Math.max(n, m),
1644
+ updateNodes = [],
1645
+ enterNodes = [],
1646
+ exitNodes = [],
1647
+ node,
1648
+ nodeData;
1649
+
1650
+ if (join) {
1651
+ var nodeByKey = {},
1652
+ keys = [],
1653
+ key,
1654
+ j = groupData.length;
1655
+
1656
+ for (i = -1; ++i < n;) {
1657
+ key = join.call(node = group[i], node.__data__, i);
1658
+ if (key in nodeByKey) {
1659
+ exitNodes[j++] = node; // duplicate key
1660
+ } else {
1661
+ nodeByKey[key] = node;
1662
+ }
1663
+ keys.push(key);
1664
+ }
1665
+
1666
+ for (i = -1; ++i < m;) {
1667
+ node = nodeByKey[key = join.call(groupData, nodeData = groupData[i], i)];
1668
+ if (node) {
1669
+ node.__data__ = nodeData;
1670
+ updateNodes[i] = node;
1671
+ enterNodes[i] = exitNodes[i] = null;
1672
+ } else {
1673
+ enterNodes[i] = d3_selection_dataNode(nodeData);
1674
+ updateNodes[i] = exitNodes[i] = null;
1675
+ }
1676
+ delete nodeByKey[key];
1677
+ }
1678
+
1679
+ for (i = -1; ++i < n;) {
1680
+ if (keys[i] in nodeByKey) {
1681
+ exitNodes[i] = group[i];
1682
+ }
1683
+ }
1684
+ } else {
1685
+ for (i = -1; ++i < n0;) {
1686
+ node = group[i];
1687
+ nodeData = groupData[i];
1688
+ if (node) {
1689
+ node.__data__ = nodeData;
1690
+ updateNodes[i] = node;
1691
+ enterNodes[i] = exitNodes[i] = null;
1692
+ } else {
1693
+ enterNodes[i] = d3_selection_dataNode(nodeData);
1694
+ updateNodes[i] = exitNodes[i] = null;
1695
+ }
1696
+ }
1697
+ for (; i < m; ++i) {
1698
+ enterNodes[i] = d3_selection_dataNode(groupData[i]);
1699
+ updateNodes[i] = exitNodes[i] = null;
1700
+ }
1701
+ for (; i < n1; ++i) {
1702
+ exitNodes[i] = group[i];
1703
+ enterNodes[i] = updateNodes[i] = null;
1704
+ }
1705
+ }
1706
+
1707
+ enterNodes.update
1708
+ = updateNodes;
1709
+
1710
+ enterNodes.parentNode
1711
+ = updateNodes.parentNode
1712
+ = exitNodes.parentNode
1713
+ = group.parentNode;
1714
+
1715
+ enter.push(enterNodes);
1716
+ update.push(updateNodes);
1717
+ exit.push(exitNodes);
1718
+ }
1719
+
1720
+ var i = -1,
1721
+ n = this.length,
1722
+ group;
1723
+ if (typeof data === "function") {
1724
+ while (++i < n) {
1725
+ bind(group = this[i], data.call(group, group.parentNode.__data__, i));
1726
+ }
1727
+ } else {
1728
+ while (++i < n) {
1729
+ bind(group = this[i], data);
1730
+ }
1731
+ }
1732
+
1733
+ var selection = d3_selection(update);
1734
+ selection.enter = function() { return d3_selection_enter(enter); };
1735
+ selection.exit = function() { return d3_selection(exit); };
1736
+ return selection;
1737
+ };
1738
+
1739
+ function d3_selection_dataNode(data) {
1740
+ return {__data__: data};
1741
+ }
1742
+ d3_selectionPrototype.filter = function(filter) {
1743
+ var subgroups = [],
1744
+ subgroup,
1745
+ group,
1746
+ node;
1747
+
1748
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
1749
+
1750
+ for (var j = 0, m = this.length; j < m; j++) {
1751
+ subgroups.push(subgroup = []);
1752
+ subgroup.parentNode = (group = this[j]).parentNode;
1753
+ for (var i = 0, n = group.length; i < n; i++) {
1754
+ if ((node = group[i]) && filter.call(node, node.__data__, i)) {
1755
+ subgroup.push(node);
1756
+ }
1757
+ }
1758
+ }
1759
+
1760
+ return d3_selection(subgroups);
1761
+ };
1762
+
1763
+ function d3_selection_filter(selector) {
1764
+ return function() {
1765
+ return d3_selectMatches(this, selector);
1766
+ };
1767
+ }
1768
+ d3_selectionPrototype.map = function(map) {
1769
+ return this.each(function() {
1770
+ this.__data__ = map.apply(this, arguments);
1771
+ });
1772
+ };
1773
+ d3_selectionPrototype.order = function() {
1774
+ for (var j = -1, m = this.length; ++j < m;) {
1775
+ for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
1776
+ if (node = group[i]) {
1777
+ if (next) next.parentNode.insertBefore(node, next);
1778
+ next = node;
1779
+ }
1780
+ }
1781
+ }
1782
+ return this;
1783
+ };
1784
+ d3_selectionPrototype.sort = function(comparator) {
1785
+ comparator = d3_selection_sortComparator.apply(this, arguments);
1786
+ for (var j = -1, m = this.length; ++j < m;) this[j].sort(comparator);
1787
+ return this.order();
1788
+ };
1789
+
1790
+ function d3_selection_sortComparator(comparator) {
1791
+ if (!arguments.length) comparator = d3.ascending;
1792
+ return function(a, b) {
1793
+ return comparator(a && a.__data__, b && b.__data__);
1794
+ };
1795
+ }
1796
+ // type can be namespaced, e.g., "click.foo"
1797
+ // listener can be null for removal
1798
+ d3_selectionPrototype.on = function(type, listener, capture) {
1799
+ if (arguments.length < 3) capture = false;
1800
+
1801
+ // parse the type specifier
1802
+ var name = "__on" + type, i = type.indexOf(".");
1803
+ if (i > 0) type = type.substring(0, i);
1804
+
1805
+ // if called with only one argument, return the current listener
1806
+ if (arguments.length < 2) return (i = this.node()[name]) && i._;
1807
+
1808
+ // remove the old event listener, and add the new event listener
1809
+ return this.each(function(d, i) {
1810
+ var node = this;
1811
+
1812
+ if (node[name]) node.removeEventListener(type, node[name], capture);
1813
+ if (listener) node.addEventListener(type, node[name] = l, capture);
1814
+
1815
+ // wrapped event listener that preserves i
1816
+ function l(e) {
1817
+ var o = d3.event; // Events can be reentrant (e.g., focus).
1818
+ d3.event = e;
1819
+ try {
1820
+ listener.call(node, node.__data__, i);
1821
+ } finally {
1822
+ d3.event = o;
1823
+ }
1824
+ }
1825
+
1826
+ // stash the unwrapped listener for retrieval
1827
+ l._ = listener;
1828
+ });
1829
+ };
1830
+ d3_selectionPrototype.each = function(callback) {
1831
+ for (var j = -1, m = this.length; ++j < m;) {
1832
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
1833
+ var node = group[i];
1834
+ if (node) callback.call(node, node.__data__, i, j);
1835
+ }
1836
+ }
1837
+ return this;
1838
+ };
1839
+ //
1840
+ // Note: assigning to the arguments array simultaneously changes the value of
1841
+ // the corresponding argument!
1842
+ //
1843
+ // TODO The `this` argument probably shouldn't be the first argument to the
1844
+ // callback, anyway, since it's redundant. However, that will require a major
1845
+ // version bump due to backwards compatibility, so I'm not changing it right
1846
+ // away.
1847
+ //
1848
+ d3_selectionPrototype.call = function(callback) {
1849
+ callback.apply(this, (arguments[0] = this, arguments));
1850
+ return this;
1851
+ };
1852
+ d3_selectionPrototype.empty = function() {
1853
+ return !this.node();
1854
+ };
1855
+ d3_selectionPrototype.node = function(callback) {
1856
+ for (var j = 0, m = this.length; j < m; j++) {
1857
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
1858
+ var node = group[i];
1859
+ if (node) return node;
1860
+ }
1861
+ }
1862
+ return null;
1863
+ };
1864
+ d3_selectionPrototype.transition = function() {
1865
+ var subgroups = [],
1866
+ subgroup,
1867
+ node;
1868
+
1869
+ for (var j = -1, m = this.length; ++j < m;) {
1870
+ subgroups.push(subgroup = []);
1871
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
1872
+ subgroup.push((node = group[i]) ? {node: node, delay: 0, duration: 250} : null);
1873
+ }
1874
+ }
1875
+
1876
+ return d3_transition(subgroups, d3_transitionInheritId || ++d3_transitionId, Date.now());
1877
+ };
1878
+ var d3_selectionRoot = d3_selection([[document]]);
1879
+
1880
+ d3_selectionRoot[0].parentNode = d3_selectRoot;
1881
+
1882
+ // TODO fast singleton implementation!
1883
+ // TODO select(function)
1884
+ d3.select = function(selector) {
1885
+ return typeof selector === "string"
1886
+ ? d3_selectionRoot.select(selector)
1887
+ : d3_selection([[selector]]); // assume node
1888
+ };
1889
+
1890
+ // TODO selectAll(function)
1891
+ d3.selectAll = function(selector) {
1892
+ return typeof selector === "string"
1893
+ ? d3_selectionRoot.selectAll(selector)
1894
+ : d3_selection([d3_array(selector)]); // assume node[]
1895
+ };
1896
+ function d3_selection_enter(selection) {
1897
+ d3_arraySubclass(selection, d3_selection_enterPrototype);
1898
+ return selection;
1899
+ }
1900
+
1901
+ var d3_selection_enterPrototype = [];
1902
+
1903
+ d3_selection_enterPrototype.append = d3_selectionPrototype.append;
1904
+ d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
1905
+ d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
1906
+ d3_selection_enterPrototype.node = d3_selectionPrototype.node;
1907
+ d3_selection_enterPrototype.select = function(selector) {
1908
+ var subgroups = [],
1909
+ subgroup,
1910
+ subnode,
1911
+ upgroup,
1912
+ group,
1913
+ node;
1914
+
1915
+ for (var j = -1, m = this.length; ++j < m;) {
1916
+ upgroup = (group = this[j]).update;
1917
+ subgroups.push(subgroup = []);
1918
+ subgroup.parentNode = group.parentNode;
1919
+ for (var i = -1, n = group.length; ++i < n;) {
1920
+ if (node = group[i]) {
1921
+ subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
1922
+ subnode.__data__ = node.__data__;
1923
+ } else {
1924
+ subgroup.push(null);
1925
+ }
1926
+ }
1927
+ }
1928
+
1929
+ return d3_selection(subgroups);
1930
+ };
1931
+ function d3_transition(groups, id, time) {
1932
+ d3_arraySubclass(groups, d3_transitionPrototype);
1933
+
1934
+ var tweens = {},
1935
+ event = d3.dispatch("start", "end"),
1936
+ ease = d3_transitionEase;
1937
+
1938
+ groups.id = id;
1939
+
1940
+ groups.time = time;
1941
+
1942
+ groups.tween = function(name, tween) {
1943
+ if (arguments.length < 2) return tweens[name];
1944
+ if (tween == null) delete tweens[name];
1945
+ else tweens[name] = tween;
1946
+ return groups;
1947
+ };
1948
+
1949
+ groups.ease = function(value) {
1950
+ if (!arguments.length) return ease;
1951
+ ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments);
1952
+ return groups;
1953
+ };
1954
+
1955
+ groups.each = function(type, listener) {
1956
+ if (arguments.length < 2) return d3_transition_each.call(groups, type);
1957
+ event.on(type, listener);
1958
+ return groups;
1959
+ };
1960
+
1961
+ d3.timer(function(elapsed) {
1962
+ groups.each(function(d, i, j) {
1963
+ var tweened = [],
1964
+ node = this,
1965
+ delay = groups[j][i].delay,
1966
+ duration = groups[j][i].duration,
1967
+ lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0});
1968
+
1969
+ ++lock.count;
1970
+
1971
+ delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time);
1972
+
1973
+ function start(elapsed) {
1974
+ if (lock.active > id) return stop();
1975
+ lock.active = id;
1976
+
1977
+ for (var tween in tweens) {
1978
+ if (tween = tweens[tween].call(node, d, i)) {
1979
+ tweened.push(tween);
1980
+ }
1981
+ }
1982
+
1983
+ event.start.call(node, d, i);
1984
+ if (!tick(elapsed)) d3.timer(tick, 0, time);
1985
+ return 1;
1986
+ }
1987
+
1988
+ function tick(elapsed) {
1989
+ if (lock.active !== id) return stop();
1990
+
1991
+ var t = (elapsed - delay) / duration,
1992
+ e = ease(t),
1993
+ n = tweened.length;
1994
+
1995
+ while (n > 0) {
1996
+ tweened[--n].call(node, e);
1997
+ }
1998
+
1999
+ if (t >= 1) {
2000
+ stop();
2001
+ d3_transitionInheritId = id;
2002
+ event.end.call(node, d, i);
2003
+ d3_transitionInheritId = 0;
2004
+ return 1;
2005
+ }
2006
+ }
2007
+
2008
+ function stop() {
2009
+ if (!--lock.count) delete node.__transition__;
2010
+ return 1;
2011
+ }
2012
+ });
2013
+ return 1;
2014
+ }, 0, time);
2015
+
2016
+ return groups;
2017
+ }
2018
+
2019
+ var d3_transitionRemove = {};
2020
+
2021
+ function d3_transitionNull(d, i, a) {
2022
+ return a != "" && d3_transitionRemove;
2023
+ }
2024
+
2025
+ function d3_transitionTween(name, b) {
2026
+ var interpolate = d3_interpolateByName(name);
2027
+
2028
+ function transitionFunction(d, i, a) {
2029
+ var v = b.call(this, d, i);
2030
+ return v == null
2031
+ ? a != "" && d3_transitionRemove
2032
+ : a != v && interpolate(a, v);
2033
+ }
2034
+
2035
+ function transitionString(d, i, a) {
2036
+ return a != b && interpolate(a, b);
2037
+ }
2038
+
2039
+ return typeof b === "function" ? transitionFunction
2040
+ : b == null ? d3_transitionNull
2041
+ : (b += "", transitionString);
2042
+ }
2043
+
2044
+ var d3_transitionPrototype = [],
2045
+ d3_transitionId = 0,
2046
+ d3_transitionInheritId = 0,
2047
+ d3_transitionEase = d3.ease("cubic-in-out");
2048
+
2049
+ d3_transitionPrototype.call = d3_selectionPrototype.call;
2050
+
2051
+ d3.transition = function() {
2052
+ return d3_selectionRoot.transition();
2053
+ };
2054
+
2055
+ d3.transition.prototype = d3_transitionPrototype;
2056
+ d3_transitionPrototype.select = function(selector) {
2057
+ var subgroups = [],
2058
+ subgroup,
2059
+ subnode,
2060
+ node;
2061
+
2062
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
2063
+
2064
+ for (var j = -1, m = this.length; ++j < m;) {
2065
+ subgroups.push(subgroup = []);
2066
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
2067
+ if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) {
2068
+ if ("__data__" in node.node) subnode.__data__ = node.node.__data__;
2069
+ subgroup.push({node: subnode, delay: node.delay, duration: node.duration});
2070
+ } else {
2071
+ subgroup.push(null);
2072
+ }
2073
+ }
2074
+ }
2075
+
2076
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
2077
+ };
2078
+ d3_transitionPrototype.selectAll = function(selector) {
2079
+ var subgroups = [],
2080
+ subgroup,
2081
+ subnodes,
2082
+ node;
2083
+
2084
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
2085
+
2086
+ for (var j = -1, m = this.length; ++j < m;) {
2087
+ for (var group = this[j], i = -1, n = group.length; ++i < n;) {
2088
+ if (node = group[i]) {
2089
+ subnodes = selector.call(node.node, node.node.__data__, i);
2090
+ subgroups.push(subgroup = []);
2091
+ for (var k = -1, o = subnodes.length; ++k < o;) {
2092
+ subgroup.push({node: subnodes[k], delay: node.delay, duration: node.duration});
2093
+ }
2094
+ }
2095
+ }
2096
+ }
2097
+
2098
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
2099
+ };
2100
+ d3_transitionPrototype.attr = function(name, value) {
2101
+ return this.attrTween(name, d3_transitionTween(name, value));
2102
+ };
2103
+
2104
+ d3_transitionPrototype.attrTween = function(nameNS, tween) {
2105
+ var name = d3.ns.qualify(nameNS);
2106
+
2107
+ function attrTween(d, i) {
2108
+ var f = tween.call(this, d, i, this.getAttribute(name));
2109
+ return f === d3_transitionRemove
2110
+ ? (this.removeAttribute(name), null)
2111
+ : f && function(t) { this.setAttribute(name, f(t)); };
2112
+ }
2113
+
2114
+ function attrTweenNS(d, i) {
2115
+ var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
2116
+ return f === d3_transitionRemove
2117
+ ? (this.removeAttributeNS(name.space, name.local), null)
2118
+ : f && function(t) { this.setAttributeNS(name.space, name.local, f(t)); };
2119
+ }
2120
+
2121
+ return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
2122
+ };
2123
+ d3_transitionPrototype.style = function(name, value, priority) {
2124
+ if (arguments.length < 3) priority = "";
2125
+ return this.styleTween(name, d3_transitionTween(name, value), priority);
2126
+ };
2127
+
2128
+ d3_transitionPrototype.styleTween = function(name, tween, priority) {
2129
+ if (arguments.length < 3) priority = "";
2130
+ return this.tween("style." + name, function(d, i) {
2131
+ var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));
2132
+ return f === d3_transitionRemove
2133
+ ? (this.style.removeProperty(name), null)
2134
+ : f && function(t) { this.style.setProperty(name, f(t), priority); };
2135
+ });
2136
+ };
2137
+ d3_transitionPrototype.text = function(value) {
2138
+ return this.tween("text", function(d, i) {
2139
+ this.textContent = typeof value === "function"
2140
+ ? value.call(this, d, i)
2141
+ : value;
2142
+ });
2143
+ };
2144
+ d3_transitionPrototype.remove = function() {
2145
+ return this.each("end", function() {
2146
+ var p;
2147
+ if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
2148
+ });
2149
+ };
2150
+ d3_transitionPrototype.delay = function(value) {
2151
+ var groups = this;
2152
+ return groups.each(typeof value === "function"
2153
+ ? function(d, i, j) { groups[j][i].delay = +value.apply(this, arguments); }
2154
+ : (value = +value, function(d, i, j) { groups[j][i].delay = value; }));
2155
+ };
2156
+ d3_transitionPrototype.duration = function(value) {
2157
+ var groups = this;
2158
+ return groups.each(typeof value === "function"
2159
+ ? function(d, i, j) { groups[j][i].duration = +value.apply(this, arguments); }
2160
+ : (value = +value, function(d, i, j) { groups[j][i].duration = value; }));
2161
+ };
2162
+ function d3_transition_each(callback) {
2163
+ for (var j = 0, m = this.length; j < m; j++) {
2164
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
2165
+ var node = group[i];
2166
+ if (node) callback.call(node = node.node, node.__data__, i, j);
2167
+ }
2168
+ }
2169
+ return this;
2170
+ }
2171
+ d3_transitionPrototype.transition = function() {
2172
+ return this.select(d3_this);
2173
+ };
2174
+ var d3_timer_queue = null,
2175
+ d3_timer_interval, // is an interval (or frame) active?
2176
+ d3_timer_timeout; // is a timeout active?
2177
+
2178
+ // The timer will continue to fire until callback returns true.
2179
+ d3.timer = function(callback, delay, then) {
2180
+ var found = false,
2181
+ t0,
2182
+ t1 = d3_timer_queue;
2183
+
2184
+ if (arguments.length < 3) {
2185
+ if (arguments.length < 2) delay = 0;
2186
+ else if (!isFinite(delay)) return;
2187
+ then = Date.now();
2188
+ }
2189
+
2190
+ // See if the callback's already in the queue.
2191
+ while (t1) {
2192
+ if (t1.callback === callback) {
2193
+ t1.then = then;
2194
+ t1.delay = delay;
2195
+ found = true;
2196
+ break;
2197
+ }
2198
+ t0 = t1;
2199
+ t1 = t1.next;
2200
+ }
2201
+
2202
+ // Otherwise, add the callback to the queue.
2203
+ if (!found) d3_timer_queue = {
2204
+ callback: callback,
2205
+ then: then,
2206
+ delay: delay,
2207
+ next: d3_timer_queue
2208
+ };
2209
+
2210
+ // Start animatin'!
2211
+ if (!d3_timer_interval) {
2212
+ d3_timer_timeout = clearTimeout(d3_timer_timeout);
2213
+ d3_timer_interval = 1;
2214
+ d3_timer_frame(d3_timer_step);
2215
+ }
2216
+ }
2217
+
2218
+ function d3_timer_step() {
2219
+ var elapsed,
2220
+ now = Date.now(),
2221
+ t1 = d3_timer_queue;
2222
+
2223
+ while (t1) {
2224
+ elapsed = now - t1.then;
2225
+ if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
2226
+ t1 = t1.next;
2227
+ }
2228
+
2229
+ var delay = d3_timer_flush() - now;
2230
+ if (delay > 24) {
2231
+ if (isFinite(delay)) {
2232
+ clearTimeout(d3_timer_timeout);
2233
+ d3_timer_timeout = setTimeout(d3_timer_step, delay);
2234
+ }
2235
+ d3_timer_interval = 0;
2236
+ } else {
2237
+ d3_timer_interval = 1;
2238
+ d3_timer_frame(d3_timer_step);
2239
+ }
2240
+ }
2241
+
2242
+ d3.timer.flush = function() {
2243
+ var elapsed,
2244
+ now = Date.now(),
2245
+ t1 = d3_timer_queue;
2246
+
2247
+ while (t1) {
2248
+ elapsed = now - t1.then;
2249
+ if (!t1.delay) t1.flush = t1.callback(elapsed);
2250
+ t1 = t1.next;
2251
+ }
2252
+
2253
+ d3_timer_flush();
2254
+ };
2255
+
2256
+ // Flush after callbacks, to avoid concurrent queue modification.
2257
+ function d3_timer_flush() {
2258
+ var t0 = null,
2259
+ t1 = d3_timer_queue,
2260
+ then = Infinity;
2261
+ while (t1) {
2262
+ if (t1.flush) {
2263
+ t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
2264
+ } else {
2265
+ then = Math.min(then, t1.then + t1.delay);
2266
+ t1 = (t0 = t1).next;
2267
+ }
2268
+ }
2269
+ return then;
2270
+ }
2271
+
2272
+ var d3_timer_frame = window.requestAnimationFrame
2273
+ || window.webkitRequestAnimationFrame
2274
+ || window.mozRequestAnimationFrame
2275
+ || window.oRequestAnimationFrame
2276
+ || window.msRequestAnimationFrame
2277
+ || function(callback) { setTimeout(callback, 17); };
2278
+ d3.transform = function(string) {
2279
+ d3_transformG.setAttribute("transform", string);
2280
+ var t = d3_transformG.transform.baseVal.consolidate();
2281
+ return new d3_transform(t ? t.matrix : d3_transformIdentity);
2282
+ };
2283
+
2284
+ // Compute x-scale and normalize the first row.
2285
+ // Compute shear and make second row orthogonal to first.
2286
+ // Compute y-scale and normalize the second row.
2287
+ // Finally, compute the rotation.
2288
+ function d3_transform(m) {
2289
+ var r0 = [m.a, m.b],
2290
+ r1 = [m.c, m.d],
2291
+ kx = d3_transformNormalize(r0),
2292
+ kz = d3_transformDot(r0, r1),
2293
+ ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
2294
+ if (r0[0] * r1[1] < r1[0] * r0[1]) {
2295
+ r0[0] *= -1;
2296
+ r0[1] *= -1;
2297
+ kx *= -1;
2298
+ kz *= -1;
2299
+ }
2300
+ this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees;
2301
+ this.translate = [m.e, m.f];
2302
+ this.scale = [kx, ky];
2303
+ this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0;
2304
+ };
2305
+
2306
+ d3_transform.prototype.toString = function() {
2307
+ return "translate(" + this.translate
2308
+ + ")rotate(" + this.rotate
2309
+ + ")skewX(" + this.skew
2310
+ + ")scale(" + this.scale
2311
+ + ")";
2312
+ };
2313
+
2314
+ function d3_transformDot(a, b) {
2315
+ return a[0] * b[0] + a[1] * b[1];
2316
+ }
2317
+
2318
+ function d3_transformNormalize(a) {
2319
+ var k = Math.sqrt(d3_transformDot(a, a));
2320
+ if (k) {
2321
+ a[0] /= k;
2322
+ a[1] /= k;
2323
+ }
2324
+ return k;
2325
+ }
2326
+
2327
+ function d3_transformCombine(a, b, k) {
2328
+ a[0] += k * b[0];
2329
+ a[1] += k * b[1];
2330
+ return a;
2331
+ }
2332
+
2333
+ var d3_transformG = document.createElementNS(d3.ns.prefix.svg, "g"),
2334
+ d3_transformIdentity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0},
2335
+ d3_transformDegrees = 180 / Math.PI;
2336
+ function d3_noop() {}
2337
+ d3.scale = {};
2338
+
2339
+ function d3_scaleExtent(domain) {
2340
+ var start = domain[0], stop = domain[domain.length - 1];
2341
+ return start < stop ? [start, stop] : [stop, start];
2342
+ }
2343
+
2344
+ function d3_scaleRange(scale) {
2345
+ return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
2346
+ }
2347
+ function d3_scale_nice(domain, nice) {
2348
+ var i0 = 0,
2349
+ i1 = domain.length - 1,
2350
+ x0 = domain[i0],
2351
+ x1 = domain[i1],
2352
+ dx;
2353
+
2354
+ if (x1 < x0) {
2355
+ dx = i0; i0 = i1; i1 = dx;
2356
+ dx = x0; x0 = x1; x1 = dx;
2357
+ }
2358
+
2359
+ if (dx = x1 - x0) {
2360
+ nice = nice(dx);
2361
+ domain[i0] = nice.floor(x0);
2362
+ domain[i1] = nice.ceil(x1);
2363
+ }
2364
+
2365
+ return domain;
2366
+ }
2367
+
2368
+ function d3_scale_niceDefault() {
2369
+ return Math;
2370
+ }
2371
+ d3.scale.linear = function() {
2372
+ return d3_scale_linear([0, 1], [0, 1], d3.interpolate, false);
2373
+ };
2374
+
2375
+ function d3_scale_linear(domain, range, interpolate, clamp) {
2376
+ var output,
2377
+ input;
2378
+
2379
+ function rescale() {
2380
+ var linear = domain.length == 2 ? d3_scale_bilinear : d3_scale_polylinear,
2381
+ uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
2382
+ output = linear(domain, range, uninterpolate, interpolate);
2383
+ input = linear(range, domain, uninterpolate, d3.interpolate);
2384
+ return scale;
2385
+ }
2386
+
2387
+ function scale(x) {
2388
+ return output(x);
2389
+ }
2390
+
2391
+ // Note: requires range is coercible to number!
2392
+ scale.invert = function(y) {
2393
+ return input(y);
2394
+ };
2395
+
2396
+ scale.domain = function(x) {
2397
+ if (!arguments.length) return domain;
2398
+ domain = x.map(Number);
2399
+ return rescale();
2400
+ };
2401
+
2402
+ scale.range = function(x) {
2403
+ if (!arguments.length) return range;
2404
+ range = x;
2405
+ return rescale();
2406
+ };
2407
+
2408
+ scale.rangeRound = function(x) {
2409
+ return scale.range(x).interpolate(d3.interpolateRound);
2410
+ };
2411
+
2412
+ scale.clamp = function(x) {
2413
+ if (!arguments.length) return clamp;
2414
+ clamp = x;
2415
+ return rescale();
2416
+ };
2417
+
2418
+ scale.interpolate = function(x) {
2419
+ if (!arguments.length) return interpolate;
2420
+ interpolate = x;
2421
+ return rescale();
2422
+ };
2423
+
2424
+ scale.ticks = function(m) {
2425
+ return d3_scale_linearTicks(domain, m);
2426
+ };
2427
+
2428
+ scale.tickFormat = function(m) {
2429
+ return d3_scale_linearTickFormat(domain, m);
2430
+ };
2431
+
2432
+ scale.nice = function() {
2433
+ d3_scale_nice(domain, d3_scale_linearNice);
2434
+ return rescale();
2435
+ };
2436
+
2437
+ scale.copy = function() {
2438
+ return d3_scale_linear(domain, range, interpolate, clamp);
2439
+ };
2440
+
2441
+ return rescale();
2442
+ };
2443
+
2444
+ function d3_scale_linearRebind(scale, linear) {
2445
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
2446
+ }
2447
+
2448
+ function d3_scale_linearNice(dx) {
2449
+ dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
2450
+ return {
2451
+ floor: function(x) { return Math.floor(x / dx) * dx; },
2452
+ ceil: function(x) { return Math.ceil(x / dx) * dx; }
2453
+ };
2454
+ }
2455
+
2456
+ // TODO Dates? Ugh.
2457
+ function d3_scale_linearTickRange(domain, m) {
2458
+ var extent = d3_scaleExtent(domain),
2459
+ span = extent[1] - extent[0],
2460
+ step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)),
2461
+ err = m / span * step;
2462
+
2463
+ // Filter ticks to get closer to the desired count.
2464
+ if (err <= .15) step *= 10;
2465
+ else if (err <= .35) step *= 5;
2466
+ else if (err <= .75) step *= 2;
2467
+
2468
+ // Round start and stop values to step interval.
2469
+ extent[0] = Math.ceil(extent[0] / step) * step;
2470
+ extent[1] = Math.floor(extent[1] / step) * step + step * .5; // inclusive
2471
+ extent[2] = step;
2472
+ return extent;
2473
+ }
2474
+
2475
+ function d3_scale_linearTicks(domain, m) {
2476
+ return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
2477
+ }
2478
+
2479
+ function d3_scale_linearTickFormat(domain, m) {
2480
+ return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
2481
+ }
2482
+ function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
2483
+ var u = uninterpolate(domain[0], domain[1]),
2484
+ i = interpolate(range[0], range[1]);
2485
+ return function(x) {
2486
+ return i(u(x));
2487
+ };
2488
+ }
2489
+ function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
2490
+ var u = [],
2491
+ i = [],
2492
+ j = 0,
2493
+ n = domain.length;
2494
+
2495
+ while (++j < n) {
2496
+ u.push(uninterpolate(domain[j - 1], domain[j]));
2497
+ i.push(interpolate(range[j - 1], range[j]));
2498
+ }
2499
+
2500
+ return function(x) {
2501
+ var j = d3.bisect(domain, x, 1, domain.length - 1) - 1;
2502
+ return i[j](u[j](x));
2503
+ };
2504
+ }
2505
+ d3.scale.log = function() {
2506
+ return d3_scale_log(d3.scale.linear(), d3_scale_logp);
2507
+ };
2508
+
2509
+ function d3_scale_log(linear, log) {
2510
+ var pow = log.pow;
2511
+
2512
+ function scale(x) {
2513
+ return linear(log(x));
2514
+ }
2515
+
2516
+ scale.invert = function(x) {
2517
+ return pow(linear.invert(x));
2518
+ };
2519
+
2520
+ scale.domain = function(x) {
2521
+ if (!arguments.length) return linear.domain().map(pow);
2522
+ log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
2523
+ pow = log.pow;
2524
+ linear.domain(x.map(log));
2525
+ return scale;
2526
+ };
2527
+
2528
+ scale.nice = function() {
2529
+ linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
2530
+ return scale;
2531
+ };
2532
+
2533
+ scale.ticks = function() {
2534
+ var extent = d3_scaleExtent(linear.domain()),
2535
+ ticks = [];
2536
+ if (extent.every(isFinite)) {
2537
+ var i = Math.floor(extent[0]),
2538
+ j = Math.ceil(extent[1]),
2539
+ u = pow(extent[0]),
2540
+ v = pow(extent[1]);
2541
+ if (log === d3_scale_logn) {
2542
+ ticks.push(pow(i));
2543
+ for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
2544
+ } else {
2545
+ for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
2546
+ ticks.push(pow(i));
2547
+ }
2548
+ for (i = 0; ticks[i] < u; i++) {} // strip small values
2549
+ for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values
2550
+ ticks = ticks.slice(i, j);
2551
+ }
2552
+ return ticks;
2553
+ };
2554
+
2555
+ scale.tickFormat = function(n, format) {
2556
+ if (arguments.length < 2) format = d3_scale_logFormat;
2557
+ if (arguments.length < 1) return format;
2558
+ var k = n / scale.ticks().length,
2559
+ f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil),
2560
+ e;
2561
+ return function(d) {
2562
+ return d / pow(f(log(d) + e)) < k ? format(d) : "";
2563
+ };
2564
+ };
2565
+
2566
+ scale.copy = function() {
2567
+ return d3_scale_log(linear.copy(), log);
2568
+ };
2569
+
2570
+ return d3_scale_linearRebind(scale, linear);
2571
+ };
2572
+
2573
+ var d3_scale_logFormat = d3.format(".0e");
2574
+
2575
+ function d3_scale_logp(x) {
2576
+ return Math.log(x) / Math.LN10;
2577
+ }
2578
+
2579
+ function d3_scale_logn(x) {
2580
+ return -Math.log(-x) / Math.LN10;
2581
+ }
2582
+
2583
+ d3_scale_logp.pow = function(x) {
2584
+ return Math.pow(10, x);
2585
+ };
2586
+
2587
+ d3_scale_logn.pow = function(x) {
2588
+ return -Math.pow(10, -x);
2589
+ };
2590
+ d3.scale.pow = function() {
2591
+ return d3_scale_pow(d3.scale.linear(), 1);
2592
+ };
2593
+
2594
+ function d3_scale_pow(linear, exponent) {
2595
+ var powp = d3_scale_powPow(exponent),
2596
+ powb = d3_scale_powPow(1 / exponent);
2597
+
2598
+ function scale(x) {
2599
+ return linear(powp(x));
2600
+ }
2601
+
2602
+ scale.invert = function(x) {
2603
+ return powb(linear.invert(x));
2604
+ };
2605
+
2606
+ scale.domain = function(x) {
2607
+ if (!arguments.length) return linear.domain().map(powb);
2608
+ linear.domain(x.map(powp));
2609
+ return scale;
2610
+ };
2611
+
2612
+ scale.ticks = function(m) {
2613
+ return d3_scale_linearTicks(scale.domain(), m);
2614
+ };
2615
+
2616
+ scale.tickFormat = function(m) {
2617
+ return d3_scale_linearTickFormat(scale.domain(), m);
2618
+ };
2619
+
2620
+ scale.nice = function() {
2621
+ return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
2622
+ };
2623
+
2624
+ scale.exponent = function(x) {
2625
+ if (!arguments.length) return exponent;
2626
+ var domain = scale.domain();
2627
+ powp = d3_scale_powPow(exponent = x);
2628
+ powb = d3_scale_powPow(1 / exponent);
2629
+ return scale.domain(domain);
2630
+ };
2631
+
2632
+ scale.copy = function() {
2633
+ return d3_scale_pow(linear.copy(), exponent);
2634
+ };
2635
+
2636
+ return d3_scale_linearRebind(scale, linear);
2637
+ };
2638
+
2639
+ function d3_scale_powPow(e) {
2640
+ return function(x) {
2641
+ return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
2642
+ };
2643
+ }
2644
+ d3.scale.sqrt = function() {
2645
+ return d3.scale.pow().exponent(.5);
2646
+ };
2647
+ d3.scale.ordinal = function() {
2648
+ return d3_scale_ordinal([], {t: "range", x: []});
2649
+ };
2650
+
2651
+ function d3_scale_ordinal(domain, ranger) {
2652
+ var index,
2653
+ range,
2654
+ rangeBand;
2655
+
2656
+ function scale(x) {
2657
+ return range[((index[x] || (index[x] = domain.push(x))) - 1) % range.length];
2658
+ }
2659
+
2660
+ function steps(start, step) {
2661
+ return d3.range(domain.length).map(function(i) { return start + step * i; });
2662
+ }
2663
+
2664
+ scale.domain = function(x) {
2665
+ if (!arguments.length) return domain;
2666
+ domain = [];
2667
+ index = {};
2668
+ var i = -1, n = x.length, xi;
2669
+ while (++i < n) if (!index[xi = x[i]]) index[xi] = domain.push(xi);
2670
+ return scale[ranger.t](ranger.x, ranger.p);
2671
+ };
2672
+
2673
+ scale.range = function(x) {
2674
+ if (!arguments.length) return range;
2675
+ range = x;
2676
+ rangeBand = 0;
2677
+ ranger = {t: "range", x: x};
2678
+ return scale;
2679
+ };
2680
+
2681
+ scale.rangePoints = function(x, padding) {
2682
+ if (arguments.length < 2) padding = 0;
2683
+ var start = x[0],
2684
+ stop = x[1],
2685
+ step = (stop - start) / (domain.length - 1 + padding);
2686
+ range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
2687
+ rangeBand = 0;
2688
+ ranger = {t: "rangePoints", x: x, p: padding};
2689
+ return scale;
2690
+ };
2691
+
2692
+ scale.rangeBands = function(x, padding) {
2693
+ if (arguments.length < 2) padding = 0;
2694
+ var start = x[0],
2695
+ stop = x[1],
2696
+ step = (stop - start) / (domain.length + padding);
2697
+ range = steps(start + step * padding, step);
2698
+ rangeBand = step * (1 - padding);
2699
+ ranger = {t: "rangeBands", x: x, p: padding};
2700
+ return scale;
2701
+ };
2702
+
2703
+ scale.rangeRoundBands = function(x, padding) {
2704
+ if (arguments.length < 2) padding = 0;
2705
+ var start = x[0],
2706
+ stop = x[1],
2707
+ step = Math.floor((stop - start) / (domain.length + padding));
2708
+ range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step);
2709
+ rangeBand = Math.round(step * (1 - padding));
2710
+ ranger = {t: "rangeRoundBands", x: x, p: padding};
2711
+ return scale;
2712
+ };
2713
+
2714
+ scale.rangeBand = function() {
2715
+ return rangeBand;
2716
+ };
2717
+
2718
+ scale.rangeExtent = function() {
2719
+ return ranger.x;
2720
+ };
2721
+
2722
+ scale.copy = function() {
2723
+ return d3_scale_ordinal(domain, ranger);
2724
+ };
2725
+
2726
+ return scale.domain(domain);
2727
+ };
2728
+ /*
2729
+ * This product includes color specifications and designs developed by Cynthia
2730
+ * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information.
2731
+ */
2732
+
2733
+ d3.scale.category10 = function() {
2734
+ return d3.scale.ordinal().range(d3_category10);
2735
+ };
2736
+
2737
+ d3.scale.category20 = function() {
2738
+ return d3.scale.ordinal().range(d3_category20);
2739
+ };
2740
+
2741
+ d3.scale.category20b = function() {
2742
+ return d3.scale.ordinal().range(d3_category20b);
2743
+ };
2744
+
2745
+ d3.scale.category20c = function() {
2746
+ return d3.scale.ordinal().range(d3_category20c);
2747
+ };
2748
+
2749
+ var d3_category10 = [
2750
+ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
2751
+ "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"
2752
+ ];
2753
+
2754
+ var d3_category20 = [
2755
+ "#1f77b4", "#aec7e8",
2756
+ "#ff7f0e", "#ffbb78",
2757
+ "#2ca02c", "#98df8a",
2758
+ "#d62728", "#ff9896",
2759
+ "#9467bd", "#c5b0d5",
2760
+ "#8c564b", "#c49c94",
2761
+ "#e377c2", "#f7b6d2",
2762
+ "#7f7f7f", "#c7c7c7",
2763
+ "#bcbd22", "#dbdb8d",
2764
+ "#17becf", "#9edae5"
2765
+ ];
2766
+
2767
+ var d3_category20b = [
2768
+ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede",
2769
+ "#637939", "#8ca252", "#b5cf6b", "#cedb9c",
2770
+ "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94",
2771
+ "#843c39", "#ad494a", "#d6616b", "#e7969c",
2772
+ "#7b4173", "#a55194", "#ce6dbd", "#de9ed6"
2773
+ ];
2774
+
2775
+ var d3_category20c = [
2776
+ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef",
2777
+ "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2",
2778
+ "#31a354", "#74c476", "#a1d99b", "#c7e9c0",
2779
+ "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb",
2780
+ "#636363", "#969696", "#bdbdbd", "#d9d9d9"
2781
+ ];
2782
+ d3.scale.quantile = function() {
2783
+ return d3_scale_quantile([], []);
2784
+ };
2785
+
2786
+ function d3_scale_quantile(domain, range) {
2787
+ var thresholds;
2788
+
2789
+ function rescale() {
2790
+ var k = 0,
2791
+ n = domain.length,
2792
+ q = range.length;
2793
+ thresholds = [];
2794
+ while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
2795
+ return scale;
2796
+ }
2797
+
2798
+ function scale(x) {
2799
+ if (isNaN(x = +x)) return NaN;
2800
+ return range[d3.bisect(thresholds, x)];
2801
+ }
2802
+
2803
+ scale.domain = function(x) {
2804
+ if (!arguments.length) return domain;
2805
+ domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending);
2806
+ return rescale();
2807
+ };
2808
+
2809
+ scale.range = function(x) {
2810
+ if (!arguments.length) return range;
2811
+ range = x;
2812
+ return rescale();
2813
+ };
2814
+
2815
+ scale.quantiles = function() {
2816
+ return thresholds;
2817
+ };
2818
+
2819
+ scale.copy = function() {
2820
+ return d3_scale_quantile(domain, range); // copy on write!
2821
+ };
2822
+
2823
+ return rescale();
2824
+ };
2825
+ d3.scale.quantize = function() {
2826
+ return d3_scale_quantize(0, 1, [0, 1]);
2827
+ };
2828
+
2829
+ function d3_scale_quantize(x0, x1, range) {
2830
+ var kx, i;
2831
+
2832
+ function scale(x) {
2833
+ return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
2834
+ }
2835
+
2836
+ function rescale() {
2837
+ kx = range.length / (x1 - x0);
2838
+ i = range.length - 1;
2839
+ return scale;
2840
+ }
2841
+
2842
+ scale.domain = function(x) {
2843
+ if (!arguments.length) return [x0, x1];
2844
+ x0 = +x[0];
2845
+ x1 = +x[x.length - 1];
2846
+ return rescale();
2847
+ };
2848
+
2849
+ scale.range = function(x) {
2850
+ if (!arguments.length) return range;
2851
+ range = x;
2852
+ return rescale();
2853
+ };
2854
+
2855
+ scale.copy = function() {
2856
+ return d3_scale_quantize(x0, x1, range); // copy on write
2857
+ };
2858
+
2859
+ return rescale();
2860
+ };
2861
+ d3.svg = {};
2862
+ d3.svg.arc = function() {
2863
+ var innerRadius = d3_svg_arcInnerRadius,
2864
+ outerRadius = d3_svg_arcOuterRadius,
2865
+ startAngle = d3_svg_arcStartAngle,
2866
+ endAngle = d3_svg_arcEndAngle;
2867
+
2868
+ function arc() {
2869
+ var r0 = innerRadius.apply(this, arguments),
2870
+ r1 = outerRadius.apply(this, arguments),
2871
+ a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset,
2872
+ a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset,
2873
+ da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0),
2874
+ df = da < Math.PI ? "0" : "1",
2875
+ c0 = Math.cos(a0),
2876
+ s0 = Math.sin(a0),
2877
+ c1 = Math.cos(a1),
2878
+ s1 = Math.sin(a1);
2879
+ return da >= d3_svg_arcMax
2880
+ ? (r0
2881
+ ? "M0," + r1
2882
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
2883
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
2884
+ + "M0," + r0
2885
+ + "A" + r0 + "," + r0 + " 0 1,0 0," + (-r0)
2886
+ + "A" + r0 + "," + r0 + " 0 1,0 0," + r0
2887
+ + "Z"
2888
+ : "M0," + r1
2889
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
2890
+ + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
2891
+ + "Z")
2892
+ : (r0
2893
+ ? "M" + r1 * c0 + "," + r1 * s0
2894
+ + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1
2895
+ + "L" + r0 * c1 + "," + r0 * s1
2896
+ + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0
2897
+ + "Z"
2898
+ : "M" + r1 * c0 + "," + r1 * s0
2899
+ + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1
2900
+ + "L0,0"
2901
+ + "Z");
2902
+ }
2903
+
2904
+ arc.innerRadius = function(v) {
2905
+ if (!arguments.length) return innerRadius;
2906
+ innerRadius = d3.functor(v);
2907
+ return arc;
2908
+ };
2909
+
2910
+ arc.outerRadius = function(v) {
2911
+ if (!arguments.length) return outerRadius;
2912
+ outerRadius = d3.functor(v);
2913
+ return arc;
2914
+ };
2915
+
2916
+ arc.startAngle = function(v) {
2917
+ if (!arguments.length) return startAngle;
2918
+ startAngle = d3.functor(v);
2919
+ return arc;
2920
+ };
2921
+
2922
+ arc.endAngle = function(v) {
2923
+ if (!arguments.length) return endAngle;
2924
+ endAngle = d3.functor(v);
2925
+ return arc;
2926
+ };
2927
+
2928
+ arc.centroid = function() {
2929
+ var r = (innerRadius.apply(this, arguments)
2930
+ + outerRadius.apply(this, arguments)) / 2,
2931
+ a = (startAngle.apply(this, arguments)
2932
+ + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
2933
+ return [Math.cos(a) * r, Math.sin(a) * r];
2934
+ };
2935
+
2936
+ return arc;
2937
+ };
2938
+
2939
+ var d3_svg_arcOffset = -Math.PI / 2,
2940
+ d3_svg_arcMax = 2 * Math.PI - 1e-6;
2941
+
2942
+ function d3_svg_arcInnerRadius(d) {
2943
+ return d.innerRadius;
2944
+ }
2945
+
2946
+ function d3_svg_arcOuterRadius(d) {
2947
+ return d.outerRadius;
2948
+ }
2949
+
2950
+ function d3_svg_arcStartAngle(d) {
2951
+ return d.startAngle;
2952
+ }
2953
+
2954
+ function d3_svg_arcEndAngle(d) {
2955
+ return d.endAngle;
2956
+ }
2957
+ function d3_svg_line(projection) {
2958
+ var x = d3_svg_lineX,
2959
+ y = d3_svg_lineY,
2960
+ interpolate = "linear",
2961
+ interpolator = d3_svg_lineInterpolators[interpolate],
2962
+ tension = .7;
2963
+
2964
+ function line(d) {
2965
+ return d.length < 1 ? null : "M" + interpolator(projection(d3_svg_linePoints(this, d, x, y)), tension);
2966
+ }
2967
+
2968
+ line.x = function(v) {
2969
+ if (!arguments.length) return x;
2970
+ x = v;
2971
+ return line;
2972
+ };
2973
+
2974
+ line.y = function(v) {
2975
+ if (!arguments.length) return y;
2976
+ y = v;
2977
+ return line;
2978
+ };
2979
+
2980
+ line.interpolate = function(v) {
2981
+ if (!arguments.length) return interpolate;
2982
+ interpolator = d3_svg_lineInterpolators[interpolate = v];
2983
+ return line;
2984
+ };
2985
+
2986
+ line.tension = function(v) {
2987
+ if (!arguments.length) return tension;
2988
+ tension = v;
2989
+ return line;
2990
+ };
2991
+
2992
+ return line;
2993
+ }
2994
+
2995
+ d3.svg.line = function() {
2996
+ return d3_svg_line(Object);
2997
+ };
2998
+
2999
+ // Converts the specified array of data into an array of points
3000
+ // (x-y tuples), by evaluating the specified `x` and `y` functions on each
3001
+ // data point. The `this` context of the evaluated functions is the specified
3002
+ // "self" object; each function is passed the current datum and index.
3003
+ function d3_svg_linePoints(self, d, x, y) {
3004
+ var points = [],
3005
+ i = -1,
3006
+ n = d.length,
3007
+ fx = typeof x === "function",
3008
+ fy = typeof y === "function",
3009
+ value;
3010
+ if (fx && fy) {
3011
+ while (++i < n) points.push([
3012
+ x.call(self, value = d[i], i),
3013
+ y.call(self, value, i)
3014
+ ]);
3015
+ } else if (fx) {
3016
+ while (++i < n) points.push([x.call(self, d[i], i), y]);
3017
+ } else if (fy) {
3018
+ while (++i < n) points.push([x, y.call(self, d[i], i)]);
3019
+ } else {
3020
+ while (++i < n) points.push([x, y]);
3021
+ }
3022
+ return points;
3023
+ }
3024
+
3025
+ // The default `x` property, which references d[0].
3026
+ function d3_svg_lineX(d) {
3027
+ return d[0];
3028
+ }
3029
+
3030
+ // The default `y` property, which references d[1].
3031
+ function d3_svg_lineY(d) {
3032
+ return d[1];
3033
+ }
3034
+
3035
+ // The various interpolators supported by the `line` class.
3036
+ var d3_svg_lineInterpolators = {
3037
+ "linear": d3_svg_lineLinear,
3038
+ "step-before": d3_svg_lineStepBefore,
3039
+ "step-after": d3_svg_lineStepAfter,
3040
+ "basis": d3_svg_lineBasis,
3041
+ "basis-open": d3_svg_lineBasisOpen,
3042
+ "basis-closed": d3_svg_lineBasisClosed,
3043
+ "bundle": d3_svg_lineBundle,
3044
+ "cardinal": d3_svg_lineCardinal,
3045
+ "cardinal-open": d3_svg_lineCardinalOpen,
3046
+ "cardinal-closed": d3_svg_lineCardinalClosed,
3047
+ "monotone": d3_svg_lineMonotone
3048
+ };
3049
+
3050
+ // Linear interpolation; generates "L" commands.
3051
+ function d3_svg_lineLinear(points) {
3052
+ var i = 0,
3053
+ n = points.length,
3054
+ p = points[0],
3055
+ path = [p[0], ",", p[1]];
3056
+ while (++i < n) path.push("L", (p = points[i])[0], ",", p[1]);
3057
+ return path.join("");
3058
+ }
3059
+
3060
+ // Step interpolation; generates "H" and "V" commands.
3061
+ function d3_svg_lineStepBefore(points) {
3062
+ var i = 0,
3063
+ n = points.length,
3064
+ p = points[0],
3065
+ path = [p[0], ",", p[1]];
3066
+ while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
3067
+ return path.join("");
3068
+ }
3069
+
3070
+ // Step interpolation; generates "H" and "V" commands.
3071
+ function d3_svg_lineStepAfter(points) {
3072
+ var i = 0,
3073
+ n = points.length,
3074
+ p = points[0],
3075
+ path = [p[0], ",", p[1]];
3076
+ while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
3077
+ return path.join("");
3078
+ }
3079
+
3080
+ // Open cardinal spline interpolation; generates "C" commands.
3081
+ function d3_svg_lineCardinalOpen(points, tension) {
3082
+ return points.length < 4
3083
+ ? d3_svg_lineLinear(points)
3084
+ : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1),
3085
+ d3_svg_lineCardinalTangents(points, tension));
3086
+ }
3087
+
3088
+ // Closed cardinal spline interpolation; generates "C" commands.
3089
+ function d3_svg_lineCardinalClosed(points, tension) {
3090
+ return points.length < 3
3091
+ ? d3_svg_lineLinear(points)
3092
+ : points[0] + d3_svg_lineHermite((points.push(points[0]), points),
3093
+ d3_svg_lineCardinalTangents([points[points.length - 2]]
3094
+ .concat(points, [points[1]]), tension));
3095
+ }
3096
+
3097
+ // Cardinal spline interpolation; generates "C" commands.
3098
+ function d3_svg_lineCardinal(points, tension, closed) {
3099
+ return points.length < 3
3100
+ ? d3_svg_lineLinear(points)
3101
+ : points[0] + d3_svg_lineHermite(points,
3102
+ d3_svg_lineCardinalTangents(points, tension));
3103
+ }
3104
+
3105
+ // Hermite spline construction; generates "C" commands.
3106
+ function d3_svg_lineHermite(points, tangents) {
3107
+ if (tangents.length < 1
3108
+ || (points.length != tangents.length
3109
+ && points.length != tangents.length + 2)) {
3110
+ return d3_svg_lineLinear(points);
3111
+ }
3112
+
3113
+ var quad = points.length != tangents.length,
3114
+ path = "",
3115
+ p0 = points[0],
3116
+ p = points[1],
3117
+ t0 = tangents[0],
3118
+ t = t0,
3119
+ pi = 1;
3120
+
3121
+ if (quad) {
3122
+ path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3)
3123
+ + "," + p[0] + "," + p[1];
3124
+ p0 = points[1];
3125
+ pi = 2;
3126
+ }
3127
+
3128
+ if (tangents.length > 1) {
3129
+ t = tangents[1];
3130
+ p = points[pi];
3131
+ pi++;
3132
+ path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1])
3133
+ + "," + (p[0] - t[0]) + "," + (p[1] - t[1])
3134
+ + "," + p[0] + "," + p[1];
3135
+ for (var i = 2; i < tangents.length; i++, pi++) {
3136
+ p = points[pi];
3137
+ t = tangents[i];
3138
+ path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1])
3139
+ + "," + p[0] + "," + p[1];
3140
+ }
3141
+ }
3142
+
3143
+ if (quad) {
3144
+ var lp = points[pi];
3145
+ path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3)
3146
+ + "," + lp[0] + "," + lp[1];
3147
+ }
3148
+
3149
+ return path;
3150
+ }
3151
+
3152
+ // Generates tangents for a cardinal spline.
3153
+ function d3_svg_lineCardinalTangents(points, tension) {
3154
+ var tangents = [],
3155
+ a = (1 - tension) / 2,
3156
+ p0,
3157
+ p1 = points[0],
3158
+ p2 = points[1],
3159
+ i = 1,
3160
+ n = points.length;
3161
+ while (++i < n) {
3162
+ p0 = p1;
3163
+ p1 = p2;
3164
+ p2 = points[i];
3165
+ tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]);
3166
+ }
3167
+ return tangents;
3168
+ }
3169
+
3170
+ // B-spline interpolation; generates "C" commands.
3171
+ function d3_svg_lineBasis(points) {
3172
+ if (points.length < 3) return d3_svg_lineLinear(points);
3173
+ var i = 1,
3174
+ n = points.length,
3175
+ pi = points[0],
3176
+ x0 = pi[0],
3177
+ y0 = pi[1],
3178
+ px = [x0, x0, x0, (pi = points[1])[0]],
3179
+ py = [y0, y0, y0, pi[1]],
3180
+ path = [x0, ",", y0];
3181
+ d3_svg_lineBasisBezier(path, px, py);
3182
+ while (++i < n) {
3183
+ pi = points[i];
3184
+ px.shift(); px.push(pi[0]);
3185
+ py.shift(); py.push(pi[1]);
3186
+ d3_svg_lineBasisBezier(path, px, py);
3187
+ }
3188
+ i = -1;
3189
+ while (++i < 2) {
3190
+ px.shift(); px.push(pi[0]);
3191
+ py.shift(); py.push(pi[1]);
3192
+ d3_svg_lineBasisBezier(path, px, py);
3193
+ }
3194
+ return path.join("");
3195
+ }
3196
+
3197
+ // Open B-spline interpolation; generates "C" commands.
3198
+ function d3_svg_lineBasisOpen(points) {
3199
+ if (points.length < 4) return d3_svg_lineLinear(points);
3200
+ var path = [],
3201
+ i = -1,
3202
+ n = points.length,
3203
+ pi,
3204
+ px = [0],
3205
+ py = [0];
3206
+ while (++i < 3) {
3207
+ pi = points[i];
3208
+ px.push(pi[0]);
3209
+ py.push(pi[1]);
3210
+ }
3211
+ path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px)
3212
+ + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
3213
+ --i; while (++i < n) {
3214
+ pi = points[i];
3215
+ px.shift(); px.push(pi[0]);
3216
+ py.shift(); py.push(pi[1]);
3217
+ d3_svg_lineBasisBezier(path, px, py);
3218
+ }
3219
+ return path.join("");
3220
+ }
3221
+
3222
+ // Closed B-spline interpolation; generates "C" commands.
3223
+ function d3_svg_lineBasisClosed(points) {
3224
+ var path,
3225
+ i = -1,
3226
+ n = points.length,
3227
+ m = n + 4,
3228
+ pi,
3229
+ px = [],
3230
+ py = [];
3231
+ while (++i < 4) {
3232
+ pi = points[i % n];
3233
+ px.push(pi[0]);
3234
+ py.push(pi[1]);
3235
+ }
3236
+ path = [
3237
+ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",",
3238
+ d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)
3239
+ ];
3240
+ --i; while (++i < m) {
3241
+ pi = points[i % n];
3242
+ px.shift(); px.push(pi[0]);
3243
+ py.shift(); py.push(pi[1]);
3244
+ d3_svg_lineBasisBezier(path, px, py);
3245
+ }
3246
+ return path.join("");
3247
+ }
3248
+
3249
+ function d3_svg_lineBundle(points, tension) {
3250
+ var n = points.length - 1,
3251
+ x0 = points[0][0],
3252
+ y0 = points[0][1],
3253
+ dx = points[n][0] - x0,
3254
+ dy = points[n][1] - y0,
3255
+ i = -1,
3256
+ p,
3257
+ t;
3258
+ while (++i <= n) {
3259
+ p = points[i];
3260
+ t = i / n;
3261
+ p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
3262
+ p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
3263
+ }
3264
+ return d3_svg_lineBasis(points);
3265
+ }
3266
+
3267
+ // Returns the dot product of the given four-element vectors.
3268
+ function d3_svg_lineDot4(a, b) {
3269
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
3270
+ }
3271
+
3272
+ // Matrix to transform basis (b-spline) control points to bezier
3273
+ // control points. Derived from FvD 11.2.8.
3274
+ var d3_svg_lineBasisBezier1 = [0, 2/3, 1/3, 0],
3275
+ d3_svg_lineBasisBezier2 = [0, 1/3, 2/3, 0],
3276
+ d3_svg_lineBasisBezier3 = [0, 1/6, 2/3, 1/6];
3277
+
3278
+ // Pushes a "C" Bézier curve onto the specified path array, given the
3279
+ // two specified four-element arrays which define the control points.
3280
+ function d3_svg_lineBasisBezier(path, x, y) {
3281
+ path.push(
3282
+ "C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x),
3283
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y),
3284
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x),
3285
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y),
3286
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x),
3287
+ ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
3288
+ }
3289
+
3290
+ // Computes the slope from points p0 to p1.
3291
+ function d3_svg_lineSlope(p0, p1) {
3292
+ return (p1[1] - p0[1]) / (p1[0] - p0[0]);
3293
+ }
3294
+
3295
+ // Compute three-point differences for the given points.
3296
+ // http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Finite_difference
3297
+ function d3_svg_lineFiniteDifferences(points) {
3298
+ var i = 0,
3299
+ j = points.length - 1,
3300
+ m = [],
3301
+ p0 = points[0],
3302
+ p1 = points[1],
3303
+ d = m[0] = d3_svg_lineSlope(p0, p1);
3304
+ while (++i < j) {
3305
+ m[i] = d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]));
3306
+ }
3307
+ m[i] = d;
3308
+ return m;
3309
+ }
3310
+
3311
+ // Interpolates the given points using Fritsch-Carlson Monotone cubic Hermite
3312
+ // interpolation. Returns an array of tangent vectors. For details, see
3313
+ // http://en.wikipedia.org/wiki/Monotone_cubic_interpolation
3314
+ function d3_svg_lineMonotoneTangents(points) {
3315
+ var tangents = [],
3316
+ d,
3317
+ a,
3318
+ b,
3319
+ s,
3320
+ m = d3_svg_lineFiniteDifferences(points),
3321
+ i = -1,
3322
+ j = points.length - 1;
3323
+
3324
+ // The first two steps are done by computing finite-differences:
3325
+ // 1. Compute the slopes of the secant lines between successive points.
3326
+ // 2. Initialize the tangents at every point as the average of the secants.
3327
+
3328
+ // Then, for each segment…
3329
+ while (++i < j) {
3330
+ d = d3_svg_lineSlope(points[i], points[i + 1]);
3331
+
3332
+ // 3. If two successive yk = y{k + 1} are equal (i.e., d is zero), then set
3333
+ // mk = m{k + 1} = 0 as the spline connecting these points must be flat to
3334
+ // preserve monotonicity. Ignore step 4 and 5 for those k.
3335
+
3336
+ if (Math.abs(d) < 1e-6) {
3337
+ m[i] = m[i + 1] = 0;
3338
+ } else {
3339
+ // 4. Let ak = mk / dk and bk = m{k + 1} / dk.
3340
+ a = m[i] / d;
3341
+ b = m[i + 1] / d;
3342
+
3343
+ // 5. Prevent overshoot and ensure monotonicity by restricting the
3344
+ // magnitude of vector <ak, bk> to a circle of radius 3.
3345
+ s = a * a + b * b;
3346
+ if (s > 9) {
3347
+ s = d * 3 / Math.sqrt(s);
3348
+ m[i] = s * a;
3349
+ m[i + 1] = s * b;
3350
+ }
3351
+ }
3352
+ }
3353
+
3354
+ // Compute the normalized tangent vector from the slopes. Note that if x is
3355
+ // not monotonic, it's possible that the slope will be infinite, so we protect
3356
+ // against NaN by setting the coordinate to zero.
3357
+ i = -1; while (++i <= j) {
3358
+ s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0])
3359
+ / (6 * (1 + m[i] * m[i]));
3360
+ tangents.push([s || 0, m[i] * s || 0]);
3361
+ }
3362
+
3363
+ return tangents;
3364
+ }
3365
+
3366
+ function d3_svg_lineMonotone(points) {
3367
+ return points.length < 3
3368
+ ? d3_svg_lineLinear(points)
3369
+ : points[0] +
3370
+ d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
3371
+ }
3372
+ d3.svg.line.radial = function() {
3373
+ var line = d3_svg_line(d3_svg_lineRadial);
3374
+ line.radius = line.x, delete line.x;
3375
+ line.angle = line.y, delete line.y;
3376
+ return line;
3377
+ };
3378
+
3379
+ function d3_svg_lineRadial(points) {
3380
+ var point,
3381
+ i = -1,
3382
+ n = points.length,
3383
+ r,
3384
+ a;
3385
+ while (++i < n) {
3386
+ point = points[i];
3387
+ r = point[0];
3388
+ a = point[1] + d3_svg_arcOffset;
3389
+ point[0] = r * Math.cos(a);
3390
+ point[1] = r * Math.sin(a);
3391
+ }
3392
+ return points;
3393
+ }
3394
+ function d3_svg_area(projection) {
3395
+ var x0 = d3_svg_lineX,
3396
+ x1 = d3_svg_lineX,
3397
+ y0 = 0,
3398
+ y1 = d3_svg_lineY,
3399
+ interpolate,
3400
+ i0,
3401
+ i1,
3402
+ tension = .7;
3403
+
3404
+ function area(d) {
3405
+ if (d.length < 1) return null;
3406
+ var points0 = d3_svg_linePoints(this, d, x0, y0),
3407
+ points1 = d3_svg_linePoints(this, d, x0 === x1 ? d3_svg_areaX(points0) : x1, y0 === y1 ? d3_svg_areaY(points0) : y1);
3408
+ return "M" + i0(projection(points1), tension)
3409
+ + "L" + i1(projection(points0.reverse()), tension)
3410
+ + "Z";
3411
+ }
3412
+
3413
+ area.x = function(x) {
3414
+ if (!arguments.length) return x1;
3415
+ x0 = x1 = x;
3416
+ return area;
3417
+ };
3418
+
3419
+ area.x0 = function(x) {
3420
+ if (!arguments.length) return x0;
3421
+ x0 = x;
3422
+ return area;
3423
+ };
3424
+
3425
+ area.x1 = function(x) {
3426
+ if (!arguments.length) return x1;
3427
+ x1 = x;
3428
+ return area;
3429
+ };
3430
+
3431
+ area.y = function(y) {
3432
+ if (!arguments.length) return y1;
3433
+ y0 = y1 = y;
3434
+ return area;
3435
+ };
3436
+
3437
+ area.y0 = function(y) {
3438
+ if (!arguments.length) return y0;
3439
+ y0 = y;
3440
+ return area;
3441
+ };
3442
+
3443
+ area.y1 = function(y) {
3444
+ if (!arguments.length) return y1;
3445
+ y1 = y;
3446
+ return area;
3447
+ };
3448
+
3449
+ area.interpolate = function(x) {
3450
+ if (!arguments.length) return interpolate;
3451
+ i0 = d3_svg_lineInterpolators[interpolate = x];
3452
+ i1 = i0.reverse || i0;
3453
+ return area;
3454
+ };
3455
+
3456
+ area.tension = function(x) {
3457
+ if (!arguments.length) return tension;
3458
+ tension = x;
3459
+ return area;
3460
+ };
3461
+
3462
+ return area.interpolate("linear");
3463
+ }
3464
+
3465
+ d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
3466
+ d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
3467
+
3468
+ d3.svg.area = function() {
3469
+ return d3_svg_area(Object);
3470
+ };
3471
+
3472
+ function d3_svg_areaX(points) {
3473
+ return function(d, i) {
3474
+ return points[i][0];
3475
+ };
3476
+ }
3477
+
3478
+ function d3_svg_areaY(points) {
3479
+ return function(d, i) {
3480
+ return points[i][1];
3481
+ };
3482
+ }
3483
+ d3.svg.area.radial = function() {
3484
+ var area = d3_svg_area(d3_svg_lineRadial);
3485
+ area.radius = area.x, delete area.x;
3486
+ area.innerRadius = area.x0, delete area.x0;
3487
+ area.outerRadius = area.x1, delete area.x1;
3488
+ area.angle = area.y, delete area.y;
3489
+ area.startAngle = area.y0, delete area.y0;
3490
+ area.endAngle = area.y1, delete area.y1;
3491
+ return area;
3492
+ };
3493
+ d3.svg.chord = function() {
3494
+ var source = d3_svg_chordSource,
3495
+ target = d3_svg_chordTarget,
3496
+ radius = d3_svg_chordRadius,
3497
+ startAngle = d3_svg_arcStartAngle,
3498
+ endAngle = d3_svg_arcEndAngle;
3499
+
3500
+ // TODO Allow control point to be customized.
3501
+
3502
+ function chord(d, i) {
3503
+ var s = subgroup(this, source, d, i),
3504
+ t = subgroup(this, target, d, i);
3505
+ return "M" + s.p0
3506
+ + arc(s.r, s.p1) + (equals(s, t)
3507
+ ? curve(s.r, s.p1, s.r, s.p0)
3508
+ : curve(s.r, s.p1, t.r, t.p0)
3509
+ + arc(t.r, t.p1)
3510
+ + curve(t.r, t.p1, s.r, s.p0))
3511
+ + "Z";
3512
+ }
3513
+
3514
+ function subgroup(self, f, d, i) {
3515
+ var subgroup = f.call(self, d, i),
3516
+ r = radius.call(self, subgroup, i),
3517
+ a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset,
3518
+ a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
3519
+ return {
3520
+ r: r,
3521
+ a0: a0,
3522
+ a1: a1,
3523
+ p0: [r * Math.cos(a0), r * Math.sin(a0)],
3524
+ p1: [r * Math.cos(a1), r * Math.sin(a1)]
3525
+ };
3526
+ }
3527
+
3528
+ function equals(a, b) {
3529
+ return a.a0 == b.a0 && a.a1 == b.a1;
3530
+ }
3531
+
3532
+ function arc(r, p) {
3533
+ return "A" + r + "," + r + " 0 0,1 " + p;
3534
+ }
3535
+
3536
+ function curve(r0, p0, r1, p1) {
3537
+ return "Q 0,0 " + p1;
3538
+ }
3539
+
3540
+ chord.radius = function(v) {
3541
+ if (!arguments.length) return radius;
3542
+ radius = d3.functor(v);
3543
+ return chord;
3544
+ };
3545
+
3546
+ chord.source = function(v) {
3547
+ if (!arguments.length) return source;
3548
+ source = d3.functor(v);
3549
+ return chord;
3550
+ };
3551
+
3552
+ chord.target = function(v) {
3553
+ if (!arguments.length) return target;
3554
+ target = d3.functor(v);
3555
+ return chord;
3556
+ };
3557
+
3558
+ chord.startAngle = function(v) {
3559
+ if (!arguments.length) return startAngle;
3560
+ startAngle = d3.functor(v);
3561
+ return chord;
3562
+ };
3563
+
3564
+ chord.endAngle = function(v) {
3565
+ if (!arguments.length) return endAngle;
3566
+ endAngle = d3.functor(v);
3567
+ return chord;
3568
+ };
3569
+
3570
+ return chord;
3571
+ };
3572
+
3573
+ function d3_svg_chordSource(d) {
3574
+ return d.source;
3575
+ }
3576
+
3577
+ function d3_svg_chordTarget(d) {
3578
+ return d.target;
3579
+ }
3580
+
3581
+ function d3_svg_chordRadius(d) {
3582
+ return d.radius;
3583
+ }
3584
+
3585
+ function d3_svg_chordStartAngle(d) {
3586
+ return d.startAngle;
3587
+ }
3588
+
3589
+ function d3_svg_chordEndAngle(d) {
3590
+ return d.endAngle;
3591
+ }
3592
+ d3.svg.diagonal = function() {
3593
+ var source = d3_svg_chordSource,
3594
+ target = d3_svg_chordTarget,
3595
+ projection = d3_svg_diagonalProjection;
3596
+
3597
+ function diagonal(d, i) {
3598
+ var p0 = source.call(this, d, i),
3599
+ p3 = target.call(this, d, i),
3600
+ m = (p0.y + p3.y) / 2,
3601
+ p = [p0, {x: p0.x, y: m}, {x: p3.x, y: m}, p3];
3602
+ p = p.map(projection);
3603
+ return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
3604
+ }
3605
+
3606
+ diagonal.source = function(x) {
3607
+ if (!arguments.length) return source;
3608
+ source = d3.functor(x);
3609
+ return diagonal;
3610
+ };
3611
+
3612
+ diagonal.target = function(x) {
3613
+ if (!arguments.length) return target;
3614
+ target = d3.functor(x);
3615
+ return diagonal;
3616
+ };
3617
+
3618
+ diagonal.projection = function(x) {
3619
+ if (!arguments.length) return projection;
3620
+ projection = x;
3621
+ return diagonal;
3622
+ };
3623
+
3624
+ return diagonal;
3625
+ };
3626
+
3627
+ function d3_svg_diagonalProjection(d) {
3628
+ return [d.x, d.y];
3629
+ }
3630
+ d3.svg.diagonal.radial = function() {
3631
+ var diagonal = d3.svg.diagonal(),
3632
+ projection = d3_svg_diagonalProjection,
3633
+ projection_ = diagonal.projection;
3634
+
3635
+ diagonal.projection = function(x) {
3636
+ return arguments.length
3637
+ ? projection_(d3_svg_diagonalRadialProjection(projection = x))
3638
+ : projection;
3639
+ };
3640
+
3641
+ return diagonal;
3642
+ };
3643
+
3644
+ function d3_svg_diagonalRadialProjection(projection) {
3645
+ return function() {
3646
+ var d = projection.apply(this, arguments),
3647
+ r = d[0],
3648
+ a = d[1] + d3_svg_arcOffset;
3649
+ return [r * Math.cos(a), r * Math.sin(a)];
3650
+ };
3651
+ }
3652
+ d3.svg.mouse = function(container) {
3653
+ return d3_svg_mousePoint(container, d3.event);
3654
+ };
3655
+
3656
+ // https://bugs.webkit.org/show_bug.cgi?id=44083
3657
+ var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
3658
+
3659
+ function d3_svg_mousePoint(container, e) {
3660
+ var point = (container.ownerSVGElement || container).createSVGPoint();
3661
+ if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) {
3662
+ var svg = d3.select(document.body)
3663
+ .append("svg")
3664
+ .style("position", "absolute")
3665
+ .style("top", 0)
3666
+ .style("left", 0);
3667
+ var ctm = svg[0][0].getScreenCTM();
3668
+ d3_mouse_bug44083 = !(ctm.f || ctm.e);
3669
+ svg.remove();
3670
+ }
3671
+ if (d3_mouse_bug44083) {
3672
+ point.x = e.pageX;
3673
+ point.y = e.pageY;
3674
+ } else {
3675
+ point.x = e.clientX;
3676
+ point.y = e.clientY;
3677
+ }
3678
+ point = point.matrixTransform(container.getScreenCTM().inverse());
3679
+ return [point.x, point.y];
3680
+ };
3681
+ d3.svg.touches = function(container, touches) {
3682
+ if (arguments.length < 2) touches = d3.event.touches;
3683
+
3684
+ return touches ? d3_array(touches).map(function(touch) {
3685
+ var point = d3_svg_mousePoint(container, touch);
3686
+ point.identifier = touch.identifier;
3687
+ return point;
3688
+ }) : [];
3689
+ };
3690
+ d3.svg.symbol = function() {
3691
+ var type = d3_svg_symbolType,
3692
+ size = d3_svg_symbolSize;
3693
+
3694
+ function symbol(d, i) {
3695
+ return (d3_svg_symbols[type.call(this, d, i)]
3696
+ || d3_svg_symbols.circle)
3697
+ (size.call(this, d, i));
3698
+ }
3699
+
3700
+ symbol.type = function(x) {
3701
+ if (!arguments.length) return type;
3702
+ type = d3.functor(x);
3703
+ return symbol;
3704
+ };
3705
+
3706
+ // size of symbol in square pixels
3707
+ symbol.size = function(x) {
3708
+ if (!arguments.length) return size;
3709
+ size = d3.functor(x);
3710
+ return symbol;
3711
+ };
3712
+
3713
+ return symbol;
3714
+ };
3715
+
3716
+ function d3_svg_symbolSize() {
3717
+ return 64;
3718
+ }
3719
+
3720
+ function d3_svg_symbolType() {
3721
+ return "circle";
3722
+ }
3723
+
3724
+ // TODO cross-diagonal?
3725
+ var d3_svg_symbols = {
3726
+ "circle": function(size) {
3727
+ var r = Math.sqrt(size / Math.PI);
3728
+ return "M0," + r
3729
+ + "A" + r + "," + r + " 0 1,1 0," + (-r)
3730
+ + "A" + r + "," + r + " 0 1,1 0," + r
3731
+ + "Z";
3732
+ },
3733
+ "cross": function(size) {
3734
+ var r = Math.sqrt(size / 5) / 2;
3735
+ return "M" + -3 * r + "," + -r
3736
+ + "H" + -r
3737
+ + "V" + -3 * r
3738
+ + "H" + r
3739
+ + "V" + -r
3740
+ + "H" + 3 * r
3741
+ + "V" + r
3742
+ + "H" + r
3743
+ + "V" + 3 * r
3744
+ + "H" + -r
3745
+ + "V" + r
3746
+ + "H" + -3 * r
3747
+ + "Z";
3748
+ },
3749
+ "diamond": function(size) {
3750
+ var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)),
3751
+ rx = ry * d3_svg_symbolTan30;
3752
+ return "M0," + -ry
3753
+ + "L" + rx + ",0"
3754
+ + " 0," + ry
3755
+ + " " + -rx + ",0"
3756
+ + "Z";
3757
+ },
3758
+ "square": function(size) {
3759
+ var r = Math.sqrt(size) / 2;
3760
+ return "M" + -r + "," + -r
3761
+ + "L" + r + "," + -r
3762
+ + " " + r + "," + r
3763
+ + " " + -r + "," + r
3764
+ + "Z";
3765
+ },
3766
+ "triangle-down": function(size) {
3767
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3),
3768
+ ry = rx * d3_svg_symbolSqrt3 / 2;
3769
+ return "M0," + ry
3770
+ + "L" + rx +"," + -ry
3771
+ + " " + -rx + "," + -ry
3772
+ + "Z";
3773
+ },
3774
+ "triangle-up": function(size) {
3775
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3),
3776
+ ry = rx * d3_svg_symbolSqrt3 / 2;
3777
+ return "M0," + -ry
3778
+ + "L" + rx +"," + ry
3779
+ + " " + -rx + "," + ry
3780
+ + "Z";
3781
+ }
3782
+ };
3783
+
3784
+ d3.svg.symbolTypes = d3.keys(d3_svg_symbols);
3785
+
3786
+ var d3_svg_symbolSqrt3 = Math.sqrt(3),
3787
+ d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);
3788
+ d3.svg.axis = function() {
3789
+ var scale = d3.scale.linear(),
3790
+ orient = "bottom",
3791
+ tickMajorSize = 6,
3792
+ tickMinorSize = 6,
3793
+ tickEndSize = 6,
3794
+ tickPadding = 3,
3795
+ tickArguments_ = [10],
3796
+ tickFormat_,
3797
+ tickSubdivide = 0;
3798
+
3799
+ function axis(selection) {
3800
+ selection.each(function(d, i, j) {
3801
+ var g = d3.select(this);
3802
+
3803
+ // If selection is a transition, create subtransitions.
3804
+ var transition = selection.delay ? function(o) {
3805
+ var id = d3_transitionInheritId;
3806
+ try {
3807
+ d3_transitionInheritId = selection.id;
3808
+ return o.transition()
3809
+ .delay(selection[j][i].delay)
3810
+ .duration(selection[j][i].duration)
3811
+ .ease(selection.ease());
3812
+ } finally {
3813
+ d3_transitionInheritId = id;
3814
+ }
3815
+ } : Object;
3816
+
3817
+ // Ticks, or domain values for ordinal scales.
3818
+ var ticks = scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain(),
3819
+ tickFormat = tickFormat_ == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String) : tickFormat_;
3820
+
3821
+ // Minor ticks.
3822
+ var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide),
3823
+ subtick = g.selectAll(".minor").data(subticks, String),
3824
+ subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6),
3825
+ subtickExit = transition(subtick.exit()).style("opacity", 1e-6).remove(),
3826
+ subtickUpdate = transition(subtick).style("opacity", 1);
3827
+
3828
+ // Major ticks.
3829
+ var tick = g.selectAll("g").data(ticks, String),
3830
+ tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6),
3831
+ tickExit = transition(tick.exit()).style("opacity", 1e-6).remove(),
3832
+ tickUpdate = transition(tick).style("opacity", 1),
3833
+ tickTransform;
3834
+
3835
+ // Domain.
3836
+ var range = d3_scaleRange(scale),
3837
+ path = g.selectAll(".domain").data([0]),
3838
+ pathEnter = path.enter().append("path").attr("class", "domain"),
3839
+ pathUpdate = transition(path);
3840
+
3841
+ // Stash a snapshot of the new scale, and retrieve the old snapshot.
3842
+ var scale1 = scale.copy(),
3843
+ scale0 = this.__chart__ || scale1;
3844
+ this.__chart__ = scale1;
3845
+
3846
+ tickEnter.append("line").attr("class", "tick");
3847
+ tickEnter.append("text");
3848
+ tickUpdate.select("text").text(tickFormat);
3849
+
3850
+ switch (orient) {
3851
+ case "bottom": {
3852
+ tickTransform = d3_svg_axisX;
3853
+ subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
3854
+ tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize);
3855
+ tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle");
3856
+ pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
3857
+ break;
3858
+ }
3859
+ case "top": {
3860
+ tickTransform = d3_svg_axisX;
3861
+ subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
3862
+ tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize);
3863
+ tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle");
3864
+ pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
3865
+ break;
3866
+ }
3867
+ case "left": {
3868
+ tickTransform = d3_svg_axisY;
3869
+ subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
3870
+ tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0);
3871
+ tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end");
3872
+ pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
3873
+ break;
3874
+ }
3875
+ case "right": {
3876
+ tickTransform = d3_svg_axisY;
3877
+ subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
3878
+ tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0);
3879
+ tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start");
3880
+ pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
3881
+ break;
3882
+ }
3883
+ }
3884
+
3885
+ // For quantitative scales:
3886
+ // - enter new ticks from the old scale
3887
+ // - exit old ticks to the new scale
3888
+ if (scale.ticks) {
3889
+ tickEnter.call(tickTransform, scale0);
3890
+ tickUpdate.call(tickTransform, scale1);
3891
+ tickExit.call(tickTransform, scale1);
3892
+ subtickEnter.call(tickTransform, scale0);
3893
+ subtickUpdate.call(tickTransform, scale1);
3894
+ subtickExit.call(tickTransform, scale1);
3895
+ }
3896
+
3897
+ // For ordinal scales:
3898
+ // - any entering ticks are undefined in the old scale
3899
+ // - any exiting ticks are undefined in the new scale
3900
+ // Therefore, we only need to transition updating ticks.
3901
+ else {
3902
+ var dx = scale1.rangeBand() / 2, x = function(d) { return scale1(d) + dx; };
3903
+ tickEnter.call(tickTransform, x);
3904
+ tickUpdate.call(tickTransform, x);
3905
+ }
3906
+ });
3907
+ }
3908
+
3909
+ axis.scale = function(x) {
3910
+ if (!arguments.length) return scale;
3911
+ scale = x;
3912
+ return axis;
3913
+ };
3914
+
3915
+ axis.orient = function(x) {
3916
+ if (!arguments.length) return orient;
3917
+ orient = x;
3918
+ return axis;
3919
+ };
3920
+
3921
+ axis.ticks = function() {
3922
+ if (!arguments.length) return tickArguments_;
3923
+ tickArguments_ = arguments;
3924
+ return axis;
3925
+ };
3926
+
3927
+ axis.tickFormat = function(x) {
3928
+ if (!arguments.length) return tickFormat_;
3929
+ tickFormat_ = x;
3930
+ return axis;
3931
+ };
3932
+
3933
+ axis.tickSize = function(x, y, z) {
3934
+ if (!arguments.length) return tickMajorSize;
3935
+ var n = arguments.length - 1;
3936
+ tickMajorSize = +x;
3937
+ tickMinorSize = n > 1 ? +y : tickMajorSize;
3938
+ tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
3939
+ return axis;
3940
+ };
3941
+
3942
+ axis.tickPadding = function(x) {
3943
+ if (!arguments.length) return tickPadding;
3944
+ tickPadding = +x;
3945
+ return axis;
3946
+ };
3947
+
3948
+ axis.tickSubdivide = function(x) {
3949
+ if (!arguments.length) return tickSubdivide;
3950
+ tickSubdivide = +x;
3951
+ return axis;
3952
+ };
3953
+
3954
+ return axis;
3955
+ };
3956
+
3957
+ function d3_svg_axisX(selection, x) {
3958
+ selection.attr("transform", function(d) { return "translate(" + x(d) + ",0)"; });
3959
+ }
3960
+
3961
+ function d3_svg_axisY(selection, y) {
3962
+ selection.attr("transform", function(d) { return "translate(0," + y(d) + ")"; });
3963
+ }
3964
+
3965
+ function d3_svg_axisSubdivide(scale, ticks, m) {
3966
+ subticks = [];
3967
+ if (m && ticks.length > 1) {
3968
+ var extent = d3_scaleExtent(scale.domain()),
3969
+ subticks,
3970
+ i = -1,
3971
+ n = ticks.length,
3972
+ d = (ticks[1] - ticks[0]) / ++m,
3973
+ j,
3974
+ v;
3975
+ while (++i < n) {
3976
+ for (j = m; --j > 0;) {
3977
+ if ((v = +ticks[i] - j * d) >= extent[0]) {
3978
+ subticks.push(v);
3979
+ }
3980
+ }
3981
+ }
3982
+ for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1];) {
3983
+ subticks.push(v);
3984
+ }
3985
+ }
3986
+ return subticks;
3987
+ }
3988
+ d3.svg.brush = function() {
3989
+ var event = d3.dispatch("brushstart", "brush", "brushend"),
3990
+ x, // x-scale, optional
3991
+ y, // y-scale, optional
3992
+ extent = [[0, 0], [0, 0]]; // [x0, y0], [x1, y1]
3993
+
3994
+ function brush(g) {
3995
+ var resizes = x && y ? ["n", "e", "s", "w", "nw", "ne", "se", "sw"]
3996
+ : x ? ["e", "w"]
3997
+ : y ? ["n", "s"]
3998
+ : [];
3999
+
4000
+ g.each(function() {
4001
+ var g = d3.select(this).on("mousedown.brush", down),
4002
+ bg = g.selectAll(".background").data([,]),
4003
+ fg = g.selectAll(".extent").data([,]),
4004
+ tz = g.selectAll(".resize").data(resizes, String),
4005
+ e;
4006
+
4007
+ // An invisible, mouseable area for starting a new brush.
4008
+ bg.enter().append("rect")
4009
+ .attr("class", "background")
4010
+ .style("visibility", "hidden")
4011
+ .style("pointer-events", "all")
4012
+ .style("cursor", "crosshair");
4013
+
4014
+ // The visible brush extent; style this as you like!
4015
+ fg.enter().append("rect")
4016
+ .attr("class", "extent")
4017
+ .style("cursor", "move");
4018
+
4019
+ // More invisible rects for resizing the extent.
4020
+ tz.enter().append("rect")
4021
+ .attr("class", function(d) { return "resize " + d; })
4022
+ .attr("width", 6)
4023
+ .attr("height", 6)
4024
+ .style("visibility", "hidden")
4025
+ .style("pointer-events", brush.empty() ? "none" : "all")
4026
+ .style("cursor", function(d) { return d3_svg_brushCursor[d]; });
4027
+
4028
+ // Remove any superfluous resizers.
4029
+ tz.exit().remove();
4030
+
4031
+ // Initialize the background to fill the defined range.
4032
+ // If the range isn't defined, you can post-process.
4033
+ if (x) {
4034
+ e = d3_scaleRange(x);
4035
+ bg.attr("x", e[0]).attr("width", e[1] - e[0]);
4036
+ d3_svg_brushRedrawX(g, extent);
4037
+ }
4038
+ if (y) {
4039
+ e = d3_scaleRange(y);
4040
+ bg.attr("y", e[0]).attr("height", e[1] - e[0]);
4041
+ d3_svg_brushRedrawY(g, extent);
4042
+ }
4043
+ });
4044
+ }
4045
+
4046
+ function down() {
4047
+ var target = d3.select(d3.event.target);
4048
+
4049
+ // Store some global state for the duration of the brush gesture.
4050
+ d3_svg_brush = brush;
4051
+ d3_svg_brushTarget = this;
4052
+ d3_svg_brushExtent = extent;
4053
+ d3_svg_brushOffset = d3.svg.mouse(d3_svg_brushTarget);
4054
+
4055
+ // If the extent was clicked on, drag rather than brush;
4056
+ // store the offset between the mouse and extent origin instead.
4057
+ if (d3_svg_brushDrag = target.classed("extent")) {
4058
+ d3_svg_brushOffset[0] = extent[0][0] - d3_svg_brushOffset[0];
4059
+ d3_svg_brushOffset[1] = extent[0][1] - d3_svg_brushOffset[1];
4060
+ }
4061
+
4062
+ // If a resizer was clicked on, record which side is to be resized.
4063
+ // Also, set the offset to the opposite side.
4064
+ else if (target.classed("resize")) {
4065
+ d3_svg_brushResize = d3.event.target.__data__;
4066
+ d3_svg_brushOffset[0] = extent[+/w$/.test(d3_svg_brushResize)][0];
4067
+ d3_svg_brushOffset[1] = extent[+/^n/.test(d3_svg_brushResize)][1];
4068
+ }
4069
+
4070
+ // If the ALT key is down when starting a brush, the center is at the mouse.
4071
+ else if (d3.event.altKey) {
4072
+ d3_svg_brushCenter = d3_svg_brushOffset.slice();
4073
+ }
4074
+
4075
+ // Restrict which dimensions are resized.
4076
+ d3_svg_brushX = !/^(n|s)$/.test(d3_svg_brushResize) && x;
4077
+ d3_svg_brushY = !/^(e|w)$/.test(d3_svg_brushResize) && y;
4078
+
4079
+ // Notify listeners.
4080
+ d3_svg_brushDispatch = dispatcher(this, arguments);
4081
+ d3_svg_brushDispatch("brushstart");
4082
+ d3_svg_brushMove();
4083
+ d3_eventCancel();
4084
+ }
4085
+
4086
+ function dispatcher(that, argumentz) {
4087
+ return function(type) {
4088
+ var e = d3.event;
4089
+ try {
4090
+ d3.event = {type: type, target: brush};
4091
+ event[type].apply(that, argumentz);
4092
+ } finally {
4093
+ d3.event = e;
4094
+ }
4095
+ };
4096
+ }
4097
+
4098
+ brush.x = function(z) {
4099
+ if (!arguments.length) return x;
4100
+ x = z;
4101
+ return brush;
4102
+ };
4103
+
4104
+ brush.y = function(z) {
4105
+ if (!arguments.length) return y;
4106
+ y = z;
4107
+ return brush;
4108
+ };
4109
+
4110
+ brush.extent = function(z) {
4111
+ var x0, x1, y0, y1, t;
4112
+
4113
+ // Invert the pixel extent to data-space.
4114
+ if (!arguments.length) {
4115
+ if (x) {
4116
+ x0 = extent[0][0], x1 = extent[1][0];
4117
+ if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
4118
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
4119
+ }
4120
+ if (y) {
4121
+ y0 = extent[0][1], y1 = extent[1][1];
4122
+ if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
4123
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
4124
+ }
4125
+ return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1];
4126
+ }
4127
+
4128
+ // Scale the data-space extent to pixels.
4129
+ if (x) {
4130
+ x0 = z[0], x1 = z[1];
4131
+ if (y) x0 = x0[0], x1 = x1[0];
4132
+ if (x.invert) x0 = x(x0), x1 = x(x1);
4133
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
4134
+ extent[0][0] = x0, extent[1][0] = x1;
4135
+ }
4136
+ if (y) {
4137
+ y0 = z[0], y1 = z[1];
4138
+ if (x) y0 = y0[1], y1 = y1[1];
4139
+ if (y.invert) y0 = y(y0), y1 = y(y1);
4140
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
4141
+ extent[0][1] = y0, extent[1][1] = y1;
4142
+ }
4143
+
4144
+ return brush;
4145
+ };
4146
+
4147
+ brush.clear = function() {
4148
+ extent[0][0] =
4149
+ extent[0][1] =
4150
+ extent[1][0] =
4151
+ extent[1][1] = 0;
4152
+ return brush;
4153
+ };
4154
+
4155
+ brush.empty = function() {
4156
+ return (x && extent[0][0] === extent[1][0])
4157
+ || (y && extent[0][1] === extent[1][1]);
4158
+ };
4159
+
4160
+ d3.select(window)
4161
+ .on("mousemove.brush", d3_svg_brushMove)
4162
+ .on("mouseup.brush", d3_svg_brushUp)
4163
+ .on("keydown.brush", d3_svg_brushKeydown)
4164
+ .on("keyup.brush", d3_svg_brushKeyup);
4165
+
4166
+ return d3.rebind(brush, event, "on");
4167
+ };
4168
+
4169
+ var d3_svg_brush,
4170
+ d3_svg_brushDispatch,
4171
+ d3_svg_brushTarget,
4172
+ d3_svg_brushX,
4173
+ d3_svg_brushY,
4174
+ d3_svg_brushExtent,
4175
+ d3_svg_brushDrag,
4176
+ d3_svg_brushResize,
4177
+ d3_svg_brushCenter,
4178
+ d3_svg_brushOffset;
4179
+
4180
+ function d3_svg_brushRedrawX(g, extent) {
4181
+ g.select(".extent").attr("x", extent[0][0]);
4182
+ g.selectAll(".n,.s,.w,.nw,.sw").attr("x", extent[0][0] - 2);
4183
+ g.selectAll(".e,.ne,.se").attr("x", extent[1][0] - 3);
4184
+ g.selectAll(".extent,.n,.s").attr("width", extent[1][0] - extent[0][0]);
4185
+ }
4186
+
4187
+ function d3_svg_brushRedrawY(g, extent) {
4188
+ g.select(".extent").attr("y", extent[0][1]);
4189
+ g.selectAll(".n,.e,.w,.nw,.ne").attr("y", extent[0][1] - 3);
4190
+ g.selectAll(".s,.se,.sw").attr("y", extent[1][1] - 4);
4191
+ g.selectAll(".extent,.e,.w").attr("height", extent[1][1] - extent[0][1]);
4192
+ }
4193
+
4194
+ function d3_svg_brushKeydown() {
4195
+ if (d3.event.keyCode == 32 && d3_svg_brushTarget && !d3_svg_brushDrag) {
4196
+ d3_svg_brushCenter = null;
4197
+ d3_svg_brushOffset[0] -= d3_svg_brushExtent[1][0];
4198
+ d3_svg_brushOffset[1] -= d3_svg_brushExtent[1][1];
4199
+ d3_svg_brushDrag = 2;
4200
+ d3_eventCancel();
4201
+ }
4202
+ }
4203
+
4204
+ function d3_svg_brushKeyup() {
4205
+ if (d3.event.keyCode == 32 && d3_svg_brushDrag == 2) {
4206
+ d3_svg_brushOffset[0] += d3_svg_brushExtent[1][0];
4207
+ d3_svg_brushOffset[1] += d3_svg_brushExtent[1][1];
4208
+ d3_svg_brushDrag = 0;
4209
+ d3_eventCancel();
4210
+ }
4211
+ }
4212
+
4213
+ function d3_svg_brushMove() {
4214
+ if (d3_svg_brushOffset) {
4215
+ var mouse = d3.svg.mouse(d3_svg_brushTarget),
4216
+ g = d3.select(d3_svg_brushTarget);
4217
+
4218
+ if (!d3_svg_brushDrag) {
4219
+
4220
+ // If needed, determine the center from the current extent.
4221
+ if (d3.event.altKey) {
4222
+ if (!d3_svg_brushCenter) {
4223
+ d3_svg_brushCenter = [
4224
+ (d3_svg_brushExtent[0][0] + d3_svg_brushExtent[1][0]) / 2,
4225
+ (d3_svg_brushExtent[0][1] + d3_svg_brushExtent[1][1]) / 2
4226
+ ];
4227
+ }
4228
+
4229
+ // Update the offset, for when the ALT key is released.
4230
+ d3_svg_brushOffset[0] = d3_svg_brushExtent[+(mouse[0] < d3_svg_brushCenter[0])][0];
4231
+ d3_svg_brushOffset[1] = d3_svg_brushExtent[+(mouse[1] < d3_svg_brushCenter[1])][1];
4232
+ }
4233
+
4234
+ // When the ALT key is released, we clear the center.
4235
+ else d3_svg_brushCenter = null;
4236
+ }
4237
+
4238
+ // Update the brush extent for each dimension.
4239
+ if (d3_svg_brushX) {
4240
+ d3_svg_brushMove1(mouse, d3_svg_brushX, 0);
4241
+ d3_svg_brushRedrawX(g, d3_svg_brushExtent);
4242
+ }
4243
+ if (d3_svg_brushY) {
4244
+ d3_svg_brushMove1(mouse, d3_svg_brushY, 1);
4245
+ d3_svg_brushRedrawY(g, d3_svg_brushExtent);
4246
+ }
4247
+
4248
+ // Notify listeners.
4249
+ d3_svg_brushDispatch("brush");
4250
+ }
4251
+ }
4252
+
4253
+ function d3_svg_brushMove1(mouse, scale, i) {
4254
+ var range = d3_scaleRange(scale),
4255
+ r0 = range[0],
4256
+ r1 = range[1],
4257
+ offset = d3_svg_brushOffset[i],
4258
+ size = d3_svg_brushExtent[1][i] - d3_svg_brushExtent[0][i],
4259
+ min,
4260
+ max;
4261
+
4262
+ // When dragging, reduce the range by the extent size and offset.
4263
+ if (d3_svg_brushDrag) {
4264
+ r0 -= offset;
4265
+ r1 -= size + offset;
4266
+ }
4267
+
4268
+ // Clamp the mouse so that the extent fits within the range extent.
4269
+ min = Math.max(r0, Math.min(r1, mouse[i]));
4270
+
4271
+ // Compute the new extent bounds.
4272
+ if (d3_svg_brushDrag) {
4273
+ max = (min += offset) + size;
4274
+ } else {
4275
+
4276
+ // If the ALT key is pressed, then preserve the center of the extent.
4277
+ if (d3_svg_brushCenter) offset = Math.max(r0, Math.min(r1, 2 * d3_svg_brushCenter[i] - min));
4278
+
4279
+ // Compute the min and max of the offset and mouse.
4280
+ if (offset < min) {
4281
+ max = min;
4282
+ min = offset;
4283
+ } else {
4284
+ max = offset;
4285
+ }
4286
+ }
4287
+
4288
+ // Update the stored bounds.
4289
+ d3_svg_brushExtent[0][i] = min;
4290
+ d3_svg_brushExtent[1][i] = max;
4291
+ }
4292
+
4293
+ function d3_svg_brushUp() {
4294
+ if (d3_svg_brushOffset) {
4295
+ d3_svg_brushMove();
4296
+ d3.select(d3_svg_brushTarget).selectAll(".resize").style("pointer-events", d3_svg_brush.empty() ? "none" : "all");
4297
+ d3_svg_brushDispatch("brushend");
4298
+ d3_svg_brush =
4299
+ d3_svg_brushDispatch =
4300
+ d3_svg_brushTarget =
4301
+ d3_svg_brushX =
4302
+ d3_svg_brushY =
4303
+ d3_svg_brushExtent =
4304
+ d3_svg_brushDrag =
4305
+ d3_svg_brushResize =
4306
+ d3_svg_brushCenter =
4307
+ d3_svg_brushOffset = null;
4308
+ d3_eventCancel();
4309
+ }
4310
+ }
4311
+
4312
+ var d3_svg_brushCursor = {
4313
+ n: "ns-resize",
4314
+ e: "ew-resize",
4315
+ s: "ns-resize",
4316
+ w: "ew-resize",
4317
+ nw: "nwse-resize",
4318
+ ne: "nesw-resize",
4319
+ se: "nwse-resize",
4320
+ sw: "nesw-resize"
4321
+ };
4322
+ d3.behavior = {};
4323
+ // TODO Track touch points by identifier.
4324
+
4325
+ d3.behavior.drag = function() {
4326
+ var event = d3.dispatch("drag", "dragstart", "dragend"),
4327
+ origin = null;
4328
+
4329
+ function drag() {
4330
+ this
4331
+ .on("mousedown.drag", mousedown)
4332
+ .on("touchstart.drag", mousedown);
4333
+
4334
+ d3.select(window)
4335
+ .on("mousemove.drag", d3_behavior_dragMove)
4336
+ .on("touchmove.drag", d3_behavior_dragMove)
4337
+ .on("mouseup.drag", d3_behavior_dragUp, true)
4338
+ .on("touchend.drag", d3_behavior_dragUp, true)
4339
+ .on("click.drag", d3_behavior_dragClick, true);
4340
+ }
4341
+
4342
+ // snapshot the local context for subsequent dispatch
4343
+ function start() {
4344
+ d3_behavior_dragEvent = event;
4345
+ d3_behavior_dragEventTarget = d3.event.target;
4346
+ d3_behavior_dragTarget = this;
4347
+ d3_behavior_dragArguments = arguments;
4348
+ d3_behavior_dragOrigin = d3_behavior_dragPoint();
4349
+ if (origin) {
4350
+ d3_behavior_dragOffset = origin.apply(d3_behavior_dragTarget, d3_behavior_dragArguments);
4351
+ d3_behavior_dragOffset = [d3_behavior_dragOffset.x - d3_behavior_dragOrigin[0], d3_behavior_dragOffset.y - d3_behavior_dragOrigin[1]];
4352
+ } else {
4353
+ d3_behavior_dragOffset = [0, 0];
4354
+ }
4355
+ d3_behavior_dragMoved = 0;
4356
+ }
4357
+
4358
+ function mousedown() {
4359
+ start.apply(this, arguments);
4360
+ d3_behavior_dragDispatch("dragstart");
4361
+ }
4362
+
4363
+ drag.origin = function(x) {
4364
+ if (!arguments.length) return origin;
4365
+ origin = x;
4366
+ return drag;
4367
+ };
4368
+
4369
+ return d3.rebind(drag, event, "on");
4370
+ };
4371
+
4372
+ var d3_behavior_dragEvent,
4373
+ d3_behavior_dragEventTarget,
4374
+ d3_behavior_dragTarget,
4375
+ d3_behavior_dragArguments,
4376
+ d3_behavior_dragOffset,
4377
+ d3_behavior_dragOrigin,
4378
+ d3_behavior_dragMoved;
4379
+
4380
+ function d3_behavior_dragDispatch(type) {
4381
+ var p = d3_behavior_dragPoint(),
4382
+ o = d3.event,
4383
+ e = d3.event = {type: type};
4384
+
4385
+ if (p) {
4386
+ e.x = p[0] + d3_behavior_dragOffset[0];
4387
+ e.y = p[1] + d3_behavior_dragOffset[1];
4388
+ e.dx = p[0] - d3_behavior_dragOrigin[0];
4389
+ e.dy = p[1] - d3_behavior_dragOrigin[1];
4390
+ d3_behavior_dragMoved |= e.dx | e.dy;
4391
+ d3_behavior_dragOrigin = p;
4392
+ }
4393
+
4394
+ try {
4395
+ d3_behavior_dragEvent[type].apply(d3_behavior_dragTarget, d3_behavior_dragArguments);
4396
+ } finally {
4397
+ d3.event = o;
4398
+ }
4399
+
4400
+ o.stopPropagation();
4401
+ o.preventDefault();
4402
+ }
4403
+
4404
+ function d3_behavior_dragPoint() {
4405
+ var p = d3_behavior_dragTarget.parentNode,
4406
+ t = d3.event.changedTouches;
4407
+ return p && (t
4408
+ ? d3.svg.touches(p, t)[0]
4409
+ : d3.svg.mouse(p));
4410
+ }
4411
+
4412
+ function d3_behavior_dragMove() {
4413
+ if (!d3_behavior_dragTarget) return;
4414
+ var parent = d3_behavior_dragTarget.parentNode;
4415
+
4416
+ // O NOES! The drag element was removed from the DOM.
4417
+ if (!parent) return d3_behavior_dragUp();
4418
+
4419
+ d3_behavior_dragDispatch("drag");
4420
+ d3_eventCancel();
4421
+ }
4422
+
4423
+ function d3_behavior_dragUp() {
4424
+ if (!d3_behavior_dragTarget) return;
4425
+ d3_behavior_dragDispatch("dragend");
4426
+
4427
+ // If the node was moved, prevent the mouseup from propagating.
4428
+ // Also prevent the subsequent click from propagating (e.g., for anchors).
4429
+ if (d3_behavior_dragMoved) {
4430
+ d3_eventCancel();
4431
+ d3_behavior_dragMoved = d3.event.target === d3_behavior_dragEventTarget;
4432
+ }
4433
+
4434
+ d3_behavior_dragEvent =
4435
+ d3_behavior_dragEventTarget =
4436
+ d3_behavior_dragTarget =
4437
+ d3_behavior_dragArguments =
4438
+ d3_behavior_dragOffset =
4439
+ d3_behavior_dragOrigin = null;
4440
+ }
4441
+
4442
+ function d3_behavior_dragClick() {
4443
+ if (d3_behavior_dragMoved) {
4444
+ d3_eventCancel();
4445
+ d3_behavior_dragMoved = 0;
4446
+ }
4447
+ }
4448
+ // TODO unbind zoom behavior?
4449
+ d3.behavior.zoom = function() {
4450
+ var xyz = [0, 0, 0],
4451
+ event = d3.dispatch("zoom"),
4452
+ extent = d3_behavior_zoomInfiniteExtent;
4453
+
4454
+ function zoom() {
4455
+ this
4456
+ .on("mousedown.zoom", mousedown)
4457
+ .on("mousewheel.zoom", mousewheel)
4458
+ .on("DOMMouseScroll.zoom", mousewheel)
4459
+ .on("dblclick.zoom", dblclick)
4460
+ .on("touchstart.zoom", touchstart);
4461
+
4462
+ d3.select(window)
4463
+ .on("mousemove.zoom", d3_behavior_zoomMousemove)
4464
+ .on("mouseup.zoom", d3_behavior_zoomMouseup)
4465
+ .on("touchmove.zoom", d3_behavior_zoomTouchmove)
4466
+ .on("touchend.zoom", d3_behavior_zoomTouchup)
4467
+ .on("click.zoom", d3_behavior_zoomClick, true);
4468
+ }
4469
+
4470
+ // snapshot the local context for subsequent dispatch
4471
+ function start() {
4472
+ d3_behavior_zoomXyz = xyz;
4473
+ d3_behavior_zoomExtent = extent;
4474
+ d3_behavior_zoomDispatch = event.zoom;
4475
+ d3_behavior_zoomEventTarget = d3.event.target;
4476
+ d3_behavior_zoomTarget = this;
4477
+ d3_behavior_zoomArguments = arguments;
4478
+ }
4479
+
4480
+ function mousedown() {
4481
+ start.apply(this, arguments);
4482
+ d3_behavior_zoomPanning = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget));
4483
+ d3_behavior_zoomMoved = 0;
4484
+ d3.event.preventDefault();
4485
+ window.focus();
4486
+ }
4487
+
4488
+ // store starting mouse location
4489
+ function mousewheel() {
4490
+ start.apply(this, arguments);
4491
+ if (!d3_behavior_zoomZooming) d3_behavior_zoomZooming = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget));
4492
+ d3_behavior_zoomTo(d3_behavior_zoomDelta() + xyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomZooming);
4493
+ }
4494
+
4495
+ function dblclick() {
4496
+ start.apply(this, arguments);
4497
+ var mouse = d3.svg.mouse(d3_behavior_zoomTarget);
4498
+ d3_behavior_zoomTo(d3.event.shiftKey ? Math.ceil(xyz[2] - 1) : Math.floor(xyz[2] + 1), mouse, d3_behavior_zoomLocation(mouse));
4499
+ }
4500
+
4501
+ // doubletap detection
4502
+ function touchstart() {
4503
+ start.apply(this, arguments);
4504
+ var touches = d3_behavior_zoomTouchup(),
4505
+ touch,
4506
+ now = Date.now();
4507
+ if ((touches.length === 1) && (now - d3_behavior_zoomLast < 300)) {
4508
+ d3_behavior_zoomTo(1 + Math.floor(xyz[2]), touch = touches[0], d3_behavior_zoomLocations[touch.identifier]);
4509
+ }
4510
+ d3_behavior_zoomLast = now;
4511
+ }
4512
+
4513
+ zoom.extent = function(x) {
4514
+ if (!arguments.length) return extent;
4515
+ extent = x == null ? d3_behavior_zoomInfiniteExtent : x;
4516
+ return zoom;
4517
+ };
4518
+
4519
+ return d3.rebind(zoom, event, "on");
4520
+ };
4521
+
4522
+ var d3_behavior_zoomDiv,
4523
+ d3_behavior_zoomPanning,
4524
+ d3_behavior_zoomZooming,
4525
+ d3_behavior_zoomLocations = {}, // identifier -> location
4526
+ d3_behavior_zoomLast = 0,
4527
+ d3_behavior_zoomXyz,
4528
+ d3_behavior_zoomExtent,
4529
+ d3_behavior_zoomDispatch,
4530
+ d3_behavior_zoomEventTarget,
4531
+ d3_behavior_zoomTarget,
4532
+ d3_behavior_zoomArguments,
4533
+ d3_behavior_zoomMoved;
4534
+
4535
+ function d3_behavior_zoomLocation(point) {
4536
+ return [
4537
+ point[0] - d3_behavior_zoomXyz[0],
4538
+ point[1] - d3_behavior_zoomXyz[1],
4539
+ d3_behavior_zoomXyz[2]
4540
+ ];
4541
+ }
4542
+
4543
+ // detect the pixels that would be scrolled by this wheel event
4544
+ function d3_behavior_zoomDelta() {
4545
+
4546
+ // mousewheel events are totally broken!
4547
+ // https://bugs.webkit.org/show_bug.cgi?id=40441
4548
+ // not only that, but Chrome and Safari differ in re. to acceleration!
4549
+ if (!d3_behavior_zoomDiv) {
4550
+ d3_behavior_zoomDiv = d3.select("body").append("div")
4551
+ .style("visibility", "hidden")
4552
+ .style("top", 0)
4553
+ .style("height", 0)
4554
+ .style("width", 0)
4555
+ .style("overflow-y", "scroll")
4556
+ .append("div")
4557
+ .style("height", "2000px")
4558
+ .node().parentNode;
4559
+ }
4560
+
4561
+ var e = d3.event, delta;
4562
+ try {
4563
+ d3_behavior_zoomDiv.scrollTop = 1000;
4564
+ d3_behavior_zoomDiv.dispatchEvent(e);
4565
+ delta = 1000 - d3_behavior_zoomDiv.scrollTop;
4566
+ } catch (error) {
4567
+ delta = e.wheelDelta || (-e.detail * 5);
4568
+ }
4569
+
4570
+ return delta * .005;
4571
+ }
4572
+
4573
+ // Note: Since we don't rotate, it's possible for the touches to become
4574
+ // slightly detached from their original positions. Thus, we recompute the
4575
+ // touch points on touchend as well as touchstart!
4576
+ function d3_behavior_zoomTouchup() {
4577
+ var touches = d3.svg.touches(d3_behavior_zoomTarget),
4578
+ i = -1,
4579
+ n = touches.length,
4580
+ touch;
4581
+ while (++i < n) d3_behavior_zoomLocations[(touch = touches[i]).identifier] = d3_behavior_zoomLocation(touch);
4582
+ return touches;
4583
+ }
4584
+
4585
+ function d3_behavior_zoomTouchmove() {
4586
+ var touches = d3.svg.touches(d3_behavior_zoomTarget);
4587
+ switch (touches.length) {
4588
+
4589
+ // single-touch pan
4590
+ case 1: {
4591
+ var touch = touches[0];
4592
+ d3_behavior_zoomTo(d3_behavior_zoomXyz[2], touch, d3_behavior_zoomLocations[touch.identifier]);
4593
+ break;
4594
+ }
4595
+
4596
+ // double-touch pan + zoom
4597
+ case 2: {
4598
+ var p0 = touches[0],
4599
+ p1 = touches[1],
4600
+ p2 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2],
4601
+ l0 = d3_behavior_zoomLocations[p0.identifier],
4602
+ l1 = d3_behavior_zoomLocations[p1.identifier],
4603
+ l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2, l0[2]];
4604
+ d3_behavior_zoomTo(Math.log(d3.event.scale) / Math.LN2 + l0[2], p2, l2);
4605
+ break;
4606
+ }
4607
+ }
4608
+ }
4609
+
4610
+ function d3_behavior_zoomMousemove() {
4611
+ d3_behavior_zoomZooming = null;
4612
+ if (d3_behavior_zoomPanning) {
4613
+ d3_behavior_zoomMoved = 1;
4614
+ d3_behavior_zoomTo(d3_behavior_zoomXyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomPanning);
4615
+ }
4616
+ }
4617
+
4618
+ function d3_behavior_zoomMouseup() {
4619
+ if (d3_behavior_zoomPanning) {
4620
+ if (d3_behavior_zoomMoved) {
4621
+ d3_eventCancel();
4622
+ d3_behavior_zoomMoved = d3_behavior_zoomEventTarget === d3.event.target;
4623
+ }
4624
+
4625
+ d3_behavior_zoomXyz =
4626
+ d3_behavior_zoomExtent =
4627
+ d3_behavior_zoomDispatch =
4628
+ d3_behavior_zoomEventTarget =
4629
+ d3_behavior_zoomTarget =
4630
+ d3_behavior_zoomArguments =
4631
+ d3_behavior_zoomPanning = null;
4632
+ }
4633
+ }
4634
+
4635
+ function d3_behavior_zoomClick() {
4636
+ if (d3_behavior_zoomMoved) {
4637
+ d3_eventCancel();
4638
+ d3_behavior_zoomMoved = 0;
4639
+ }
4640
+ }
4641
+
4642
+ function d3_behavior_zoomTo(z, x0, x1) {
4643
+ z = d3_behavior_zoomExtentClamp(z, 2);
4644
+ var j = Math.pow(2, d3_behavior_zoomXyz[2]),
4645
+ k = Math.pow(2, z),
4646
+ K = Math.pow(2, (d3_behavior_zoomXyz[2] = z) - x1[2]),
4647
+ x_ = d3_behavior_zoomXyz[0],
4648
+ y_ = d3_behavior_zoomXyz[1],
4649
+ x = d3_behavior_zoomXyz[0] = d3_behavior_zoomExtentClamp((x0[0] - x1[0] * K), 0, k),
4650
+ y = d3_behavior_zoomXyz[1] = d3_behavior_zoomExtentClamp((x0[1] - x1[1] * K), 1, k),
4651
+ o = d3.event; // Events can be reentrant (e.g., focus).
4652
+
4653
+ d3.event = {
4654
+ scale: k,
4655
+ translate: [x, y],
4656
+ transform: function(sx, sy) {
4657
+ if (sx) transform(sx, x_, x);
4658
+ if (sy) transform(sy, y_, y);
4659
+ }
4660
+ };
4661
+
4662
+ function transform(scale, a, b) {
4663
+ scale.domain(scale.range().map(function(v) { return scale.invert(((v - b) * j) / k + a); }));
4664
+ }
4665
+
4666
+ try {
4667
+ d3_behavior_zoomDispatch.apply(d3_behavior_zoomTarget, d3_behavior_zoomArguments);
4668
+ } finally {
4669
+ d3.event = o;
4670
+ }
4671
+
4672
+ o.preventDefault();
4673
+ }
4674
+
4675
+ var d3_behavior_zoomInfiniteExtent = [
4676
+ [-Infinity, Infinity],
4677
+ [-Infinity, Infinity],
4678
+ [-Infinity, Infinity]
4679
+ ];
4680
+
4681
+ function d3_behavior_zoomExtentClamp(x, i, k) {
4682
+ var range = d3_behavior_zoomExtent[i],
4683
+ r0 = range[0],
4684
+ r1 = range[1];
4685
+ return arguments.length === 3
4686
+ ? Math.max(r1 * (r1 === Infinity ? -Infinity : 1 / k - 1),
4687
+ Math.min(r0 === -Infinity ? Infinity : r0, x / k)) * k
4688
+ : Math.max(r0, Math.min(r1, x));
4689
+ }
4690
+ })();