Skip to content

Instantly share code, notes, and snippets.

@phil-pedruco
phil-pedruco / index.html
Last active December 25, 2015 22:39
Disable zoom on scrollwheel but retain the ability to pan #1
<!DOCTYPE html>
<meta charset="utf-8">
<style>
#boroughs {
stroke: grey;
stroke-width: 2px;
fill: steelblue;
}
</style>
@phil-pedruco
phil-pedruco / index.html
Last active December 25, 2015 22:39
Disable zoom on scrollwheel but retain the ability to pan #2
<!DOCTYPE html>
<meta charset="utf-8">
<style>
#boroughs {
stroke: grey;
stroke-width: 2px;
fill: steelblue;
}
</style>
@phil-pedruco
phil-pedruco / README.md
Last active December 26, 2015 17:49 — forked from mbostock/.block
Symbol Map with Text

This this a variation of this bl.ock by Mike Bostock to demostrate the appending text to a map in response to this stack overflow question. The area of each circle in this symbol map is proportional to the population of the associated state.

@phil-pedruco
phil-pedruco / fun.csv
Last active December 27, 2015 01:19
Reading csv for nvd3
label value
Fun 50
Stupid -20
Yes 100
No 70
@phil-pedruco
phil-pedruco / 004.json
Last active December 27, 2015 19:59 — forked from pere/004.json
D3.js and Leaflet with a simple json overlay
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phil-pedruco
phil-pedruco / index.html
Last active January 30, 2017 02:04
Click to zoom with table and map in D3
<!DOCTYPE html>
<meta charset="utf-8">
<style>
@import url(mapStyle.css);
</style>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<body>
@phil-pedruco
phil-pedruco / index.html
Last active September 9, 2018 12:23
Plotting points on a map in D3
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Point on a map D3</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<style type="text/css">
@phil-pedruco
phil-pedruco / d3.min3.1.5.js
Last active January 2, 2016 21:29
Map with Voronio Polygons for Tooltip
d3=function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.length}function e(n){for(var t=1;n*t%1;)t*=10;return t}function r(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function u(){}function i(){}function a(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function o(){}function c(n){function t(){for(var t,r=e,u=-1,i=r.length;++u<i;)(t=r[u].on)&&t.apply(this,arguments);return n}var e=[],r=new u;return t.on=function(t,u){var i,a=r.get(t);return arguments.length<2?a&&a.on:(a&&(a.on=null,e=e.slice(0,i=e.indexOf(a)).concat(e.slice(i+1)),r.remove(t)),u&&e.push(r.set(t,{on:u})),n)},t}function l(){ca.event.stopPropagation(),ca.event.preventDefault()}function f(){for(var n,t=ca.event;n=t.sourceEvent;)t=n;return t}function s(n,t){function e(){n.on(t,null)}n.on(t,function(){l(),e()},!0),setTimeout(e,0)}function h(n){for(var t=new o,e=0,r=arguments.length;++e<r;)t[arguments[e]]=c(t);return t.of=function(e,r){return
@phil-pedruco
phil-pedruco / data.tsv
Last active August 29, 2015 13:56
Bar chart with mouseover event
letter frequency
A .08167
B .01492
C .02782
D .04253
E .12702
F .02288
G .02015
H .06094
I .06966
@phil-pedruco
phil-pedruco / data.tsv
Last active August 29, 2015 13:56
Axis transition
Date Alabama Alaska Arizona Arkansas California Colorado Connecticut Delaware Midwest Northeast South West United States
1917 14.3 2.8 11.7 11.2 15 13.3 19.1 37.9 13.1 22.9 15.7 13.2 17.3
1918 11.5 1.3 11.6 11.7 14.9 10.3 16.9 32.9 11.7 20.2 15.1 11.7 15.6
1919 13.2 1.1 9.8 9.9 15 12.1 16.6 30.4 12.8 21.2 14.3 12.2 16
1920 12.1 1.2 8.3 9.6 12.7 11.1 14.1 21 12.4 17.8 13.5 10.9 14.5
1921 13.4 2.1 8.4 10.6 13.4 11.7 16.4 21.8 13.2 17.9 14 12 15.3
1922 14.2 2 9.8 11.7 14.2 13.6 16.6 23 14.1 19.8 15 12.8 16.6
1923 13.4 1.9 9.1 10.9 13.4 12.1 16.2 22.7 12.9 18 14.4 12 15.3
1924 14.5 2.3 10.4 11.1 14.7 13.1 18.5 29.1 14.7 20 15.3 12.9 17
1925 15.8 3.1 14.2 12.5 16.3 16 21.3 35.4 17.3 22.9 18 15.2 19.8