block by tophtucker 83a90b326c547f65cdee

Inflation adjuster

Full Screen

On blur, bar heights represent nominal dollars, and bar areas represent real dollars. Mousemoves along the date axis normalizes width, forcing height to represent real dollars.

Bar chart based on mbostock/3885304. Box office data from boxofficemojo.com. CPI from inflationdata.com.

index.html

<!DOCTYPE html>
<meta charset="utf-8">
<style>

svg {
  overflow: visible;
}

g {
  pointer-events: all;
  font: 10px sans-serif;
}

.bar {
  fill: steelblue;
}

.bar:hover {
  fill: brown;
}

.axis {
  font: 10px sans-serif;
}

.axis path,
.axis line {
  fill: none;
  stroke: #000;
  shape-rendering: crispEdges;
}

.x.axis path {
  display: none;
}

</style>
<body>

<script src="d3.min.js"></script>
<script src="d3-jetpack.js"></script>
<script src="//d3js.org/queue.v1.min.js"></script>

<script>

var margin = {top: 20, right: 20, bottom: 30, left: 85},
    width = 960 - margin.left - margin.right,
    height = 500 - margin.top - margin.bottom;

var x = d3.time.scale()
    .range([0, width]);

var y = d3.scale.linear()
    .range([height, 0]);

var xAxis = d3.svg.axis()
    .scale(x)
    .orient("bottom");

var yAxis = d3.svg.axis()
    .scale(y)
    .orient("left")
    .ticks(10, "$,");

var svg = d3.select("body").append("svg")
    .attr("width", width + margin.left + margin.right)
    .attr("height", height + margin.top + margin.bottom)
  .append("g")
    .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

svg.append("rect")
  .attr('class', 'click-capture')
  .style('visibility', 'hidden')
  .attr('x', -margin.left)
  .attr('y', -margin.top)
  .attr('width', width + margin.left + margin.right)
  .attr('height', height + margin.top + margin.bottom);

var title = svg.append("text")
  .attr("dx", "1em")
  .attr("dy", "1em")
  .text("Hollywood annual box office grosses, nominal USD");

queue()
    .defer(d3.tsv, "boxoffice.tsv", dataType)
    .defer(d3.tsv, "cpi.tsv", indexType)
    .await(render);

function render(error, data, index) {
  if (error) throw error;

  data.sort(function(a,b) { return a.year - b.year; });

  x.domain(d3.extent(data, function(d) { return d.year; }));
  y.domain([0, d3.max(data, function(d) { return d.totalgross; })]);

  index = indexer(index);

  var maxRatio = d3.max(index.domain().map(function(year) { 
    var extent = d3.extent(data, ƒ('year'));
    return year >= extent[0] && year <= extent[1] ? 1 / index(year) : false; 
  }));

  var inflation = d3.scale.linear()
    .range([0, width / data.length])
    .domain([0, maxRatio]);

  svg.append("g")
      .attr("class", "x axis")
      .attr("transform", "translate(0," + height + ")")
      .call(xAxis);

  svg.append("g")
      .attr("class", "y axis")
      .call(yAxis);

  svg.selectAll(".bar")
      .data(data)
    .enter().append("rect")
      .attr("class", "bar")
      .attr("x", function(d) { return x(d.year); })
      .attr("width", function(d) { return inflation(1 / index(d.year)); })
      .attr("y", function(d) { return y(d.totalgross); })
      .attr("height", function(d) { return height - y(d.totalgross); });

  svg
    .on("mousemove", scrub)
    .on("touchmove", scrub)
    .on("mouseleave", reset)
    .on("touchend", reset);

  function scrub() {
    var date = d3.touch(this) 
      ? x.invert(d3.touch(this))[0] 
      : x.invert(d3.mouse(this)[0]);

    svg.selectAll(".bar")
      .transition()
      .ease("linear")
      .duration(100)
      .attr("width", function(d) { return inflation(1 / index(date)); })
      .attr("y", function(d) { return y(d.totalgross * (index(date) / index(d.year))); })
      .attr("height", function(d) { return height - y(d.totalgross * (index(date) / index(d.year))); })

    title.text("Hollywood annual box office grosses, real " + date.getFullYear() + " USD");
  }

  function reset() {
    title.text("Hollywood annual box office grosses, nominal USD");
      svg.selectAll(".bar")
        .transition()
        .attr("width", function(d) { return inflation(1 / index(d.year)); })
        .attr("y", function(d) { return y(d.totalgross); })
        .attr("height", function(d) { return height - y(d.totalgross); });
  }

}

