mdarray-sol 0.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +35 -0
- data/LICENSE.txt~ +73 -0
- data/README.md +140 -0
- data/README.md~ +290 -0
- data/Rakefile +80 -0
- data/config.rb +223 -0
- data/doc/Nashorn.html +1406 -0
- data/doc/Sol.html +692 -0
- data/doc/Sol/BarChart.html +181 -0
- data/doc/Sol/BaseChart.html +799 -0
- data/doc/Sol/Bootstrap.html +1134 -0
- data/doc/Sol/Bridge.html +448 -0
- data/doc/Sol/Chart.html +1162 -0
- data/doc/Sol/CoordinateChart.html +673 -0
- data/doc/Sol/DCFX.html +807 -0
- data/doc/Sol/Dashboard.html +1967 -0
- data/doc/Sol/ExecMessages.html +332 -0
- data/doc/Sol/GuiCommunication.html +230 -0
- data/doc/Sol/Interval.html +1213 -0
- data/doc/Sol/JS.html +448 -0
- data/doc/Sol/LineChart.html +344 -0
- data/doc/Sol/LinearScale.html +334 -0
- data/doc/Sol/Margins.html +219 -0
- data/doc/Sol/OrdinalScale.html +263 -0
- data/doc/Sol/ReadBuffer.html +302 -0
- data/doc/Sol/Scale.html +462 -0
- data/doc/Sol/Stack.html +199 -0
- data/doc/Sol/TimeScale.html +396 -0
- data/doc/_index.html +362 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +95 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +95 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +849 -0
- data/doc/top-level-namespace.html +135 -0
- data/examples/bar_chart/bar_chart.rb +268 -0
- data/examples/bar_plot.rb +96 -0
- data/examples/charts/area.rb +25 -0
- data/examples/charts/area_script.rb +69 -0
- data/examples/charts/env.rb +8 -0
- data/examples/charts/monthly-move.csv +6725 -0
- data/examples/charts/morley.csv +101 -0
- data/examples/charts/morley2.csv +81 -0
- data/examples/charts/morley3.csv +121 -0
- data/examples/d3_tutorial.rb +98 -0
- data/examples/sc_plot.rb +57 -0
- data/examples/scatterplot/axes.rb +111 -0
- data/examples/scatterplot/scatterplot.rb +221 -0
- data/examples/us_states/map.rb +90 -0
- data/examples/us_states/us-ag-productivity2004.csv +49 -0
- data/examples/us_states/us-cities.csv +51 -0
- data/examples/util/linear_scale.rb +83 -0
- data/examples/util/ordinal_scale.rb +72 -0
- data/init.rb +39 -0
- data/lib/jx/array_handler.js +70 -0
- data/lib/jx/callback.rb +255 -0
- data/lib/jx/hash_handler.js +87 -0
- data/lib/jx/irbobject.rb +121 -0
- data/lib/jx/js.rb +442 -0
- data/lib/jx/js_array.rb +31 -0
- data/lib/jx/js_hash.rb +76 -0
- data/lib/jx/js_init.rb +62 -0
- data/lib/jx/jsarray.rb +66 -0
- data/lib/jx/jsfunction.rb +73 -0
- data/lib/jx/jsobject.rb +188 -0
- data/lib/jx/jsstyle_sheet.rb +231 -0
- data/lib/jx/jsundefined.rb +46 -0
- data/lib/jx/proxy_array.rb +62 -0
- data/lib/jx/rbobject.rb +80 -0
- data/lib/jx/ruby_proxy.js +176 -0
- data/lib/jx/ruby_rich.js +70 -0
- data/lib/jx/sol.rb +109 -0
- data/lib/mdarray-sol.rb +34 -0
- data/lib/mdarray/jsmdarray.rb +39 -0
- data/lib/ruby_rich/bootstrap.rb +230 -0
- data/lib/ruby_rich/config.html +22 -0
- data/lib/ruby_rich/dashboard.rb +299 -0
- data/lib/ruby_rich/ruby_rich.rb +120 -0
- data/lib/sol/bar_chart.rb +35 -0
- data/lib/sol/base_chart.rb +148 -0
- data/lib/sol/chart.rb +138 -0
- data/lib/sol/coordinate_chart.rb +128 -0
- data/lib/sol/interval.rb +156 -0
- data/lib/sol/line_chart.rb +58 -0
- data/lib/sol/margins.rb +52 -0
- data/lib/sol/scale.rb +212 -0
- data/lib/sol/stack.rb +44 -0
- data/node_modules/bootstrap/Gruntfile.js +533 -0
- data/node_modules/bootstrap/dist/js/bootstrap.js +2363 -0
- data/node_modules/bootstrap/dist/js/bootstrap.min.js +7 -0
- data/node_modules/bootstrap/dist/js/npm.js +13 -0
- data/node_modules/bootstrap/grunt/bs-commonjs-generator.js +30 -0
- data/node_modules/bootstrap/grunt/bs-glyphicons-data-generator.js +42 -0
- data/node_modules/bootstrap/grunt/bs-lessdoc-parser.js +237 -0
- data/node_modules/bootstrap/grunt/bs-raw-files-generator.js +44 -0
- data/node_modules/bootstrap/js/affix.js +162 -0
- data/node_modules/bootstrap/js/alert.js +94 -0
- data/node_modules/bootstrap/js/button.js +120 -0
- data/node_modules/bootstrap/js/carousel.js +237 -0
- data/node_modules/bootstrap/js/collapse.js +211 -0
- data/node_modules/bootstrap/js/dropdown.js +165 -0
- data/node_modules/bootstrap/js/modal.js +337 -0
- data/node_modules/bootstrap/js/popover.js +108 -0
- data/node_modules/bootstrap/js/scrollspy.js +172 -0
- data/node_modules/bootstrap/js/tab.js +155 -0
- data/node_modules/bootstrap/js/tooltip.js +514 -0
- data/node_modules/bootstrap/js/transition.js +59 -0
- data/node_modules/chai/chai.js +6142 -0
- data/node_modules/chai/index.js +1 -0
- data/node_modules/chai/karma.conf.js +28 -0
- data/node_modules/chai/karma.sauce.js +41 -0
- data/node_modules/chai/lib/chai.js +93 -0
- data/node_modules/chai/lib/chai/assertion.js +131 -0
- data/node_modules/chai/lib/chai/config.js +55 -0
- data/node_modules/chai/lib/chai/core/assertions.js +1860 -0
- data/node_modules/chai/lib/chai/interface/assert.js +1645 -0
- data/node_modules/chai/lib/chai/interface/expect.js +34 -0
- data/node_modules/chai/lib/chai/interface/should.js +201 -0
- data/node_modules/chai/lib/chai/utils/addChainableMethod.js +112 -0
- data/node_modules/chai/lib/chai/utils/addMethod.js +44 -0
- data/node_modules/chai/lib/chai/utils/addProperty.js +48 -0
- data/node_modules/chai/lib/chai/utils/expectTypes.js +42 -0
- data/node_modules/chai/lib/chai/utils/flag.js +33 -0
- data/node_modules/chai/lib/chai/utils/getActual.js +20 -0
- data/node_modules/chai/lib/chai/utils/getEnumerableProperties.js +26 -0
- data/node_modules/chai/lib/chai/utils/getMessage.js +51 -0
- data/node_modules/chai/lib/chai/utils/getName.js +22 -0
- data/node_modules/chai/lib/chai/utils/getPathInfo.js +111 -0
- data/node_modules/chai/lib/chai/utils/getPathValue.js +43 -0
- data/node_modules/chai/lib/chai/utils/getProperties.js +36 -0
- data/node_modules/chai/lib/chai/utils/hasProperty.js +64 -0
- data/node_modules/chai/lib/chai/utils/index.js +130 -0
- data/node_modules/chai/lib/chai/utils/inspect.js +335 -0
- data/node_modules/chai/lib/chai/utils/objDisplay.js +50 -0
- data/node_modules/chai/lib/chai/utils/overwriteChainableMethod.js +54 -0
- data/node_modules/chai/lib/chai/utils/overwriteMethod.js +52 -0
- data/node_modules/chai/lib/chai/utils/overwriteProperty.js +55 -0
- data/node_modules/chai/lib/chai/utils/test.js +28 -0
- data/node_modules/chai/lib/chai/utils/transferFlags.js +45 -0
- data/node_modules/chai/node_modules/assertion-error/index.js +116 -0
- data/node_modules/chai/node_modules/deep-eql/index.js +1 -0
- data/node_modules/chai/node_modules/deep-eql/karma.conf.js +20 -0
- data/node_modules/chai/node_modules/deep-eql/lib/eql.js +257 -0
- data/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/index.js +1 -0
- data/node_modules/chai/node_modules/deep-eql/node_modules/type-detect/lib/type.js +142 -0
- data/node_modules/chai/node_modules/type-detect/index.js +1 -0
- data/node_modules/chai/node_modules/type-detect/lib/type.js +134 -0
- data/node_modules/chai/sauce.browsers.js +128 -0
- data/node_modules/dc/Gruntfile.js +437 -0
- data/node_modules/dc/dc.js +10477 -0
- data/node_modules/dc/dc.min.js +23 -0
- data/node_modules/dc/docs/coverage.js +203 -0
- data/node_modules/dc/grunt/format-file-list.js +33 -0
- data/node_modules/dc/index.js +5 -0
- data/node_modules/dc/node_modules/crossfilter2/crossfilter.js +1401 -0
- data/node_modules/dc/node_modules/crossfilter2/crossfilter.min.js +1 -0
- data/node_modules/dc/node_modules/crossfilter2/index.js +1 -0
- data/node_modules/dc/node_modules/crossfilter2/src/array.js +46 -0
- data/node_modules/dc/node_modules/crossfilter2/src/bisect.js +44 -0
- data/node_modules/dc/node_modules/crossfilter2/src/crossfilter.js +872 -0
- data/node_modules/dc/node_modules/crossfilter2/src/filter.js +19 -0
- data/node_modules/dc/node_modules/crossfilter2/src/heap.js +44 -0
- data/node_modules/dc/node_modules/crossfilter2/src/heapselect.js +36 -0
- data/node_modules/dc/node_modules/crossfilter2/src/identity.js +3 -0
- data/node_modules/dc/node_modules/crossfilter2/src/insertionsort.js +18 -0
- data/node_modules/dc/node_modules/crossfilter2/src/null.js +3 -0
- data/node_modules/dc/node_modules/crossfilter2/src/permute.js +8 -0
- data/node_modules/dc/node_modules/crossfilter2/src/quicksort.js +283 -0
- data/node_modules/dc/node_modules/crossfilter2/src/reduce.js +19 -0
- data/node_modules/dc/node_modules/crossfilter2/src/zero.js +3 -0
- data/node_modules/dc/node_modules/d3/d3.js +9554 -0
- data/node_modules/dc/node_modules/d3/d3.min.js +5 -0
- data/node_modules/dc/node_modules/d3/package.js +13 -0
- data/node_modules/dc/node_modules/d3/src/arrays/ascending.js +5 -0
- data/node_modules/dc/node_modules/d3/src/arrays/bisect.js +36 -0
- data/node_modules/dc/node_modules/d3/src/arrays/descending.js +3 -0
- data/node_modules/dc/node_modules/d3/src/arrays/deviation.js +6 -0
- data/node_modules/dc/node_modules/d3/src/arrays/entries.js +5 -0
- data/node_modules/dc/node_modules/d3/src/arrays/extent.js +21 -0
- data/node_modules/dc/node_modules/d3/src/arrays/index.js +25 -0
- data/node_modules/dc/node_modules/d3/src/arrays/keys.js +5 -0
- data/node_modules/dc/node_modules/d3/src/arrays/map.js +84 -0
- data/node_modules/dc/node_modules/d3/src/arrays/max.js +14 -0
- data/node_modules/dc/node_modules/d3/src/arrays/mean.js +15 -0
- data/node_modules/dc/node_modules/d3/src/arrays/median.js +16 -0
- data/node_modules/dc/node_modules/d3/src/arrays/merge.js +21 -0
- data/node_modules/dc/node_modules/d3/src/arrays/min.js +14 -0
- data/node_modules/dc/node_modules/d3/src/arrays/nest.js +97 -0
- data/node_modules/dc/node_modules/d3/src/arrays/pairs.js +5 -0
- data/node_modules/dc/node_modules/d3/src/arrays/permute.js +5 -0
- data/node_modules/dc/node_modules/d3/src/arrays/quantile.js +8 -0
- data/node_modules/dc/node_modules/d3/src/arrays/range.js +26 -0
- data/node_modules/dc/node_modules/d3/src/arrays/set.js +27 -0
- data/node_modules/dc/node_modules/d3/src/arrays/shuffle.js +9 -0
- data/node_modules/dc/node_modules/d3/src/arrays/sum.js +14 -0
- data/node_modules/dc/node_modules/d3/src/arrays/transpose.js +15 -0
- data/node_modules/dc/node_modules/d3/src/arrays/values.js +5 -0
- data/node_modules/dc/node_modules/d3/src/arrays/variance.js +29 -0
- data/node_modules/dc/node_modules/d3/src/arrays/zip.js +5 -0
- data/node_modules/dc/node_modules/d3/src/behavior/behavior.js +1 -0
- data/node_modules/dc/node_modules/d3/src/behavior/drag.js +88 -0
- data/node_modules/dc/node_modules/d3/src/behavior/index.js +3 -0
- data/node_modules/dc/node_modules/d3/src/behavior/zoom.js +348 -0
- data/node_modules/dc/node_modules/d3/src/color/color.js +7 -0
- data/node_modules/dc/node_modules/d3/src/color/hcl.js +34 -0
- data/node_modules/dc/node_modules/d3/src/color/hsl.js +56 -0
- data/node_modules/dc/node_modules/d3/src/color/index.js +6 -0
- data/node_modules/dc/node_modules/d3/src/color/lab.js +60 -0
- data/node_modules/dc/node_modules/d3/src/color/rgb.js +301 -0
- data/node_modules/dc/node_modules/d3/src/color/xyz.js +7 -0
- data/node_modules/dc/node_modules/d3/src/compat/array.js +15 -0
- data/node_modules/dc/node_modules/d3/src/compat/date.js +3 -0
- data/node_modules/dc/node_modules/d3/src/compat/index.js +3 -0
- data/node_modules/dc/node_modules/d3/src/compat/style.js +23 -0
- data/node_modules/dc/node_modules/d3/src/core/array.js +2 -0
- data/node_modules/dc/node_modules/d3/src/core/class.js +8 -0
- data/node_modules/dc/node_modules/d3/src/core/document.js +15 -0
- data/node_modules/dc/node_modules/d3/src/core/functor.js +5 -0
- data/node_modules/dc/node_modules/d3/src/core/identity.js +3 -0
- data/node_modules/dc/node_modules/d3/src/core/index.js +3 -0
- data/node_modules/dc/node_modules/d3/src/core/noop.js +1 -0
- data/node_modules/dc/node_modules/d3/src/core/ns.js +18 -0
- data/node_modules/dc/node_modules/d3/src/core/rebind.js +16 -0
- data/node_modules/dc/node_modules/d3/src/core/source.js +3 -0
- data/node_modules/dc/node_modules/d3/src/core/subclass.js +11 -0
- data/node_modules/dc/node_modules/d3/src/core/target.js +3 -0
- data/node_modules/dc/node_modules/d3/src/core/true.js +3 -0
- data/node_modules/dc/node_modules/d3/src/core/vendor.js +10 -0
- data/node_modules/dc/node_modules/d3/src/core/zero.js +3 -0
- data/node_modules/dc/node_modules/d3/src/d3.js +23 -0
- data/node_modules/dc/node_modules/d3/src/dsv/csv.js +3 -0
- data/node_modules/dc/node_modules/d3/src/dsv/dsv.js +136 -0
- data/node_modules/dc/node_modules/d3/src/dsv/index.js +3 -0
- data/node_modules/dc/node_modules/d3/src/dsv/tsv.js +3 -0
- data/node_modules/dc/node_modules/d3/src/end.js +4 -0
- data/node_modules/dc/node_modules/d3/src/event/dispatch.js +69 -0
- data/node_modules/dc/node_modules/d3/src/event/drag.js +36 -0
- data/node_modules/dc/node_modules/d3/src/event/event.js +50 -0
- data/node_modules/dc/node_modules/d3/src/event/index.js +6 -0
- data/node_modules/dc/node_modules/d3/src/event/mouse.js +39 -0
- data/node_modules/dc/node_modules/d3/src/event/timer.js +82 -0
- data/node_modules/dc/node_modules/d3/src/event/touch.js +11 -0
- data/node_modules/dc/node_modules/d3/src/event/touches.js +12 -0
- data/node_modules/dc/node_modules/d3/src/format/collapse.js +3 -0
- data/node_modules/dc/node_modules/d3/src/format/format.js +3 -0
- data/node_modules/dc/node_modules/d3/src/format/formatPrefix.js +24 -0
- data/node_modules/dc/node_modules/d3/src/format/index.js +4 -0
- data/node_modules/dc/node_modules/d3/src/format/precision.js +3 -0
- data/node_modules/dc/node_modules/d3/src/format/requote.js +5 -0
- data/node_modules/dc/node_modules/d3/src/format/round.js +5 -0
- data/node_modules/dc/node_modules/d3/src/geo/albers-usa.js +129 -0
- data/node_modules/dc/node_modules/d3/src/geo/albers.js +11 -0
- data/node_modules/dc/node_modules/d3/src/geo/area.js +69 -0
- data/node_modules/dc/node_modules/d3/src/geo/azimuthal-equal-area.js +12 -0
- data/node_modules/dc/node_modules/d3/src/geo/azimuthal-equidistant.js +13 -0
- data/node_modules/dc/node_modules/d3/src/geo/azimuthal.js +25 -0
- data/node_modules/dc/node_modules/d3/src/geo/bounds.js +168 -0
- data/node_modules/dc/node_modules/d3/src/geo/cartesian.js +47 -0
- data/node_modules/dc/node_modules/d3/src/geo/centroid.js +149 -0
- data/node_modules/dc/node_modules/d3/src/geo/circle.js +81 -0
- data/node_modules/dc/node_modules/d3/src/geo/clip-antimeridian.js +95 -0
- data/node_modules/dc/node_modules/d3/src/geo/clip-circle.js +178 -0
- data/node_modules/dc/node_modules/d3/src/geo/clip-extent.js +196 -0
- data/node_modules/dc/node_modules/d3/src/geo/clip-polygon.js +104 -0
- data/node_modules/dc/node_modules/d3/src/geo/clip.js +149 -0
- data/node_modules/dc/node_modules/d3/src/geo/compose.js +12 -0
- data/node_modules/dc/node_modules/d3/src/geo/conic-conformal.js +39 -0
- data/node_modules/dc/node_modules/d3/src/geo/conic-equal-area.js +33 -0
- data/node_modules/dc/node_modules/d3/src/geo/conic-equidistant.js +36 -0
- data/node_modules/dc/node_modules/d3/src/geo/conic.js +16 -0
- data/node_modules/dc/node_modules/d3/src/geo/distance.js +13 -0
- data/node_modules/dc/node_modules/d3/src/geo/equirectangular.js +10 -0
- data/node_modules/dc/node_modules/d3/src/geo/geo.js +1 -0
- data/node_modules/dc/node_modules/d3/src/geo/gnomonic.js +12 -0
- data/node_modules/dc/node_modules/d3/src/geo/graticule.js +103 -0
- data/node_modules/dc/node_modules/d3/src/geo/greatArc.js +42 -0
- data/node_modules/dc/node_modules/d3/src/geo/index.js +33 -0
- data/node_modules/dc/node_modules/d3/src/geo/interpolate.js +38 -0
- data/node_modules/dc/node_modules/d3/src/geo/length.js +44 -0
- data/node_modules/dc/node_modules/d3/src/geo/mercator.js +48 -0
- data/node_modules/dc/node_modules/d3/src/geo/orthographic.js +12 -0
- data/node_modules/dc/node_modules/d3/src/geo/path-area.js +41 -0
- data/node_modules/dc/node_modules/d3/src/geo/path-bounds.js +21 -0
- data/node_modules/dc/node_modules/d3/src/geo/path-buffer.js +59 -0
- data/node_modules/dc/node_modules/d3/src/geo/path-centroid.js +78 -0
- data/node_modules/dc/node_modules/d3/src/geo/path-context.js +49 -0
- data/node_modules/dc/node_modules/d3/src/geo/path.js +87 -0
- data/node_modules/dc/node_modules/d3/src/geo/point-in-polygon.js +71 -0
- data/node_modules/dc/node_modules/d3/src/geo/projection.js +121 -0
- data/node_modules/dc/node_modules/d3/src/geo/resample.js +109 -0
- data/node_modules/dc/node_modules/d3/src/geo/rotation.js +79 -0
- data/node_modules/dc/node_modules/d3/src/geo/spherical.js +13 -0
- data/node_modules/dc/node_modules/d3/src/geo/stereographic.js +12 -0
- data/node_modules/dc/node_modules/d3/src/geo/stream.js +71 -0
- data/node_modules/dc/node_modules/d3/src/geo/transform.js +36 -0
- data/node_modules/dc/node_modules/d3/src/geo/transverse-mercator.js +31 -0
- data/node_modules/dc/node_modules/d3/src/geom/clip-line.js +66 -0
- data/node_modules/dc/node_modules/d3/src/geom/delaunay.js +6 -0
- data/node_modules/dc/node_modules/d3/src/geom/geom.js +1 -0
- data/node_modules/dc/node_modules/d3/src/geom/hull.js +91 -0
- data/node_modules/dc/node_modules/d3/src/geom/index.js +6 -0
- data/node_modules/dc/node_modules/d3/src/geom/point.js +7 -0
- data/node_modules/dc/node_modules/d3/src/geom/polygon.js +105 -0
- data/node_modules/dc/node_modules/d3/src/geom/quadtree.js +243 -0
- data/node_modules/dc/node_modules/d3/src/geom/voronoi.js +110 -0
- data/node_modules/dc/node_modules/d3/src/geom/voronoi/beach.js +186 -0
- data/node_modules/dc/node_modules/d3/src/geom/voronoi/cell.js +64 -0
- data/node_modules/dc/node_modules/d3/src/geom/voronoi/circle.js +73 -0
- data/node_modules/dc/node_modules/d3/src/geom/voronoi/clip.js +80 -0
- data/node_modules/dc/node_modules/d3/src/geom/voronoi/edge.js +50 -0
- data/node_modules/dc/node_modules/d3/src/geom/voronoi/index.js +59 -0
- data/node_modules/dc/node_modules/d3/src/geom/voronoi/red-black.js +235 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/array.js +19 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/ease.js +111 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/hcl.js +20 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/hsl.js +20 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/index.js +14 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/interpolate.js +26 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/lab.js +17 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/number.js +6 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/object.js +25 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/rgb.js +20 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/round.js +6 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/string.js +54 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/transform.js +59 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/uninterpolate.js +9 -0
- data/node_modules/dc/node_modules/d3/src/interpolate/zoom.js +53 -0
- data/node_modules/dc/node_modules/d3/src/layout/bundle.js +59 -0
- data/node_modules/dc/node_modules/d3/src/layout/chord.js +157 -0
- data/node_modules/dc/node_modules/d3/src/layout/cluster.js +92 -0
- data/node_modules/dc/node_modules/d3/src/layout/force.js +372 -0
- data/node_modules/dc/node_modules/d3/src/layout/hierarchy.js +136 -0
- data/node_modules/dc/node_modules/d3/src/layout/histogram.js +110 -0
- data/node_modules/dc/node_modules/d3/src/layout/index.js +13 -0
- data/node_modules/dc/node_modules/d3/src/layout/layout.js +1 -0
- data/node_modules/dc/node_modules/d3/src/layout/pack.js +211 -0
- data/node_modules/dc/node_modules/d3/src/layout/partition.js +51 -0
- data/node_modules/dc/node_modules/d3/src/layout/pie.js +78 -0
- data/node_modules/dc/node_modules/d3/src/layout/stack.js +247 -0
- data/node_modules/dc/node_modules/d3/src/layout/tree.js +240 -0
- data/node_modules/dc/node_modules/d3/src/layout/treemap.js +229 -0
- data/node_modules/dc/node_modules/d3/src/locale/ca-ES.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/de-CH.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/de-DE.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/en-CA.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/en-GB.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/en-US.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/es-ES.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/fi-FI.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/fr-CA.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/fr-FR.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/he-IL.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/hu-HU.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/it-IT.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/ja-JP.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/ko-KR.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/locale.js +9 -0
- data/node_modules/dc/node_modules/d3/src/locale/mk-MK.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/nl-NL.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/number-format.js +155 -0
- data/node_modules/dc/node_modules/d3/src/locale/pl-PL.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/pt-BR.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/ru-RU.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/sv-SE.js +16 -0
- data/node_modules/dc/node_modules/d3/src/locale/time-format.js +370 -0
- data/node_modules/dc/node_modules/d3/src/locale/time-scale.js +0 -0
- data/node_modules/dc/node_modules/d3/src/locale/zh-CN.js +16 -0
- data/node_modules/dc/node_modules/d3/src/math/abs.js +1 -0
- data/node_modules/dc/node_modules/d3/src/math/adder.js +34 -0
- data/node_modules/dc/node_modules/d3/src/math/index.js +2 -0
- data/node_modules/dc/node_modules/d3/src/math/number.js +7 -0
- data/node_modules/dc/node_modules/d3/src/math/random.js +34 -0
- data/node_modules/dc/node_modules/d3/src/math/transform.js +64 -0
- data/node_modules/dc/node_modules/d3/src/math/trigonometry.js +44 -0
- data/node_modules/dc/node_modules/d3/src/scale/bilinear.js +7 -0
- data/node_modules/dc/node_modules/d3/src/scale/category.js +58 -0
- data/node_modules/dc/node_modules/d3/src/scale/identity.js +33 -0
- data/node_modules/dc/node_modules/d3/src/scale/index.js +11 -0
- data/node_modules/dc/node_modules/d3/src/scale/linear.js +160 -0
- data/node_modules/dc/node_modules/d3/src/scale/log.js +92 -0
- data/node_modules/dc/node_modules/d3/src/scale/nice.js +30 -0
- data/node_modules/dc/node_modules/d3/src/scale/ordinal.js +102 -0
- data/node_modules/dc/node_modules/d3/src/scale/polylinear.js +24 -0
- data/node_modules/dc/node_modules/d3/src/scale/pow.js +57 -0
- data/node_modules/dc/node_modules/d3/src/scale/quantile.js +55 -0
- data/node_modules/dc/node_modules/d3/src/scale/quantize.js +44 -0
- data/node_modules/dc/node_modules/d3/src/scale/scale.js +10 -0
- data/node_modules/dc/node_modules/d3/src/scale/sqrt.js +6 -0
- data/node_modules/dc/node_modules/d3/src/scale/threshold.js +36 -0
- data/node_modules/dc/node_modules/d3/src/selection/append.js +28 -0
- data/node_modules/dc/node_modules/d3/src/selection/attr.js +62 -0
- data/node_modules/dc/node_modules/d3/src/selection/call.js +8 -0
- data/node_modules/dc/node_modules/d3/src/selection/classed.js +76 -0
- data/node_modules/dc/node_modules/d3/src/selection/data.js +117 -0
- data/node_modules/dc/node_modules/d3/src/selection/datum.js +7 -0
- data/node_modules/dc/node_modules/d3/src/selection/each.js +16 -0
- data/node_modules/dc/node_modules/d3/src/selection/empty.js +5 -0
- data/node_modules/dc/node_modules/d3/src/selection/enter-insert.js +20 -0
- data/node_modules/dc/node_modules/d3/src/selection/enter-select.js +27 -0
- data/node_modules/dc/node_modules/d3/src/selection/enter.js +21 -0
- data/node_modules/dc/node_modules/d3/src/selection/filter.js +28 -0
- data/node_modules/dc/node_modules/d3/src/selection/html.js +10 -0
- data/node_modules/dc/node_modules/d3/src/selection/index.js +1 -0
- data/node_modules/dc/node_modules/d3/src/selection/insert.js +9 -0
- data/node_modules/dc/node_modules/d3/src/selection/interrupt.js +27 -0
- data/node_modules/dc/node_modules/d3/src/selection/node.js +11 -0
- data/node_modules/dc/node_modules/d3/src/selection/on.js +106 -0
- data/node_modules/dc/node_modules/d3/src/selection/order.js +13 -0
- data/node_modules/dc/node_modules/d3/src/selection/property.js +43 -0
- data/node_modules/dc/node_modules/d3/src/selection/remove.js +13 -0
- data/node_modules/dc/node_modules/d3/src/selection/select.js +32 -0
- data/node_modules/dc/node_modules/d3/src/selection/selectAll.js +27 -0
- data/node_modules/dc/node_modules/d3/src/selection/selection.js +81 -0
- data/node_modules/dc/node_modules/d3/src/selection/size.js +7 -0
- data/node_modules/dc/node_modules/d3/src/selection/sort.js +15 -0
- data/node_modules/dc/node_modules/d3/src/selection/style.js +59 -0
- data/node_modules/dc/node_modules/d3/src/selection/text.js +10 -0
- data/node_modules/dc/node_modules/d3/src/selection/transition.js +21 -0
- data/node_modules/dc/node_modules/d3/src/start.js +2 -0
- data/node_modules/dc/node_modules/d3/src/svg/arc.js +292 -0
- data/node_modules/dc/node_modules/d3/src/svg/area-radial.js +14 -0
- data/node_modules/dc/node_modules/d3/src/svg/area.js +121 -0
- data/node_modules/dc/node_modules/d3/src/svg/axis.js +160 -0
- data/node_modules/dc/node_modules/d3/src/svg/brush.js +429 -0
- data/node_modules/dc/node_modules/d3/src/svg/chord.js +90 -0
- data/node_modules/dc/node_modules/d3/src/svg/diagonal-radial.js +27 -0
- data/node_modules/dc/node_modules/d3/src/svg/diagonal.js +43 -0
- data/node_modules/dc/node_modules/d3/src/svg/index.js +12 -0
- data/node_modules/dc/node_modules/d3/src/svg/line-radial.js +27 -0
- data/node_modules/dc/node_modules/d3/src/svg/line.js +432 -0
- data/node_modules/dc/node_modules/d3/src/svg/svg.js +1 -0
- data/node_modules/dc/node_modules/d3/src/svg/symbol.js +105 -0
- data/node_modules/dc/node_modules/d3/src/time/day.js +21 -0
- data/node_modules/dc/node_modules/d3/src/time/format-iso.js +19 -0
- data/node_modules/dc/node_modules/d3/src/time/format-utc.js +3 -0
- data/node_modules/dc/node_modules/d3/src/time/format.js +4 -0
- data/node_modules/dc/node_modules/d3/src/time/hour.js +14 -0
- data/node_modules/dc/node_modules/d3/src/time/index.js +14 -0
- data/node_modules/dc/node_modules/d3/src/time/interval.js +71 -0
- data/node_modules/dc/node_modules/d3/src/time/minute.js +13 -0
- data/node_modules/dc/node_modules/d3/src/time/month.js +16 -0
- data/node_modules/dc/node_modules/d3/src/time/scale-utc.js +25 -0
- data/node_modules/dc/node_modules/d3/src/time/scale.js +155 -0
- data/node_modules/dc/node_modules/d3/src/time/second.js +13 -0
- data/node_modules/dc/node_modules/d3/src/time/time.js +33 -0
- data/node_modules/dc/node_modules/d3/src/time/week.js +31 -0
- data/node_modules/dc/node_modules/d3/src/time/year.js +16 -0
- data/node_modules/dc/node_modules/d3/src/transition/attr.js +58 -0
- data/node_modules/dc/node_modules/d3/src/transition/delay.js +10 -0
- data/node_modules/dc/node_modules/d3/src/transition/duration.js +10 -0
- data/node_modules/dc/node_modules/d3/src/transition/each.js +26 -0
- data/node_modules/dc/node_modules/d3/src/transition/ease.js +10 -0
- data/node_modules/dc/node_modules/d3/src/transition/filter.js +22 -0
- data/node_modules/dc/node_modules/d3/src/transition/index.js +1 -0
- data/node_modules/dc/node_modules/d3/src/transition/remove.js +9 -0
- data/node_modules/dc/node_modules/d3/src/transition/select.js +28 -0
- data/node_modules/dc/node_modules/d3/src/transition/selectAll.js +31 -0
- data/node_modules/dc/node_modules/d3/src/transition/style.js +53 -0
- data/node_modules/dc/node_modules/d3/src/transition/subtransition.js +25 -0
- data/node_modules/dc/node_modules/d3/src/transition/text.js +11 -0
- data/node_modules/dc/node_modules/d3/src/transition/transition.js +161 -0
- data/node_modules/dc/node_modules/d3/src/transition/tween.js +17 -0
- data/node_modules/dc/node_modules/d3/src/xhr/html.js +12 -0
- data/node_modules/dc/node_modules/d3/src/xhr/index.js +5 -0
- data/node_modules/dc/node_modules/d3/src/xhr/json.js +9 -0
- data/node_modules/dc/node_modules/d3/src/xhr/text.js +5 -0
- data/node_modules/dc/node_modules/d3/src/xhr/xhr.js +126 -0
- data/node_modules/dc/node_modules/d3/src/xhr/xml.js +5 -0
- data/node_modules/dc/regression/inject-serializer.js +6 -0
- data/node_modules/dc/regression/stock-regression-test.js +140 -0
- data/node_modules/dc/spec/bar-chart-spec.js +1230 -0
- data/node_modules/dc/spec/base-mixin-spec.js +611 -0
- data/node_modules/dc/spec/biggish-data-spec.js +136 -0
- data/node_modules/dc/spec/box-plot-spec.js +211 -0
- data/node_modules/dc/spec/bubble-chart-spec.js +450 -0
- data/node_modules/dc/spec/bubble-overlay-spec.js +102 -0
- data/node_modules/dc/spec/color-spec.js +89 -0
- data/node_modules/dc/spec/composite-chart-spec.js +691 -0
- data/node_modules/dc/spec/coordinate-grid-chart-spec.js +962 -0
- data/node_modules/dc/spec/core-spec.js +301 -0
- data/node_modules/dc/spec/data-addition-spec.js +122 -0
- data/node_modules/dc/spec/data-count-spec.js +180 -0
- data/node_modules/dc/spec/data-grid-spec.js +124 -0
- data/node_modules/dc/spec/data-table-spec.js +251 -0
- data/node_modules/dc/spec/event-spec.js +41 -0
- data/node_modules/dc/spec/filter-dates-spec.js +92 -0
- data/node_modules/dc/spec/filters-spec.js +140 -0
- data/node_modules/dc/spec/geo-choropleth-chart-spec.js +225 -0
- data/node_modules/dc/spec/heatmap-spec.js +363 -0
- data/node_modules/dc/spec/helpers/custom_matchers.js +213 -0
- data/node_modules/dc/spec/helpers/fixtures.js +81 -0
- data/node_modules/dc/spec/helpers/geoFixtures.js +113 -0
- data/node_modules/dc/spec/helpers/load-jsreporter.js +37 -0
- data/node_modules/dc/spec/helpers/spec-helper.js +53 -0
- data/node_modules/dc/spec/legend-spec.js +266 -0
- data/node_modules/dc/spec/line-chart-spec.js +709 -0
- data/node_modules/dc/spec/logger-spec.js +80 -0
- data/node_modules/dc/spec/number-display-spec.js +168 -0
- data/node_modules/dc/spec/pie-chart-spec.js +677 -0
- data/node_modules/dc/spec/row-chart-spec.js +362 -0
- data/node_modules/dc/spec/scatter-plot-spec.js +336 -0
- data/node_modules/dc/spec/series-chart-spec.js +133 -0
- data/node_modules/dc/spec/utils-spec.js +110 -0
- data/node_modules/dc/src/banner.js +2 -0
- data/node_modules/dc/src/bar-chart.js +374 -0
- data/node_modules/dc/src/base-mixin.js +1478 -0
- data/node_modules/dc/src/box-plot.js +240 -0
- data/node_modules/dc/src/bubble-chart.js +177 -0
- data/node_modules/dc/src/bubble-mixin.js +244 -0
- data/node_modules/dc/src/bubble-overlay.js +207 -0
- data/node_modules/dc/src/cap-mixin.js +151 -0
- data/node_modules/dc/src/color-mixin.js +172 -0
- data/node_modules/dc/src/composite-chart.js +544 -0
- data/node_modules/dc/src/coordinate-grid-mixin.js +1300 -0
- data/node_modules/dc/src/core.js +425 -0
- data/node_modules/dc/src/d3.box.js +317 -0
- data/node_modules/dc/src/data-count.js +110 -0
- data/node_modules/dc/src/data-grid.js +243 -0
- data/node_modules/dc/src/data-table.js +419 -0
- data/node_modules/dc/src/errors.js +28 -0
- data/node_modules/dc/src/events.js +37 -0
- data/node_modules/dc/src/filters.js +124 -0
- data/node_modules/dc/src/footer.js +35 -0
- data/node_modules/dc/src/geo-choropleth-chart.js +279 -0
- data/node_modules/dc/src/heatmap.js +378 -0
- data/node_modules/dc/src/legend.js +277 -0
- data/node_modules/dc/src/line-chart.js +504 -0
- data/node_modules/dc/src/logger.js +40 -0
- data/node_modules/dc/src/margin-mixin.js +44 -0
- data/node_modules/dc/src/number-display.js +141 -0
- data/node_modules/dc/src/pie-chart.js +571 -0
- data/node_modules/dc/src/row-chart.js +425 -0
- data/node_modules/dc/src/scatter-plot.js +338 -0
- data/node_modules/dc/src/series-chart.js +192 -0
- data/node_modules/dc/src/stack-mixin.js +319 -0
- data/node_modules/dc/src/utils.js +290 -0
- data/node_modules/dc/web/docs/html/scripts/docstrap.lib.js +11 -0
- data/node_modules/dc/web/docs/html/scripts/fulltext-search-ui.js +89 -0
- data/node_modules/dc/web/docs/html/scripts/fulltext-search.js +36 -0
- data/node_modules/dc/web/docs/html/scripts/lunr.min.js +7 -0
- data/node_modules/dc/web/docs/html/scripts/prettify/jquery.min.js +6 -0
- data/node_modules/dc/web/docs/html/scripts/prettify/lang-css.js +21 -0
- data/node_modules/dc/web/docs/html/scripts/prettify/prettify.js +496 -0
- data/node_modules/dc/web/docs/html/scripts/sunlight.js +1157 -0
- data/node_modules/dc/web/docs/html/scripts/toc.js +203 -0
- data/node_modules/dc/web/ep/list.js +106 -0
- data/node_modules/dc/web/examples/lysenko-interval-tree.js +447 -0
- data/node_modules/dc/web/highlighter/shAutoloader.js +17 -0
- data/node_modules/dc/web/highlighter/shBrushJScript.js +52 -0
- data/node_modules/dc/web/highlighter/shBrushXml.js +69 -0
- data/node_modules/dc/web/highlighter/shCore.js +17 -0
- data/node_modules/dc/web/js/colorbrewer.js +1 -0
- data/node_modules/dc/web/js/crossfilter.js +1401 -0
- data/node_modules/dc/web/js/d3.js +9554 -0
- data/node_modules/dc/web/js/dc.js +10477 -0
- data/node_modules/dc/web/js/dc.min.js +23 -0
- data/node_modules/dc/web/js/env-data.js +218 -0
- data/node_modules/dc/web/js/jasmine-jsreporter.js +394 -0
- data/node_modules/dc/web/stock.js +685 -0
- data/node_modules/dc/web/transitions/transition-test.js +45 -0
- data/node_modules/jquery/dist/jquery.js +9814 -0
- data/node_modules/jquery/dist/jquery.min.js +4 -0
- data/node_modules/jquery/external/sizzle/dist/sizzle.js +2143 -0
- data/node_modules/jquery/external/sizzle/dist/sizzle.min.js +3 -0
- data/node_modules/jquery/src/ajax.js +845 -0
- data/node_modules/jquery/src/ajax/jsonp.js +100 -0
- data/node_modules/jquery/src/ajax/load.js +83 -0
- data/node_modules/jquery/src/ajax/parseJSON.js +13 -0
- data/node_modules/jquery/src/ajax/parseXML.js +27 -0
- data/node_modules/jquery/src/ajax/script.js +68 -0
- data/node_modules/jquery/src/ajax/var/location.js +3 -0
- data/node_modules/jquery/src/ajax/var/nonce.js +5 -0
- data/node_modules/jquery/src/ajax/var/rquery.js +3 -0
- data/node_modules/jquery/src/ajax/xhr.js +167 -0
- data/node_modules/jquery/src/attributes.js +11 -0
- data/node_modules/jquery/src/attributes/attr.js +142 -0
- data/node_modules/jquery/src/attributes/classes.js +177 -0
- data/node_modules/jquery/src/attributes/prop.js +125 -0
- data/node_modules/jquery/src/attributes/support.js +36 -0
- data/node_modules/jquery/src/attributes/val.js +177 -0
- data/node_modules/jquery/src/callbacks.js +232 -0
- data/node_modules/jquery/src/core.js +494 -0
- data/node_modules/jquery/src/core/access.js +65 -0
- data/node_modules/jquery/src/core/init.js +134 -0
- data/node_modules/jquery/src/core/parseHTML.js +41 -0
- data/node_modules/jquery/src/core/ready.js +103 -0
- data/node_modules/jquery/src/core/var/rsingleTag.js +5 -0
- data/node_modules/jquery/src/css.js +502 -0
- data/node_modules/jquery/src/css/addGetHookIf.js +24 -0
- data/node_modules/jquery/src/css/adjustCSS.js +65 -0
- data/node_modules/jquery/src/css/curCSS.js +60 -0
- data/node_modules/jquery/src/css/defaultDisplay.js +72 -0
- data/node_modules/jquery/src/css/hiddenVisibleSelectors.js +18 -0
- data/node_modules/jquery/src/css/showHide.js +48 -0
- data/node_modules/jquery/src/css/support.js +121 -0
- data/node_modules/jquery/src/css/var/cssExpand.js +3 -0
- data/node_modules/jquery/src/css/var/getStyles.js +15 -0
- data/node_modules/jquery/src/css/var/isHidden.js +16 -0
- data/node_modules/jquery/src/css/var/rmargin.js +3 -0
- data/node_modules/jquery/src/css/var/rnumnonpx.js +5 -0
- data/node_modules/jquery/src/css/var/swap.js +24 -0
- data/node_modules/jquery/src/data.js +187 -0
- data/node_modules/jquery/src/data/Data.js +200 -0
- data/node_modules/jquery/src/data/var/acceptData.js +18 -0
- data/node_modules/jquery/src/data/var/dataPriv.js +5 -0
- data/node_modules/jquery/src/data/var/dataUser.js +5 -0
- data/node_modules/jquery/src/deferred.js +158 -0
- data/node_modules/jquery/src/deprecated.js +32 -0
- data/node_modules/jquery/src/dimensions.js +54 -0
- data/node_modules/jquery/src/effects.js +629 -0
- data/node_modules/jquery/src/effects/Tween.js +121 -0
- data/node_modules/jquery/src/effects/animatedSelector.js +13 -0
- data/node_modules/jquery/src/event.js +711 -0
- data/node_modules/jquery/src/event/ajax.js +20 -0
- data/node_modules/jquery/src/event/alias.js +27 -0
- data/node_modules/jquery/src/event/focusin.js +53 -0
- data/node_modules/jquery/src/event/support.js +9 -0
- data/node_modules/jquery/src/event/trigger.js +183 -0
- data/node_modules/jquery/src/exports/amd.js +24 -0
- data/node_modules/jquery/src/exports/global.js +26 -0
- data/node_modules/jquery/src/intro.js +44 -0
- data/node_modules/jquery/src/jquery.js +37 -0
- data/node_modules/jquery/src/manipulation.js +481 -0
- data/node_modules/jquery/src/manipulation/_evalUrl.js +20 -0
- data/node_modules/jquery/src/manipulation/buildFragment.js +102 -0
- data/node_modules/jquery/src/manipulation/getAll.js +21 -0
- data/node_modules/jquery/src/manipulation/setGlobalEval.js +20 -0
- data/node_modules/jquery/src/manipulation/support.js +33 -0
- data/node_modules/jquery/src/manipulation/var/rcheckableType.js +3 -0
- data/node_modules/jquery/src/manipulation/var/rscriptType.js +3 -0
- data/node_modules/jquery/src/manipulation/var/rtagName.js +3 -0
- data/node_modules/jquery/src/manipulation/wrapMap.js +27 -0
- data/node_modules/jquery/src/offset.js +218 -0
- data/node_modules/jquery/src/outro.js +2 -0
- data/node_modules/jquery/src/queue.js +143 -0
- data/node_modules/jquery/src/queue/delay.js +22 -0
- data/node_modules/jquery/src/selector-native.js +211 -0
- data/node_modules/jquery/src/selector-sizzle.js +14 -0
- data/node_modules/jquery/src/selector.js +1 -0
- data/node_modules/jquery/src/serialize.js +125 -0
- data/node_modules/jquery/src/traversing.js +175 -0
- data/node_modules/jquery/src/traversing/findFilter.js +100 -0
- data/node_modules/jquery/src/traversing/var/dir.js +20 -0
- data/node_modules/jquery/src/traversing/var/rneedsContext.js +6 -0
- data/node_modules/jquery/src/traversing/var/siblings.js +15 -0
- data/node_modules/jquery/src/var/arr.js +3 -0
- data/node_modules/jquery/src/var/class2type.js +5 -0
- data/node_modules/jquery/src/var/concat.js +5 -0
- data/node_modules/jquery/src/var/document.js +3 -0
- data/node_modules/jquery/src/var/documentElement.js +5 -0
- data/node_modules/jquery/src/var/hasOwn.js +5 -0
- data/node_modules/jquery/src/var/indexOf.js +5 -0
- data/node_modules/jquery/src/var/pnum.js +3 -0
- data/node_modules/jquery/src/var/push.js +5 -0
- data/node_modules/jquery/src/var/rcssNum.js +7 -0
- data/node_modules/jquery/src/var/rnotwhite.js +3 -0
- data/node_modules/jquery/src/var/slice.js +5 -0
- data/node_modules/jquery/src/var/support.js +5 -0
- data/node_modules/jquery/src/var/toString.js +5 -0
- data/node_modules/jquery/src/wrap.js +79 -0
- data/target/mdarray_sol.jar +0 -0
- data/test/jx/test_complete.rb +35 -0
- data/test/jx/test_js.rb +543 -0
- data/test/jx/test_proxy_array.rb +239 -0
- data/test/jx/test_proxy_hash.rb +160 -0
- data/test/jx/test_proxy_lambda.rb +80 -0
- data/test/jx/test_rb_js_compat.rb +135 -0
- data/test/jx/test_style_sheets.rb +90 -0
- data/test/mdarray/test_mdarray.rb +75 -0
- data/util/cacert.pem +4095 -0
- data/util/download.rb +256 -0
- data/vendor/jxbrowser-6.8.jar +0 -0
- data/vendor/licence.jar +0 -0
- data/version.rb +2 -0
- metadata +817 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
import "../selection/each";
|
2
|
+
import "transition";
|
3
|
+
|
4
|
+
d3_transitionPrototype.tween = function(name, tween) {
|
5
|
+
var id = this.id, ns = this.namespace;
|
6
|
+
if (arguments.length < 2) return this.node()[ns][id].tween.get(name);
|
7
|
+
return d3_selection_each(this, tween == null
|
8
|
+
? function(node) { node[ns][id].tween.remove(name); }
|
9
|
+
: function(node) { node[ns][id].tween.set(name, tween); });
|
10
|
+
};
|
11
|
+
|
12
|
+
function d3_transition_tween(groups, name, value, tween) {
|
13
|
+
var id = groups.id, ns = groups.namespace;
|
14
|
+
return d3_selection_each(groups, typeof value === "function"
|
15
|
+
? function(node, i, j) { node[ns][id].tween.set(name, tween(value.call(node, node.__data__, i, j))); }
|
16
|
+
: (value = tween(value), function(node) { node[ns][id].tween.set(name, value); }));
|
17
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import "../core/document";
|
2
|
+
import "xhr";
|
3
|
+
|
4
|
+
d3.html = function(url, callback) {
|
5
|
+
return d3_xhr(url, "text/html", d3_html, callback);
|
6
|
+
};
|
7
|
+
|
8
|
+
function d3_html(request) {
|
9
|
+
var range = d3_document.createRange();
|
10
|
+
range.selectNode(d3_document.body);
|
11
|
+
return range.createContextualFragment(request.responseText);
|
12
|
+
}
|
@@ -0,0 +1,126 @@
|
|
1
|
+
import "../core/array";
|
2
|
+
import "../core/document";
|
3
|
+
import "../core/identity";
|
4
|
+
import "../core/rebind";
|
5
|
+
import "../event/dispatch";
|
6
|
+
|
7
|
+
d3.xhr = d3_xhrType(d3_identity);
|
8
|
+
|
9
|
+
function d3_xhrType(response) {
|
10
|
+
return function(url, mimeType, callback) {
|
11
|
+
if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType, mimeType = null;
|
12
|
+
return d3_xhr(url, mimeType, response, callback);
|
13
|
+
};
|
14
|
+
}
|
15
|
+
|
16
|
+
function d3_xhr(url, mimeType, response, callback) {
|
17
|
+
var xhr = {},
|
18
|
+
dispatch = d3.dispatch("beforesend", "progress", "load", "error"),
|
19
|
+
headers = {},
|
20
|
+
request = new XMLHttpRequest,
|
21
|
+
responseType = null;
|
22
|
+
|
23
|
+
// If IE does not support CORS, use XDomainRequest.
|
24
|
+
if (this.XDomainRequest
|
25
|
+
&& !("withCredentials" in request)
|
26
|
+
&& /^(http(s)?:)?\/\//.test(url)) request = new XDomainRequest;
|
27
|
+
|
28
|
+
"onload" in request
|
29
|
+
? request.onload = request.onerror = respond
|
30
|
+
: request.onreadystatechange = function() { request.readyState > 3 && respond(); };
|
31
|
+
|
32
|
+
function respond() {
|
33
|
+
var status = request.status, result;
|
34
|
+
if (!status && d3_xhrHasResponse(request) || status >= 200 && status < 300 || status === 304) {
|
35
|
+
try {
|
36
|
+
result = response.call(xhr, request);
|
37
|
+
} catch (e) {
|
38
|
+
dispatch.error.call(xhr, e);
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
dispatch.load.call(xhr, result);
|
42
|
+
} else {
|
43
|
+
dispatch.error.call(xhr, request);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
request.onprogress = function(event) {
|
48
|
+
var o = d3.event;
|
49
|
+
d3.event = event;
|
50
|
+
try { dispatch.progress.call(xhr, request); }
|
51
|
+
finally { d3.event = o; }
|
52
|
+
};
|
53
|
+
|
54
|
+
xhr.header = function(name, value) {
|
55
|
+
name = (name + "").toLowerCase();
|
56
|
+
if (arguments.length < 2) return headers[name];
|
57
|
+
if (value == null) delete headers[name];
|
58
|
+
else headers[name] = value + "";
|
59
|
+
return xhr;
|
60
|
+
};
|
61
|
+
|
62
|
+
// If mimeType is non-null and no Accept header is set, a default is used.
|
63
|
+
xhr.mimeType = function(value) {
|
64
|
+
if (!arguments.length) return mimeType;
|
65
|
+
mimeType = value == null ? null : value + "";
|
66
|
+
return xhr;
|
67
|
+
};
|
68
|
+
|
69
|
+
// Specifies what type the response value should take;
|
70
|
+
// for instance, arraybuffer, blob, document, or text.
|
71
|
+
xhr.responseType = function(value) {
|
72
|
+
if (!arguments.length) return responseType;
|
73
|
+
responseType = value;
|
74
|
+
return xhr;
|
75
|
+
};
|
76
|
+
|
77
|
+
// Specify how to convert the response content to a specific type;
|
78
|
+
// changes the callback value on "load" events.
|
79
|
+
xhr.response = function(value) {
|
80
|
+
response = value;
|
81
|
+
return xhr;
|
82
|
+
};
|
83
|
+
|
84
|
+
// Convenience methods.
|
85
|
+
["get", "post"].forEach(function(method) {
|
86
|
+
xhr[method] = function() {
|
87
|
+
return xhr.send.apply(xhr, [method].concat(d3_array(arguments)));
|
88
|
+
};
|
89
|
+
});
|
90
|
+
|
91
|
+
// If callback is non-null, it will be used for error and load events.
|
92
|
+
xhr.send = function(method, data, callback) {
|
93
|
+
if (arguments.length === 2 && typeof data === "function") callback = data, data = null;
|
94
|
+
request.open(method, url, true);
|
95
|
+
if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*";
|
96
|
+
if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]);
|
97
|
+
if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType);
|
98
|
+
if (responseType != null) request.responseType = responseType;
|
99
|
+
if (callback != null) xhr.on("error", callback).on("load", function(request) { callback(null, request); });
|
100
|
+
dispatch.beforesend.call(xhr, request);
|
101
|
+
request.send(data == null ? null : data);
|
102
|
+
return xhr;
|
103
|
+
};
|
104
|
+
|
105
|
+
xhr.abort = function() {
|
106
|
+
request.abort();
|
107
|
+
return xhr;
|
108
|
+
};
|
109
|
+
|
110
|
+
d3.rebind(xhr, dispatch, "on");
|
111
|
+
|
112
|
+
return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback));
|
113
|
+
};
|
114
|
+
|
115
|
+
function d3_xhr_fixCallback(callback) {
|
116
|
+
return callback.length === 1
|
117
|
+
? function(error, request) { callback(error == null ? request : null); }
|
118
|
+
: callback;
|
119
|
+
}
|
120
|
+
|
121
|
+
function d3_xhrHasResponse(request) {
|
122
|
+
var type = request.responseType;
|
123
|
+
return type && type !== "text"
|
124
|
+
? request.response // null on error
|
125
|
+
: request.responseText; // "" on error
|
126
|
+
}
|
@@ -0,0 +1,140 @@
|
|
1
|
+
var grunt = require("grunt");
|
2
|
+
var phantomjs = require('grunt-lib-phantomjs').init(grunt);
|
3
|
+
var difflib = require("jsdifflib");
|
4
|
+
|
5
|
+
module.exports = {
|
6
|
+
testStockExample: function (asyncDone, showDiff) {
|
7
|
+
var passed = false;
|
8
|
+
process.env.TZ = "UTC";
|
9
|
+
|
10
|
+
phantomjs.on('rendered', function(pageStr) {
|
11
|
+
require("fs").readFile(__dirname + '/rendered-stock-fixture.html', function (err, data) {
|
12
|
+
var fixtureStr = data.toString();
|
13
|
+
|
14
|
+
if (err) {
|
15
|
+
grunt.log.error("Failed to open stock example.");
|
16
|
+
} else {
|
17
|
+
var diffs = diffPages(fixtureStr, pageStr);
|
18
|
+
if (diffs.length > 0) {
|
19
|
+
grunt.log.error("Failed comparison to stock example.");
|
20
|
+
grunt.log.error("If these changes are intentional, please run `grunt update-stock-example` to overwrite the fixture.");
|
21
|
+
if (showDiff) {
|
22
|
+
grunt.log.writeln("\n" + diffs + "\n");
|
23
|
+
} else {
|
24
|
+
grunt.log.error("Run `grunt test-stock-example:diff` to see differences.");
|
25
|
+
}
|
26
|
+
} else {
|
27
|
+
grunt.log.writeln("Passed comparison to stock example.");
|
28
|
+
passed = true;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
phantomjs.halt();
|
32
|
+
});
|
33
|
+
});
|
34
|
+
|
35
|
+
phantomjs.spawn('web/index.html', {
|
36
|
+
options: {
|
37
|
+
inject: __dirname + "/inject-serializer.js"
|
38
|
+
},
|
39
|
+
done: function () {
|
40
|
+
if (!passed) {
|
41
|
+
grunt.fatal("Failed regression test.");
|
42
|
+
}
|
43
|
+
asyncDone();
|
44
|
+
}
|
45
|
+
});
|
46
|
+
},
|
47
|
+
|
48
|
+
updateStockExample: function (asyncDone) {
|
49
|
+
var ok = false;
|
50
|
+
process.env.TZ = "UTC";
|
51
|
+
|
52
|
+
phantomjs.on('rendered', function(pageStr) {
|
53
|
+
require("fs").writeFile(__dirname + '/rendered-stock-fixture.html', pageStr, function (err) {
|
54
|
+
if (!err) {
|
55
|
+
grunt.log.writeln("Overwrote stock example.");
|
56
|
+
ok = true;
|
57
|
+
}
|
58
|
+
phantomjs.halt();
|
59
|
+
});
|
60
|
+
});
|
61
|
+
|
62
|
+
phantomjs.spawn('web/index.html', {
|
63
|
+
options: {
|
64
|
+
inject: __dirname + "/inject-serializer.js"
|
65
|
+
},
|
66
|
+
done: function () {
|
67
|
+
if (!ok) {
|
68
|
+
grunt.fatal("Failed to overwrite stock example.");
|
69
|
+
}
|
70
|
+
asyncDone();
|
71
|
+
}
|
72
|
+
});
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
function diffPages(first, second) {
|
77
|
+
first = filterExceptions(first);
|
78
|
+
second = filterExceptions(second);
|
79
|
+
|
80
|
+
var firstLines = difflib.stringAsLines(first);
|
81
|
+
var secondLines = difflib.stringAsLines(second);
|
82
|
+
var seq = new difflib.SequenceMatcher(firstLines, secondLines);
|
83
|
+
var ops = seq.get_opcodes();
|
84
|
+
var diffs = [];
|
85
|
+
|
86
|
+
for (var i = 0; i < ops.length; i++) {
|
87
|
+
var op = ops[i];
|
88
|
+
var firstDiff = firstLines.slice(op[1], op[2]).join("\n");
|
89
|
+
var secondDiff = secondLines.slice(op[3], op[4]).join("\n");
|
90
|
+
|
91
|
+
if (op[0] === 'replace') {
|
92
|
+
if (!onlyDiffersByDelta(firstDiff, secondDiff, 0.01)) {
|
93
|
+
diffs.push("Replacement:");
|
94
|
+
diffs.push(firstDiff.red);
|
95
|
+
diffs.push(secondDiff.green);
|
96
|
+
}
|
97
|
+
} else if (op[0] === 'insert') {
|
98
|
+
diffs.push("Insertion:");
|
99
|
+
diffs.push(secondDiff.green);
|
100
|
+
} else if (op[0] === 'delete') {
|
101
|
+
diffs.push("Deletion:");
|
102
|
+
diffs.push(firstDiff.red);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
return diffs.join("\n\n");
|
107
|
+
}
|
108
|
+
|
109
|
+
// TODO: remove use of clientHeight in legend and remove this function
|
110
|
+
function filterExceptions(fixtureStr) {
|
111
|
+
fixtureStr = fixtureStr.replace(/<text x="15" y="[0-9.]+">Monthly Index Move<\/text>/, "EXCEPTION");
|
112
|
+
fixtureStr = fixtureStr.replace(/<text x="15" y="[0-9.]+">Monthly Index Average<\/text>/, "EXCEPTION");
|
113
|
+
return fixtureStr;
|
114
|
+
}
|
115
|
+
|
116
|
+
function onlyDiffersByDelta(firstLine, secondLine, delta) {
|
117
|
+
var findNums = /(?:[0-9]*\.[0-9]+|[0-9]+)/g;
|
118
|
+
|
119
|
+
var firstNums = firstLine.match(findNums);
|
120
|
+
var secondNums = secondLine.match(findNums);
|
121
|
+
|
122
|
+
var firstWithoutNums = firstLine.replace(findNums, "NUMBER");
|
123
|
+
var secondWithoutNums = secondLine.replace(findNums, "NUMBER");
|
124
|
+
|
125
|
+
if (firstWithoutNums !== secondWithoutNums) {
|
126
|
+
return false;
|
127
|
+
}
|
128
|
+
|
129
|
+
if (secondNums.length !== firstNums.length) {
|
130
|
+
return false;
|
131
|
+
}
|
132
|
+
|
133
|
+
for (var i = 0; i < firstNums.length; i++) {
|
134
|
+
if (Math.abs(+firstNums[i] - +secondNums[i]) > delta) {
|
135
|
+
return false;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
return true;
|
140
|
+
}
|
@@ -0,0 +1,1230 @@
|
|
1
|
+
/* global appendChartID, loadDateFixture, makeDate, cleanDateRange */
|
2
|
+
describe('dc.barChart', function () {
|
3
|
+
var id, chart, data;
|
4
|
+
var dimension, group;
|
5
|
+
|
6
|
+
beforeEach(function () {
|
7
|
+
data = crossfilter(loadDateFixture());
|
8
|
+
dimension = data.dimension(function (d) { return d3.time.day.utc(d.dd); });
|
9
|
+
group = dimension.group();
|
10
|
+
|
11
|
+
id = 'bar-chart';
|
12
|
+
appendChartID(id);
|
13
|
+
|
14
|
+
chart = dc.barChart('#' + id);
|
15
|
+
chart.dimension(dimension).group(group)
|
16
|
+
.width(1100).height(200)
|
17
|
+
.x(d3.time.scale.utc().domain([makeDate(2012, 0, 1), makeDate(2012, 11, 31)]))
|
18
|
+
.transitionDuration(0)
|
19
|
+
.controlsUseVisibility(true);
|
20
|
+
});
|
21
|
+
|
22
|
+
describe('rendering', function () {
|
23
|
+
beforeEach(function () {
|
24
|
+
chart.render();
|
25
|
+
});
|
26
|
+
|
27
|
+
it('should set bar height using y-values from data', function () {
|
28
|
+
forEachBar(function (bar, datum) {
|
29
|
+
expect(+bar.attr('y')).toBe(chart.y()(datum.data.value));
|
30
|
+
});
|
31
|
+
});
|
32
|
+
|
33
|
+
it('should set bar width to the minimum for a relatively small chart', function () {
|
34
|
+
forEachBar(function (bar) {
|
35
|
+
expect(+bar.attr('width')).toBe(1);
|
36
|
+
});
|
37
|
+
});
|
38
|
+
|
39
|
+
it('should preserve method chaining', function () {
|
40
|
+
expect(chart.render()).toEqual(chart);
|
41
|
+
});
|
42
|
+
|
43
|
+
it('should not display bar labels without setting renderLabel(true)', function () {
|
44
|
+
expect(chart.selectAll('text.barLabel').size()).toBe(0);
|
45
|
+
});
|
46
|
+
|
47
|
+
describe('with centered bars', function () {
|
48
|
+
beforeEach(function () {
|
49
|
+
chart.centerBar(true).render();
|
50
|
+
});
|
51
|
+
|
52
|
+
it('should position bars centered around their data points', function () {
|
53
|
+
var halfBarWidth = 0.5;
|
54
|
+
forEachBar(function (bar, datum) {
|
55
|
+
var barPosition = chart.x()(datum.data.key);
|
56
|
+
expect(+bar.attr('x')).toBeCloseTo(barPosition - halfBarWidth, 3);
|
57
|
+
});
|
58
|
+
});
|
59
|
+
});
|
60
|
+
|
61
|
+
describe('without centered bars', function () {
|
62
|
+
it('should position bars starting at their data points', function () {
|
63
|
+
forEachBar(function (bar, datum) {
|
64
|
+
var barPosition = chart.x()(datum.data.key);
|
65
|
+
expect(+bar.attr('x')).toBeCloseTo(barPosition, 3);
|
66
|
+
});
|
67
|
+
});
|
68
|
+
});
|
69
|
+
|
70
|
+
describe('with bar labels', function () {
|
71
|
+
beforeEach(function () {
|
72
|
+
chart.renderLabel(true).render();
|
73
|
+
});
|
74
|
+
|
75
|
+
it('should generate a label for each datum', function () {
|
76
|
+
expect(chart.selectAll('text.barLabel').size()).toBe(6);
|
77
|
+
});
|
78
|
+
|
79
|
+
it('should generate labels with positions corresponding to their data', function () {
|
80
|
+
expect(nthStack(0).nthLabel(0).attr('x')).toBeWithinDelta(405, 1);
|
81
|
+
expect(nthStack(0).nthLabel(0).attr('y')).toBeWithinDelta(104, 1);
|
82
|
+
expect(nthStack(0).nthLabel(0).text()).toBe('1');
|
83
|
+
|
84
|
+
expect(nthStack(0).nthLabel(3).attr('x')).toBeWithinDelta(509, 1);
|
85
|
+
expect(nthStack(0).nthLabel(3).attr('y')).toBeWithinDelta(104, 1);
|
86
|
+
expect(nthStack(0).nthLabel(3).text()).toBe('1');
|
87
|
+
|
88
|
+
expect(nthStack(0).nthLabel(5).attr('x')).toBeWithinDelta(620, 1);
|
89
|
+
expect(nthStack(0).nthLabel(5).attr('y')).toBeWithinDelta(50, 1);
|
90
|
+
expect(nthStack(0).nthLabel(5).text()).toBe('2');
|
91
|
+
});
|
92
|
+
});
|
93
|
+
|
94
|
+
describe('with custom bar labels', function () {
|
95
|
+
beforeEach(function () {
|
96
|
+
chart.label(function () {
|
97
|
+
return 'custom label';
|
98
|
+
}).render();
|
99
|
+
});
|
100
|
+
|
101
|
+
it('should render a label for each datum', function () {
|
102
|
+
expect(chart.selectAll('text.barLabel').size()).toBe(6);
|
103
|
+
});
|
104
|
+
|
105
|
+
it('should use the custom function for each label', function () {
|
106
|
+
chart.selectAll('text.barLabel').each(function () {
|
107
|
+
expect(d3.select(this).text()).toBe('custom label');
|
108
|
+
});
|
109
|
+
});
|
110
|
+
|
111
|
+
describe('with labels disabled', function () {
|
112
|
+
beforeEach(function () {
|
113
|
+
chart.renderLabel(false).render();
|
114
|
+
});
|
115
|
+
|
116
|
+
it('should not display labels', function () {
|
117
|
+
expect(chart.selectAll('text.barLabel').size()).toBe(0);
|
118
|
+
});
|
119
|
+
});
|
120
|
+
});
|
121
|
+
|
122
|
+
describe('and then switching the group at runtime', function () {
|
123
|
+
beforeEach(function () {
|
124
|
+
chart.rescale(); // BUG: barWidth cannot change after initial rendering
|
125
|
+
|
126
|
+
var domain = [makeDate(2012, 4, 20), makeDate(2012, 7, 15)];
|
127
|
+
|
128
|
+
chart.x(d3.time.scale.utc().domain(domain))
|
129
|
+
.group(dimension.group().reduceSum(function (d) {
|
130
|
+
return +d.nvalue;
|
131
|
+
}))
|
132
|
+
.elasticY(true)
|
133
|
+
.centerBar(false)
|
134
|
+
.xUnits(d3.time.days.utc)
|
135
|
+
.yAxis().ticks(5);
|
136
|
+
|
137
|
+
chart.render();
|
138
|
+
});
|
139
|
+
|
140
|
+
it('should generate a bar for each datum', function () {
|
141
|
+
expect(chart.selectAll('rect.bar').size()).toBe(6);
|
142
|
+
});
|
143
|
+
|
144
|
+
it('should automatically resize the bar widths', function () {
|
145
|
+
forEachBar(function (bar) {
|
146
|
+
expect(bar.attr('width')).toBe('9');
|
147
|
+
});
|
148
|
+
});
|
149
|
+
function nthYAxisText (n) {
|
150
|
+
return d3.select(chart.selectAll('g.y text')[0][n]);
|
151
|
+
}
|
152
|
+
it('should generate bars with positions corresponding to their data', function () {
|
153
|
+
expect(nthStack(0).nthBar(0).attr('x')).toBeWithinDelta(58, 1);
|
154
|
+
expect(nthStack(0).nthBar(0).attr('y')).toBeWithinDelta(84, 1);
|
155
|
+
expect(nthStack(0).nthBar(0).attr('height')).toBeWithinDelta(30, 1);
|
156
|
+
|
157
|
+
expect(nthStack(0).nthBar(3).attr('x')).toBeWithinDelta(492, 1);
|
158
|
+
expect(nthStack(0).nthBar(3).attr('y')).toBeWithinDelta(84, 1);
|
159
|
+
expect(nthStack(0).nthBar(3).attr('height')).toBeWithinDelta(23, 1);
|
160
|
+
|
161
|
+
expect(nthStack(0).nthBar(5).attr('x')).toBeWithinDelta(961, 1);
|
162
|
+
expect(nthStack(0).nthBar(5).attr('y')).toBeWithinDelta(61, 1);
|
163
|
+
expect(nthStack(0).nthBar(5).attr('height')).toBeWithinDelta(23, 1);
|
164
|
+
});
|
165
|
+
|
166
|
+
it('should generate the y-axis domain dynamically', function () {
|
167
|
+
expect(nthYAxisText(0).text()).toMatch(/-10/);
|
168
|
+
expect(nthYAxisText(1).text()).toMatch(/-5/);
|
169
|
+
expect(nthYAxisText(2).text()).toBe('0');
|
170
|
+
});
|
171
|
+
|
172
|
+
});
|
173
|
+
|
174
|
+
describe('with an ordinal x domain', function () {
|
175
|
+
var stateDimension;
|
176
|
+
|
177
|
+
beforeEach(function () {
|
178
|
+
stateDimension = data.dimension(function (d) { return d.state; });
|
179
|
+
var stateGroup = stateDimension.group();
|
180
|
+
var ordinalDomainValues = ['California', 'Colorado', 'Delaware', 'Ontario', 'Mississippi', 'Oklahoma'];
|
181
|
+
|
182
|
+
chart.rescale(); // BUG: barWidth cannot change after initial rendering
|
183
|
+
|
184
|
+
chart.dimension(stateDimension)
|
185
|
+
.group(stateGroup)
|
186
|
+
.xUnits(dc.units.ordinal)
|
187
|
+
.x(d3.scale.ordinal().domain(ordinalDomainValues))
|
188
|
+
.barPadding(0)
|
189
|
+
.outerPadding(0.1)
|
190
|
+
.render();
|
191
|
+
});
|
192
|
+
|
193
|
+
it('should automatically disable the brush', function () {
|
194
|
+
expect(chart.brushOn()).toBeFalsy();
|
195
|
+
});
|
196
|
+
|
197
|
+
it('should generate a bar for each ordinal domain value', function () {
|
198
|
+
expect(chart.selectAll('rect.bar').size()).toBe(6);
|
199
|
+
});
|
200
|
+
|
201
|
+
it('should size the bars proportionally to the graph', function () {
|
202
|
+
expect(+chart.select('rect.bar').attr('width')).toBe(164);
|
203
|
+
});
|
204
|
+
|
205
|
+
it('should position the bar based on the ordinal range', function () {
|
206
|
+
expect(nthStack(0).nthBar(0).attr('x')).toBeWithinDelta(16, 1);
|
207
|
+
expect(nthStack(0).nthBar(3).attr('x')).toBeWithinDelta(674, 1);
|
208
|
+
expect(nthStack(0).nthBar(5).attr('x')).toBeWithinDelta(509, 1);
|
209
|
+
});
|
210
|
+
|
211
|
+
it('should fade deselected bars', function () {
|
212
|
+
chart.filter('Ontario').filter('Colorado').redraw();
|
213
|
+
expect(nthStack(0).nthBar(0).classed('deselected')).toBeTruthy();
|
214
|
+
expect(nthStack(0).nthBar(1).classed('deselected')).toBeFalsy();
|
215
|
+
expect(nthStack(0).nthBar(5).classed('deselected')).toBeFalsy();
|
216
|
+
expect(stateDimension.top(Infinity).length).toBe(3);
|
217
|
+
});
|
218
|
+
|
219
|
+
it('should respect the ordering of the specified domain', function () {
|
220
|
+
// Note that bar chart works differently from pie chart. The bar objects (the
|
221
|
+
// actual DOM nodes) don't get reordered by the custom ordering, but they are
|
222
|
+
// placed so that they are drawn in the order specified.
|
223
|
+
var ontarioXPos = nthStack(0).nthBar(5).attr('x');
|
224
|
+
var mississippiXPos = nthStack(0).nthBar(3).attr('x');
|
225
|
+
var oklahomaXPos = nthStack(0).nthBar(4).attr('x');
|
226
|
+
|
227
|
+
expect(ontarioXPos).toBeLessThan(mississippiXPos);
|
228
|
+
expect(mississippiXPos).toBeLessThan(oklahomaXPos);
|
229
|
+
});
|
230
|
+
|
231
|
+
describe('with elasticY enabled', function () {
|
232
|
+
beforeEach(function () {
|
233
|
+
chart.elasticY(true).render();
|
234
|
+
});
|
235
|
+
|
236
|
+
it('should use all ordinal keys to determine the maximum y', function () {
|
237
|
+
expect(chart.y().domain()).toEqual([0, 3]);
|
238
|
+
});
|
239
|
+
});
|
240
|
+
|
241
|
+
describe('with an unspecified domain', function () {
|
242
|
+
beforeEach(function () {
|
243
|
+
chart.x(d3.scale.ordinal()).render();
|
244
|
+
});
|
245
|
+
|
246
|
+
it('should use alphabetical ordering', function () {
|
247
|
+
var data = chart.selectAll('rect.bar').data();
|
248
|
+
var expectedData = ['California', 'Colorado', 'Delaware', 'Mississippi', 'Oklahoma', 'Ontario'];
|
249
|
+
|
250
|
+
expect(data.map(function (datum) { return datum.x; })).toEqual(expectedData);
|
251
|
+
|
252
|
+
var oldX = -Infinity;
|
253
|
+
forEachBar(function (bar) {
|
254
|
+
expect(bar.attr('x')).toBeGreaterThan(oldX);
|
255
|
+
oldX = bar.attr('x');
|
256
|
+
});
|
257
|
+
});
|
258
|
+
});
|
259
|
+
|
260
|
+
describe('redrawing after changing the value accessor', function () {
|
261
|
+
beforeEach(function () {
|
262
|
+
chart.valueAccessor(function () { return 30; });
|
263
|
+
chart.redraw();
|
264
|
+
});
|
265
|
+
|
266
|
+
it('should position bars based on ordinal range', function () {
|
267
|
+
expect(nthStack(0).nthBar(0).attr('height')).toBe('1600');
|
268
|
+
expect(nthStack(0).nthBar(1).attr('height')).toBe('1600');
|
269
|
+
expect(nthStack(0).nthBar(2).attr('height')).toBe('1600');
|
270
|
+
});
|
271
|
+
});
|
272
|
+
|
273
|
+
describe('clicking', function () {
|
274
|
+
it('causes other dimension to be filtered', function () {
|
275
|
+
expect(dimension.top(Infinity).length).toEqual(10);
|
276
|
+
// fake a click
|
277
|
+
var abar = chart.selectAll('rect.bar:nth-child(3)');
|
278
|
+
abar.on('click')(abar.datum());
|
279
|
+
expect(dimension.top(Infinity).length).toEqual(1);
|
280
|
+
});
|
281
|
+
});
|
282
|
+
|
283
|
+
describe('clicking bar labels', function () {
|
284
|
+
beforeEach(function () {
|
285
|
+
chart.renderLabel(true).render();
|
286
|
+
});
|
287
|
+
|
288
|
+
it('causes other dimension to be filtered', function () {
|
289
|
+
expect(dimension.top(Infinity).length).toEqual(10);
|
290
|
+
// fake a click
|
291
|
+
var alabel = chart.select('text.barLabel');
|
292
|
+
alabel.on('click')(alabel.datum());
|
293
|
+
expect(dimension.top(Infinity).length).toEqual(3);
|
294
|
+
});
|
295
|
+
});
|
296
|
+
});
|
297
|
+
|
298
|
+
describe('with a linear x domain', function () {
|
299
|
+
beforeEach(function () {
|
300
|
+
var linearDimension = data.dimension(function (d) { return +d.value; });
|
301
|
+
var linearGroup = linearDimension.group();
|
302
|
+
|
303
|
+
chart.rescale(); // BUG: barWidth cannot change after initial rendering
|
304
|
+
|
305
|
+
chart.dimension(linearDimension)
|
306
|
+
.group(linearGroup)
|
307
|
+
.xUnits(dc.units.integers)
|
308
|
+
.x(d3.scale.linear().domain([20, 70]))
|
309
|
+
.render();
|
310
|
+
});
|
311
|
+
|
312
|
+
it('should generate the correct number of bars', function () {
|
313
|
+
expect(chart.selectAll('rect.bar').size()).toBe(5);
|
314
|
+
});
|
315
|
+
|
316
|
+
it('should auto size bar width', function () {
|
317
|
+
forEachBar(function (bar) {
|
318
|
+
expect(bar.attr('width')).toBe('18');
|
319
|
+
});
|
320
|
+
});
|
321
|
+
|
322
|
+
it('should position bars based on linear range', function () {
|
323
|
+
expect(nthStack(0).nthBar(0).attr('x')).toBeWithinDelta(40, 1);
|
324
|
+
expect(nthStack(0).nthBar(2).attr('x')).toBeWithinDelta(489, 1);
|
325
|
+
expect(nthStack(0).nthBar(4).attr('x')).toBeWithinDelta(938, 1);
|
326
|
+
});
|
327
|
+
|
328
|
+
describe('with a custom click handler', function () {
|
329
|
+
beforeEach(function () {
|
330
|
+
chart.brushOn(false)
|
331
|
+
.on('renderlet', function (_chart) {
|
332
|
+
_chart.selectAll('rect.bar').on('click', _chart.onClick);
|
333
|
+
})
|
334
|
+
.render();
|
335
|
+
});
|
336
|
+
it('clicking causes another dimension to be filtered', function () {
|
337
|
+
expect(dimension.top(Infinity).length).toEqual(10);
|
338
|
+
var abar = chart.selectAll('rect.bar:nth-child(3)');
|
339
|
+
abar.on('click')(abar.datum());
|
340
|
+
expect(dimension.top(Infinity).length).toEqual(3);
|
341
|
+
});
|
342
|
+
});
|
343
|
+
});
|
344
|
+
|
345
|
+
describe('with stacked data', function () {
|
346
|
+
describe('with positive data', function () {
|
347
|
+
beforeEach(function () {
|
348
|
+
var idGroup = dimension.group().reduceSum(function (d) { return d.id; });
|
349
|
+
var sumGroup = dimension.group().reduceSum(function (d) { return d.value; });
|
350
|
+
|
351
|
+
chart
|
352
|
+
.brushOn(false)
|
353
|
+
.x(d3.time.scale.utc().domain([makeDate(2012, 4, 20), makeDate(2012, 7, 15)]))
|
354
|
+
.group(idGroup, 'stack 0')
|
355
|
+
.title('stack 0', function (d) { return 'stack 0: ' + d.value; })
|
356
|
+
.stack(sumGroup, 'stack 1')
|
357
|
+
.title('stack 1', function (d) { return 'stack 1: ' + d.value; })
|
358
|
+
.stack(sumGroup, 'stack 2', function (d) { return 3; })
|
359
|
+
.elasticY(true)
|
360
|
+
.renderLabel(true)
|
361
|
+
.render();
|
362
|
+
});
|
363
|
+
|
364
|
+
it('should set the y domain to encompass all stacks', function () {
|
365
|
+
expect(chart.y().domain()).toEqual([0, 152]);
|
366
|
+
});
|
367
|
+
|
368
|
+
it('should generate each stack using its associated group', function () {
|
369
|
+
expect(nthStack(0).selectAll('rect.bar').size()).toBe(6);
|
370
|
+
expect(nthStack(1).selectAll('rect.bar').size()).toBe(6);
|
371
|
+
expect(nthStack(2).selectAll('rect.bar').size()).toBe(6);
|
372
|
+
});
|
373
|
+
|
374
|
+
it('should render the correct number of stacks', function () {
|
375
|
+
expect(chart.selectAll('.stack').size()).toBe(3);
|
376
|
+
});
|
377
|
+
|
378
|
+
it('should display one label for each stack', function () {
|
379
|
+
expect(chart.selectAll('text.barLabel').size()).toBe(6);
|
380
|
+
});
|
381
|
+
|
382
|
+
it('should generate labels with total value of stack', function () {
|
383
|
+
expect(nthStack(2).nthLabel(0).text()).toBe('48');
|
384
|
+
expect(nthStack(2).nthLabel(3).text()).toBe('51');
|
385
|
+
expect(nthStack(2).nthLabel(5).text()).toBe('92');
|
386
|
+
});
|
387
|
+
|
388
|
+
it('should stack the bars', function () {
|
389
|
+
expect(+nthStack(0).nthBar(2).attr('y')).toBe(142);
|
390
|
+
expect(+nthStack(0).nthBar(4).attr('y')).toBe(144);
|
391
|
+
|
392
|
+
expect(+nthStack(1).nthBar(2).attr('y')).toBe(3);
|
393
|
+
expect(+nthStack(1).nthBar(4).attr('y')).toBe(86);
|
394
|
+
|
395
|
+
expect(+nthStack(2).nthBar(2).attr('y')).toBe(0);
|
396
|
+
expect(+nthStack(2).nthBar(4).attr('y')).toBe(83);
|
397
|
+
});
|
398
|
+
|
399
|
+
it('should have its own title accessor', function () {
|
400
|
+
expect(chart.title()({value: 1})).toBe('stack 0: 1');
|
401
|
+
expect(chart.title('stack 0')({value: 2})).toBe('stack 0: 2');
|
402
|
+
expect(chart.title('stack 1')({value: 3})).toBe('stack 1: 3');
|
403
|
+
});
|
404
|
+
|
405
|
+
it('should have titles rendered for extra stacks', function () {
|
406
|
+
nthStack(1).forEachBar(function (bar, datum) {
|
407
|
+
expect(bar.selectAll('title')[0].length).toBe(1);
|
408
|
+
expect(bar.select('title').text()).toBe('stack 1: ' + datum.data.value);
|
409
|
+
});
|
410
|
+
});
|
411
|
+
|
412
|
+
it('should default to first stack title for untitled stacks', function () {
|
413
|
+
nthStack(2).forEachBar(function (bar, datum) {
|
414
|
+
expect(bar.select('title').text()).toBe('stack 0: ' + datum.data.value);
|
415
|
+
});
|
416
|
+
});
|
417
|
+
|
418
|
+
describe('extra redraws', function () {
|
419
|
+
beforeEach(function () {
|
420
|
+
chart.redraw();
|
421
|
+
chart.redraw();
|
422
|
+
});
|
423
|
+
|
424
|
+
it('should not create extra title elements', function () {
|
425
|
+
nthStack(1).forEachBar(function (bar, datum) {
|
426
|
+
expect(bar.selectAll('title')[0].length).toBe(1);
|
427
|
+
});
|
428
|
+
});
|
429
|
+
});
|
430
|
+
|
431
|
+
describe('with title rendering disabled', function () {
|
432
|
+
beforeEach(function () {
|
433
|
+
chart.renderTitle(false).render();
|
434
|
+
});
|
435
|
+
|
436
|
+
it('should not generate title elements', function () {
|
437
|
+
expect(chart.selectAll('rect.bar title').empty()).toBeTruthy();
|
438
|
+
});
|
439
|
+
});
|
440
|
+
|
441
|
+
describe('stack hiding', function () {
|
442
|
+
describe('first stack', function () {
|
443
|
+
beforeEach(function () {
|
444
|
+
chart.hideStack('stack 0').render();
|
445
|
+
});
|
446
|
+
|
447
|
+
it('should hide the stack', function () {
|
448
|
+
expect(nthStack(0).nthBar(0).attr('height')).toBe('52');
|
449
|
+
expect(nthStack(0).nthBar(1).attr('height')).toBe('78');
|
450
|
+
});
|
451
|
+
|
452
|
+
it('should show the stack', function () {
|
453
|
+
chart.showStack('stack 0').render();
|
454
|
+
expect(nthStack(0).nthBar(0).attr('height')).toBe('1');
|
455
|
+
expect(nthStack(0).nthBar(1).attr('height')).toBe('6');
|
456
|
+
});
|
457
|
+
});
|
458
|
+
|
459
|
+
describe('any other stack', function () {
|
460
|
+
beforeEach(function () {
|
461
|
+
chart.title('stack 2', function (d) { return 'stack 2: ' + d.value; });
|
462
|
+
chart.hideStack('stack 1').render();
|
463
|
+
});
|
464
|
+
|
465
|
+
it('should hide the stack', function () {
|
466
|
+
expect(nthStack(1).nthBar(0).attr('height')).toBe('24');
|
467
|
+
expect(nthStack(1).nthBar(1).attr('height')).toBe('24');
|
468
|
+
});
|
469
|
+
|
470
|
+
it('should show the stack', function () {
|
471
|
+
chart.showStack('stack 1').render();
|
472
|
+
expect(nthStack(1).nthBar(0).attr('height')).toBe('46');
|
473
|
+
expect(nthStack(1).nthBar(1).attr('height')).toBe('70');
|
474
|
+
});
|
475
|
+
|
476
|
+
it('should still show the title for a visible stack', function () {
|
477
|
+
nthStack(1).forEachBar(function (bar, datum) {
|
478
|
+
expect(bar.select('title').text()).toBe('stack 2: ' + datum.data.value);
|
479
|
+
});
|
480
|
+
});
|
481
|
+
});
|
482
|
+
|
483
|
+
describe('hiding all the stacks', function () {
|
484
|
+
beforeEach(function () {
|
485
|
+
chart.hideStack('stack 0')
|
486
|
+
.hideStack('stack 1')
|
487
|
+
.hideStack('stack 2')
|
488
|
+
.render();
|
489
|
+
});
|
490
|
+
|
491
|
+
it('should show a blank graph', function () {
|
492
|
+
expect(chart.selectAll('rect.bar').size()).toBe(0);
|
493
|
+
});
|
494
|
+
});
|
495
|
+
});
|
496
|
+
});
|
497
|
+
|
498
|
+
describe('with negative data', function () {
|
499
|
+
beforeEach(function () {
|
500
|
+
var negativeGroup = dimension.group().reduceSum(function (d) { return d.nvalue; });
|
501
|
+
|
502
|
+
chart.group(negativeGroup).stack(negativeGroup).stack(negativeGroup);
|
503
|
+
chart.x(d3.time.scale.utc().domain([makeDate(2012, 4, 20), makeDate(2012, 7, 15)]));
|
504
|
+
|
505
|
+
chart.margins({top: 30, right: 50, bottom: 30, left: 30})
|
506
|
+
.yAxisPadding(5)
|
507
|
+
.elasticY(true)
|
508
|
+
.xUnits(d3.time.days.utc)
|
509
|
+
.yAxis().ticks(5);
|
510
|
+
|
511
|
+
chart.rescale(); // BUG: barWidth cannot change after initial rendering
|
512
|
+
|
513
|
+
chart.render();
|
514
|
+
});
|
515
|
+
|
516
|
+
it('should generate a bar for each datum across all stacks', function () {
|
517
|
+
expect(chart.selectAll('rect.bar').size()).toBe(18);
|
518
|
+
});
|
519
|
+
|
520
|
+
it('should automatically size the bar widths', function () {
|
521
|
+
forEachBar(function (bar) {
|
522
|
+
expect(bar.attr('width')).toBe('9');
|
523
|
+
});
|
524
|
+
});
|
525
|
+
|
526
|
+
it('should generate negative bars for stack 0', function () {
|
527
|
+
expect(nthStack(0).nthBar(0).attr('x')).toBeWithinDelta(58, 1);
|
528
|
+
expect(nthStack(0).nthBar(0).attr('y')).toBeWithinDelta(73, 1);
|
529
|
+
expect(nthStack(0).nthBar(0).attr('height')).toBeWithinDelta(8, 1);
|
530
|
+
|
531
|
+
expect(nthStack(0).nthBar(3).attr('x')).toBeWithinDelta(492, 1);
|
532
|
+
expect(nthStack(0).nthBar(3).attr('y')).toBeWithinDelta(73, 1);
|
533
|
+
expect(nthStack(0).nthBar(3).attr('height')).toBeWithinDelta(6, 1);
|
534
|
+
|
535
|
+
expect(nthStack(0).nthBar(5).attr('x')).toBeWithinDelta(961, 1);
|
536
|
+
expect(nthStack(0).nthBar(5).attr('y')).toBeWithinDelta(67, 1);
|
537
|
+
expect(nthStack(0).nthBar(5).attr('height')).toBeWithinDelta(6, 1);
|
538
|
+
});
|
539
|
+
|
540
|
+
it('should generate negative bar for stack 1', function () {
|
541
|
+
expect(nthStack(1).nthBar(0).attr('x')).toBeWithinDelta(58, 1);
|
542
|
+
expect(nthStack(1).nthBar(0).attr('y')).toBeWithinDelta(81, 1);
|
543
|
+
expect(nthStack(1).nthBar(0).attr('height')).toBeWithinDelta(7, 1);
|
544
|
+
|
545
|
+
expect(nthStack(1).nthBar(3).attr('x')).toBeWithinDelta(492, 1);
|
546
|
+
expect(nthStack(1).nthBar(3).attr('y')).toBeWithinDelta(79, 1);
|
547
|
+
expect(nthStack(1).nthBar(3).attr('height')).toBeWithinDelta(5, 1);
|
548
|
+
|
549
|
+
expect(nthStack(1).nthBar(5).attr('x')).toBeWithinDelta(961, 1);
|
550
|
+
expect(nthStack(1).nthBar(5).attr('y')).toBeWithinDelta(61, 1);
|
551
|
+
expect(nthStack(1).nthBar(5).attr('height')).toBeWithinDelta(6, 1);
|
552
|
+
});
|
553
|
+
|
554
|
+
it('should generate y axis domain dynamically', function () {
|
555
|
+
var nthText = function (n) { return d3.select(chart.selectAll('g.y text')[0][n]); };
|
556
|
+
|
557
|
+
expect(nthText(0).text()).toBe('-20');
|
558
|
+
expect(nthText(1).text()).toBe('0');
|
559
|
+
expect(nthText(2).text()).toBe('20');
|
560
|
+
});
|
561
|
+
});
|
562
|
+
});
|
563
|
+
|
564
|
+
it('should not be focused by default', function () {
|
565
|
+
expect(chart.refocused()).toBeFalsy();
|
566
|
+
});
|
567
|
+
|
568
|
+
describe('when focused', function () {
|
569
|
+
beforeEach(function () {
|
570
|
+
chart.elasticY(true).gap(1).xUnits(d3.time.days.utc);
|
571
|
+
chart.focus([makeDate(2012, 5, 11), makeDate(2012, 6, 9)]);
|
572
|
+
});
|
573
|
+
|
574
|
+
it('should render the one (focused) bar', function () {
|
575
|
+
expect(chart.selectAll('rect.bar').size()).toBe(1);
|
576
|
+
});
|
577
|
+
|
578
|
+
it('should resize the bar width according to the focused width', function () {
|
579
|
+
expect(chart.select('rect.bar').attr('width')).toBe('35');
|
580
|
+
});
|
581
|
+
|
582
|
+
it('should reset the y-axis domain based on the focus range', function () {
|
583
|
+
expect(chart.y().domain()).toEqual([0, 1]);
|
584
|
+
});
|
585
|
+
|
586
|
+
it('should redraw the x-axis scale and ticks', function () {
|
587
|
+
expect(xAxisText().slice(0,4)).toEqual(['Mon 11', 'Wed 13', 'Fri 15', 'Jun 17']);
|
588
|
+
});
|
589
|
+
|
590
|
+
it('should set its focus flag', function () {
|
591
|
+
expect(chart.refocused()).toBeTruthy();
|
592
|
+
});
|
593
|
+
|
594
|
+
it('should reset the focus when focused to null', function () {
|
595
|
+
chart.focus(null);
|
596
|
+
itBehavesLikeItWasReset();
|
597
|
+
});
|
598
|
+
|
599
|
+
it('should reset the focus when focused to []', function () {
|
600
|
+
chart.focus([]);
|
601
|
+
itBehavesLikeItWasReset();
|
602
|
+
});
|
603
|
+
|
604
|
+
function itBehavesLikeItWasReset () {
|
605
|
+
expect(chart.refocused()).toBeFalsy();
|
606
|
+
expect(chart.x().domain()).toEqual([makeDate(2012, 0, 1), makeDate(2012, 11, 31)]);
|
607
|
+
|
608
|
+
expect(xAxisText().slice(0,4)).toEqual(['2012', 'February', 'March', 'April']);
|
609
|
+
}
|
610
|
+
|
611
|
+
function xAxisText () {
|
612
|
+
return chart.selectAll('g.x text')[0].map(function (x) { return d3.select(x).text(); });
|
613
|
+
}
|
614
|
+
});
|
615
|
+
|
616
|
+
describe('legend hovering', function () {
|
617
|
+
var firstItem;
|
618
|
+
|
619
|
+
beforeEach(function () {
|
620
|
+
chart.stack(group)
|
621
|
+
.legend(dc.legend().x(400).y(10).itemHeight(13).gap(5))
|
622
|
+
.render();
|
623
|
+
|
624
|
+
firstItem = chart.select('g.dc-legend g.dc-legend-item');
|
625
|
+
firstItem.on('mouseover')(firstItem.datum());
|
626
|
+
});
|
627
|
+
|
628
|
+
describe('when a legend item is hovered over', function () {
|
629
|
+
it('should highlight corresponding lines and areas', function () {
|
630
|
+
nthStack(0).forEachBar(function (bar) {
|
631
|
+
expect(bar.classed('highlight')).toBeTruthy();
|
632
|
+
});
|
633
|
+
});
|
634
|
+
|
635
|
+
it('should fade out non-corresponding lines and areas', function () {
|
636
|
+
nthStack(1).forEachBar(function (bar) {
|
637
|
+
expect(bar.classed('fadeout')).toBeTruthy();
|
638
|
+
});
|
639
|
+
});
|
640
|
+
});
|
641
|
+
|
642
|
+
describe('when a legend item is hovered out', function () {
|
643
|
+
it('should remove highlighting from corresponding lines and areas', function () {
|
644
|
+
firstItem.on('mouseout')(firstItem.datum());
|
645
|
+
nthStack(0).forEachBar(function (bar) {
|
646
|
+
expect(bar.classed('highlight')).toBeFalsy();
|
647
|
+
});
|
648
|
+
});
|
649
|
+
|
650
|
+
it('should fade in non-corresponding lines and areas', function () {
|
651
|
+
firstItem.on('mouseout')(firstItem.datum());
|
652
|
+
nthStack(1).forEachBar(function (bar) {
|
653
|
+
expect(bar.classed('fadeout')).toBeFalsy();
|
654
|
+
});
|
655
|
+
});
|
656
|
+
});
|
657
|
+
});
|
658
|
+
|
659
|
+
describe('filtering', function () {
|
660
|
+
beforeEach(function () {
|
661
|
+
d3.select('#' + id).append('span').attr('class', 'filter').style('visibility', 'hidden');
|
662
|
+
d3.select('#' + id).append('a').attr('class', 'reset').style('visibility', 'hidden');
|
663
|
+
chart.filter([makeDate(2012, 5, 1), makeDate(2012, 5, 30)]).redraw();
|
664
|
+
dc.dateFormat = d3.time.format.utc('%m/%d/%Y');
|
665
|
+
chart.redraw();
|
666
|
+
});
|
667
|
+
|
668
|
+
it('should set the chart filter', function () {
|
669
|
+
expect(chart.filter()).toEqual([makeDate(2012, 5, 1), makeDate(2012, 5, 30)]);
|
670
|
+
});
|
671
|
+
|
672
|
+
it('should enable the reset link after rendering', function () {
|
673
|
+
expect(chart.select('a.reset').style('visibility')).not.toBe('none');
|
674
|
+
});
|
675
|
+
|
676
|
+
it('should set the filter printer', function () {
|
677
|
+
expect(chart.filterPrinter()).not.toBeNull();
|
678
|
+
});
|
679
|
+
|
680
|
+
it('should show the filter info', function () {
|
681
|
+
expect(chart.select('span.filter').style('visibility')).toBe('visible');
|
682
|
+
});
|
683
|
+
|
684
|
+
it('should set filter text after slice selection', function () {
|
685
|
+
expect(chart.select('span.filter').text()).toBe('[06/01/2012 -> 06/30/2012]');
|
686
|
+
});
|
687
|
+
|
688
|
+
describe('when a brush is defined', function () {
|
689
|
+
it('should position the brush with an offset', function () {
|
690
|
+
expect(chart.select('g.brush').attr('transform')).toMatchTranslate(chart.margins().left, 10);
|
691
|
+
});
|
692
|
+
|
693
|
+
it('should create a fancy brush resize handle', function () {
|
694
|
+
chart.select('g.brush').selectAll('.resize path').each(function (d, i) {
|
695
|
+
if (i === 0) {
|
696
|
+
expect(d3.select(this).attr('d'))
|
697
|
+
.toMatchPath('M0.5,53 A6,6 0 0 1 6.5,59 V100 A6,6 0 0 1 0.5,106 ZM2.5,61 V98 M4.5,61 V98');
|
698
|
+
} else {
|
699
|
+
expect(d3.select(this).attr('d'))
|
700
|
+
.toMatchPath('M-0.5,53 A6,6 0 0 0 -6.5,59 V100 A6,6 0 0 0 -0.5,106 ZM-2.5,61 V98 M-4.5,61 V98');
|
701
|
+
}
|
702
|
+
});
|
703
|
+
});
|
704
|
+
|
705
|
+
it('should stretch the background', function () {
|
706
|
+
expect(+chart.select('g.brush rect.background').attr('width')).toBe(1020);
|
707
|
+
});
|
708
|
+
|
709
|
+
it('should set the background height to the chart height', function () {
|
710
|
+
expect(+chart.select('g.brush rect.background').attr('height')).toBe(160);
|
711
|
+
});
|
712
|
+
|
713
|
+
it('should set extent height to the chart height', function () {
|
714
|
+
expect(+chart.select('g.brush rect.extent').attr('height')).toBe(160);
|
715
|
+
});
|
716
|
+
|
717
|
+
it('should set extent width based on filter set', function () {
|
718
|
+
expect(chart.select('g.brush rect.extent').attr('width')).toBeWithinDelta(81, 1);
|
719
|
+
});
|
720
|
+
|
721
|
+
it('should push unselected bars to the background', function () {
|
722
|
+
expect(nthStack(0).nthBar(0).classed('deselected')).toBeTruthy();
|
723
|
+
expect(nthStack(0).nthBar(1).classed('deselected')).toBeFalsy();
|
724
|
+
expect(nthStack(0).nthBar(3).classed('deselected')).toBeTruthy();
|
725
|
+
});
|
726
|
+
|
727
|
+
it('should push the selected bars to the foreground', function () {
|
728
|
+
expect(nthStack(0).nthBar(1).classed('deselected')).toBeFalsy();
|
729
|
+
});
|
730
|
+
|
731
|
+
describe('after reset', function () {
|
732
|
+
beforeEach(function () {
|
733
|
+
chart.filterAll();
|
734
|
+
chart.redraw();
|
735
|
+
});
|
736
|
+
|
737
|
+
it('should push all bars to the foreground', function () {
|
738
|
+
chart.selectAll('rect.bar').each(function () {
|
739
|
+
var bar = d3.select(this);
|
740
|
+
expect(bar.classed('deselected')).toBeFalsy();
|
741
|
+
});
|
742
|
+
});
|
743
|
+
});
|
744
|
+
});
|
745
|
+
});
|
746
|
+
|
747
|
+
describe('a chart with a large domain', function () {
|
748
|
+
beforeEach(function () {
|
749
|
+
chart.x(d3.time.scale.utc().domain([makeDate(2000, 0, 1), makeDate(2012, 11, 31)]));
|
750
|
+
});
|
751
|
+
|
752
|
+
describe('when filters are applied', function () {
|
753
|
+
beforeEach(function () {
|
754
|
+
data.dimension(function (d) { return d.value; }).filter(66);
|
755
|
+
chart.redraw();
|
756
|
+
});
|
757
|
+
|
758
|
+
it('should not deselect any bars', function () {
|
759
|
+
forEachBar(function (bar) {
|
760
|
+
expect(bar.classed('deselected')).toBeFalsy();
|
761
|
+
});
|
762
|
+
});
|
763
|
+
|
764
|
+
it('should set the bars to the minimum bar width', function () {
|
765
|
+
forEachBar(function (bar) {
|
766
|
+
expect(+bar.attr('width')).toBe(1);
|
767
|
+
});
|
768
|
+
});
|
769
|
+
});
|
770
|
+
});
|
771
|
+
|
772
|
+
describe('a chart with a linear numerical domain', function () {
|
773
|
+
beforeEach(function () {
|
774
|
+
var numericalDimension = data.dimension(function (d) { return +d.value; });
|
775
|
+
chart.dimension(numericalDimension).group(numericalDimension.group());
|
776
|
+
chart.x(d3.scale.linear().domain([10, 80])).elasticY(true);
|
777
|
+
chart.render();
|
778
|
+
});
|
779
|
+
|
780
|
+
it('should base the y-axis height on the maximum value in the data', function () {
|
781
|
+
var yAxisMax = 3.0;
|
782
|
+
var ticks = chart.selectAll('g.y g.tick');
|
783
|
+
var tickValues = ticks[0].map(function (tick) { return +d3.select(tick).text(); });
|
784
|
+
var maxTickValue = Math.max.apply(this, tickValues);
|
785
|
+
expect(maxTickValue).toBe(yAxisMax);
|
786
|
+
});
|
787
|
+
|
788
|
+
describe('when filters are applied', function () {
|
789
|
+
beforeEach(function () {
|
790
|
+
data.dimension(function (d) { return d.countrycode; }).filter('CA');
|
791
|
+
chart.redraw();
|
792
|
+
});
|
793
|
+
|
794
|
+
it('should rescale the y-axis after applying a filter', function () {
|
795
|
+
var yAxisMax = 1.0;
|
796
|
+
var ticks = chart.selectAll('g.y g.tick');
|
797
|
+
var tickValues = ticks[0].map(function (tick) { return +d3.select(tick).text(); });
|
798
|
+
var maxTickValue = Math.max.apply(this, tickValues);
|
799
|
+
expect(maxTickValue).toBe(yAxisMax);
|
800
|
+
});
|
801
|
+
});
|
802
|
+
});
|
803
|
+
});
|
804
|
+
|
805
|
+
describe('with another ordinal domain', function () {
|
806
|
+
beforeEach(function () {
|
807
|
+
var rows = [];
|
808
|
+
rows.push({State: 'CA', 'Population': 2704659});
|
809
|
+
rows.push({State: 'TX', 'Population': 1827307});
|
810
|
+
data = crossfilter(rows);
|
811
|
+
dimension = data.dimension(dc.pluck('State'));
|
812
|
+
group = dimension.group().reduceSum(dc.pluck('Population'));
|
813
|
+
|
814
|
+
chart = dc.barChart('#' + id);
|
815
|
+
chart.xUnits(dc.units.ordinal)
|
816
|
+
.x(d3.scale.ordinal())
|
817
|
+
.transitionDuration(0)
|
818
|
+
.dimension(dimension)
|
819
|
+
.group(group, 'Population');
|
820
|
+
chart.render();
|
821
|
+
});
|
822
|
+
it('should not overlap bars', function () {
|
823
|
+
var x = numAttr('x'), wid = numAttr('width');
|
824
|
+
expect(x(nthStack(0).nthBar(0)) + wid(nthStack(0).nthBar(0)))
|
825
|
+
.toBeLessThan(x(nthStack(0).nthBar(1)));
|
826
|
+
});
|
827
|
+
});
|
828
|
+
|
829
|
+
describe('with yetnother ordinal domain', function () {
|
830
|
+
beforeEach(function () {
|
831
|
+
var rows = [{
|
832
|
+
name: 'Venezuela',
|
833
|
+
sale: 300
|
834
|
+
}, {
|
835
|
+
name: 'Saudi',
|
836
|
+
sale: 253
|
837
|
+
}, {
|
838
|
+
name: 'Canada',
|
839
|
+
sale: 150
|
840
|
+
}, {
|
841
|
+
name: 'Iran',
|
842
|
+
sale: 125
|
843
|
+
}, {
|
844
|
+
name: 'Russia',
|
845
|
+
sale: 110
|
846
|
+
}, {
|
847
|
+
name: 'UAE',
|
848
|
+
sale: 90
|
849
|
+
}, {
|
850
|
+
name: 'US',
|
851
|
+
sale: 40
|
852
|
+
}, {
|
853
|
+
name: 'China',
|
854
|
+
sale: 37
|
855
|
+
}];
|
856
|
+
data = crossfilter(rows);
|
857
|
+
dimension = data.dimension(function (d) {
|
858
|
+
return d.name;
|
859
|
+
});
|
860
|
+
group = dimension.group().reduceSum(function (d) {
|
861
|
+
return d.sale;
|
862
|
+
});
|
863
|
+
chart = dc.barChart('#' + id);
|
864
|
+
chart.transitionDuration(0)
|
865
|
+
.outerPadding(0)
|
866
|
+
.dimension(dimension)
|
867
|
+
.group(group)
|
868
|
+
.x(d3.scale.ordinal())
|
869
|
+
.xUnits(dc.units.ordinal);
|
870
|
+
chart.render();
|
871
|
+
});
|
872
|
+
it('should not overlap bars', function () {
|
873
|
+
for (var i = 0; i < 7; ++i) {
|
874
|
+
checkBarOverlap(i);
|
875
|
+
}
|
876
|
+
});
|
877
|
+
});
|
878
|
+
|
879
|
+
describe('with changing number of bars', function () {
|
880
|
+
beforeEach(function () {
|
881
|
+
var rows1 = [
|
882
|
+
{x: 1, y: 3},
|
883
|
+
{x: 2, y: 9},
|
884
|
+
{x: 5, y: 10},
|
885
|
+
{x: 6, y: 7}
|
886
|
+
];
|
887
|
+
|
888
|
+
data = crossfilter(rows1);
|
889
|
+
dimension = data.dimension(function (d) {
|
890
|
+
return d.x;
|
891
|
+
});
|
892
|
+
group = dimension.group().reduceSum(function (d) {
|
893
|
+
return d.y;
|
894
|
+
});
|
895
|
+
|
896
|
+
chart = dc.barChart('#' + id);
|
897
|
+
chart.width(500).transitionDuration(0)
|
898
|
+
.x(d3.scale.linear().domain([0,7]))
|
899
|
+
.elasticY(true)
|
900
|
+
.dimension(dimension)
|
901
|
+
.group(group);
|
902
|
+
chart.render();
|
903
|
+
});
|
904
|
+
it('should not overlap bars', function () {
|
905
|
+
for (var i = 0; i < 3; ++i) {
|
906
|
+
checkBarOverlap(i);
|
907
|
+
}
|
908
|
+
});
|
909
|
+
describe('with bars added', function () {
|
910
|
+
beforeEach(function () {
|
911
|
+
var rows2 = [
|
912
|
+
{x: 7, y: 4},
|
913
|
+
{x: 12, y: 9}
|
914
|
+
];
|
915
|
+
|
916
|
+
data.add(rows2);
|
917
|
+
chart.x().domain([0,13]);
|
918
|
+
chart.render();
|
919
|
+
});
|
920
|
+
it('should not overlap bars', function () {
|
921
|
+
for (var i = 0; i < 5; ++i) {
|
922
|
+
checkBarOverlap(i);
|
923
|
+
}
|
924
|
+
});
|
925
|
+
});
|
926
|
+
});
|
927
|
+
|
928
|
+
describe('with changing number of bars and elasticX', function () {
|
929
|
+
beforeEach(function () {
|
930
|
+
var rows1 = [
|
931
|
+
{x: 1, y: 3},
|
932
|
+
{x: 2, y: 9},
|
933
|
+
{x: 5, y: 10},
|
934
|
+
{x: 6, y: 7}
|
935
|
+
];
|
936
|
+
|
937
|
+
data = crossfilter(rows1);
|
938
|
+
dimension = data.dimension(function (d) {
|
939
|
+
return d.x;
|
940
|
+
});
|
941
|
+
group = dimension.group().reduceSum(function (d) {
|
942
|
+
return d.y;
|
943
|
+
});
|
944
|
+
|
945
|
+
chart = dc.barChart('#' + id);
|
946
|
+
chart.width(500).transitionDuration(0)
|
947
|
+
.x(d3.scale.linear())
|
948
|
+
.elasticY(true).elasticX(true)
|
949
|
+
.dimension(dimension)
|
950
|
+
.group(group);
|
951
|
+
chart.render();
|
952
|
+
});
|
953
|
+
it('should not overlap bars', function () {
|
954
|
+
for (var i = 0; i < 3; ++i) {
|
955
|
+
checkBarOverlap(i);
|
956
|
+
}
|
957
|
+
});
|
958
|
+
describe('with bars added', function () {
|
959
|
+
beforeEach(function () {
|
960
|
+
var rows2 = [
|
961
|
+
{x: 7, y: 4},
|
962
|
+
{x: 12, y: 9}
|
963
|
+
];
|
964
|
+
|
965
|
+
data.add(rows2);
|
966
|
+
chart.render();
|
967
|
+
});
|
968
|
+
it('should not overlap bars', function () {
|
969
|
+
for (var i = 0; i < 5; ++i) {
|
970
|
+
checkBarOverlap(i);
|
971
|
+
}
|
972
|
+
});
|
973
|
+
});
|
974
|
+
});
|
975
|
+
|
976
|
+
describe('with changing number of ordinal bars and elasticX', function () {
|
977
|
+
beforeEach(function () {
|
978
|
+
var rows1 = [
|
979
|
+
{x: 'a', y: 3},
|
980
|
+
{x: 'b', y: 9},
|
981
|
+
{x: 'e', y: 10},
|
982
|
+
{x: 'f', y: 7}
|
983
|
+
];
|
984
|
+
|
985
|
+
data = crossfilter(rows1);
|
986
|
+
dimension = data.dimension(function (d) {
|
987
|
+
return d.x;
|
988
|
+
});
|
989
|
+
group = dimension.group().reduceSum(function (d) {
|
990
|
+
return d.y;
|
991
|
+
});
|
992
|
+
|
993
|
+
chart = dc.barChart('#' + id);
|
994
|
+
chart.width(500).transitionDuration(0)
|
995
|
+
.x(d3.scale.ordinal())
|
996
|
+
.xUnits(dc.units.ordinal)
|
997
|
+
.elasticY(true).elasticX(true)
|
998
|
+
.dimension(dimension)
|
999
|
+
.group(group);
|
1000
|
+
chart.render();
|
1001
|
+
});
|
1002
|
+
it('should not overlap bars', function () {
|
1003
|
+
for (var i = 0; i < 3; ++i) {
|
1004
|
+
checkBarOverlap(i);
|
1005
|
+
}
|
1006
|
+
});
|
1007
|
+
describe('with bars added', function () {
|
1008
|
+
beforeEach(function () {
|
1009
|
+
var rows2 = [
|
1010
|
+
{x: 'g', y: 4},
|
1011
|
+
{x: 'l', y: 9}
|
1012
|
+
];
|
1013
|
+
|
1014
|
+
data.add(rows2);
|
1015
|
+
chart.render();
|
1016
|
+
});
|
1017
|
+
it('should not overlap bars', function () {
|
1018
|
+
for (var i = 0; i < 5; ++i) {
|
1019
|
+
checkBarOverlap(i);
|
1020
|
+
}
|
1021
|
+
});
|
1022
|
+
});
|
1023
|
+
});
|
1024
|
+
|
1025
|
+
describe('brushing with bars centered and rounding enabled', function () {
|
1026
|
+
beforeEach(function () {
|
1027
|
+
chart
|
1028
|
+
.brushOn(true)
|
1029
|
+
.round(d3.time.month.utc.round)
|
1030
|
+
.centerBar(true);
|
1031
|
+
});
|
1032
|
+
|
1033
|
+
describe('with alwaysUseRounding disabled', function () {
|
1034
|
+
var consoleWarnSpy;
|
1035
|
+
|
1036
|
+
beforeEach(function () {
|
1037
|
+
chart.alwaysUseRounding(false);
|
1038
|
+
consoleWarnSpy = spyOn(console, 'warn');
|
1039
|
+
chart.render();
|
1040
|
+
chart.brush().extent([makeDate(2012, 6, 1), makeDate(2012, 7, 15)]);
|
1041
|
+
chart.brush().event(chart.root());
|
1042
|
+
});
|
1043
|
+
|
1044
|
+
it('should log a warning indicating that brush rounding was disabled', function () {
|
1045
|
+
expect(consoleWarnSpy.calls.mostRecent().args[0]).toMatch(/brush rounding is disabled/);
|
1046
|
+
});
|
1047
|
+
|
1048
|
+
it('should not round the brush', function () {
|
1049
|
+
jasmine.clock().tick(100);
|
1050
|
+
var filter = cleanDateRange(chart.filter());
|
1051
|
+
expect(filter).toEqual([makeDate(2012, 6, 1), makeDate(2012, 7, 15)]);
|
1052
|
+
});
|
1053
|
+
});
|
1054
|
+
|
1055
|
+
describe('with alwaysUseRounding enabled', function () {
|
1056
|
+
beforeEach(function () {
|
1057
|
+
chart.alwaysUseRounding(true);
|
1058
|
+
chart.render();
|
1059
|
+
chart.brush().extent([makeDate(2012, 6, 1), makeDate(2012, 7, 15)]);
|
1060
|
+
chart.brush().event(chart.root());
|
1061
|
+
});
|
1062
|
+
|
1063
|
+
it('should round the brush', function () {
|
1064
|
+
jasmine.clock().tick(100);
|
1065
|
+
expect(chart.brush().extent()).toEqual([makeDate(2012, 6, 1), makeDate(2012, 7, 1)]);
|
1066
|
+
});
|
1067
|
+
});
|
1068
|
+
});
|
1069
|
+
|
1070
|
+
describe('check ordering option of the x axis', function () {
|
1071
|
+
beforeEach(function () {
|
1072
|
+
var rows = [
|
1073
|
+
{x: 'a', y: 1},
|
1074
|
+
{x: 'b', y: 3},
|
1075
|
+
{x: 'd', y: 4},
|
1076
|
+
{x: 'c', y: 2}
|
1077
|
+
];
|
1078
|
+
|
1079
|
+
id = 'bar-chart';
|
1080
|
+
appendChartID(id);
|
1081
|
+
data = crossfilter(rows);
|
1082
|
+
dimension = data.dimension(function (d) {
|
1083
|
+
return d.x;
|
1084
|
+
});
|
1085
|
+
group = dimension.group().reduceSum(function (d) {
|
1086
|
+
return d.y;
|
1087
|
+
});
|
1088
|
+
|
1089
|
+
chart = dc.barChart('#' + id);
|
1090
|
+
chart.width(500).transitionDuration(0)
|
1091
|
+
.x(d3.scale.ordinal())
|
1092
|
+
.xUnits(dc.units.ordinal)
|
1093
|
+
.elasticY(true).elasticX(true)
|
1094
|
+
.dimension(dimension)
|
1095
|
+
.group(group);
|
1096
|
+
chart.render();
|
1097
|
+
});
|
1098
|
+
|
1099
|
+
it('should be ordered by default alphabetical order', function () {
|
1100
|
+
var data = chart.data()['0'].values;
|
1101
|
+
var expectedData = ['a', 'b', 'c', 'd'];
|
1102
|
+
expect(data.map(function (d) { return d.x; })).toEqual(expectedData);
|
1103
|
+
});
|
1104
|
+
|
1105
|
+
it('should be ordered by value increasing', function () {
|
1106
|
+
chart.ordering(function (d) { return d.value; });
|
1107
|
+
chart.redraw();
|
1108
|
+
expect(xAxisText()).toEqual(['a', 'c', 'b', 'd']);
|
1109
|
+
});
|
1110
|
+
|
1111
|
+
it('should be ordered by value decreasing', function () {
|
1112
|
+
chart.ordering(function (d) { return -d.value; });
|
1113
|
+
chart.redraw();
|
1114
|
+
expect(xAxisText()).toEqual(['d', 'b', 'c', 'a']);
|
1115
|
+
});
|
1116
|
+
|
1117
|
+
it('should be ordered by alphabetical order', function () {
|
1118
|
+
chart.ordering(function (d) { return d.key; });
|
1119
|
+
chart.redraw();
|
1120
|
+
expect(xAxisText()).toEqual(['a', 'b', 'c', 'd']);
|
1121
|
+
});
|
1122
|
+
|
1123
|
+
function xAxisText () {
|
1124
|
+
return chart.selectAll('g.x text')[0].map(function (x) { return d3.select(x).text(); });
|
1125
|
+
}
|
1126
|
+
});
|
1127
|
+
|
1128
|
+
describe('ordering with stacks', function () {
|
1129
|
+
beforeEach(function () {
|
1130
|
+
var rows = [
|
1131
|
+
{x: 'a', y: 1, z: 10},
|
1132
|
+
{x: 'b', y: 3, z: 20},
|
1133
|
+
{x: 'd', y: 4, z: 30},
|
1134
|
+
{x: 'c', y: 2, z: 40}
|
1135
|
+
];
|
1136
|
+
|
1137
|
+
id = 'bar-chart';
|
1138
|
+
appendChartID(id);
|
1139
|
+
data = crossfilter(rows);
|
1140
|
+
dimension = data.dimension(function (d) {
|
1141
|
+
return d.x;
|
1142
|
+
});
|
1143
|
+
group = dimension.group().reduceSum(function (d) {
|
1144
|
+
return d.y;
|
1145
|
+
});
|
1146
|
+
var group2 = dimension.group().reduceSum(function (d) {
|
1147
|
+
return d.z;
|
1148
|
+
});
|
1149
|
+
|
1150
|
+
chart = dc.barChart('#' + id);
|
1151
|
+
chart.width(500).transitionDuration(0)
|
1152
|
+
.x(d3.scale.ordinal())
|
1153
|
+
.xUnits(dc.units.ordinal)
|
1154
|
+
.elasticY(true).elasticX(true)
|
1155
|
+
.dimension(dimension)
|
1156
|
+
.group(group)
|
1157
|
+
.stack(group2);
|
1158
|
+
chart.render();
|
1159
|
+
});
|
1160
|
+
|
1161
|
+
it('should be ordered by default alphabetical order', function () {
|
1162
|
+
var data = chart.data()['0'].values;
|
1163
|
+
var expectedData = ['a', 'b', 'c', 'd'];
|
1164
|
+
expect(data.map(function (d) { return d.x; })).toEqual(expectedData);
|
1165
|
+
});
|
1166
|
+
|
1167
|
+
// note: semantics are kind of screwy here: which stack do you want to sort
|
1168
|
+
// by when you order by value? right now it's all of them together.
|
1169
|
+
it('should be ordered by value increasing', function () {
|
1170
|
+
chart.ordering(function (d) { return d.value; });
|
1171
|
+
chart.redraw();
|
1172
|
+
expect(xAxisText()).toEqual(['a', 'c', 'b', 'd']);
|
1173
|
+
});
|
1174
|
+
|
1175
|
+
it('should be ordered by value decreasing', function () {
|
1176
|
+
chart.ordering(function (d) { return -d.value; });
|
1177
|
+
chart.redraw();
|
1178
|
+
expect(xAxisText()).toEqual(['c', 'd', 'b', 'a']);
|
1179
|
+
});
|
1180
|
+
|
1181
|
+
it('should be ordered by alphabetical order', function () {
|
1182
|
+
chart.ordering(function (d) { return d.key; });
|
1183
|
+
chart.redraw();
|
1184
|
+
expect(xAxisText()).toEqual(['a', 'b', 'c', 'd']);
|
1185
|
+
});
|
1186
|
+
|
1187
|
+
function xAxisText () {
|
1188
|
+
return chart.selectAll('g.x text')[0].map(function (x) { return d3.select(x).text(); });
|
1189
|
+
}
|
1190
|
+
});
|
1191
|
+
|
1192
|
+
function nthStack (n) {
|
1193
|
+
var stack = d3.select(chart.selectAll('.stack')[0][n]);
|
1194
|
+
|
1195
|
+
stack.nthBar = function (n) {
|
1196
|
+
return d3.select(this.selectAll('rect.bar')[0][n]);
|
1197
|
+
};
|
1198
|
+
|
1199
|
+
stack.nthLabel = function (n) {
|
1200
|
+
return d3.select(this.selectAll('text.barLabel')[0][n]);
|
1201
|
+
};
|
1202
|
+
|
1203
|
+
stack.forEachBar = function (assertions) {
|
1204
|
+
this.selectAll('rect.bar').each(function (d) {
|
1205
|
+
assertions(d3.select(this), d);
|
1206
|
+
});
|
1207
|
+
};
|
1208
|
+
|
1209
|
+
return stack;
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
function forEachBar (assertions) {
|
1213
|
+
chart.selectAll('rect.bar').each(function (d) {
|
1214
|
+
assertions(d3.select(this), d);
|
1215
|
+
});
|
1216
|
+
}
|
1217
|
+
|
1218
|
+
// mostly because jshint complains about the +
|
1219
|
+
function numAttr (attr) {
|
1220
|
+
return function (selection) {
|
1221
|
+
return +selection.attr(attr);
|
1222
|
+
};
|
1223
|
+
}
|
1224
|
+
|
1225
|
+
function checkBarOverlap (n) {
|
1226
|
+
var x = numAttr('x'), wid = numAttr('width');
|
1227
|
+
expect(x(nthStack(0).nthBar(n)) + wid(nthStack(0).nthBar(n)))
|
1228
|
+
.toBeLessThan(x(nthStack(0).nthBar(n + 1)));
|
1229
|
+
}
|
1230
|
+
});
|