Commit 6d6119b4 authored by Sam Calisch's avatar Sam Calisch
Browse files

moved

parents
%% This BibTeX bibliography file was created using BibDesk.
%% http://bibdesk.sourceforge.net/
%% Created for sam calisch at 2017-03-01 15:22:03 -0500
%% Saved with string encoding Unicode (UTF-8)
@book{european2009economics,
Author = {European Wind Energy Association},
Date-Added = {2017-03-01 20:10:33 +0000},
Date-Modified = {2017-03-01 20:10:42 +0000},
Publisher = {EWEA},
Title = {The economics of wind energy},
Url = {http://pineenergy.com/files/pdf/Economics_of_Wind_Main_Report_FINAL_lr.pdf},
Year = {2009}}
@inproceedings{jay2014design,
Author = {Jay, Angelina and Myers, Andrew},
Booktitle = {Structures Congress 2014},
Date-Added = {2017-03-01 18:18:18 +0000},
Date-Modified = {2017-03-01 18:18:35 +0000},
Pages = {1675--1683},
Title = {Design of Conical Steel Wind Turbine Towers Manufactured with Automated Spiral Welding},
Url = {http://nuweb5.neu.edu/atm/wp-content/uploads/2014/04/Jay-et-al_StructuresCongress2014-FINAL.pdf},
Year = {2014}}
@article{koh2016downwind,
Author = {Koh, JH and Ng, EYK},
Date-Added = {2017-03-01 16:31:43 +0000},
Date-Modified = {2017-03-01 16:31:55 +0000},
Journal = {Renewable and Sustainable Energy Reviews},
Pages = {797--808},
Publisher = {Elsevier},
Title = {Downwind offshore wind turbines: Opportunities, trends and technical challenges},
Url = {http://www.sciencedirect.com/science/article/pii/S1364032115011752},
Volume = {54},
Year = {2016}}
@article{ichter2015morphing,
Author = {Ichter, Brian and Steele, Adam and Loth, Eric and Moriarty, Patrick and Selig, Michael},
Date-Added = {2017-03-01 16:24:21 +0000},
Date-Modified = {2017-03-01 16:24:37 +0000},
Journal = {Wind Energy},
Publisher = {Wiley Online Library},
Title = {A morphing downwind-aligned rotor concept based on a 13-MW wind turbine},
Url = {http://onlinelibrary.wiley.com/store/10.1002/we.1855/asset/we1855.pdf?v=1&t=izr5udgb&s=4def5ab08f1a17cb1f75ed62a28b4c60a79f638c},
Year = {2015}}
@article{ning2016integrated,
Author = {Ning, Andrew and Petch, Derek},
Date-Added = {2017-03-01 16:22:23 +0000},
Date-Modified = {2017-03-01 16:22:47 +0000},
Journal = {Wind Energy},
Publisher = {Wiley Online Library},
Title = {Integrated design of downwind land-based wind turbines using analytic gradients},
Url = {http://onlinelibrary.wiley.com/doi/10.1002/we.1972/pdf},
Year = {2016}}
@inproceedings{loth2012segmented,
Author = {Loth, Eric and Steele, Adam and Ichter, Brian and Selig, Michael and Moriarty, Patrick},
Booktitle = {50th AIAA Aerospace Sciences Meeting including the New Horizons Forum and Aerospace Exposition},
Date-Added = {2017-03-01 16:09:40 +0000},
Date-Modified = {2017-03-01 16:09:57 +0000},
Pages = {1290},
Title = {Segmented ultralight pre-aligned rotor for extreme-scale wind turbines},
Url = {http://arc.aiaa.org/doi/pdf/10.2514/6.2012-1290},
Year = {2012}}
@article{spitzley2006life,
Author = {Spitzley, David V and Dietz, Bernhard A and Keoleian, Gregory A},
Date-Added = {2017-02-28 20:08:56 +0000},
Date-Modified = {2017-02-28 20:09:06 +0000},
Journal = {Ann Arbor},
Publisher = {Citeseer},
Title = {Life-Cycle Assessment of Office Furniture Products},
Url = {http://css.snre.umich.edu/sites/default/files/css_doc/CSS05-08.pdf},
Year = {2006}}
@article{allwood2015well,
Author = {Allwood, Julian M and Laursen, Soren Ellebaek and de Rodriguez, Cecilia Malvido and Bocken, Nancy MP and others},
Date-Added = {2017-02-28 19:00:54 +0000},
Date-Modified = {2017-02-28 19:01:06 +0000},
Journal = {Journal of the Home Economics Institute of Australia},
Number = {1},
Pages = {42},
Publisher = {Home Economics Institute of Australia},
Title = {Well dressed?: The present and future sustainability of clothing and textiles in the United Kingdom},
Url = {http://www.ifm.eng.cam.ac.uk/uploads/Resources/Other_Reports/UK_textiles.pdf},
Volume = {22},
Year = {2015}}
@techreport{stripple2001life,
Author = {Stripple, H},
Date-Added = {2017-02-28 18:23:00 +0000},
Date-Modified = {2017-02-28 18:46:26 +0000},
Institution = {IVL Swedish Environmental Research Institute},
Title = {Life cycle assessment of road. A pilot study for inventory analysis. IVL report B 1210 E, Gothenburg, Sweden},
Url = {http://www.ivl.se/download/18.343dc99d14e8bb0f58b734e/1445515385608/B1210E.pdf},
Year = {2001},
Bdsk-Url-1 = {http://www.ivl.se/download/18.343dc99d14e8bb0f58b734e/1445515385608/B1210E.pdf}}
@article{muench2010roadway,
Author = {Muench, Stephen},
Date-Added = {2017-02-28 18:12:29 +0000},
Date-Modified = {2017-02-28 18:23:13 +0000},
Journal = {Transportation Research Record: Journal of the Transportation Research Board},
Number = {2151},
Pages = {36--45},
Publisher = {Transportation Research Board of the National Academies},
Title = {Roadway construction sustainability impacts: review of life-cycle assessments},
Url = {http://courses.washington.edu/cee500e/Files/Muench--final%20article.pdf},
Year = {2010},
Bdsk-Url-1 = {http://courses.washington.edu/cee500e/Files/Muench--final%20article.pdf}}
@book{international2016key,
Author = {International Energy Agency},
Date-Added = {2017-02-15 20:39:12 +0000},
Date-Modified = {2017-02-15 20:39:36 +0000},
Publisher = {International Energy Agency},
Title = {Key world energy statistics},
Url = {https://www.iea.org/publications/freepublications/publication/KeyWorld2016.pdf},
Year = {2016},
Bdsk-Url-1 = {https://www.iea.org/publications/freepublications/publication/KeyWorld2016.pdf}}
@techreport{ibis2010global,
Author = {IBISWorld, Inc.},
Date-Added = {2017-02-15 20:25:51 +0000},
Date-Modified = {2017-02-15 20:27:56 +0000},
Institution = {IBISWorld, Inc.},
Title = {IBISWorld Industry Report: Global Footwear Manufacturing: C1321-GL},
Url = {http://www.just-style.com/store/samples/2010_IBISWorld%20Global%20Style%20Sample%20Industry%20Report.pdf},
Year = {2010},
Bdsk-Url-1 = {http://www.just-style.com/store/samples/2010_IBISWorld%20Global%20Style%20Sample%20Industry%20Report.pdf}}
@techreport{tpi2003cost,
Author = {TPI Composites},
Date-Added = {2017-02-14 15:48:36 +0000},
Date-Modified = {2017-02-14 15:49:53 +0000},
Institution = {Sandia National Labs., Albuquerque, NM (US); Sandia National Labs., Livermore, CA (US)},
Title = {Cost Study for Large Wind Turbine Blades: WindPACT Blade System Design Studies},
Url = {http://windpower.sandia.gov/other/031428.pdf},
Year = {2003},
Bdsk-Url-1 = {https://www.osti.gov/scitech/biblio/801402}}
@techreport{ashwill2002parametric,
Author = {ASHWILL, THOMAS D},
Date-Added = {2017-02-14 15:39:52 +0000},
Date-Modified = {2017-02-14 15:46:42 +0000},
Institution = {Sandia National Labs., Albuquerque, NM (US); Sandia National Labs., Livermore, CA (US)},
Title = {Parametric Study for Large Wind Turbine Blades: WindPACT Blade System Design Studies},
Url = {https://www.osti.gov/scitech/biblio/801402},
Year = {2002},
Bdsk-Url-1 = {https://www.osti.gov/scitech/biblio/801402}}
@article{Puca2017124,
Author = {Antonio Puca and Marco Carrano and Gengyuan Liu and Dimitri Musella and Maddalena Ripa and Silvio Viglia and Sergio Ulgiati},
Date-Added = {2017-02-13 20:36:53 +0000},
Date-Modified = {2017-02-13 20:36:53 +0000},
Doi = {http://dx.doi.org/10.1016/j.resconrec.2016.09.030},
Issn = {0921-3449},
Journal = {Resources, Conservation and Recycling},
Pages = {124 - 136},
Title = {Energy and eMergy assessment of the production and operation of a personal computer},
Url = {http://www.sciencedirect.com/science/article/pii/S0921344916302786},
Volume = {116},
Year = {2017},
Bdsk-Url-1 = {http://www.sciencedirect.com/science/article/pii/S0921344916302786},
Bdsk-Url-2 = {http://dx.doi.org/10.1016/j.resconrec.2016.09.030}}
@article{White2006,
Abstract = {This paper updates a life-cycle net energy analysis and carbon dioxide emissions analysis of three Midwestern utility-scale wind systems. Both the Energy Payback Ratio (EPR) and CO2 analysis results provide useful data for policy discussions regarding an efficient and low-carbon energy mix. The EPR is the amount of electrical energy produced for the lifetime of the power plant divided by the total amount of energy required to procure and transport the materials, build, operate, and decommission the power plants. The CO2 analysis for each power plant was calculated from the life-cycle energy input data.},
Author = {White, Scott W.},
Date-Added = {2016-06-29 18:55:36 +0000},
Date-Modified = {2016-06-29 18:55:36 +0000},
Doi = {10.1007/s11053-007-9024-y},
Issn = {1573-8981},
Journal = {Natural Resources Research},
Number = {4},
Pages = {271--281},
Title = {Net Energy Payback and CO2 Emissions from Three Midwestern Wind Farms: An Update},
Url = {http://dx.doi.org/10.1007/s11053-007-9024-y},
Volume = {15},
Year = {2006},
Bdsk-Url-1 = {http://dx.doi.org/10.1007/s11053-007-9024-y}}
@article{haapala2014comparative,
Author = {Haapala, Karl R and Prempreeda, Preedanood},
Date-Added = {2016-06-29 18:08:52 +0000},
Date-Modified = {2016-06-29 18:09:40 +0000},
Journal = {International Journal of Sustainable Manufacturing},
Number = {2},
Pages = {170--185},
Publisher = {Inderscience Publishers Ltd},
Title = {Comparative life cycle assessment of 2.0 MW wind turbines},
Url = {http://www.ourenergypolicy.org/wp-content/uploads/2014/06/turbines.pdf},
Volume = {3},
Year = {2014},
Bdsk-Url-1 = {http://www.ourenergypolicy.org/wp-content/uploads/2014/06/turbines.pdf}}
@article{dot2015national,
Author = {DOT, US},
Date-Added = {2016-06-29 18:04:43 +0000},
Date-Modified = {2016-06-29 18:05:19 +0000},
Journal = {Bureau of Transportation Statistics, Washington, DC},
Title = {National transportation statistics},
Url = {http://www.rita.dot.gov/bts/sites/rita.dot.gov.bts/files/publications/national_transportation_statistics/index.html#chapter_4},
Year = {2015},
Bdsk-Url-1 = {http://www.rita.dot.gov/bts/sites/rita.dot.gov.bts/files/publications/national_transportation_statistics/index.html#chapter_4}}
@article{davis2015transportation,
Author = {Davis, Stacy C and Diegel, Susan W and Boundy, Robert G},
Date-Added = {2016-06-29 18:02:22 +0000},
Date-Modified = {2016-06-29 18:02:49 +0000},
Number = {34},
Title = {Transportation energy data book},
Url = {http://cta.ornl.gov/data/index.shtml},
Year = {2015},
Bdsk-Url-1 = {http://cta.ornl.gov/data/index.shtml}}
@article{krohn1997energy,
Author = {Krohn, Soren},
Date-Added = {2016-06-29 15:03:17 +0000},
Date-Modified = {2016-06-29 15:03:32 +0000},
Journal = {Wind power note},
Pages = {1--16},
Title = {The energy balance of modern wind turbines},
Url = {http://www.olino.org/wp-content/uploads/2009/07/the_energy_balance_of_modern_wind_turbines_1997.pdf},
Volume = {16},
Year = {1997},
Bdsk-Url-1 = {http://www.olino.org/wp-content/uploads/2009/07/the_energy_balance_of_modern_wind_turbines_1997.pdf}}
@article{crawford2007life,
Author = {Crawford, RA},
Date-Added = {2016-06-28 22:15:06 +0000},
Date-Modified = {2016-06-28 22:15:25 +0000},
Journal = {Energy and Sustainability},
Pages = {155},
Publisher = {Transactions of the Wessex Institute, Ecology and the Environment (WIT Press, Wessex, UK, 2007)},
Title = {Life-Cycle Energy Analysis of Wind Turbines---An Assessment of the Effect of Size on Energy Yield},
Url = {http://www.witpress.com/Secure/elibrary/papers/ESUS07/ESUS07016FU1.pdf},
Volume = {105},
Year = {2007},
Bdsk-Url-1 = {http://www.witpress.com/Secure/elibrary/papers/ESUS07/ESUS07016FU1.pdf}}
@article{geoff2011inventory,
Author = {Geoff, Hammond and Jones, C},
Date-Added = {2016-06-28 21:04:31 +0000},
Date-Modified = {2016-06-28 21:04:51 +0000},
Journal = {Sustainable Energy Research Team (SERT) Department of Mechanical Engineering},
Title = {Inventory of carbon \& energy (ICE), Version 2.0},
Url = {http://www.circularecology.com/embodied-energy-and-carbon-footprint-database.html#.V3LmcDkrKCQ},
Year = {2011},
Bdsk-Url-1 = {http://www.circularecology.com/embodied-energy-and-carbon-footprint-database.html#.V3LmcDkrKCQ}}
@book{mackay2008sustainable,
Author = {MacKay, David},
Date-Added = {2016-06-28 20:14:57 +0000},
Date-Modified = {2016-06-28 20:15:20 +0000},
Publisher = {UIT Cambridge},
Title = {Sustainable Energy-without the hot air},
Url = {https://www.withouthotair.com},
Year = {2008},
Bdsk-Url-1 = {https://www.withouthotair.com}}
@article{cullen2009role,
Author = {Cullen, Jonathan M and Allwood, Julian M},
Date-Added = {2016-06-28 19:50:58 +0000},
Date-Modified = {2016-06-28 19:59:05 +0000},
Journal = {Journal of Industrial Ecology},
Number = {1},
Pages = {27--37},
Publisher = {Wiley Online Library},
Title = {The role of washing machines in life cycle assessment studies},
Url = {http://onlinelibrary.wiley.com/doi/10.1111/j.1530-9290.2009.00107.x/full},
Volume = {13},
Year = {2009},
Bdsk-Url-1 = {http://onlinelibrary.wiley.com/doi/10.1111/j.1530-9290.2009.00107.x/full}}
@book{allwood2012sustainable,
Author = {Allwood, Julian M and Cullen, Jonathan M and Carruth, Mark A and Cooper, Daniel R and McBrien, Martin and Milford, Rachel L and Moynihan, Muiris C and Patel, Alexandra CH},
Date-Added = {2016-06-27 21:50:01 +0000},
Date-Modified = {2016-06-27 21:50:24 +0000},
Publisher = {Citeseer},
Title = {Sustainable materials: with both eyes open},
Url = {http://www.withbotheyesopen.com/},
Year = {2012},
Bdsk-Url-1 = {http://www.withbotheyesopen.com/}}
@book{wilburn2011wind,
Author = {Wilburn, David R},
Date-Added = {2016-06-27 21:16:05 +0000},
Date-Modified = {2016-06-27 21:47:46 +0000},
Publisher = {US Department of the Interior, US Geological Survey},
Title = {Wind energy in the United States and materials required for the land-based wind turbine industry from 2010 through 2030},
Url = {http://pubs.usgs.gov/sir/2011/5036/sir2011-5036.pdf},
Year = {2011},
Bdsk-Url-1 = {http://pubs.usgs.gov/sir/2011/5036/sir2011-5036.pdf}}
@article{kubiszewski2010meta,
Author = {Kubiszewski, Ida and Cleveland, Cutler J and Endres, Peter K},
Date-Added = {2016-06-27 21:15:08 +0000},
Date-Modified = {2016-06-29 15:43:53 +0000},
Journal = {Renewable energy},
Number = {1},
Pages = {218--225},
Publisher = {Elsevier},
Title = {Meta-analysis of net energy return for wind power systems},
Url = {http://www.sciencedirect.com/science/article/pii/S096014810900055X},
Volume = {35},
Year = {2010},
Bdsk-Url-1 = {http://www.sciencedirect.com/science/article/pii/S096014810900055X}}
@article{ancona2001wind,
Author = {Ancona, Dan and McVeigh, Jim},
Date-Added = {2016-06-27 21:13:14 +0000},
Date-Modified = {2016-06-27 21:13:14 +0000},
Journal = {Princeton Energy Resources International, LLC},
Title = {Wind turbine-materials and manufacturing fact sheet},
Volume = {19},
Year = {2001}}
@article{Lenzen2002339,
Author = {Manfred Lenzen and Jesper Munksgaard},
Date-Added = {2016-06-27 14:42:22 +0000},
Date-Modified = {2016-06-27 14:48:18 +0000},
Issn = {0960-1481},
Journal = {Renewable Energy},
Keywords = {Life-cycle assessment},
Number = {3},
Pages = {339 - 362},
Title = {Energy and CO2 life-cycle analyses of wind turbines---review and applications},
Url = {http://www.sciencedirect.com/science/article/pii/S0960148101001458},
Volume = {26},
Year = {2002},
Bdsk-Url-1 = {http://www.sciencedirect.com/science/article/pii/S0960148101001458}}
@article{Cheah201318,
Author = {Lynette Cheah and Natalia Duque Ciceri and Elsa Olivetti and Seiko Matsumura and Dai Forterre and Richard Roth and Randolph Kirchain},
Date-Added = {2016-06-27 13:45:28 +0000},
Date-Modified = {2016-06-27 14:45:41 +0000},
Issn = {0959-6526},
Journal = {Journal of Cleaner Production},
Keywords = {Carbon footprint},
Pages = {18 - 29},
Title = {Manufacturing-focused emissions reductions in footwear production},
Url = {http://www.sciencedirect.com/science/article/pii/S0959652612006300},
Volume = {44},
Year = {2013},
Bdsk-Url-1 = {http://www.sciencedirect.com/science/article/pii/S0959652612006300}}
<html lang="en">
<head>
<title>energy</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style/main.css">
<link rel="stylesheet" type="text/css" href="style/ternary.css">
<script type='text/javascript' src='js/jquery-3.0.0.min.js'></script>
<script type='text/javascript' src='js/mustache.min.js'></script>
<script type='text/javascript' src='js/parse-bibtex.js'></script>
<script type='text/javascript' src='js/parse_citations.js'></script>
</head>
<body>
<script charset="UTF-8" src="js/d3.min.js"></script>
<script charset="UTF-8" src="js/ternary.js"></script>
<div id="plot" style='text-align:center;'></div>
<div id='define'>
<p><span id='word'> Materials energy: </span>
<span id='definition'>Energy required to bring raw materials from reference state (earth’s crust) to start of product-specific manufacturing.</span></p>
</div>
<div id='define'>
<p><span id='word'> Manufacturing energy: </span>
<span id='definition'>Energy for product specific industrial production. This includes transporting parts to end use location and installation/distribution at end use location.</span></p>
</div>
<div id='define'>
<p><span id='word'>End use energy:</span>
<span id='definition'>Energy required to utilize the service provided by the product. This includes active use power, maintenance, and disposal.</span></p>
</div>
<h2>Studies</h2>
<ul id='studies'></ul>
<h2>References</h2>
<div id="bib"></div>
<script type='text/javascript'>make_all_citations('energy.bib');</script>
<script >
var plot_opts = {
side: 550,
height:580,
margin: {top:40,left:150,bottom:20,right:150},
axis_labels:['Materials Energy','Manufacturing Energy','End Use Energy',],
axis_ticks:d3.range(0, 101, 20),
minor_axis_ticks:d3.range(0, 101, 5)
}
var tp = ternaryPlot( '#plot', plot_opts );
$.getJSON("results.json", function(studies){
var d = []
var studylist = document.getElementById("studies");
for(var key in studies){
//build data for d3
os = studies[key]['label_offset'] ? studies[key]['label_offset'] : [0,0];
d.push({
materials_energy:studies[key]['materials_energy'],
manufacturing_energy:studies[key]['manufacturing_energy'],
use_energy:studies[key]['use_energy'],
label:key,
url:studies[key]['url'],
offset: os
});
//build list of links to studies
var entry = document.createElement("li");
var template = "<a href={{url}}>"+key+"</a>";
entry.innerHTML = Mustache.to_html(template,studies[key]);
studylist.appendChild(entry);
}
tp.data(d, function(d){ return [d.materials_energy, d.manufacturing_energy, d.use_energy, d.label, d.url, d.offset]}, 'label');
});
//TODO: Build a full bibliography here
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
//curve fitting routines
//requires math.js
function linear_least_squares(phis,xs,ys){
//return beta_j that minimizes sum_i(f(x_i)-y_i)**2 where f=sum_j beta_j phi_j
//see https://en.wikipedia.org/wiki/Least_squares
//first evaluate basis functions at data points
var X = [];
for(var i=0; i<xs.length; i++){
var X_i = [];
for(var j=0; j<phis.length; j++){
X_i.push( phis[j](xs[i]) );
}
X.push(X_i);
}
//then solve linear system
return math.lusolve( math.multiply( math.transpose(X), X ), math.multiply( math.transpose(X), ys ));
}
function linear_fit(xs,ys){
// f = beta[0]*x + beta[1]
return linear_least_squares([function(x){return x;}, function(x){return 1;}],xs,ys);
}
function homogeneous_quadratic_fit(xs,ys){
// f = beta[0] * x^2
return linear_least_squares([function(x){return x*x;}],xs,ys);
}
function exponential_fit(xs,ys){
//f = beta[0] * e^(beta[1]*x)
var beta = linear_least_squares([function(x){return 1;}, function(x){return x;} ], xs, ys.map(Math.log));
beta[0] = Math.exp(beta[0]);
return beta
}
function power_fit(xs,ys){
//f = beta[0] * x ^ beta[1]
var beta = linear_least_squares([function(x){return 1;}, function(x){return Math.log(x);} ], xs, ys.map(Math.log) );
beta[0] = Math.exp(beta[0]);
return beta;
}
// d3.legend.js
// (C) 2012 ziggy.jonsson.nyc@gmail.com
// MIT licence
(function() {
d3.legend = function(g) {
g.each(function() {
var g= d3.select(this),
items = {},
svg = d3.select(g.property("nearestViewportElement")),
legendPadding = g.attr("data-style-padding") || 5,
lb = g.selectAll(".legend-box").data([true]),
li = g.selectAll(".legend-items").data([true])
lb.enter().append("rect").classed("legend-box",true)
li.enter().append("g").classed("legend-items",true)
svg.selectAll("[data-legend]").each(function() {
var self = d3.select(this)
items[self.attr("data-legend")] = {
pos : self.attr("data-legend-pos") || this.getBBox().y,
color : self.attr("data-legend-color") != undefined ? self.attr("data-legend-color") : self.style("fill") != 'none' ? self.style("fill") : self.style("stroke")
}
})
items = d3.entries(items).sort(function(a,b) { return a.value.pos-b.value.pos})
li.selectAll("text")
.data(items,function(d) { return d.key})
.call(function(d) { d.enter().append("text")})
.call(function(d) { d.exit().remove()})
.attr("y",function(d,i) { return i+"em"})
.attr("x","1em")
.text(function(d) { ;return d.key})
li.selectAll("circle")
.data(items,function(d) { return d.key})
.call(function(d) { d.enter().append("circle")})
.call(function(d) { d.exit().remove()})
.attr("cy",function(d,i) { return i-0.25+"em"})
.attr("cx",0)
.attr("r","0.4em")
.style("fill",function(d) { return d.value.color})
// Reposition and resize the box
var lbbox = li[0][0].getBBox()
lb.attr("x",(lbbox.x-legendPadding))
.attr("y",(lbbox.y-legendPadding))
.attr("height",(lbbox.height+2*legendPadding))
.attr("width",(lbbox.width+2*legendPadding))
})
return g
}
})()
\ No newline at end of file
//make a stacked line graph from data
//following chart API, except using selection as input: https://bost.ocks.org/mike/chart/
function lineGraph() {
var width = 600, // default width
height = 400, // default height
margin = {top: 30, right: 20, bottom: 30, left: 50},
color = d3.scale.ordinal().range(["#98abc5", "#8a89a6", "#7b6888", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]),
xaxislabel = '',
yaxislabel = '',
offset = 'zero',
selection_string = '',
legend_font_size="",
title = '',
data = []; //data
function my() {
//create axes
var minyval = 0;//d3.min(data, function(d){return d3.min(_.map(d.values, 'y'));});
var maxyval = d3.max(data, function(d){return d3.max(_.map(d.values, 'y'));});
var minxval = d3.min(data, function(d){return d3.min(_.map(d.values, 'x'));});
var maxxval = d3.max(data, function(d){return d3.max(_.map(d.values, 'x'));});
var x = d3.scale.linear().domain([minxval,maxxval]).range([0, width]);
var y = d3.scale.linear().domain([minyval,maxyval]).range([height, 0]);
var xAxis = d3.svg.axis().scale(x).orient("bottom").ticks(10);
var yAxis = d3.svg.axis().scale(y).orient("left").ticks(10);
var line = d3.svg.line()
.x(function(d) { return x(d.x); })
.y(function(d) { return y(d.y); });
//create svg
var svg = d3.select(selection_string)
.append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.attr("class","graph")
.append("g")
.attr("transform",
"translate(" + margin.left + "," + margin.top + ")");
svg.selectAll("path")
.data(_.map(data, 'values'))
.enter()
.append("path")
.attr("fill","none")
.attr("d", line)
.attr("stroke-width","2px")
.style("stroke", function(d,i) { return color(i); })
.attr("data-legend",function(d,i) { return data[i].name});
//must append axes after binding data.
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")