Skip to content

Instantly share code, notes, and snippets.

@jthomassie
Created February 25, 2016 23:53
Show Gist options
  • Save jthomassie/f2a50428db0431c54490 to your computer and use it in GitHub Desktop.
Save jthomassie/f2a50428db0431c54490 to your computer and use it in GitHub Desktop.
fresh block
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
svg { width:100%; height: 100% }
</style>
</head>
<body>
<script>
// Feel free to change or delete any of the code you see!
var svg = d3.select("body").append("svg")
svg.append("rect")
.attr({x: 100, y: 10, width: 700, height: 480})
.style({ fill: "#a72d1a"})
.transition().duration(3000).ease("bounce")
.style({ fill: "#5db9e3"})
console.log(budget_current);
</script>
</body>
var budget_current = [
{
"year": "2006",
"all": 136.019,
"omb050": 78.737,
"non-def-total": 57.282,
"omb251": 7.539,
"omb252": 10.401,
"omb270": 1.244,
"omb300": 2.219,
"omb350": 2.118,
"omb400": 1.730,
"omb550": 28.932,
"omb700": 769,
"other": 2.330
},
{
"year": "2007",
"all": 141.890,
"omb050": 82.658,
"non-def-total": 59.232,
"omb251": 8.712,
"omb252": 10.988,
"omb270": 1.922,
"omb300": 2.096,
"omb350": 1.950,
"omb400": 1.380,
"omb550": 29.581,
"omb700": 820,
"other": 1.783
},
{
"year": "2008",
"all": 144.391,
"omb050": 85.129,
"non-def-total": 59.262,
"omb251": 9.007,
"omb252": 10.672,
"omb270": 2.076,
"omb300": 2.202,
"omb350": 1.997,
"omb400": 1.413,
"omb550": 29.212,
"omb700": 886,
"other": 1.797
},
{
"year": "2009",
"all": 164.292,
"omb050": 85.642,
"non-def-total": 78.650,
"omb251": 14.128,
"omb252": 9.060,
"omb270": 3.794,
"omb300": 2.615,
"omb350": 2.249,
"omb400": 1.461,
"omb550": 42.051,
"omb700": 943,
"other": 2.349
},
{
"year": "2010",
"all": 148.962,
"omb050": 86.789,
"non-def-total": 62.173,
"omb251": 10.509,
"omb252": 8.232,
"omb270": 2.570,
"omb300": 2.430,
"omb350": 2.206,
"omb400": 1.517,
"omb550": 31.693,
"omb700": 1.034,
"other": 1.982
},
{
"year": "2011",
"all": 144.379,
"omb050": 83.226,
"non-def-total": 61.153,
"omb251": 10.581,
"omb252": 8.658,
"omb270": 2.265,
"omb300": 2.314,
"omb350": 1.768,
"omb400": 1.420,
"omb550": 30.990,
"omb700": 1.160,
"other": 1.997
},
{
"year": "2012",
"all": 143.737,
"omb050": 79.875,
"non-def-total": 63.862,
"omb251": 10.536,
"omb252": 10.801,
"omb270": 2.231,
"omb300": 2.300,
"omb350": 2.005,
"omb400": 1.511,
"omb550": 31.411,
"omb700": 1.160,
"other": 1.907
},
{
"year": "2013",
"all": 132.477,
"omb050": 70.781,
"non-def-total": 61.696,
"omb251": 9.620,
"omb252": 10.476,
"omb270": 2.289,
"omb300": 2.169,
"omb350": 1.818,
"omb400": 1.359,
"omb550": 30.200,
"omb700": 1.164,
"other": 2.601
},
{
"year": "2014",
"all": 136.159,
"omb050": 70.992,
"non-def-total": 65.167,
"omb251": 10.524,
"omb252": 11.228,
"omb270": 2.407,
"omb300": 2.328,
"omb350": 2.077,
"omb400": 1.278,
"omb550": 31.099,
"omb700": 1.101,
"other": 3.125
},
{
"year": "2015",
"all": 137.172,
"omb050": 71.030,
"non-def-total": 66.142,
"omb251": 10.679,
"omb252": 11.629,
"omb270": 2.427,
"omb300": 2.414,
"omb350": 2.142,
"omb400": 1.330,
"omb550": 31.443,
"omb700": 1.090,
"other": 2.988
},
{
"year": "2016",
"all": 146.478,
"omb050": 76.798,
"non-def-total": 69.680,
"omb251": 11.208,
"omb252": 11.991,
"omb270": 2.992,
"omb300": 2.727,
"omb350": 2.584,
"omb400": 1.492,
"omb550": 32.443,
"omb700": 1.147,
"other": 3.096
}
];
var avg_growth_current = {
"year": "2006–10b",
"all": 2.3,
"omb050": 2.5,
"non-def-total": 2.1,
"omb251": 8.7,
"omb252": -5.7,
"omb270": 19.9,
"omb300": 2.3,
"omb350": 1.0,
"omb400": -3.2,
"omb550": 2.3,
"omb700": 7.7,
"other": -4.0
},
{
"year": "2010–13b",
"all": -3.8,
"omb050": -6.6,
"non-def-total": -0.3,
"omb251": -2.9,
"omb252": 8.4,
"omb270": -3.8,
"omb300": -3.7,
"omb350": -6.2,
"omb400": -3.6,
"omb550": -1.6,
"omb700": 4.0,
"other": 9.5
}
];
var change-current = [
{
"year": "2013–14",
"all": 2.8,
"omb050": 0.3,
"non-def-total": 5.6,
"omb251": 9.4,
"omb252": 7.2,
"omb270": 5.2,
"omb300": 7.3,
"omb350": 14.2,
"omb400": -6.0,
"omb550": 3.0,
"omb700": -5.4,
"other": 20.1
},
{
"year": "2014–15",
"all": 0.7,
"omb050": 0.1,
"non-def-total": 1.5,
"omb251": 1.5,
"omb252": 3.6,
"omb270": 0.8,
"omb300": 3.7,
"omb350": 3.1,
"omb400": 4.1,
"omb550": 1.1,
"omb700": -1.0,
"other": -4.4
},
{
"year": "2015–16",
"all": 6.8,
"omb050": 8.1,
"non-def-total": 5.3,
"omb251": 5.0,
"omb252": 3.1,
"omb270": 23.3,
"omb300": 13.0,
"omb350": 20.6,
"omb400": 12.2,
"omb550": 3.2,
"omb700": 5.2,
"other": 3.6
},
{
"year": "2006",
"all": 144.256,
"omb050": 83.505,
"non-def-total": 60.751,
"omb251": 7.996,
"omb252": 11.031,
"omb270": 1.319,
"omb300": 2.353,
"omb350": 2.246,
"omb400": 1.835,
"omb550": 30.684,
"omb700": 816,
"other": 2.471
},
{
"year": "2007",
"all": 146.520,
"omb050": 85.355,
"non-def-total": 61.165,
"omb251": 8.996,
"omb252": 11.347,
"omb270": 1.985,
"omb300": 2.164,
"omb350": 2.014,
"omb400": 1.425,
"omb550": 30.546,
"omb700": 847,
"other": 1.841
},
{
"year": "2008",
"all": 146.086,
"omb050": 86.128,
"non-def-total": 59.958,
"omb251": 9.113,
"omb252": 10.797,
"omb270": 2.100,
"omb300": 2.228,
"omb350": 2.020,
"omb400": 1.430,
"omb550": 29.555,
"omb700": 896,
"other": 1.818
},
{
"year": "2009",
"all": 164.292,
"omb050": 85.642,
"non-def-total": 78.650,
"omb251": 14.128,
"omb252": 9.060,
"omb270": 3.794,
"omb300": 2.615,
"omb350": 2.249,
"omb400": 1.461,
"omb550": 42.051,
"omb700": 943,
"other": 2.349
},
{
"year": "2010",
"all": 147.677,
"omb050": 86.040,
"non-def-total": 61.637,
"omb251": 10.418,
"omb252": 8.161,
"omb270": 2.548,
"omb300": 2.409,
"omb350": 2.187,
"omb400": 1.504,
"omb550": 31.420,
"omb700": 1.025,
"other": 1.965
},
{
"year": "2011",
"all": 140.392,
"omb050": 80.928,
"non-def-total": 59.464,
"omb251": 10.289,
"omb252": 8.419,
"omb270": 2.202,
"omb300": 2.250,
"omb350": 1.719,
"omb400": 1.381,
"omb550": 30.134,
"omb700": 1.128,
"other": 1.942
},
{
"year": "2012",
"all": 137.363,
"omb050": 76.333,
"non-def-total": 61.030,
"omb251": 10.069,
"omb252": 10.322,
"omb270": 2.132,
"omb300": 2.198,
"omb350": 1.916,
"omb400": 1.444,
"omb550": 30.018,
"omb700": 1.109,
"other": 1.822
},
{
"year": "2013",
"all": 124.438,
"omb050": 66.486,
"non-def-total": 57.952,
"omb251": 9.036,
"omb252": 9.840,
"omb270": 2.150,
"omb300": 2.037,
"omb350": 1.708,
"omb400": 1.277,
"omb550": 28.367,
"omb700": 1.093,
"other": 2.443
},
{
"year": "2014",
"all": 125.980,
"omb050": 65.685,
"non-def-total": 60.295,
"omb251": 9.737,
"omb252": 10.389,
"omb270": 2.227,
"omb300": 2.154,
"omb350": 1.922,
"omb400": 1.182,
"omb550": 28.774,
"omb700": 1.019,
"other": 2.891
},
{
"year": "2015",
"all": 125.225,
"omb050": 64.844,
"non-def-total": 60.382,
"omb251": 9.749,
"omb252": 10.616,
"omb270": 2.216,
"omb300": 2.204,
"omb350": 1.955,
"omb400": 1.214,
"omb550": 28.705,
"omb700": 995,
"other": 2.728
},
{
"year": "2016",
"all": 131.630,
"omb050": 69.013,
"non-def-total": 62.617,
"omb251": 10.072,
"omb252": 10.776,
"omb270": 2.689,
"omb300": 2.451,
"omb350": 2.322,
"omb400": 1.341,
"omb550": 29.154,
"omb700": 1.031,
"other": 2.782
}
]
var avg_growth_constant = [
{
"year": "2006–10b",
"all": 0.6,
"omb050": 0.8,
"non-def-total": 0.4,
"omb251": 6.8,
"omb252": -7.3,
"omb270": 17.9,
"omb300": 0.6,
"omb350": -0.7,
"omb400": -4.9,
"omb550": 0.6,
"omb700": 5.9,
"other": -5.6
},
{
"year": "2010–13b",
"all": -5.5,
"omb050": -8.2,
"non-def-total": -2.0,
"omb251": -4.6,
"omb252": 6.4,
"omb270": -5.5,
"omb300": -5.4,
"omb350": -7.9,
"omb400": -5.3,
"omb550": -3.3,
"omb700": 2.2,
"other": 7.5
}
];
var change_constant = [
{
"year": "2013–14",
"all": 1.2,
"omb050": -1.2,
"non-def-total": 4.0,
"omb251": 7.8,
"omb252": 5.6,
"omb270": 3.6,
"omb300": 5.7,
"omb350": 12.5,
"omb400": -7.4,
"omb550": 1.4,
"omb700": -6.8,
"other": 18.3
},
{
"year": "2014–15",
"all": -0.6,
"omb050": -1.3,
"non-def-total": 0.1,
"omb251": 0.1,
"omb252": 2.2,
"omb270": -0.5,
"omb300": 2.3,
"omb350": 1.7,
"omb400": 2.7,
"omb550": -0.2,
"omb700": -2.4,
"other": -5.6
},
{
"year": "2015–16",
"all": 5.1,
"omb050": 6.4,
"non-def-total": 3.7,
"omb251": 3.3,
"omb252": 1.5,
"omb270": 21.3,
"omb300": 11.2,
"omb350": 18.8,
"omb400": 10.5,
"omb550": 1.6,
"omb700": 3.6,
"other": 2.0
}
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment