rubyvis 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -1
- data/Manifest.txt +421 -1
- data/README.txt +12 -10
- data/examples/first.rb +2 -2
- data/examples/second.rb +6 -3
- data/lib/rubyvis.rb +18 -3
- data/lib/rubyvis/mark.rb +101 -83
- data/lib/rubyvis/mark/anchor.rb +5 -7
- data/lib/rubyvis/mark/area.rb +19 -17
- data/lib/rubyvis/mark/bar.rb +3 -10
- data/lib/rubyvis/mark/label.rb +3 -4
- data/lib/rubyvis/mark/line.rb +20 -4
- data/lib/rubyvis/mark/panel.rb +31 -6
- data/lib/rubyvis/mark/rule.rb +8 -4
- data/lib/rubyvis/property.rb +11 -0
- data/lib/rubyvis/scene/svg_label.rb +1 -1
- data/lib/rubyvis/scene/svg_scene.rb +2 -1
- data/lib/rubyvis/sceneelement.rb +2 -0
- data/spec/bar_spec.rb +50 -0
- data/spec/label_spec.rb +41 -0
- data/spec/mark_spec.rb +16 -0
- data/spec/panel_spec.rb +22 -4
- data/spec/spec_helper.rb +1 -0
- data/vendor/FUTURE +62 -0
- data/vendor/Makefile +138 -0
- data/vendor/TODO +22 -0
- data/vendor/examples/antibiotics/antibiotics-scatter.html +113 -0
- data/vendor/examples/antibiotics/antibiotics.html +140 -0
- data/vendor/examples/antibiotics/antibiotics.js +20 -0
- data/vendor/examples/barley/barley.html +102 -0
- data/vendor/examples/barley/barley.js +122 -0
- data/vendor/examples/cars/cars.html +90 -0
- data/vendor/examples/cars/cars.js +408 -0
- data/vendor/examples/clock/clock.html +91 -0
- data/vendor/examples/crimea/crimea-grouped-bar.html +65 -0
- data/vendor/examples/crimea/crimea-line.html +61 -0
- data/vendor/examples/crimea/crimea-stacked-area.html +61 -0
- data/vendor/examples/crimea/crimea-stacked-bar.html +60 -0
- data/vendor/examples/crimea/crimea.html +100 -0
- data/vendor/examples/crimea/crimea.js +33 -0
- data/vendor/examples/downloadify/LICENSE.txt +22 -0
- data/vendor/examples/downloadify/download.png +0 -0
- data/vendor/examples/downloadify/downloadify.html +57 -0
- data/vendor/examples/downloadify/downloadify.min.js +3 -0
- data/vendor/examples/downloadify/downloadify.swf +0 -0
- data/vendor/examples/downloadify/swfobject.js +4 -0
- data/vendor/examples/ex.css +17 -0
- data/vendor/examples/eyes/eyes.html +53 -0
- data/vendor/examples/eyes/matrix.html +44 -0
- data/vendor/examples/flowers/flowers.html +109 -0
- data/vendor/examples/flowers/flowers.js +154 -0
- data/vendor/examples/group-stack/group-stack.html +79 -0
- data/vendor/examples/group-stack/headcount.js +23 -0
- data/vendor/examples/hotel/hotel.html +76 -0
- data/vendor/examples/hotel/hotel.js +245 -0
- data/vendor/examples/jobs/jobs.html +71 -0
- data/vendor/examples/jobs/jobs.js +1024 -0
- data/vendor/examples/jquery-1.4.2.min.js +154 -0
- data/vendor/examples/nba/nba.html +83 -0
- data/vendor/examples/nba/nba.js +53 -0
- data/vendor/examples/nba/nba2.html +82 -0
- data/vendor/examples/sankey/gdp2009.js +184 -0
- data/vendor/examples/sankey/sankey.html +77 -0
- data/vendor/examples/slider/cell.html +112 -0
- data/vendor/examples/slider/cell.js +31 -0
- data/vendor/examples/slider/horizon.html +85 -0
- data/vendor/examples/slider/jquery-ui-1.8rc3.custom.min.js +71 -0
- data/vendor/examples/slider/slider.html +50 -0
- data/vendor/examples/slider/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/vendor/examples/slider/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/vendor/examples/slider/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/vendor/examples/slider/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/vendor/examples/slider/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/vendor/examples/slider/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/examples/slider/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/vendor/examples/slider/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/vendor/examples/slider/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/vendor/examples/slider/ui-lightness/images/ui-icons_222222_256x240.png +2 -0
- data/vendor/examples/slider/ui-lightness/images/ui-icons_228ef1_256x240.png +2 -0
- data/vendor/examples/slider/ui-lightness/images/ui-icons_ef8c08_256x240.png +2 -0
- data/vendor/examples/slider/ui-lightness/images/ui-icons_ffd27a_256x240.png +2 -0
- data/vendor/examples/slider/ui-lightness/images/ui-icons_ffffff_256x240.png +2 -0
- data/vendor/examples/slider/ui-lightness/jquery-ui-1.8rc3.custom.css +302 -0
- data/vendor/examples/tipsy/jquery.tipsy.js +198 -0
- data/vendor/examples/tipsy/tipsy-bar.html +65 -0
- data/vendor/examples/tipsy/tipsy-line.html +67 -0
- data/vendor/examples/tipsy/tipsy.css +12 -0
- data/vendor/examples/tipsy/tipsy.gif +0 -0
- data/vendor/examples/tipsy/tipsy.js +66 -0
- data/vendor/examples/weather/weather.html +86 -0
- data/vendor/examples/weather/weather.js +42 -0
- data/vendor/examples/wheat/wheat.html +130 -0
- data/vendor/examples/wheat/wheat.js +70 -0
- data/vendor/lib/google-compiler/COPYING +202 -0
- data/vendor/lib/google-compiler/README +224 -0
- data/vendor/lib/google-compiler/compiler-20100201.jar +0 -0
- data/vendor/protovis-d3.3.js +15726 -0
- data/vendor/protovis-r3.3.js +287 -0
- data/vendor/src/behavior/Behavior.js +32 -0
- data/vendor/src/behavior/Drag.js +112 -0
- data/vendor/src/behavior/Pan.js +110 -0
- data/vendor/src/behavior/Point.js +157 -0
- data/vendor/src/behavior/Resize.js +104 -0
- data/vendor/src/behavior/Select.js +100 -0
- data/vendor/src/behavior/Zoom.js +85 -0
- data/vendor/src/color/Color.js +598 -0
- data/vendor/src/color/Colors.js +135 -0
- data/vendor/src/color/Ramp.js +17 -0
- data/vendor/src/data/Arrays.js +277 -0
- data/vendor/src/data/Dom.js +380 -0
- data/vendor/src/data/Flatten.js +146 -0
- data/vendor/src/data/Histogram.js +120 -0
- data/vendor/src/data/LinearScale.js +54 -0
- data/vendor/src/data/LogScale.js +142 -0
- data/vendor/src/data/Nest.js +257 -0
- data/vendor/src/data/Numbers.js +313 -0
- data/vendor/src/data/Objects.js +78 -0
- data/vendor/src/data/OrdinalScale.js +267 -0
- data/vendor/src/data/QuantileScale.js +180 -0
- data/vendor/src/data/QuantitativeScale.js +440 -0
- data/vendor/src/data/RootScale.js +55 -0
- data/vendor/src/data/Scale.js +86 -0
- data/vendor/src/data/Transform.js +109 -0
- data/vendor/src/data/Tree.js +124 -0
- data/vendor/src/data/Vector.js +118 -0
- data/vendor/src/geo/Geo.js +5 -0
- data/vendor/src/geo/GeoScale.js +307 -0
- data/vendor/src/geo/LatLng.js +23 -0
- data/vendor/src/geo/Projection.js +43 -0
- data/vendor/src/geo/Projections.js +117 -0
- data/vendor/src/lang/Array.js +112 -0
- data/vendor/src/lang/init.js +26 -0
- data/vendor/src/layout/Arc.js +178 -0
- data/vendor/src/layout/Bullet.js +164 -0
- data/vendor/src/layout/Cluster.js +205 -0
- data/vendor/src/layout/Force.js +309 -0
- data/vendor/src/layout/Grid.js +119 -0
- data/vendor/src/layout/Hierarchy.js +249 -0
- data/vendor/src/layout/Horizon.js +159 -0
- data/vendor/src/layout/Indent.js +83 -0
- data/vendor/src/layout/Layout.js +56 -0
- data/vendor/src/layout/Matrix.js +177 -0
- data/vendor/src/layout/Network.js +302 -0
- data/vendor/src/layout/Pack.js +323 -0
- data/vendor/src/layout/Partition.js +203 -0
- data/vendor/src/layout/Rollup.js +203 -0
- data/vendor/src/layout/Stack.js +391 -0
- data/vendor/src/layout/Tree.js +282 -0
- data/vendor/src/layout/Treemap.js +347 -0
- data/vendor/src/mark/Anchor.js +81 -0
- data/vendor/src/mark/Area.js +268 -0
- data/vendor/src/mark/Bar.js +93 -0
- data/vendor/src/mark/Dot.js +212 -0
- data/vendor/src/mark/Ease.js +150 -0
- data/vendor/src/mark/Image.js +154 -0
- data/vendor/src/mark/Label.js +155 -0
- data/vendor/src/mark/Line.js +195 -0
- data/vendor/src/mark/Mark.js +1237 -0
- data/vendor/src/mark/Panel.js +273 -0
- data/vendor/src/mark/Rule.js +143 -0
- data/vendor/src/mark/Transient.js +7 -0
- data/vendor/src/mark/Transition.js +195 -0
- data/vendor/src/mark/Wedge.js +244 -0
- data/vendor/src/physics/BoundConstraint.js +75 -0
- data/vendor/src/physics/ChargeForce.js +184 -0
- data/vendor/src/physics/CollisionConstraint.js +113 -0
- data/vendor/src/physics/Constraint.js +26 -0
- data/vendor/src/physics/DragForce.js +49 -0
- data/vendor/src/physics/Force.js +25 -0
- data/vendor/src/physics/Particle.js +81 -0
- data/vendor/src/physics/PositionConstraint.js +72 -0
- data/vendor/src/physics/Quadtree.js +195 -0
- data/vendor/src/physics/Simulation.js +159 -0
- data/vendor/src/physics/SpringForce.js +141 -0
- data/vendor/src/pv-internals.js +154 -0
- data/vendor/src/pv.js +95 -0
- data/vendor/src/scene/SvgArea.js +172 -0
- data/vendor/src/scene/SvgBar.js +28 -0
- data/vendor/src/scene/SvgCurve.js +354 -0
- data/vendor/src/scene/SvgDot.js +81 -0
- data/vendor/src/scene/SvgImage.js +45 -0
- data/vendor/src/scene/SvgLabel.js +46 -0
- data/vendor/src/scene/SvgLine.js +159 -0
- data/vendor/src/scene/SvgPanel.js +126 -0
- data/vendor/src/scene/SvgRule.js +26 -0
- data/vendor/src/scene/SvgScene.js +185 -0
- data/vendor/src/scene/SvgWedge.js +66 -0
- data/vendor/src/text/DateFormat.js +262 -0
- data/vendor/src/text/Format.js +78 -0
- data/vendor/src/text/NumberFormat.js +227 -0
- data/vendor/src/text/TimeFormat.js +115 -0
- data/vendor/test1.html +30 -0
- data/vendor/tests/behavior/drag-events.html +47 -0
- data/vendor/tests/behavior/drag.html +32 -0
- data/vendor/tests/behavior/drag2.html +33 -0
- data/vendor/tests/behavior/point-area-stacked.html +73 -0
- data/vendor/tests/behavior/point-area-stacked2.html +70 -0
- data/vendor/tests/behavior/point-area.html +67 -0
- data/vendor/tests/behavior/point-bar.html +62 -0
- data/vendor/tests/behavior/point-dot.html +60 -0
- data/vendor/tests/behavior/point-line.html +62 -0
- data/vendor/tests/behavior/point-lines-grid.html +65 -0
- data/vendor/tests/behavior/point-lines.html +61 -0
- data/vendor/tests/behavior/point-wedge.html +43 -0
- data/vendor/tests/behavior/resize.html +69 -0
- data/vendor/tests/behavior/select.html +37 -0
- data/vendor/tests/bzr.js +62 -0
- data/vendor/tests/center.js +13 -0
- data/vendor/tests/data/deviation.html +54 -0
- data/vendor/tests/data/histogram-discrete.html +50 -0
- data/vendor/tests/data/histogram.html +56 -0
- data/vendor/tests/data/log-adjusted.html +48 -0
- data/vendor/tests/data/log-ceil.html +48 -0
- data/vendor/tests/data/log-floor.html +48 -0
- data/vendor/tests/data/log-symmetric.html +48 -0
- data/vendor/tests/data/log.html +48 -0
- data/vendor/tests/data/max-index.html +36 -0
- data/vendor/tests/data/max.html +36 -0
- data/vendor/tests/data/min-index.html +36 -0
- data/vendor/tests/data/min.html +36 -0
- data/vendor/tests/data/ordinal-split-banded.html +45 -0
- data/vendor/tests/data/ordinal-split-banded2.html +45 -0
- data/vendor/tests/data/ordinal-split-flush.html +51 -0
- data/vendor/tests/data/ordinal-split.html +51 -0
- data/vendor/tests/data/range.html +105 -0
- data/vendor/tests/data/scale-date.html +46 -0
- data/vendor/tests/data/scale-date2.html +38 -0
- data/vendor/tests/data/scale-date3.html +38 -0
- data/vendor/tests/data/scale-date4.html +38 -0
- data/vendor/tests/data/scale-degenerate.html +143 -0
- data/vendor/tests/data/scale-linear.html +59 -0
- data/vendor/tests/data/scale-log.html +60 -0
- data/vendor/tests/data/scale-log2.html +60 -0
- data/vendor/tests/data/scale-log3.html +60 -0
- data/vendor/tests/data/scale-log4.html +60 -0
- data/vendor/tests/data/scale-log5.html +60 -0
- data/vendor/tests/data/scale-log6.html +60 -0
- data/vendor/tests/data/scale-quantile.html +47 -0
- data/vendor/tests/data/scale-quantile2.html +50 -0
- data/vendor/tests/data/scale-quantile3.html +48 -0
- data/vendor/tests/data/scale-root.html +60 -0
- data/vendor/tests/data/scale-root2.html +39 -0
- data/vendor/tests/data/scale-tick-format.html +54 -0
- data/vendor/tests/data/scale-ticks.html +45 -0
- data/vendor/tests/data/sum.html +42 -0
- data/vendor/tests/data/variance.html +42 -0
- data/vendor/tests/diamond.js +40 -0
- data/vendor/tests/flare-imports.js +222 -0
- data/vendor/tests/flare.js +284 -0
- data/vendor/tests/geo/countries-hires.js +257 -0
- data/vendor/tests/geo/countries-lores.js +197 -0
- data/vendor/tests/geo/population.js +250 -0
- data/vendor/tests/geo/scale-aitoff.html +58 -0
- data/vendor/tests/geo/scale-gall-peters.html +56 -0
- data/vendor/tests/geo/scale-hammer.html +58 -0
- data/vendor/tests/geo/scale-identity.html +56 -0
- data/vendor/tests/geo/scale-mercator.html +56 -0
- data/vendor/tests/geo/scale-sinusoidal.html +57 -0
- data/vendor/tests/geo/scale-smart-domain.html +58 -0
- data/vendor/tests/geo/scale.html +55 -0
- data/vendor/tests/geo/scale2.html +40 -0
- data/vendor/tests/geo/us-states.js +61 -0
- data/vendor/tests/heatmap.js +63 -0
- data/vendor/tests/lang/globals.html +41 -0
- data/vendor/tests/lang/init.html +31 -0
- data/vendor/tests/layers.js +28 -0
- data/vendor/tests/layout/arc-directed.html +33 -0
- data/vendor/tests/layout/arc-radial.html +36 -0
- data/vendor/tests/layout/arc-undirected.html +32 -0
- data/vendor/tests/layout/arc.html +33 -0
- data/vendor/tests/layout/arc2.html +32 -0
- data/vendor/tests/layout/bullet-multiples.html +60 -0
- data/vendor/tests/layout/bullet.html +45 -0
- data/vendor/tests/layout/bullets.js +37 -0
- data/vendor/tests/layout/cluster-fill-group.html +24 -0
- data/vendor/tests/layout/cluster-fill.html +28 -0
- data/vendor/tests/layout/cluster-partition-radial-fill.html +43 -0
- data/vendor/tests/layout/cluster-radial-fill-radius.html +26 -0
- data/vendor/tests/layout/cluster-radial-fill.html +29 -0
- data/vendor/tests/layout/cluster-radial-group-fill.html +30 -0
- data/vendor/tests/layout/cluster-radial-radius.html +30 -0
- data/vendor/tests/layout/cluster-radial.html +28 -0
- data/vendor/tests/layout/cluster-radial2.html +33 -0
- data/vendor/tests/layout/cluster.html +34 -0
- data/vendor/tests/layout/cluster2.html +32 -0
- data/vendor/tests/layout/force-toggle.html +46 -0
- data/vendor/tests/layout/force.html +45 -0
- data/vendor/tests/layout/force2.html +58 -0
- data/vendor/tests/layout/force3.html +41 -0
- data/vendor/tests/layout/force4.html +45 -0
- data/vendor/tests/layout/force5.html +53 -0
- data/vendor/tests/layout/grid-cols.html +31 -0
- data/vendor/tests/layout/grid-heatmap.html +25 -0
- data/vendor/tests/layout/grid-rows.html +31 -0
- data/vendor/tests/layout/grid.html +34 -0
- data/vendor/tests/layout/horizon-color.html +31 -0
- data/vendor/tests/layout/horizon.html +31 -0
- data/vendor/tests/layout/indent-toggle.html +62 -0
- data/vendor/tests/layout/indent.html +25 -0
- data/vendor/tests/layout/indent2.html +33 -0
- data/vendor/tests/layout/matrix-sort.html +28 -0
- data/vendor/tests/layout/matrix.html +35 -0
- data/vendor/tests/layout/network.html +43 -0
- data/vendor/tests/layout/pack-bubble.html +45 -0
- data/vendor/tests/layout/pack.html +26 -0
- data/vendor/tests/layout/pack2.html +32 -0
- data/vendor/tests/layout/partition-fill.html +27 -0
- data/vendor/tests/layout/partition-fill2.html +22 -0
- data/vendor/tests/layout/partition-fill3.html +27 -0
- data/vendor/tests/layout/partition-radial-fill-radius.html +25 -0
- data/vendor/tests/layout/partition-radial-fill.html +26 -0
- data/vendor/tests/layout/partition-radial-fill2.html +23 -0
- data/vendor/tests/layout/partition-radial-fill3.html +29 -0
- data/vendor/tests/layout/partition-radial-radius.html +29 -0
- data/vendor/tests/layout/partition-radial.html +30 -0
- data/vendor/tests/layout/partition-radial2.html +33 -0
- data/vendor/tests/layout/partition.html +33 -0
- data/vendor/tests/layout/partition2.html +32 -0
- data/vendor/tests/layout/rollup.html +50 -0
- data/vendor/tests/layout/stack-empty.html +27 -0
- data/vendor/tests/layout/stack-expand.html +41 -0
- data/vendor/tests/layout/stack-reverse.html +42 -0
- data/vendor/tests/layout/stack-right.html +42 -0
- data/vendor/tests/layout/stack-rule.html +61 -0
- data/vendor/tests/layout/stack-visible.html +43 -0
- data/vendor/tests/layout/stack.html +53 -0
- data/vendor/tests/layout/tree-radial.html +31 -0
- data/vendor/tests/layout/tree-radial2.html +34 -0
- data/vendor/tests/layout/tree-toggle.html +36 -0
- data/vendor/tests/layout/tree.html +31 -0
- data/vendor/tests/layout/tree2.html +35 -0
- data/vendor/tests/layout/treemap-hierarchy.html +40 -0
- data/vendor/tests/layout/treemap-margin.html +26 -0
- data/vendor/tests/layout/treemap-round.html +40 -0
- data/vendor/tests/layout/treemap-slice.html +34 -0
- data/vendor/tests/layout/treemap.html +37 -0
- data/vendor/tests/life.js +212 -0
- data/vendor/tests/mark/anchor.html +25 -0
- data/vendor/tests/mark/area-anchor-chain.html +42 -0
- data/vendor/tests/mark/area-anchor-line.html +57 -0
- data/vendor/tests/mark/area-anchor-stack.html +35 -0
- data/vendor/tests/mark/area-anchor.html +43 -0
- data/vendor/tests/mark/area-anchor2.html +33 -0
- data/vendor/tests/mark/area-cardinal.html +57 -0
- data/vendor/tests/mark/area-monotone.html +57 -0
- data/vendor/tests/mark/area-segmented-basis.html +30 -0
- data/vendor/tests/mark/area-segmented-cardinal.html +30 -0
- data/vendor/tests/mark/area-segmented-monotone.html +30 -0
- data/vendor/tests/mark/area-segmented-step.html +44 -0
- data/vendor/tests/mark/area-segmented.html +29 -0
- data/vendor/tests/mark/area-stacked-cardinal.html +54 -0
- data/vendor/tests/mark/area-stacked-monotone.html +54 -0
- data/vendor/tests/mark/area-stacked.html +53 -0
- data/vendor/tests/mark/area-step.html +43 -0
- data/vendor/tests/mark/area-zero.html +32 -0
- data/vendor/tests/mark/area.html +57 -0
- data/vendor/tests/mark/bar-anchor-stack.html +51 -0
- data/vendor/tests/mark/bar-anchor.html +44 -0
- data/vendor/tests/mark/bar-column-grouped.html +63 -0
- data/vendor/tests/mark/bar-column-stacked.html +56 -0
- data/vendor/tests/mark/bar-column.html +54 -0
- data/vendor/tests/mark/bar-grouped.html +63 -0
- data/vendor/tests/mark/bar-stacked.html +57 -0
- data/vendor/tests/mark/bar.html +54 -0
- data/vendor/tests/mark/cursor.html +41 -0
- data/vendor/tests/mark/def-type.html +23 -0
- data/vendor/tests/mark/dot-anchor.html +33 -0
- data/vendor/tests/mark/dot-radius.html +22 -0
- data/vendor/tests/mark/dot-stroke.html +43 -0
- data/vendor/tests/mark/dot.html +52 -0
- data/vendor/tests/mark/dot2.html +61 -0
- data/vendor/tests/mark/ease.html +90 -0
- data/vendor/tests/mark/event-dblclick.html +30 -0
- data/vendor/tests/mark/event-prototype.html +45 -0
- data/vendor/tests/mark/event-render.html +45 -0
- data/vendor/tests/mark/event.html +24 -0
- data/vendor/tests/mark/image-color-inherit.html +33 -0
- data/vendor/tests/mark/image-color.html +35 -0
- data/vendor/tests/mark/image-color2.html +35 -0
- data/vendor/tests/mark/image-heatmap.html +29 -0
- data/vendor/tests/mark/image.html +32 -0
- data/vendor/tests/mark/label-break.html +54 -0
- data/vendor/tests/mark/label-decoration.html +22 -0
- data/vendor/tests/mark/label-events.html +32 -0
- data/vendor/tests/mark/line-anchor.html +42 -0
- data/vendor/tests/mark/line-basis.html +54 -0
- data/vendor/tests/mark/line-brownian.html +57 -0
- data/vendor/tests/mark/line-cardinal.html +77 -0
- data/vendor/tests/mark/line-catmull-rom.html +78 -0
- data/vendor/tests/mark/line-curve.html +65 -0
- data/vendor/tests/mark/line-eccentricity.html +39 -0
- data/vendor/tests/mark/line-fill.html +24 -0
- data/vendor/tests/mark/line-join.html +51 -0
- data/vendor/tests/mark/line-monotone-non-monotone.html +53 -0
- data/vendor/tests/mark/line-monotone-two-way.html +61 -0
- data/vendor/tests/mark/line-monotone.html +53 -0
- data/vendor/tests/mark/line-polar.html +36 -0
- data/vendor/tests/mark/line-segmented-basis.html +57 -0
- data/vendor/tests/mark/line-segmented-cardinal.html +80 -0
- data/vendor/tests/mark/line-segmented-join.html +52 -0
- data/vendor/tests/mark/line-segmented-monotone.html +56 -0
- data/vendor/tests/mark/line-segmented-polar.html +30 -0
- data/vendor/tests/mark/line-segmented-step.html +41 -0
- data/vendor/tests/mark/line-segmented-step2.html +32 -0
- data/vendor/tests/mark/line-segmented.html +30 -0
- data/vendor/tests/mark/line-step.html +39 -0
- data/vendor/tests/mark/line-tension.html +59 -0
- data/vendor/tests/mark/line.html +51 -0
- data/vendor/tests/mark/panel-anchor.html +37 -0
- data/vendor/tests/mark/panel-anchor2.html +31 -0
- data/vendor/tests/mark/panel-anchor3.html +22 -0
- data/vendor/tests/mark/panel-anchor4.html +28 -0
- data/vendor/tests/mark/panel-anchor5.html +28 -0
- data/vendor/tests/mark/panel-append.html +29 -0
- data/vendor/tests/mark/panel-canvas.html +107 -0
- data/vendor/tests/mark/panel-fill.html +50 -0
- data/vendor/tests/mark/panel-mouse.html +53 -0
- data/vendor/tests/mark/panel-transform.html +67 -0
- data/vendor/tests/mark/property-cast.html +24 -0
- data/vendor/tests/mark/render-partial.html +42 -0
- data/vendor/tests/mark/rule-anchor.html +29 -0
- data/vendor/tests/mark/title.html +41 -0
- data/vendor/tests/mark/transition-anchor.html +47 -0
- data/vendor/tests/mark/transition-wedge.html +47 -0
- data/vendor/tests/mark/transition.html +106 -0
- data/vendor/tests/mark/wedge-donut.html +35 -0
- data/vendor/tests/mark/wedge-implied.html +42 -0
- data/vendor/tests/mark/wedge-pie.html +37 -0
- data/vendor/tests/mark/wedge-ring.html +27 -0
- data/vendor/tests/miserables.js +348 -0
- data/vendor/tests/physics/dorling.html +70 -0
- data/vendor/tests/physics/simulation.html +56 -0
- data/vendor/tests/social.js +28 -0
- data/vendor/tests/stanford.png +0 -0
- data/vendor/tests/style.css +5 -0
- data/vendor/tests/testify.css +29 -0
- data/vendor/tests/testify.js +16 -0
- data/vendor/tests/text/format-number.html +75 -0
- data/web/first.svg +1 -0
- data/web/index.html +48 -0
- metadata +434 -31
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -2
@@ -0,0 +1,119 @@
|
|
1
|
+
/**
|
2
|
+
* Constructs a new, empty grid layout. Layouts are not typically constructed
|
3
|
+
* directly; instead, they are added to an existing panel via
|
4
|
+
* {@link pv.Mark#add}.
|
5
|
+
*
|
6
|
+
* @class Implements a grid layout with regularly-sized rows and columns. The
|
7
|
+
* number of rows and columns are determined from their respective
|
8
|
+
* properties. For example, the 2×3 array:
|
9
|
+
*
|
10
|
+
* <pre>1 2 3
|
11
|
+
* 4 5 6</pre>
|
12
|
+
*
|
13
|
+
* can be represented using the <tt>rows</tt> property as:
|
14
|
+
*
|
15
|
+
* <pre>[[1, 2, 3], [4, 5, 6]]</pre>
|
16
|
+
*
|
17
|
+
* If your data is in column-major order, you can equivalently use the
|
18
|
+
* <tt>columns</tt> property. If the <tt>rows</tt> property is an array, it
|
19
|
+
* takes priority over the <tt>columns</tt> property. The data is implicitly
|
20
|
+
* transposed, as if the {@link pv.transpose} operator were applied.
|
21
|
+
*
|
22
|
+
* <p>This layout exports a single <tt>cell</tt> mark prototype, which is
|
23
|
+
* intended to be used with a bar, panel, layout, or subclass thereof. The data
|
24
|
+
* property of the cell prototype is defined as the elements in the array. For
|
25
|
+
* example, if the array is a two-dimensional array of values in the range
|
26
|
+
* [0,1], a simple heatmap can be generated as:
|
27
|
+
*
|
28
|
+
* <pre>vis.add(pv.Layout.Grid)
|
29
|
+
* .rows(arrays)
|
30
|
+
* .cell.add(pv.Bar)
|
31
|
+
* .fillStyle(pv.ramp("white", "black"))</pre>
|
32
|
+
*
|
33
|
+
* The grid subdivides the full width and height of the parent panel into equal
|
34
|
+
* rectangles. Note, however, that for large, interactive, or animated heatmaps,
|
35
|
+
* you may see significantly better performance through dynamic {@link pv.Image}
|
36
|
+
* generation.
|
37
|
+
*
|
38
|
+
* <p>For irregular grids using value-based spatial partitioning, see {@link
|
39
|
+
* pv.Layout.Treemap}.
|
40
|
+
*
|
41
|
+
* @extends pv.Layout
|
42
|
+
*/
|
43
|
+
pv.Layout.Grid = function() {
|
44
|
+
pv.Layout.call(this);
|
45
|
+
var that = this;
|
46
|
+
|
47
|
+
/**
|
48
|
+
* The cell prototype. This prototype is intended to be used with a bar,
|
49
|
+
* panel, or layout (or subclass thereof) to render the grid cells.
|
50
|
+
*
|
51
|
+
* @type pv.Mark
|
52
|
+
* @name pv.Layout.Grid.prototype.cell
|
53
|
+
*/
|
54
|
+
(this.cell = new pv.Mark()
|
55
|
+
.data(function() {
|
56
|
+
return that.scene[that.index].$grid;
|
57
|
+
})
|
58
|
+
.width(function() {
|
59
|
+
return that.width() / that.cols();
|
60
|
+
})
|
61
|
+
.height(function() {
|
62
|
+
return that.height() / that.rows();
|
63
|
+
})
|
64
|
+
.left(function() {
|
65
|
+
return this.width() * (this.index % that.cols());
|
66
|
+
})
|
67
|
+
.top(function() {
|
68
|
+
return this.height() * Math.floor(this.index / that.cols());
|
69
|
+
})).parent = this;
|
70
|
+
};
|
71
|
+
|
72
|
+
pv.Layout.Grid.prototype = pv.extend(pv.Layout)
|
73
|
+
.property("rows")
|
74
|
+
.property("cols");
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Default properties for grid layouts. By default, there is one row and one
|
78
|
+
* column, and the data is the propagated to the child cell.
|
79
|
+
*
|
80
|
+
* @type pv.Layout.Grid
|
81
|
+
*/
|
82
|
+
pv.Layout.Grid.prototype.defaults = new pv.Layout.Grid()
|
83
|
+
.extend(pv.Layout.prototype.defaults)
|
84
|
+
.rows(1)
|
85
|
+
.cols(1);
|
86
|
+
|
87
|
+
/** @private */
|
88
|
+
pv.Layout.Grid.prototype.buildImplied = function(s) {
|
89
|
+
pv.Layout.prototype.buildImplied.call(this, s);
|
90
|
+
var r = s.rows, c = s.cols;
|
91
|
+
if (typeof c == "object") r = pv.transpose(c);
|
92
|
+
if (typeof r == "object") {
|
93
|
+
s.$grid = pv.blend(r);
|
94
|
+
s.rows = r.length;
|
95
|
+
s.cols = r[0] ? r[0].length : 0;
|
96
|
+
} else {
|
97
|
+
s.$grid = pv.repeat([s.data], r * c);
|
98
|
+
}
|
99
|
+
};
|
100
|
+
|
101
|
+
/**
|
102
|
+
* The number of rows. This property can also be specified as the data in
|
103
|
+
* row-major order; in this case, the rows property is implicitly set to the
|
104
|
+
* length of the array, and the cols property is set to the length of the first
|
105
|
+
* element in the array.
|
106
|
+
*
|
107
|
+
* @type number
|
108
|
+
* @name pv.Layout.Grid.prototype.rows
|
109
|
+
*/
|
110
|
+
|
111
|
+
/**
|
112
|
+
* The number of columns. This property can also be specified as the data in
|
113
|
+
* column-major order; in this case, the cols property is implicitly set to the
|
114
|
+
* length of the array, and the rows property is set to the length of the first
|
115
|
+
* element in the array.
|
116
|
+
*
|
117
|
+
* @type number
|
118
|
+
* @name pv.Layout.Grid.prototype.cols
|
119
|
+
*/
|
@@ -0,0 +1,249 @@
|
|
1
|
+
/**
|
2
|
+
* Constructs a new, empty hierarchy layout. Layouts are not typically
|
3
|
+
* constructed directly; instead, they are added to an existing panel via
|
4
|
+
* {@link pv.Mark#add}.
|
5
|
+
*
|
6
|
+
* @class Represents an abstract layout for hierarchy diagrams. This class is a
|
7
|
+
* specialization of {@link pv.Layout.Network}, providing the basic structure
|
8
|
+
* for both hierarchical node-link diagrams (such as Reingold-Tilford trees) and
|
9
|
+
* space-filling hierarchy diagrams (such as sunbursts and treemaps).
|
10
|
+
*
|
11
|
+
* <p>Unlike general network layouts, the <tt>links</tt> property need not be
|
12
|
+
* defined explicitly. Instead, the links are computed implicitly from the
|
13
|
+
* <tt>parentNode</tt> attribute of the node objects, as defined by the
|
14
|
+
* <tt>nodes</tt> property. This implementation is also available as
|
15
|
+
* {@link #links}, for reuse with non-hierarchical layouts; for example, to
|
16
|
+
* render a tree using force-directed layout.
|
17
|
+
*
|
18
|
+
* <p>Correspondingly, the <tt>nodes</tt> property is represented as a union of
|
19
|
+
* {@link pv.Layout.Network.Node} and {@link pv.Dom.Node}. To construct a node
|
20
|
+
* hierarchy from a simple JSON map, use the {@link pv.Dom} operator; this
|
21
|
+
* operator also provides an easy way to sort nodes before passing them to the
|
22
|
+
* layout.
|
23
|
+
*
|
24
|
+
* <p>For more details on how to use this layout, see
|
25
|
+
* {@link pv.Layout.Network}.
|
26
|
+
*
|
27
|
+
* @see pv.Layout.Cluster
|
28
|
+
* @see pv.Layout.Partition
|
29
|
+
* @see pv.Layout.Tree
|
30
|
+
* @see pv.Layout.Treemap
|
31
|
+
* @see pv.Layout.Indent
|
32
|
+
* @see pv.Layout.Pack
|
33
|
+
* @extends pv.Layout.Network
|
34
|
+
*/
|
35
|
+
pv.Layout.Hierarchy = function() {
|
36
|
+
pv.Layout.Network.call(this);
|
37
|
+
this.link.strokeStyle("#ccc");
|
38
|
+
};
|
39
|
+
|
40
|
+
pv.Layout.Hierarchy.prototype = pv.extend(pv.Layout.Network);
|
41
|
+
|
42
|
+
/** @private Compute the implied links. (Links are null by default.) */
|
43
|
+
pv.Layout.Hierarchy.prototype.buildImplied = function(s) {
|
44
|
+
if (!s.links) s.links = pv.Layout.Hierarchy.links.call(this);
|
45
|
+
pv.Layout.Network.prototype.buildImplied.call(this, s);
|
46
|
+
};
|
47
|
+
|
48
|
+
/** The implied links; computes links using the <tt>parentNode</tt> attribute. */
|
49
|
+
pv.Layout.Hierarchy.links = function() {
|
50
|
+
return this.nodes()
|
51
|
+
.filter(function(n) { return n.parentNode; })
|
52
|
+
.map(function(n) {
|
53
|
+
return {
|
54
|
+
sourceNode: n,
|
55
|
+
targetNode: n.parentNode,
|
56
|
+
linkValue: 1
|
57
|
+
};
|
58
|
+
});
|
59
|
+
};
|
60
|
+
|
61
|
+
/** @private Provides standard node-link layout based on breadth & depth. */
|
62
|
+
pv.Layout.Hierarchy.NodeLink = {
|
63
|
+
|
64
|
+
/** @private */
|
65
|
+
buildImplied: function(s) {
|
66
|
+
var nodes = s.nodes,
|
67
|
+
orient = s.orient,
|
68
|
+
horizontal = /^(top|bottom)$/.test(orient),
|
69
|
+
w = s.width,
|
70
|
+
h = s.height;
|
71
|
+
|
72
|
+
/* Compute default inner and outer radius. */
|
73
|
+
if (orient == "radial") {
|
74
|
+
var ir = s.innerRadius, or = s.outerRadius;
|
75
|
+
if (ir == null) ir = 0;
|
76
|
+
if (or == null) or = Math.min(w, h) / 2;
|
77
|
+
}
|
78
|
+
|
79
|
+
/** @private Returns the radius of the given node. */
|
80
|
+
function radius(n) {
|
81
|
+
return n.parentNode ? (n.depth * (or - ir) + ir) : 0;
|
82
|
+
}
|
83
|
+
|
84
|
+
/** @private Returns the angle of the given node. */
|
85
|
+
function midAngle(n) {
|
86
|
+
return (n.parentNode ? (n.breadth - .25) * 2 * Math.PI : 0);
|
87
|
+
}
|
88
|
+
|
89
|
+
/** @private */
|
90
|
+
function x(n) {
|
91
|
+
switch (orient) {
|
92
|
+
case "left": return n.depth * w;
|
93
|
+
case "right": return w - n.depth * w;
|
94
|
+
case "top": return n.breadth * w;
|
95
|
+
case "bottom": return w - n.breadth * w;
|
96
|
+
case "radial": return w / 2 + radius(n) * Math.cos(n.midAngle);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
/** @private */
|
101
|
+
function y(n) {
|
102
|
+
switch (orient) {
|
103
|
+
case "left": return n.breadth * h;
|
104
|
+
case "right": return h - n.breadth * h;
|
105
|
+
case "top": return n.depth * h;
|
106
|
+
case "bottom": return h - n.depth * h;
|
107
|
+
case "radial": return h / 2 + radius(n) * Math.sin(n.midAngle);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
for (var i = 0; i < nodes.length; i++) {
|
112
|
+
var n = nodes[i];
|
113
|
+
n.midAngle = orient == "radial" ? midAngle(n)
|
114
|
+
: horizontal ? Math.PI / 2 : 0;
|
115
|
+
n.x = x(n);
|
116
|
+
n.y = y(n);
|
117
|
+
if (n.firstChild) n.midAngle += Math.PI;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
};
|
121
|
+
|
122
|
+
/** @private Provides standard space-filling layout based on breadth & depth. */
|
123
|
+
pv.Layout.Hierarchy.Fill = {
|
124
|
+
|
125
|
+
/** @private */
|
126
|
+
constructor: function() {
|
127
|
+
this.node
|
128
|
+
.strokeStyle("#fff")
|
129
|
+
.fillStyle("#ccc")
|
130
|
+
.width(function(n) { return n.dx; })
|
131
|
+
.height(function(n) { return n.dy; })
|
132
|
+
.innerRadius(function(n) { return n.innerRadius; })
|
133
|
+
.outerRadius(function(n) { return n.outerRadius; })
|
134
|
+
.startAngle(function(n) { return n.startAngle; })
|
135
|
+
.angle(function(n) { return n.angle; });
|
136
|
+
|
137
|
+
this.label
|
138
|
+
.textAlign("center")
|
139
|
+
.left(function(n) { return n.x + (n.dx / 2); })
|
140
|
+
.top(function(n) { return n.y + (n.dy / 2); });
|
141
|
+
|
142
|
+
/* Hide unsupported link. */
|
143
|
+
delete this.link;
|
144
|
+
},
|
145
|
+
|
146
|
+
/** @private */
|
147
|
+
buildImplied: function(s) {
|
148
|
+
var nodes = s.nodes,
|
149
|
+
orient = s.orient,
|
150
|
+
horizontal = /^(top|bottom)$/.test(orient),
|
151
|
+
w = s.width,
|
152
|
+
h = s.height,
|
153
|
+
depth = -nodes[0].minDepth;
|
154
|
+
|
155
|
+
/* Compute default inner and outer radius. */
|
156
|
+
if (orient == "radial") {
|
157
|
+
var ir = s.innerRadius, or = s.outerRadius;
|
158
|
+
if (ir == null) ir = 0;
|
159
|
+
if (ir) depth *= 2; // use full depth step for root
|
160
|
+
if (or == null) or = Math.min(w, h) / 2;
|
161
|
+
}
|
162
|
+
|
163
|
+
/** @private Scales the specified depth for a space-filling layout. */
|
164
|
+
function scale(d, depth) {
|
165
|
+
return (d + depth) / (1 + depth);
|
166
|
+
}
|
167
|
+
|
168
|
+
/** @private */
|
169
|
+
function x(n) {
|
170
|
+
switch (orient) {
|
171
|
+
case "left": return scale(n.minDepth, depth) * w;
|
172
|
+
case "right": return (1 - scale(n.maxDepth, depth)) * w;
|
173
|
+
case "top": return n.minBreadth * w;
|
174
|
+
case "bottom": return (1 - n.maxBreadth) * w;
|
175
|
+
case "radial": return w / 2;
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
/** @private */
|
180
|
+
function y(n) {
|
181
|
+
switch (orient) {
|
182
|
+
case "left": return n.minBreadth * h;
|
183
|
+
case "right": return (1 - n.maxBreadth) * h;
|
184
|
+
case "top": return scale(n.minDepth, depth) * h;
|
185
|
+
case "bottom": return (1 - scale(n.maxDepth, depth)) * h;
|
186
|
+
case "radial": return h / 2;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
/** @private */
|
191
|
+
function dx(n) {
|
192
|
+
switch (orient) {
|
193
|
+
case "left":
|
194
|
+
case "right": return (n.maxDepth - n.minDepth) / (1 + depth) * w;
|
195
|
+
case "top":
|
196
|
+
case "bottom": return (n.maxBreadth - n.minBreadth) * w;
|
197
|
+
case "radial": return n.parentNode ? (n.innerRadius + n.outerRadius) * Math.cos(n.midAngle) : 0;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
/** @private */
|
202
|
+
function dy(n) {
|
203
|
+
switch (orient) {
|
204
|
+
case "left":
|
205
|
+
case "right": return (n.maxBreadth - n.minBreadth) * h;
|
206
|
+
case "top":
|
207
|
+
case "bottom": return (n.maxDepth - n.minDepth) / (1 + depth) * h;
|
208
|
+
case "radial": return n.parentNode ? (n.innerRadius + n.outerRadius) * Math.sin(n.midAngle) : 0;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
/** @private */
|
213
|
+
function innerRadius(n) {
|
214
|
+
return Math.max(0, scale(n.minDepth, depth / 2)) * (or - ir) + ir;
|
215
|
+
}
|
216
|
+
|
217
|
+
/** @private */
|
218
|
+
function outerRadius(n) {
|
219
|
+
return scale(n.maxDepth, depth / 2) * (or - ir) + ir;
|
220
|
+
}
|
221
|
+
|
222
|
+
/** @private */
|
223
|
+
function startAngle(n) {
|
224
|
+
return (n.parentNode ? n.minBreadth - .25 : 0) * 2 * Math.PI;
|
225
|
+
}
|
226
|
+
|
227
|
+
/** @private */
|
228
|
+
function angle(n) {
|
229
|
+
return (n.parentNode ? n.maxBreadth - n.minBreadth : 1) * 2 * Math.PI;
|
230
|
+
}
|
231
|
+
|
232
|
+
for (var i = 0; i < nodes.length; i++) {
|
233
|
+
var n = nodes[i];
|
234
|
+
n.x = x(n);
|
235
|
+
n.y = y(n);
|
236
|
+
if (orient == "radial") {
|
237
|
+
n.innerRadius = innerRadius(n);
|
238
|
+
n.outerRadius = outerRadius(n);
|
239
|
+
n.startAngle = startAngle(n);
|
240
|
+
n.angle = angle(n);
|
241
|
+
n.midAngle = n.startAngle + n.angle / 2;
|
242
|
+
} else {
|
243
|
+
n.midAngle = horizontal ? -Math.PI / 2 : 0;
|
244
|
+
}
|
245
|
+
n.dx = dx(n);
|
246
|
+
n.dy = dy(n);
|
247
|
+
}
|
248
|
+
}
|
249
|
+
};
|
@@ -0,0 +1,159 @@
|
|
1
|
+
/**
|
2
|
+
* Constructs a new, empty horizon layout. Layouts are not typically constructed
|
3
|
+
* directly; instead, they are added to an existing panel via
|
4
|
+
* {@link pv.Mark#add}.
|
5
|
+
*
|
6
|
+
* @class Implements a horizon layout, which is a variation of a single-series
|
7
|
+
* area chart where the area is folded into multiple bands. Color is used to
|
8
|
+
* encode band, allowing the size of the chart to be reduced significantly
|
9
|
+
* without impeding readability. This layout algorithm is based on the work of
|
10
|
+
* J. Heer, N. Kong and M. Agrawala in <a
|
11
|
+
* href="http://hci.stanford.edu/publications/2009/heer-horizon-chi09.pdf">"Sizing
|
12
|
+
* the Horizon: The Effects of Chart Size and Layering on the Graphical
|
13
|
+
* Perception of Time Series Visualizations"</a>, CHI 2009.
|
14
|
+
*
|
15
|
+
* <p>This layout exports a single <tt>band</tt> mark prototype, which is
|
16
|
+
* intended to be used with an area mark. The band mark is contained in a panel
|
17
|
+
* which is replicated per band (and for negative/positive bands). For example,
|
18
|
+
* to create a simple horizon graph given an array of numbers:
|
19
|
+
*
|
20
|
+
* <pre>vis.add(pv.Layout.Horizon)
|
21
|
+
* .bands(n)
|
22
|
+
* .band.add(pv.Area)
|
23
|
+
* .data(data)
|
24
|
+
* .left(function() this.index * 35)
|
25
|
+
* .height(function(d) d * 40);</pre>
|
26
|
+
*
|
27
|
+
* The layout can be further customized by changing the number of bands, and
|
28
|
+
* toggling whether the negative bands are mirrored or offset. (See the
|
29
|
+
* above-referenced paper for guidance.)
|
30
|
+
*
|
31
|
+
* <p>The <tt>fillStyle</tt> of the area can be overridden, though typically it
|
32
|
+
* is easier to customize the layout's behavior through the custom
|
33
|
+
* <tt>backgroundStyle</tt>, <tt>positiveStyle</tt> and <tt>negativeStyle</tt>
|
34
|
+
* properties. By default, the background is white, positive bands are blue, and
|
35
|
+
* negative bands are red. For the most accurate presentation, use fully-opaque
|
36
|
+
* colors of equal intensity for the negative and positive bands.
|
37
|
+
*
|
38
|
+
* @extends pv.Layout
|
39
|
+
*/
|
40
|
+
pv.Layout.Horizon = function() {
|
41
|
+
pv.Layout.call(this);
|
42
|
+
var that = this,
|
43
|
+
bands, // cached bands
|
44
|
+
mode, // cached mode
|
45
|
+
size, // cached height
|
46
|
+
fill, // cached background style
|
47
|
+
red, // cached negative color (ramp)
|
48
|
+
blue, // cached positive color (ramp)
|
49
|
+
buildImplied = this.buildImplied;
|
50
|
+
|
51
|
+
/** @private Cache the layout state to optimize properties. */
|
52
|
+
this.buildImplied = function(s) {
|
53
|
+
buildImplied.call(this, s);
|
54
|
+
bands = s.bands;
|
55
|
+
mode = s.mode;
|
56
|
+
size = Math.round((mode == "color" ? .5 : 1) * s.height);
|
57
|
+
fill = s.backgroundStyle;
|
58
|
+
red = pv.ramp(fill, s.negativeStyle).domain(0, bands);
|
59
|
+
blue = pv.ramp(fill, s.positiveStyle).domain(0, bands);
|
60
|
+
};
|
61
|
+
|
62
|
+
var bands = new pv.Panel()
|
63
|
+
.data(function() { return pv.range(bands * 2); })
|
64
|
+
.overflow("hidden")
|
65
|
+
.height(function() { return size; })
|
66
|
+
.top(function(i) { return mode == "color" ? (i & 1) * size : 0; })
|
67
|
+
.fillStyle(function(i) { return i ? null : fill; });
|
68
|
+
|
69
|
+
/**
|
70
|
+
* The band prototype. This prototype is intended to be used with an Area
|
71
|
+
* mark to render the horizon bands.
|
72
|
+
*
|
73
|
+
* @type pv.Mark
|
74
|
+
* @name pv.Layout.Horizon.prototype.band
|
75
|
+
*/
|
76
|
+
this.band = new pv.Mark()
|
77
|
+
.top(function(d, i) {
|
78
|
+
return mode == "mirror" && i & 1
|
79
|
+
? (i + 1 >> 1) * size
|
80
|
+
: null;
|
81
|
+
})
|
82
|
+
.bottom(function(d, i) {
|
83
|
+
return mode == "mirror"
|
84
|
+
? (i & 1 ? null : (i + 1 >> 1) * -size)
|
85
|
+
: ((i & 1 || -1) * (i + 1 >> 1) * size);
|
86
|
+
})
|
87
|
+
.fillStyle(function(d, i) {
|
88
|
+
return (i & 1 ? red : blue)((i >> 1) + 1);
|
89
|
+
});
|
90
|
+
|
91
|
+
this.band.add = function(type) {
|
92
|
+
return that.add(pv.Panel).extend(bands).add(type).extend(this);
|
93
|
+
};
|
94
|
+
};
|
95
|
+
|
96
|
+
pv.Layout.Horizon.prototype = pv.extend(pv.Layout)
|
97
|
+
.property("bands", Number)
|
98
|
+
.property("mode", String)
|
99
|
+
.property("backgroundStyle", pv.color)
|
100
|
+
.property("positiveStyle", pv.color)
|
101
|
+
.property("negativeStyle", pv.color);
|
102
|
+
|
103
|
+
/**
|
104
|
+
* Default properties for horizon layouts. By default, there are two bands, the
|
105
|
+
* mode is "offset", the background style is "white", the positive style is
|
106
|
+
* blue, negative style is red.
|
107
|
+
*
|
108
|
+
* @type pv.Layout.Horizon
|
109
|
+
*/
|
110
|
+
pv.Layout.Horizon.prototype.defaults = new pv.Layout.Horizon()
|
111
|
+
.extend(pv.Layout.prototype.defaults)
|
112
|
+
.bands(2)
|
113
|
+
.mode("offset")
|
114
|
+
.backgroundStyle("white")
|
115
|
+
.positiveStyle("#1f77b4")
|
116
|
+
.negativeStyle("#d62728");
|
117
|
+
|
118
|
+
/**
|
119
|
+
* The horizon mode: offset, mirror, or color. The default is "offset".
|
120
|
+
*
|
121
|
+
* @type string
|
122
|
+
* @name pv.Layout.Horizon.prototype.mode
|
123
|
+
*/
|
124
|
+
|
125
|
+
/**
|
126
|
+
* The number of bands. Must be at least one. The default value is two.
|
127
|
+
*
|
128
|
+
* @type number
|
129
|
+
* @name pv.Layout.Horizon.prototype.bands
|
130
|
+
*/
|
131
|
+
|
132
|
+
/**
|
133
|
+
* The positive band color; if non-null, the interior of positive bands are
|
134
|
+
* filled with the specified color. The default value of this property is blue.
|
135
|
+
* For accurate blending, this color should be fully opaque.
|
136
|
+
*
|
137
|
+
* @type pv.Color
|
138
|
+
* @name pv.Layout.Horizon.prototype.positiveStyle
|
139
|
+
*/
|
140
|
+
|
141
|
+
/**
|
142
|
+
* The negative band color; if non-null, the interior of negative bands are
|
143
|
+
* filled with the specified color. The default value of this property is red.
|
144
|
+
* For accurate blending, this color should be fully opaque.
|
145
|
+
*
|
146
|
+
* @type pv.Color
|
147
|
+
* @name pv.Layout.Horizon.prototype.negativeStyle
|
148
|
+
*/
|
149
|
+
|
150
|
+
/**
|
151
|
+
* The background color. The panel background is filled with the specified
|
152
|
+
* color, and the negative and positive bands are filled with an interpolated
|
153
|
+
* color between this color and the respective band color. The default value of
|
154
|
+
* this property is white. For accurate blending, this color should be fully
|
155
|
+
* opaque.
|
156
|
+
*
|
157
|
+
* @type pv.Color
|
158
|
+
* @name pv.Layout.Horizon.prototype.backgroundStyle
|
159
|
+
*/
|