how to add button table column using d3.js?
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;table with sparkline&lt;/title&gt;
&lt;script src="d3.min.js"&gt;&lt;/script&gt;
&lt;style&gt;
.line {
    fill: none;
    stroke: steelblue;
    stroke-width: 1.0px;
}
table {
    border-collapse: collapse;
    width: 100%;
}

th, td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}
th{
    background-color:#f5f5f5;
}
/*tr:hover{background-color:#f5f5f5}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h4&gt;a table&lt;/h4&gt;
&lt;div id="table"&gt;&lt;/div&gt;
&lt;script&gt;
var columns = ['Fruit', 'Color', 'Lines']

var data = [
    ['Orange', 'Orange', [1,2,3,1,6]],
    ['Apple', 'Red', [6,2,6,5,5]],
    ['Grape', 'Purple', [9,1,2,3,1]]
]

// create table
var table = d3.select("#table").append("table");

var thead = table.append("thead").append("tr");

thead.selectAll("th")
    .data(columns)
    .enter()
    .append("th")
    .text(function(d) {
        return d;
    });

var tbody = table.append("tbody");

var trows = tbody
    .selectAll("tr")
    .data(data)
    .enter()
    .append("tr");

var tcells = trows
    .selectAll("td")
    .data(function(d, i) { return d; })
    .enter()
    .append("td")
    .text(function(d, i) { return d; });

// update (add a column with graphs)
thead.append("th").text('Graphs');

trows.selectAll("td.graph")  
//use a class so you don't re-select the existing &lt;td&gt; elements
          .data(function(d) {return [d[2]];})
          .enter()
            .append("td")
            .attr("class", "graph")
            .each(lines); 


// a sparklines plot
function lines(test) {  
    var width = 100, height = 20; 

    var data = []
    for (i = 0; i &lt; test.length; i++) {
        data[i] = {
            'x': i,
            'y': +test[i]
        }
    }
    
    var x = d3.scale.linear()
        .range([0, width - 10])
        .domain([0,5]);
    
    var y = d3.scale.linear()
        .range([height, 0])
        .domain([0,10]);
    
    var line = d3.svg.line()
                .x(function(d) {return x(d.x)})
                .y(function(d) {return y(d.y)});
    
    d3.select(this).append('svg')
            .attr('width', width)
            .attr('height', height)
         .append('path')
            .attr('class','line')
            .datum(data)
            .attr('d', line);     

}
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
</div>
</div>
</p>

<p>this is my code..i have created table using d3.js..here i just want to add button in column.how to add button in column for each row??
and if i click the button it will show the alert message
here i have used data in json format</p>