<commit_before>/**
 * Hook and build the sankey graph to the page
 * @return {[type]} [description]
 */
function sankeyGraph() {
	var margin = {top: 1, right: 1, bottom: 6, left: 1},
	width = 960 - margin.left - margin.right,
	height = 500 - margin.top - margin.bottom;

	var formatNumber = d3.format(',.0f'),
		format = function(d) { return formatNumber(d) + ' TWh'; },
		color = d3.scale.category20();

	var svg = d3.select('.flow-app')
			.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 + ')')
	;

	var sankey = d3.sankey()
		.nodeWidth(15)
		.nodePadding(10)
		.size([width, height]);

	var path = sankey.link();

}


/**
* Heavily based on Mike Bostocks work: http://bost.ocks.org/mike/leaflet/
* @param  {[type]} window    [description]
* @param  {[type]} document  [description]
* @param  {[type]} L         [description]
* @param  {[type]} undefined [description]
* @return {[type]}           [description]
*/
(function (window, document, L, undefined) {
	'use strict';

	
	// sankeyGraph();


	/* create leaflet map */
	var map = L.map('map', {
		center: [44.8997, -0.8157],
		zoom: 9
	});

	/**
	 * Object to store svg:element property for future use
	 */
	var props = {
		circle: {
			default: 2,
			active: 5
		}
	};


	/**
	 * Map type of centre index to name
	 * @type {Array}
	 */
	var typeCentre = [ 'epci', 'transfert', 'traitement' ];

	/**
	 * 
	 */
	var links = [];

	/* add default stamen tile layer */
	new L.tileLayer('http://{s}.tiles.mapbox.com/v3/examples.map-vyofok3q/{z}/{x}/{y}.png', {
		minZoom: 0,
		maxZoom: 18,
		attribution: 'Map data © <a href="http://www.openstreetmap.org">OpenStreetMap contributors</a>'
	}).addTo(map);
    
	
	var svg			= d3.select(map.getPanes().overlayPane).append('svg'),
		g				= svg.append('g').attr('class', 'leaflet-zoom-hide'),
		defs			= svg.append('defs'),
		marker 			= defs.append('marker')
								.attr('id', 'arw-end')
								.attr('viewBox','0 0 10 10')
								.attr('refX', 10)
								.attr('refY', 5)
								.attr('orient','auto')
							.append('path')
								.attr('d', 'M 0,0 10,5 0,10'),
		markerMid 		= defs.append('marker')
								.attr('id', 'arw-mid')
								.attr('viewBox','0 0 10 10')
								.attr('refY', 0)
								.attr('refY', 5)
								.attr('orient', 'auto')
							.append('path')
								.attr('d', 'M 0,0 10,5 0,10'),
		entities		= g.append('g').attr('id', 'entities'),
		entitiesLabels	= g.append('g').attr('id', 'entities-labels'),
		centres			= g.append('g').attr('id', 'centres'),
		routes			= g.append('g').attr('id', 'routes')
	;

	var path, entity, label, centre;

	d3.json('scripts/gironde-epci.topo.json', function (dataset) {
		var bounds = d3.geo.bounds(topojson.feature(dataset, dataset.objects['gironde-epci.geo']));
		path = d3.geo.path().projection(projectPoint);


		entity = entities.selectAll('.entity')
			.data(topojson.feature(dataset, dataset.objects['gironde-epci.geo']).features)
			.enter()
				.append('path')
				.attr('class', 'entity')
			;
		label = entitiesLabels.selectAll('.entity-label')
			.data(topojson.feature(dataset, dataset.objects['gironde-epci.geo']).features)
			.enter()
				.append('text')
				.attr('class', 'entity-label')
			;

		// Reposition the SVG to cover the features.<commit_msg>refactor(d3): store geoJSON feature into variable<commit_after>/**
 * Hook and build the sankey graph to the page
 * @return {[type]} [description]
 */
function sankeyGraph() {
	var margin = {top: 1, right: 1, bottom: 6, left: 1},
	width = 960 - margin.left - margin.right,
	height = 500 - margin.top - margin.bottom;

	var formatNumber = d3.format(',.0f'),
		format = function(d) { return formatNumber(d) + ' TWh'; },
		color = d3.scale.category20();

	var svg = d3.select('.flow-app')
			.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 + ')')
	;

	var sankey = d3.sankey()
		.nodeWidth(15)
		.nodePadding(10)
		.size([width, height]);

	var path = sankey.link();

}


/**
* Heavily based on Mike Bostocks work: http://bost.ocks.org/mike/leaflet/
* @param  {[type]} window    [description]
* @param  {[type]} document  [description]
* @param  {[type]} L         [description]
* @param  {[type]} undefined [description]
* @return {[type]}           [description]
*/
(function (window, document, L, undefined) {
	'use strict';

	
	// sankeyGraph();


	/* create leaflet map */
	var map = L.map('map', {
		center: [44.8997, -0.8157],
		zoom: 9
	});

	/**
	 * Object to store svg:element property for future use
	 */
	var props = {
		circle: {
			default: 2,
			active: 5
		}
	};


	/**
	 * Map type of centre index to name
	 * @type {Array}
	 */
	var typeCentre = [ 'epci', 'transfert', 'traitement' ];

	/**
	 * 
	 */
	var links = [];

	/* add default stamen tile layer */
	new L.tileLayer('http://{s}.tiles.mapbox.com/v3/examples.map-vyofok3q/{z}/{x}/{y}.png', {
		minZoom: 0,
		maxZoom: 18,
		attribution: 'Map data © <a href="http://www.openstreetmap.org">OpenStreetMap contributors</a>'
	}).addTo(map);
    
	
	var svg			= d3.select(map.getPanes().overlayPane).append('svg'),
		g				= svg.append('g').attr('class', 'leaflet-zoom-hide'),
		defs			= svg.append('defs'),
		marker 			= defs.append('marker')
								.attr('id', 'arw-end')
								.attr('viewBox','0 0 10 10')
								.attr('refX', 10)
								.attr('refY', 5)
								.attr('orient','auto')
							.append('path')
								.attr('d', 'M 0,0 10,5 0,10'),
		markerMid 		= defs.append('marker')
								.attr('id', 'arw-mid')
								.attr('viewBox','0 0 10 10')
								.attr('refY', 0)
								.attr('refY', 5)
								.attr('orient', 'auto')
							.append('path')
								.attr('d', 'M 0,0 10,5 0,10'),
		entities		= g.append('g').attr('id', 'entities'),
		entitiesLabels	= g.append('g').attr('id', 'entities-labels'),
		centres			= g.append('g').attr('id', 'centres'),
		routes			= g.append('g').attr('id', 'routes')
	;

	var path, entity, label, centre;

	d3.json('scripts/gironde-epci.topo.json', function (dataset) {
		var geoData = topojson.feature(dataset, dataset.objects['gironde-epci.geo']);
		var bounds = d3.geo.bounds(geoData);
		path = d3.geo.path().projection(projectPoint);

		addCentre(geoData.features, 'id');

		entity = entities.selectAll('.entity')
			.data(geoData.features)
			.enter()
				.append('path')
				.attr('class', 'entity')
			;
		label = entitiesLabels.selectAll('.entity-label')
			.data(geoData.features)
			.enter()
				.append('text')
				.attr('class', 'entity-label')
			;

		// Reposition the SVG to cover the features.
{'fraction_non_alphanumeric': 0.2040636042402827, 'fraction_numerical': 0.022820965842167255, 'mean_word_length': 3.031454005934718, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '307968', 'n_tokens_mistral': 2983, 'n_tokens_neox': 2477, 'n_words': 529}