Skip to content

Instantly share code, notes, and snippets.

View enjalot's full-sized avatar

Ian Johnson enjalot

View GitHub Profile
@enjalot
enjalot / index.html
Created September 19, 2011 02:30
Broken arc.centroid calculation
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Testing Pie Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script>
<style type="text/css">
@enjalot
enjalot / index.html
Created October 1, 2011 20:25 — forked from ZJONSSON/index.html
Using data() enter and exit in D3
<!DOCTYPE html>
<html>
<head></head>
<body></body>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript">
// Define the SVG domain in a viewbox to get automatic resize to
// window. This is a good alternative to d3.scale for simple stuff
svg=d3.select("body")
@enjalot
enjalot / index.html
Created October 4, 2011 16:51
Double Pie Chart
<!DOCTYPE html>
<html>
<head>
<title>Pie Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.3.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.3.0"></script>
<style type="text/css">
body {
font: 10px sans-serif;
@enjalot
enjalot / index.html
Created October 4, 2011 17:34
Multi Pie
<!DOCTYPE html>
<html>
<head>
<title>Pie Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.3.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.3.0"></script>
<style type="text/css">
body {
font: 10px sans-serif;
@enjalot
enjalot / index.html
Created October 4, 2011 17:51
Bakery
<!DOCTYPE html>
<html>
<head>
<title>Pie Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.3.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.3.0"></script>
<style type="text/css">
body {
font: 10px sans-serif;
var r = 480,
format = d3.format(",d"),
fill = d3.scale.category20c();
var keeper;
var bubble = d3.layout.pack()
.sort(null)
.size([r, r]);
@enjalot
enjalot / index.html
Created October 10, 2011 21:11
viewBox space coordinate transformation
<!DOCTYPE html>
<html>
<head>
<title>Aspect Ratio</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.3.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.3.0"></script>
</style>
</head>
<body>
@enjalot
enjalot / index.html
Created October 10, 2011 21:29
Static SVG Aspect ratio problem
<!DOCTYPE html>
<html>
<head>
<title>Aspect Ratio</title>
</style>
</head>
<body>
<div id="chart">
@enjalot
enjalot / index.html
Created October 12, 2011 23:28
Chernoff Smileys
<!DOCTYPE html>
<html>
<head>
<title>Chernoff Smileys</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.3.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.3.0"></script>
<style type="text/css">
body {
font: 10px sans-serif;
@enjalot
enjalot / index.html
Created October 24, 2011 23:21 — forked from ZJONSSON/index.html
D3 - using SVG Bounding Box to get the "automatic padding"
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.0.0"></script>
<style>
path { fill:none;stroke:black}
</style>
<head>.
<body>