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

.link {
  stroke: #ccc;
}

.node text {
  font: 10px sans-serif;
  text-decoration: underline;
  fill: navy;
}

</style>
<body>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script>

var width = 1080,
height = 1080

var color = d3.scale.category10().domain([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("defs").selectAll("marker")
    .data(["end"])      
    .enter().append("marker")    
    .attr("id", String)
    .attr("viewBox", "0 -5 10 10")
    .attr("refX", 15)
    .attr("refY", -1.5)
    .attr("markerWidth", 6)
    .attr("markerHeight", 6)
    .attr("orient", "auto")
    .append("path")
    .attr("d", "M0,-5L10,0L0,5");


var force = d3.layout.force()
    .gravity(0.05)
    .size([width, height]);

d3.json("https://raw.githubusercontent.com/jobchong/newlegalesetemplates/master/d3force.json", function(error, json) {
  if (error) throw error;

  force
      .nodes(json.nodes)
      .links(json.links)
      .start();

  var typeColors = { party:      color(0),
					 subsection: color(1),
					 pdf:        color(2) };

  var link = svg.selectAll(".link")
      .data(json.links)
      .enter().append("line")
      .attr("class", "link")
      .attr("marker-end", "url(#end)");

  var node = svg.selectAll(".node")
      .data(json.nodes)
      .enter().append("g")
      .attr("class", "node")
      .call(force.drag);

  node.append("circle")
    .attr("class", function(d) { return d.type })
      .attr("r", 5)
      .style("fill", function(d) { return color(typeColors[d.type]); })
      .call(force.drag);


  node.append("svg:title")
      .text(function(d) { return d.title });

  force.on("tick", function() {
    link.attr("x1", function(d) { return d.source.x; })
        .attr("y1", function(d) { return d.source.y; })
        .attr("x2", function(d) { return d.target.x; })
        .attr("y2", function(d) { return d.target.y; });

    node.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
  });
});

</script><commit_msg>label only the subsection nodes<commit_after><!DOCTYPE html>
<meta charset="utf-8">
<style>

.link {
  stroke: #ccc;
}

.node text {
  font: 10px sans-serif;
  text-decoration: underline;
  fill: navy;
}

</style>
<body>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script>

var width = 720, height = 640;

var color = d3.scale.category10().domain([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,]);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

svg.append("defs").selectAll("marker")
    .data(["end"])      
    .enter().append("marker")    
    .attr("id", String)
    .attr("viewBox", "0 -5 10 10")
    .attr("refX", 15)
    .attr("refY", -1.5)
    .attr("markerWidth", 6)
    .attr("markerHeight", 6)
    .attr("orient", "auto")
    .append("path")
    .attr("d", "M0,-5L10,0L0,5");


var force = d3.layout.force()
    .gravity(0.05)
    .size([width, height]);

d3.json("https://raw.githubusercontent.com/jobchong/newlegalesetemplates/master/d3force.json", function(error, json) {
  if (error) throw error;

  force
      .nodes(json.nodes)
      .links(json.links)
      .start();

  var typeColors = { party:      color(0),
					 subsection: color(1),
					 pdf:        color(2) };

  var link = svg.selectAll(".link")
      .data(json.links)
      .enter().append("line")
      .attr("class", "link")
      .attr("marker-end", "url(#end)");

  var node = svg.selectAll(".node")
      .data(json.nodes)
      .enter().append("g")
      .attr("class", function(d) { return "node " + d.type })
      .call(force.drag);

  node.append("circle")
      .attr("r", 5)
      .style("fill", function(d) { return color(typeColors[d.type]); })
      .call(force.drag);

  node.append("svg:title")
      .text(function(d) { return d.title });

  svg.selectAll(".node.subsection")
	.append("text")
    .attr("dx", 12)
    .attr("dy", ".35em")
	.text(function(d) { return d.title });
  
  force.on("tick", function() {
    link.attr("x1", function(d) { return d.source.x; })
        .attr("y1", function(d) { return d.source.y; })
        .attr("x2", function(d) { return d.target.x; })
        .attr("y2", function(d) { return d.target.y; });

    node.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
  });
});

</script>
{'fraction_non_alphanumeric': 0.22561797752808987, 'fraction_numerical': 0.027865168539325844, 'mean_word_length': 2.8403796376186365, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 4, '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': '6672098', 'n_tokens_mistral': 1775, 'n_tokens_neox': 1661, 'n_words': 315}