function dataType(d) {
  d.year = new Date(d.year);
  d.totalgross = +d.totalgross;
  return d;
}

function indexType(d) {
  d.date = new Date(d.year)
  d.average = +d.average;
  return d;
}

function indexer(index) {
  return d3.scale.linear()
    .domain(index.map(ƒ('date')))
    .range(index.map(ƒ('average')));
}

</script>

boxoffice.tsv

year	totalgross	tickets	moviecount	screencount	avgticketprice	avgcost	topmovie
2015	6067000000	747200000	332		8.12		Jurassic World
2014	10360600000	1268100000	698		8.17		American Sniper
2013	10923600000	1343600000	687		8.13		Catching Fire
2012	10837400000	1361500000	665		7.96		The Avengers
2011	10174300000	1283000000	602		7.93		Harry Potter / Deathly Hallows (P2)
2010	10565600000	1339100000	536		7.89		Toy Story 3
2009	10595500000	1412700000	521		7.50		Avatar
2008	9630700000	1341300000	608		7.18		The Dark Knight
2007	9663800000	1404600000	631		6.88		Spider-Man 3
2006	9209500000	1406000000	608		6.55		Dead Man's Chest
2005	8840500000	1379200000	547		6.41		Revenge of the Sith
2004	9380500000	1510500000	551		6.21		Shrek 2
2003	9239700000	1532300000	506		6.03	63800000	Return of the King
2002	9155000000	1575700000	479	35592	5.81	58800000	Spider-Man
2001	8412500000	1487300000	482	36764	5.66	47700000	Harry Potter / Sorcerer's Stone
2000	7661000000	1420800000	478	37396	5.39	54800000	The Grinch
1999	7448000000	1465200000	461	37185	5.08	51500000	The Phantom Menace
1998	6949000000	1480700000	509	34186	4.69	52700000	Saving Private Ryan
1997	6365900000	1387700000	510	31640	4.59	53400000	Titanic
1996	5911500000	1338600000	471	29690	4.42	39800000	Independence Day
1995	5493500000	1262600000	411	27805	4.35	36400000	Toy Story
1994	5396200000	1291700000	453	26586	4.18	34300000	Forrest Gump
1993	5154200000	1244000000	462	25737	4.14	29900000	Jurassic Park
1992	4871000000	1173200000	480	25105	4.15	28900000	Aladdin
1991	4803200000	1140600000	458	24570	4.21	26100000	Terminator 2
1990	5021800000	1188600000	410	23689	4.23	26800000	Home Alone
1989	5033400000	1262800000	502	23132	3.97	23500000	Batman
1988	4458400000	1084800000	510	23234	4.11	18100000	Rain Man
1987	4252900000	1088500000	509	23555	3.91	20100000	Three Men and a Baby
1986	3778000000	1017200000	451	22765	3.71	17500000	Top Gun
1985	3749200000	1056100000	470	21147	3.55	16800000	Back to the Future
1984	4031000000	1199000000	536	20200	3.36	14400000	Beverly Hills Cop
1983	3766000000	1197000000	495	18884	3.15	11900000	Return of the Jedi
1982	3453000000	1175000000	428	18020	2.94	11800000	E.T.
1981	2966000000	1067000000	173	18040	2.78	11300000	Raiders / Lost Ark
1980	2749000000	1022000000	161	17590	2.69	9400000	The Empire Strikes Back

cpi.tsv

