<commit_before>( function( $ ) {

function dv_d3( element, i ){
	var d3ID   = element.attr( 'id' ),
	jsonData = $.parseJSON( element.attr('dv_data') );
	root = jsonData;

	console.log(jsonData);

	var diameter = 660;

	var tree = d3.layout.tree()
		.size([360, diameter / 2 - 120])
		.separation(function(a, b) { return (a.parent == b.parent ? 1 : 2) / a.depth; });

	var diagonal = d3.svg.diagonal.radial()
		.projection(function(d) { return [d.y , d.x / 180 * Math.PI]; });



	var svg = d3.select( "#" + d3ID ).append("svg")
		.attr("width", diameter)
		.attr("height", diameter )
		.append("g")
		.attr("transform", "translate(" + diameter / 2 + "," + diameter / 2 + ")");

//	d3.json(jsonData, function(error, root) {
	  var nodes = tree.nodes(root),
		  links = tree.links(nodes);

	  var link = svg.selectAll(".link")
		  .data(links)
		  .enter().append("path")
		  .attr("class", "link")
		  .attr("d", diagonal);

	  var node = svg.selectAll(".node")
		  .data(nodes)
		  .enter().append("g")
		  .attr("class", "node")
		  .attr("transform", function(d) { return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; })

	  node.append("circle")
	//to get size of circle same as size of text
	//      .attr("r", function(d) { return d.name.length*7;  } );
		  .attr("r", 25);

	  node.append("text")
		  .attr("dy", ".31em")
		  .attr("dx", function(d){ return d.x < 180 ? "-2.31em" : d.x < 220 ? "1.31em" : "2.31em"})
		  .attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; })
		  .attr("transform", function(d) { return d.x < 180 ?  d.x < 90 ? "rotate(45)translate(8)" : "rotate(-45)translate(8)" : d.x < 220 ?  "rotate(-90)translate(-8)" : d.x < 300 ? "rotate(-135)translate(-8)" : "rotate(135)translate(-8)"; })
		  .text(function(d) { return d.name; });
//	});

	d3.select(self.frameElement).style("height", diameter - 150 + "px");
};

( function ( $ ) {

	$.fn.dv_d3 = function( i ) {
		dv_d3( this , i );
		return this;
	};
} )( $ );<commit_msg>fixed the tree layout to properly work for SD.<commit_after>( function( $ ) {

function dv_d3( element, i ){
	var d3ID   = element.attr( 'id' ),
	root = $.parseJSON( element.attr('dv_data') );

	var diameter = 660;

	var tree = d3.layout.tree()
		.size([360, diameter / 2 - 120]);

	var svg = d3.select( "#" + d3ID ).append("svg")
		.attr("width", diameter)
		.attr("height", diameter )
		.append("g")
		.attr("transform", "translate(" + diameter / 2 + "," + diameter / 2 + ")");

	var nodes = tree.nodes(root),
		links = tree.links(nodes);

	var link = svg.selectAll(".link")
		.data(links)
		.enter().append("line")
		.attr("class", "link")
		.attr("x1", function(d) { return 0; })
		.attr("y1", function(d) { return 0; })
		.attr("x2", function(d) { return d.target.y;})
		.attr("y2", function(d) { return 0;})
		.attr("transform", function(d){return "rotate(" + (d.target.x-180) + ")"; });

	var node = svg.selectAll(".node")
		.data(nodes)
		.enter().append("g")
		.attr("class", "node")
		.attr("transform", function(d) { console.log(d.x, d.y);  return "rotate(" + (d.x - 180) + ")translate(" + d.y + ")"; })

	node.append("circle")
		//to get size of circle same as size of text
		//.attr("r", function(d) { return d.name.length*7;  } );
		.attr("r", 25);

	node.append("text")
		.attr("dy", ".31em")
		.attr("dx", function(d){ return d.x < 180 ? "-2.31em" : d.x < 220 ? "1.31em" : "2.31em"})
		.attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; })
		.attr("transform", function(d) {  return "rotate(" + -(d.x - 180) + ")"; })
		.text(function(d) { return d.name; });

	d3.select(self.frameElement).style("height", diameter - 150 + "px");
};

( function ( $ ) {

	$.fn.dv_d3 = function( i ) {
		dv_d3( this , i );
		return this;
	};
} )( $ );
{'fraction_non_alphanumeric': 0.24139770605494798, 'fraction_numerical': 0.038676980528140836, 'mean_word_length': 3.180602006688963, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2532077', 'n_tokens_mistral': 1623, 'n_tokens_neox': 1429, 'n_words': 315}