text: /*
   USAGE (example: line chart)
   1. c+p this template to a new file (line.js)
   2. change puddingChartName to puddingChartLine
   3. in graphic file: import './pudding-chart/line'
   4a. const charts = d3.selectAll('.thing').data(data).puddingChartLine();
   4b. const chart = d3.select('.thing').datum(datum).puddingChartLine();
  */
  
  d3.selection.prototype.puddingChartName = function init(options) {
  	function createChart(el) {
  		const $sel = d3.select(el);
  		let data = $sel.datum();
  		// dimension stuff
  		let width = 0;
  		let height = 0;
  		const marginTop = 0;
  		const marginBottom = 0;
  		const marginLeft = 0;
  		const marginRight = 0;
  
  		// scales
  		const scaleX = null;
  		const scaleY = null;
  
  		// dom elements
  		let $svg = null;
  		let $axis = null;
  		let $vis = null;
  
  		// helper functions
  
  		const Chart = {
  			// called once at start
  			init() {
  				$svg = $sel.append('svg.pudding-chart');
  				const $g = $svg.append('g');
  
  				// offset chart for margins
  				$g.attr('transform', `translate(${marginLeft}, ${marginTop})`);
  
  				// create axis
  				$axis = $svg.append('g.g-axis');
  
  				// setup viz group
  				$vis = $g.append('g.g-vis');
  
  				Chart.resize();
  				Chart.render();
  			},
  			// on resize, update new dimensions
  			resize() {
  				// defaults to grabbing dimensions from container element
  				width = $sel.node().offsetWidth - marginLeft - marginRight;
  				height = $sel.node().offsetHeight - marginTop - marginBottom;
  				$svg
  					.attr('width', width + marginLeft + marginRight)
  					.attr('height', height + marginTop + marginBottom);
  				return Chart;
  			},
  			// update scales and render chart
  			render() {
  				return Chart;
  			},
  			// get / set data
  			data(val) {
  				if (!arguments.length) return data;
  				data = val;
  				$sel.datum(data);
  				Chart.render();
  				return Chart;
  			}
  		};
  		Chart.init();
  
  		return Chart;
  	}
  
  	// create charts
  	const charts = this.nodes().map(createChart);
  	return charts.length > 1 ? charts : charts.pop();
  };
  