year	jan	feb	mar	apr	may	jun	jul	aug	sep	oct	nov	dec	average
2015	233.707	234.722	236.119	236.599	237.805								237.805
2014	233.916	234.781	236.293	237.072	237.9	238.343	238.25	237.852	238.031	237.433	236.151	234.812	236.736
2013	230.28	232.166	232.773	232.531	232.945	233.504	233.596	233.877	234.149	233.546	233.069	233.049	232.957
2012	226.665	227.663	229.392	230.085	229.815	229.478	229.104	230.379	231.407	231.317	230.221	229.601	229.594
2011	220.223	221.309	223.467	224.906	225.964	225.722	225.922	226.545	226.889	226.421	226.23	225.672	224.939
2010	216.687	216.741	217.631	218.009	218.178	217.965	218.011	218.312	218.439	218.711	218.803	219.179	218.056
2009	211.143	212.193	212.709	213.24	213.856	215.693	215.351	215.834	215.969	216.177	216.33	215.949	214.537
2008	211.08	211.693	213.528	214.823	216.632	218.815	219.964	219.086	218.783	216.573	212.425	210.228	215.303
2007	202.416	203.499	205.352	206.686	207.949	208.352	208.299	207.917	208.49	208.936	210.177	210.036	207.342
2006	198.3	198.7	199.8	201.5	202.5	202.9	203.5	203.9	202.9	201.8	201.5	201.8	201.6
2005	190.7	191.8	193.3	194.6	194.4	194.5	195.4	196.4	198.8	199.2	197.6	196.8	195.3
2004	185.2	186.2	187.4	188	189.1	189.7	189.4	189.5	189.9	190.9	191	190.3	188.9
2003	181.7	183.1	184.2	183.8	183.5	183.7	183.9	184.6	185.2	185	184.5	184.3	183.96
2002	177.1	177.8	178.8	179.8	179.8	179.9	180.1	180.7	181	181.3	181.3	180.9	179.88
2001	175.1	175.8	176.2	176.9	177.7	178	177.5	177.5	178.3	177.7	177.4	176.7	177.1
2000	168.8	169.8	171.2	171.3	171.5	172.4	172.8	172.8	173.7	174	174.1	174	172.2
1999	164.3	164.5	165	166.2	166.2	166.2	166.7	167.1	167.9	168.2	168.3	168.3	166.6
1998	161.6	161.9	162.2	162.5	162.8	163	163.2	163.4	163.6	164	164	163.9	163
1997	159.1	159.6	160	160.2	160.1	160.3	160.5	160.8	161.2	161.6	161.5	161.3	160.5
1996	154.4	154.9	155.7	156.3	156.6	156.7	157	157.3	157.8	158.3	158.6	158.6	156.9
1995	150.3	150.9	151.4	151.9	152.2	152.5	152.5	152.9	153.2	153.7	153.6	153.5	152.4
1994	146.2	146.7	147.2	147.4	147.5	148	148.4	149	149.4	149.5	149.7	149.7	148.2
1993	142.6	143.1	143.6	144	144.2	144.4	144.4	144.8	145.1	145.7	145.8	145.8	144.5
1992	138.1	138.6	139.3	139.5	139.7	140.2	140.5	140.9	141.3	141.8	142	141.9	140.3
1991	134.6	134.8	135	135.2	135.6	136	136.2	136.6	137.2	137.4	137.8	137.9	136.2
1990	127.4	128	128.7	128.9	129.2	129.9	130.4	131.6	132.7	133.5	133.8	133.8	130.7
1989	121.1	121.6	122.3	123.1	123.8	124.1	124.4	124.6	125	125.6	125.9	126.1	124
1988	115.7	116	116.5	117.1	117.5	118	118.5	119	119.8	120.2	120.3	120.5	118.3
1987	111.2	111.6	112.1	112.7	113.1	113.5	113.8	114.4	115	115.3	115.4	115.4	113.6
1986	109.6	109.3	108.8	108.6	108.9	109.5	109.5	109.7	110.2	110.3	110.4	110.5	109.6
1985	105.5	106	106.4	106.9	107.3	107.6	107.8	108	108.3	108.7	109	109.3	107.6
1984	101.9	102.4	102.6	103.1	103.4	103.7	104.1	104.5	105	105.3	105.3	105.3	103.9
1983	97.8	97.9	97.9	98.6	99.2	99.5	99.9	100.2	100.7	101	101.2	101.3	99.6
1982	94.3	94.6	94.5	94.9	95.8	97	97.5	97.7	97.9	98.2	98	97.6	96.5
1981	87	87.9	88.5	89.1	89.8	90.6	91.6	92.3	93.2	93.4	93.7	94	90.9
1980	77.8	78.9	80.1	81	81.8	82.7	82.7	83.3	84	84.8	85.5	86.3	82.4
1979	68.3	69.1	69.8	70.6	71.5	72.3	73.1	73.8	74.6	75.2	75.9	76.7	72.6
1978	62.5	62.9	63.4	63.9	64.5	65.2	65.7	66	66.5	67.1	67.4	67.7	65.2
1977	58.5	59.1	59.5	60	60.3	60.7	61	61.2	61.4	61.6	61.9	62.1	60.6
1976	55.6	55.8	55.9	56.1	56.5	56.8	57.1	57.4	57.6	57.9	58	58.2	56.9
1975	52.1	52.5	52.7	52.9	53.2	53.6	54.2	54.3	54.6	54.9	55.3	55.5	53.8
1974	46.6	47.2	47.8	48	48.6	49	49.4	50	50.6	51.1	51.5	51.9	49.3
1973	42.6	42.9	43.3	43.6	43.9	44.2	44.3	45.1	45.2	45.6	45.9	46.2	44.4
1972	41.1	41.3	41.4	41.5	41.6	41.7	41.9	42	42.1	42.3	42.4	42.5	41.8
1971	39.8	39.9	40	40.1	40.3	40.6	40.7	40.8	40.8	40.9	40.9	41.1	40.5
1970	37.8	38	38.2	38.5	38.6	38.8	39	39	39.2	39.4	39.6	39.8	38.8
1969	35.6	35.8	36.1	36.3	36.4	36.6	36.8	37	37.1	37.3	37.5	37.7	36.7
1968	34.1	34.2	34.3	34.4	34.5	34.7	34.9	35	35.1	35.3	35.4	35.5	34.8
1967	32.9	32.9	33	33.1	33.2	33.3	33.4	33.5	33.6	33.7	33.8	33.9	33.4
1966	31.8	32	32.1	32.3	32.3	32.4	32.5	32.7	32.7	32.9	32.9	32.9	32.4
1965	31.2	31.2	31.3	31.4	31.4	31.6	31.6	31.6	31.6	31.7	31.7	31.8	31.5
1964	30.9	30.9	30.9	30.9	30.9	31	31.1	31	31.1	31.1	31.2	31.2	31
1963	30.4	30.4	30.5	30.5	30.5	30.6	30.7	30.7	30.7	30.8	30.8	30.9	30.6
1962	30	30.1	30.1	30.2	30.2	30.2	30.3	30.3	30.4	30.4	30.4	30.4	30.2
1961	29.8	29.8	29.8	29.8	29.8	29.8	30	29.9	30	30	30	30	29.9
1960	29.3	29.4	29.4	29.5	29.5	29.6	29.6	29.6	29.6	29.8	29.8	29.8	29.6
1959	29	28.9	28.9	29	29	29.1	29.2	29.2	29.3	29.4	29.4	29.4	29.1
1958	28.6	28.6	28.8	28.9	28.9	28.9	29	28.9	28.9	28.9	29	28.9	28.9
1957	27.6	27.7	27.8	27.9	28	28.1	28.3	28.3	28.3	28.3	28.4	28.4	28.1
1956	26.8	26.8	26.8	26.9	27	27.2	27.4	27.3	27.4	27.5	27.5	27.6	27.2
1955	26.7	26.7	26.7	26.7	26.7	26.7	26.8	26.8	26.9	26.9	26.9	26.8	26.8
1954	26.9	26.9	26.9	26.8	26.9	26.9	26.9	26.9	26.8	26.8	26.8	26.7	26.9
1953	26.6	26.5	26.6	26.6	26.7	26.8	26.8	26.9	26.9	27	26.9	26.9	26.7
1952	26.5	26.3	26.3	26.4	26.4	26.5	26.7	26.7	26.7	26.7	26.7	26.7	26.5
1951	25.4	25.7	25.8	25.8	25.9	25.9	25.9	25.9	26.1	26.2	26.4	26.5	26
1950	23.5	23.5	23.6	23.6	23.7	23.8	24.1	24.3	24.4	24.6	24.7	25	24.1
1949	24	23.8	23.8	23.9	23.8	23.9	23.7	23.8	23.9	23.7	23.8	23.6	23.8
1948	23.7	23.5	23.4	23.8	23.9	24.1	24.4	24.5	24.5	24.4	24.2	24.1	24.1
1947	21.5	21.5	21.9	21.9	21.9	22	22.2	22.5	23	23	23.1	23.4	22.3
1946	18.2	18.1	18.3	18.4	18.5	18.7	19.8	20.2	20.4	20.8	21.3	21.5	19.5
1945	17.8	17.8	17.8	17.8	17.9	18.1	18.1	18.1	18.1	18.1	18.1	18.2	18
1944	17.4	17.4	17.4	17.5	17.5	17.6	17.7	17.7	17.7	17.7	17.7	17.8	17.6
1943	16.9	16.9	17.2	17.4	17.5	17.5	17.4	17.3	17.4	17.4	17.4	17.4	17.3
1942	15.7	15.8	16	16.1	16.3	16.3	16.4	16.5	16.5	16.7	16.8	16.9	16.3
1941	14.1	14.1	14.2	14.3	14.4	14.7	14.7	14.9	15.1	15.3	15.4	15.5	14.7
1940	13.9	14	14	14	14	14.1	14	14	14	14	14	14.1	14
1939	14	13.9	13.9	13.8	13.8	13.8	13.8	13.8	14.1	14	14	14	13.9
1938	14.2	14.1	14.1	14.2	14.1	14.1	14.1	14.1	14.1	14	14	14	14.1
1937	14.1	14.1	14.2	14.3	14.4	14.4	14.5	14.5	14.6	14.6	14.5	14.4	14.4
1936	13.8	13.8	13.7	13.7	13.7	13.8	13.9	14	14	14	14	14	13.9
1935	13.6	13.7	13.7	13.8	13.8	13.7	13.7	13.7	13.7	13.7	13.8	13.8	13.7
1934	13.2	13.3	13.3	13.3	13.3	13.4	13.4	13.4	13.6	13.5	13.5	13.4	13.4
1933	12.9	12.7	12.6	12.6	12.6	12.7	13.1	13.2	13.2	13.2	13.2	13.2	13
1932	14.3	14.1	14	13.9	13.7	13.6	13.6	13.5	13.4	13.3	13.2	13.1	13.7
1931	15.9	15.7	15.6	15.5	15.3	15.1	15.1	15.1	15	14.9	14.7	14.6	15.2
1930	17.1	17	16.9	17	16.9	16.8	16.6	16.5	16.6	16.5	16.4	16.1	16.7
1929	17.1	17.1	17	16.9	17	17.1	17.3	17.3	17.3	17.3	17.3	17.2	17.1
1928	17.3	17.1	17.1	17.1	17.2	17.1	17.1	17.1	17.3	17.2	17.2	17.1	17.1
1927	17.5	17.4	17.3	17.3	17.4	17.6	17.3	17.2	17.3	17.4	17.3	17.3	17.4
1926	17.9	17.9	17.8	17.9	17.8	17.7	17.5	17.4	17.5	17.6	17.7	17.7	17.7
1925	17.3	17.2	17.3	17.2	17.3	17.5	17.7	17.7	17.7	17.7	18	17.9	17.5
1924	17.3	17.2	17.1	17	17	17	17.1	17	17.1	17.2	17.2	17.3	17.1
1923	16.8	16.8	16.8	16.9	16.9	17	17.2	17.1	17.2	17.3	17.3	17.3	17.1
1922	16.9	16.9	16.7	16.7	16.7	16.7	16.8	16.6	16.6	16.7	16.8	16.9	16.8
1921	19	18.4	18.3	18.1	17.7	17.6	17.7	17.7	17.5	17.5	17.4	17.3	17.9
1920	19.3	19.5	19.7	20.3	20.6	20.9	20.8	20.3	20	19.9	19.8	19.4	20
1919	16.5	16.2	16.4	16.7	16.9	16.9	17.4	17.7	17.8	18.1	18.5	18.9	17.3
1918	14	14.1	14	14.2	14.5	14.7	15.1	15.4	15.7	16	16.3	16.5	15.1
1917	11.7	12	12	12.6	12.8	13	12.8	13	13.3	13.5	13.5	13.7	12.8
1916	10.4	10.4	10.5	10.6	10.7	10.8	10.8	10.9	11.1	11.3	11.5	11.6	10.9
1915	10.1	10	9.9	10	10.1	10.1	10.1	10.1	10.1	10.2	10.3	10.3	10.1
1914	10	9.9	9.9	9.8	9.9	9.9	10	10.2	10.2	10.1	10.2	10.1	10
1913	9.8	9.8	9.8	9.8	9.7	9.8	9.9	9.9	10	10	10.1	10	9.9

