Skip to content

Instantly share code, notes, and snippets.

@BarakChamo
BarakChamo / Circle.pde
Last active September 24, 2017 21:11 — forked from oshoham/Circle.pde
circle packing for the laser cutter
// Daniel Shiffman
// http://codingtra.in
// http://patreon.com/codingtrain
// Code for: https://youtu.be/QHEQuoIKgNE
import processing.pdf.*;
ArrayList<Circle> circles;
void setup() {
@BarakChamo
BarakChamo / README.md
Last active December 18, 2015 06:59 — forked from mbostock/.block

The easiest way to transition between pie charts with differently-sized datasets (while maintaining object constancy) is to set the missing values to zero.

function type(d) {
  d.apples = +d.apples || 0;
  d.oranges = +d.oranges || 0;
  return d;
}

This variation of a donut chart demonstrates how to update values with an animated transition. Clicking on the radio buttons changes the displayed metric.

Next: Missing Data
Previous: Static Update

@BarakChamo
BarakChamo / README.md
Last active December 18, 2015 06:59 — forked from mbostock/.block

The easiest way to transition between pie charts with differently-sized datasets (while maintaining object constancy) is to set the missing values to zero.

function type(d) {
  d.apples = +d.apples || 0;
  d.oranges = +d.oranges || 0;
  return d;
}
source target value
Agricultural Energy Use Carbon Dioxide 1.4
Agriculture Agriculture Soils 5.2
Agriculture Livestock and Manure 5.4
Agriculture Other Agriculture 1.7
Agriculture Rice Cultivation 1.5
Agriculture Soils Nitrous Oxide 5.2
Air Carbon Dioxide 1.7
Aluminium Non-Ferrous Metals Carbon Dioxide 1
Aluminium Non-Ferrous Metals HFCs - PFCs 0.2
@BarakChamo
BarakChamo / README.md
Created January 10, 2013 10:38 — forked from mbostock/.block

This variation of a bivariate area chart uses clipping to alternate colors. When New York is warmer than San Francisco, the difference between the two is filled in green. When San Francisco is warmer, the difference is filled in red. A similar technique was used by William Playfair all the way back in 1786.