D3 - Polylines from label to arc in Donut or Pie Chart
<p>I am making a simple donut chart. I am providing data and generating the donut as expected. Also, labels to the same are added at a distant. Now, I want to add lines right from labels to the center of arc. However, I am not getting any error and also I am not seeing any line. Pls help! </p>

<p><strong>SNIPPET:</strong> </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>     //module declaration 
            var app = angular.module('myApp',[]);

            //Controller declaration
            app.controller('myCtrl',function($scope){

            $scope.svgWidth = 800; //svg Width
            $scope.svgHeight = 500; //svg Height 

            //Data in proper format 
            var data = [{  
            "letter": "A",
              "frequency": "60"
            }, {
              "letter": "B",
              "frequency": "30"
            }, {
              "letter": "C",
              "frequency": "10"
            }];

            //removing prior svg elements ie clean up svg 
            d3.select('svg').selectAll("*").remove();

            //resetting svg height and width in current svg 
            d3.select("svg").attr("width", $scope.svgWidth).attr("height", $scope.svgHeight);

            //Setting up of our svg with proper calculations 
            var svg = d3.select("svg");
            var margin = {top: 20,right: 20,bottom: 30,left: 40};
            var width = svg.attr("width") - margin.left - margin.right;
            var height = svg.attr("height") - margin.top - margin.bottom;
            var radius = 200;

            //Plotting our base area in svg in which chart will be shown 
            var g = svg.append("g").attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");

            var pie = d3.pie().sort(null)
              .value(function(d) {return d.frequency;});

            var piedata = pie(data);

            var arc = d3.arc()
              .innerRadius(radius - 100)
              .outerRadius(radius - 50);

            var path = g.selectAll("path")
              .data(piedata)
              .enter().append("path")
              .attr("fill", function() {
                return "hsl(" + Math.random() * 360 + ",100%,50%)";
              })
              .attr("d", arc);

            g.selectAll("text").data(piedata)
              .enter()
              .append("text")
              .attr("text-anchor", "middle")
              .attr("x", function(d) {
                var a = d.startAngle + (d.endAngle - d.startAngle) / 2 - Math.PI / 2;
                d.cx = Math.cos(a) * (radius - 75);
                return d.x = Math.cos(a) * (radius - 20);
              })
              .attr("y", function(d) {
                var a = d.startAngle + (d.endAngle - d.startAngle) / 2 - Math.PI / 2;
                d.cy = Math.sin(a) * (radius - 75);
                return d.y = Math.sin(a) * (radius - 20);
              })
              .text(function(d) {
                return d.data.letter;
              });

              var polyline = g.select(".lines")
                      .selectAll("polyline")
                      .data(pie(data), function(d){ return d.data.letter });

              polyline.enter().append("polyline");



          });</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;head&gt;

        &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.12/angular.min.js"&gt;&lt;/script&gt; 
        &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt; 
        &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.3.0/d3.min.js"&gt;&lt;/script&gt;

    &lt;/head&gt; 

    &lt;body ng-app="myApp" ng-controller="myCtrl"&gt; 

        &lt;svg&gt;&lt;/svg&gt;
      &lt;/body&gt;


       
            </code></pre>
</div>
</div>
</p>

<p><strong>REFERENCE:</strong> </p>

<blockquote>
  <p><a href="http://bl.ocks.org/juan-cb/1984c7f2b446fffeedde" rel="nofollow noreferrer">http://bl.ocks.org/juan-cb/1984c7f2b446fffeedde</a></p>
</blockquote>