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.
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
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 |
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
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 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
/* Space out content a bit */ | |
body { | |
padding-top: 20px; | |
padding-bottom: 20px; | |
} | |
/* Everything but the jumbotron gets side spacing for mobile first views */ | |
.header, | |
.marketing, | |
.footer { |
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
id | name | |
---|---|---|
-1 | Northern Cyprus | |
-2 | Kosovo | |
-3 | Somaliland | |
4 | Afghanistan | |
8 | Albania | |
10 | Antarctica | |
12 | Algeria | |
16 | American Samoa | |
20 | Andorra |
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
// Daniel Shiffman | |
// http://codingtra.in | |
// http://patreon.com/codingtrain | |
// Code for: https://youtu.be/QHEQuoIKgNE | |
import processing.pdf.*; | |
ArrayList<Circle> circles; | |
void setup() { |
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
a = window; | |
TIME_SWITCH_TIME = 4000; | |
DOWNLOAD_TIME = 2000; | |
function captureImage(time) { | |
document.createElement("img"); | |
var c = document.createElement("canvas"), | |
d = c.getContext("2d"), | |
e, |
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
/* | |
GLSL distance functions and tesselation demo | |
Live demo at: https://www.shadertoy.com/view/4lccW8 | |
*/ | |
/* Euclidean distance */ | |
/* https://en.wikipedia.org/wiki/Euclidean_distance */ | |
float euclideanDistance(float p1, float p2) { | |
float d1 = (p1 - p2); | |
return sqrt(pow(d1, 2.0)); |
OlderNewer