title: d3.js Representation of links values in Les Miserables Co-occurrence example
body: <p>I am currently trying to inject my own data in this example.  See <a href="https://bost.ocks.org/mike/miserables/" rel="nofollow noreferrer">https://bost.ocks.org/mike/miserables/</a> </p>
  
  <p>So I'm creating my own JSON files. But I don't understand very well how the links values are converted into colors, especially in diagonals. I think this is happening here in the source code:</p>
  
  <pre><code>    function row(row) {
  var cell = d3.select(this).selectAll(".cell")
      .data(row.filter(function(d) { return d.z; }))
    .enter().append("rect")
      .attr("class", "cell")
      .attr("x", function(d) { return x(d.x); })
      .attr("width", x.rangeBand())
      .attr("height", x.rangeBand())
  </code></pre>
  
  <blockquote>
    <p><strong>.style("fill-opacity", function(d) { return z(d.z); })</strong></p>
  </blockquote>
  
  <pre><code>    .style("fill", function(d) { return nodes[d.x].group == nodes[d.y].group ? c(nodes[d.x].group) : null; })
      .on("mouseover", mouseover)
      .on("mouseout", mouseout);
  </code></pre>
  
  <p>The z attribute is supposed to represent the link value, so the higher this value is, the darker the color of the rectangle will be.</p>
  
  <p>So my two questions are:</p>
  
  <p>1) As we know that the fill-opacity value is between 0 and 1, how is the conversion between link value and fill-opacity value done? Is there a high-limit of the link value above which every link value will be converted into a fill-opacity value of 1?</p>
  
  <p>2)About the diagonal squares. They're supposed to represent the link value between a character and himself (what I will call "autolink"). I've noticed that in the original JSON file, there is no link element whose source is equal to the target, which means no information is given about the value of an autolink. So how are they computed? We see that the diagonal squares have different values, but how are they computed???
  When I injected my own data, I've also noticed that every diagonal square have a fill-opacity value equal to 1 (they are all completely filled). The strange thing is, when I specify a value for any autolink, no matter if it is 0 or 100, I still get a square completely filled.</p>
  
  <p>I hope I've been understandable as english is not my mother tongue and my questions are difficult to be put in words.</p>
  
  <p>If anyone could light me in any way, I'd be very pleased.</p>
  
  <p>Thanks.</p>