This gist shows how to restrict d3's zoom behavior so that users can't pan outside of a rectangular bounding box. Use your scroll wheel to zoom in and out of the field of circles, and click and drag to move when zoomed in. Note how when you zoom back out (by scrolling up) the view snaps to the original extent at zoom 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 | |
height: 200 | |
redirect: https://observablehq.com/@d3/beeswarm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8Wired Brewing | |
Superconductor DIPA, 8.9%, BU 88 | |
Hopwired IPA, 7.3%, BU 70 | |
Tall Poppy Red, 7.0%, BU 60 | |
iStout Imperial Stout, 10.0%, BU 75 | |
Mighty Imperial Ale, 10.0%, BU 75 | |
Semiconductor Session IPA, 4.4% BU 30 | |
Adnams | |
Southwold Bitter, 4.1% | |
Broadside (Premium Bitter), 6.3% |
Updated for Rails 4.0.0+
-
Set up the
bower
gem. -
Follow the Bower instructions and list your dependencies in your
bower.json
, e.g.// bower.json
{
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isRetina(){ | |
return (('devicePixelRatio' in window && devicePixelRatio > 1) || | |
('matchMedia' in window && matchMedia("(min-resolution:144dpi)").matches)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
## | |
## --- New Zealand General Election Polling --- | |
## | |
## Plots polling data scraped from Wikipedia. | |
## | |
## - GAM - | |
## | |
## The smoothed curves are calculated using a generalised additive model (GAM). The | |
## smoothing parameter is estimated using cross-validation. This means that the curves |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Upgrade PostgreSQL from 9.0 to 9.1 | |
# | |
# by David Sommers | |
# | |
brew update postgres |
Setup GitHub Pages "gh-pages" branch as a subfolder within the "master" project on your local checkout.
If you plan on switching between different branches (e.g. git checkout master-experiment
then revert back with git checkout master
) you will loose your child
folder from this tutorial (because it's in your
.gitignore and is not part of your master
branch).
NewerOlder