Skip to content

Instantly share code, notes, and snippets.

View davo's full-sized avatar
🦮
Golden

Davo Galavotti davo

🦮
Golden
View GitHub Profile
@davo
davo / README.mkd
Created December 18, 2012 17:55 — forked from mbostock/README.md

This example is a simple loupe using Polymaps. Drag the center of the loupe to move it around, or drag the thick border to resize it. Loupes are normally used to magnify, showing focus and context, but in this example we're using it to show two different tilesets. You can enable magnification (or minification) using the zoomDelta property.

@davo
davo / index.html
Created December 18, 2012 17:55 — forked from mbostock/.block
<!DOCTYPE html>
<meta charset="utf-8">
<title>Polar Clock</title>
<style>
#clock {
position: relative;
background: #222;
width: 960px;
height: 500px;
@davo
davo / README.md
Created December 21, 2012 20:44 — forked from mbostock/.block
@davo
davo / index.html
Created December 21, 2012 23:28 — forked from mbostock/.block
<!DOCTYPE html>
<meta charset="utf-8">
<title>Mercator Projection</title>
<style>
path {
fill: #ccc;
stroke: #fff;
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Easy earthquakes</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://libs.cartocdn.com/cartodb.js/v2/cartodb.js"></script>
<style type="text/css">
body{
@davo
davo / _.md
Created January 11, 2013 19:36
An inlet to Tributary
@davo
davo / README.md
Last active December 14, 2015 00:38 — forked from mbostock/.block

Example

@davo
davo / README.md
Created February 20, 2013 21:59 — forked from mbostock/.block

This diagram shows the distribution of age groups in the United States over the last 150 years. Use the arrow keys to observe the changing population. Data from the Minnesota Population Center. Use the arrow keys to change the displayed year. The blue bars are the male population for each five-year age bracket, while the pink bars are the female population; the bars are partially transparent so that you can see how they overlap, unlike the traditional side-by-side display which makes it difficult to compare the relative distribution of the sexes.

The Issue

I'm trying to build a map that can be zoomed using the mouse wheel and panned with drag. For that I'm using d3.behavior.zoom() and it works fine for the map. However, I also need to mark some points in the map (which are included in the same topojson used to draw the map). They get rendered just fine, but I'm having trouble handling the zoom behaviour with these points. If you try to zoom or pan, the points get translated abruptly and even seem to change their path!

Any ideas?

@davo
davo / _.md
Created March 6, 2013 12:49
zoomable map