d3-jetpack.js

(function() {
        
    function jetpack(d3) {
        d3.selection.prototype.translate = function(xy) {
            return this.attr('transform', function(d,i) {
                return 'translate('+[typeof xy == 'function' ? xy(d,i) : xy]+')';
            });
        };

        d3.transition.prototype.translate = function(xy) {
            return this.attr('transform', function(d,i) {
                return 'translate('+[typeof xy == 'function' ? xy(d,i) : xy]+')';
            });
        };

        d3.selection.prototype.tspans = function(lines, lh) {
            return this.selectAll('tspan')
                .data(lines)
                .enter()
                .append('tspan')
                .text(function(d) { return d; })
                .attr('x', 0)
                .attr('dy', function(d,i) { return i ? lh || 15 : 0; });
        };

        d3.selection.prototype.append = 
        d3.selection.enter.prototype.append = function(name) {
            var n = d3_parse_attributes(name), s;
            //console.log(name, n);
            name = n.attr ? n.tag : name;
            name = d3_selection_creator(name);
            s = this.select(function() {
                return this.appendChild(name.apply(this, arguments));
            });
            return n.attr ? s.attr(n.attr) : s;
        };

        d3.selection.prototype.insert = 
        d3.selection.enter.prototype.insert = function(name, before) {
            var n = d3_parse_attributes(name), s;
            name = n.attr ? n.tag : name;
            name = d3_selection_creator(name);
            before = d3_selection_selector(before);
            s = this.select(function() {
                return this.insertBefore(name.apply(this, arguments), before.apply(this, arguments) || null);
            });
            return n.attr ? s.attr(n.attr) : s;
        };

        var d3_parse_attributes_regex = /([\.#])/g;

        function d3_parse_attributes(name) {
            if (typeof name === "string") {
                var attr = {},
                    parts = name.split(d3_parse_attributes_regex), p;
                    name = parts.shift();
                while ((p = parts.shift())) {
                    if (p == '.') attr['class'] = attr['class'] ? attr['class'] + ' ' + parts.shift() : parts.shift();
                    else if (p == '#') attr.id = parts.shift();
                }
                return attr.id || attr['class'] ? { tag: name, attr: attr } : name;
            }
            return name;
        }

        function d3_selection_creator(name) {
            return typeof name === "function" ? name : (name = d3.ns.qualify(name)).local ? function() {
                return this.ownerDocument.createElementNS(name.space, name.local);
            } : function() {
                return this.ownerDocument.createElementNS(this.namespaceURI, name);
            };
        }

        function d3_selection_selector(selector) {
            return typeof selector === "function" ? selector : function() {
                return this.querySelector(selector);
            };
        }

        d3.wordwrap = function(line, maxCharactersPerLine) {
            var w = line.split(' '),
                lines = [],
                words = [],
                maxChars = maxCharactersPerLine || 40,
                l = 0;
            w.forEach(function(d) {
                if (l+d.length > maxChars) {
                    lines.push(words.join(' '));
                    words.length = 0;
                    l = 0;
                }
                l += d.length;
                words.push(d);
            });
            if (words.length) {
                lines.push(words.join(' '));
            }
            return lines;
        };
        
        d3.ascendingKey = function(key) {
            return typeof key == 'function' ? function (a, b) {
                  return key(a) < key(b) ? -1 : key(a) > key(b) ? 1 : key(a) >= key(b) ? 0 : NaN;
            } : function (a, b) {
                  return a[key] < b[key] ? -1 : a[key] > b[key] ? 1 : a[key] >= b[key] ? 0 : NaN;
            };
        };

        d3.descendingKey = function(key) {
            return typeof key == 'function' ? function (a, b) {
                return key(b) < key(a) ? -1 : key(b) > key(a) ? 1 : key(b) >= key(a) ? 0 : NaN;
            } : function (a, b) {
                return b[key] < a[key] ? -1 : b[key] > a[key] ? 1 : b[key] >= a[key] ? 0 : NaN;
            };
        };
        
        d3.f = function(){
            var functions = arguments;
            //convert all string arguments into field accessors
            var i = 0, l = functions.length;
            while (i < l) {
                if (typeof(functions[i]) === 'string' || typeof(functions[i]) === 'number'){
                    functions[i] = (function(str){ return function(d){ return d[str] }; })(functions[i])
                }
                i++;
            }
             //return composition of functions
            return function(d) {
                var i=0, l = functions.length;
                while (i++ < l) d = functions[i-1].call(this, d);
                return d;
            };
        };
        // store d3.f as convenient unicode character function (alt-f on macs)
        if (!window.hasOwnProperty('ƒ')) window.ƒ = d3.f;
        
        // this tweak allows setting a listener for multiple events, jquery style
        var d3_selection_on = d3.selection.prototype.on;
        d3.selection.prototype.on = function(type, listener, capture) {
            if (typeof type == 'string' && type.indexOf(' ') > -1) {
                type = type.split(' ');
                for (var i = 0; i<type.length; i++) {
                    d3_selection_on.apply(this, [type[i], listener, capture]);
                }
            } else {
                d3_selection_on.apply(this, [type, listener, capture]);
            }
            return this;
        };
    }

    if (typeof d3 === 'object' && d3.version) jetpack(d3);
    else if (typeof define === 'function' && define.amd) {
        define(['d3'], jetpack);
    }

})();

~$data.xlsx

Information Systems                                   Information Systems                                   `���