title: d3js - i want to see lines
body: <p>I have a project using d3js platform.</p>
  
  <p>but when i customermized d3js's file and json file,</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var diameter = 960,
    radius = diameter / 2,
    innerRadius = radius - 120;
  
  var cluster = d3.cluster().size([360, innerRadius]);
  
  var line = d3.radialLine().curve(d3.curveBundle.beta(0.85)).radius(
    function(d) {
      return d.y;
    }).angle(function(d) {
    return d.x / 180 * Math.PI;
  });
  
  var svg = d3.select("body").append("svg").attr("width", diameter).attr(
    "height", diameter).append("g").attr("transform",
    "translate(" + radius + "," + radius + ")");
  
  var link = svg.append("g").selectAll(".link"),
    node = svg.append("g")
    .selectAll(".node");
  
  var classes = [{
      "name": "LineOne.Seoul",
      "size": 3938,
      "imports": [{
        "station": "LineOne.Cityhall",
        "value": 2000
      }, {
        "station": "1호선.종로3가",
        "value": 1000
      }]
    },
    {
      "name": "LineOne.Cityhall",
      "size": 3812,
      "imports": [{
        "station": "LineOne .Seoul",
        "value": 3000
      }]
    },
    {
      "name": "LineOne.Jongro-3",
      "size": 3812,
      "imports": [{
        "station": "LineOne.Seoul",
        "value": 3500
      }]
    },
    {
      "name": "LineOne.Jongro-5",
      "size": 38120,
      "imports": [{
        "station": "LineOne.Seoul",
        "value": 40000
      }]
    },
    {
      "name": "LineOne.DongDaeMoon",
      "size": 1812,
      "imports": [{
        "station": "LineOne.Seoul",
        "value": 3500
      }]
    },
    {
      "name": "LineOne.DongMyo",
      "size": 28120,
      "imports": [{
        "station": "LineOne.Seoul",
        "value": 25000
      }]
    }
  ];
  
  var root = packageHierarchy(classes).sum(function(d) {
  
    return d.size;
  });
  
  
  cluster(root);
  var index_size = 0;
  
  link = link.data(packageImports(root.leaves()))
    .enter().append("path")
    .each(function(d) {
      console.log("link : " + d)
      d.source = d[0], d.target = d[d.length - 1];
    })
    .attr("class", "link").attr("d", line).style("stroke", function(d) {
  
  
      if (d[0].value &lt; 2000) {
        return "red";
      } else if (d[0].value &gt;= 2000 &amp;&amp; d[0].value &lt; 10000) {
        return "blue";
      } else if (d[0].value &gt;= 10000) {
        return "black";
      }
    });
  
  
  node = node.data(root.leaves()).enter().append("text").attr(
    "class", "node").attr("dy", "0.31em").attr(
    "transform",
    function(d) {
      return "rotate(" + (d.x - 90) + ")translate(" +
        (d.y + 8) + ",0)" +
        (d.x &lt; 180 ? "" : "rotate(180)");
    }).attr("text-anchor", function(d) {
    return d.x &lt; 180 ? "start" : "end";
  }).text(function(d) {
    return d.data.key;
  }).on("mouseover", mouseovered).on("mouseout", mouseouted);
  
  function mouseovered() {}
  
  function mouseouted() {}
  
  function packageHierarchy(classes) {
    var map = {};
  
    function find(name, data) {
  
      var node = map[name],
        i;
      if (!node) {
        node = map[name] = data || {
          name: name,
          children: []
        };
        if (name.length) {
          node.parent = find(name.substring(0, i = name
            .lastIndexOf(".")));
          node.parent.children.push(node);
          node.key = name.substring(i + 1);
  
  
        }
      }
      return node;
    }
  
    classes.forEach(function(d) {
      find(d.name, d);
    });
  
    return d3.hierarchy(map[""]);
  }
  
  // Return a list of imports for the given array of nodes.
  function packageImports(nodes) {
    var map = {},
      imports = [];
  
    // Compute a map from name to node.
    nodes.forEach(function(d) {
      map[d.data.name] = d;
    });
  
    // For each import, construct a link from the source to target node.
    nodes.forEach(function(d) {
      if (d.data.imports.station)
        d.data.imports.station.forEach(function(i) {
          imports.push(map[d.data.name].path(map[i]));
        });
  
    });
  
    return imports;
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.node {
   font: 300 15px "Helvetica Neue", Helvetica, Arial, sans-serif;
   fill: #bbb;
  }
  
  .node:hover {
   fill: #000;
  }
  
  .link {
   stroke: red;
   stroke-opacity: 0.5;
   fill: none;
   pointer-events: none;
   stroke-width: 3px;
  }
  
  
  .node:hover, .node--source, .node--target {
   font-weight: 700;
  }
  
  .node--source {
   fill: #2ca02c;
  }
  
  .node--target {
   fill: #d62728;
  }
  
  .link--source, .link--target {
   stroke-opacity: 1;
   stroke-width: 2px;
  }
  
  .link--source {
   stroke: #d62728;
  }
  
  .link--target {
   stroke: #2ca02c;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://d3js.org/d3.v4.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>there is no graphic lines on the chrome. Only change is 'imports's variable format in json file(Arraylist -> Map). how can i solve the problem?  </p>