خرید بک لینک

Vote count: 0

I'm trying to build a table with a update function to toggle between different name selection. I've already find a thread with an answers to that question here http://plnkr.co/edit/HwzD4SpROPyjsW0REkfJ?p however I'm not able to adapt this to my code.

From what I have understand I need to : 1- build the selector button and attached it in a array where I push the value I want to update (in my case the authoame) 2- The I have to append the authoame I've selected to a row.

Here is my code http://plnkr.co/edit/yIguXVCmoFQNuumYkK5t?p or this below :

<script>   


var table = d3.select("#container").append("table");
var thead = table.append("thead");
var tbody = table.append("tbody");

// append the header row
thead.append("tr")
  .selectAll("th")
  .data(["authoame", "linkclicks"])
  .enter()
  .append("th")
  .text(function(column) { retu column; })



function draw(data) {


    var transformedData = d3.nest()
        .key(function(d) { retu d.authoame;})
        .rollup(function(d) { retu d3.sum(d, function(g) {retu g.linkclicks;}); })
        .entries(data);
    var filterdata = transformedData.filter(function(d) {
            retu d.key !== "";
                })
    var tr = tbody
        .selectAll("tr")
        .data(filterdata)
        .enter()
        .append('tr')
        .sort(function(a, b) {
            retu d3.descending(a.values, b.values)
                });
        tr
        .append('td')
        .text(function(d) { retu d.key; });
        tr
        .append('td')
        .text(function(d) { retu d.values;})
    };

var url = 'http://localhost:5000/authors';

d3.json(url, function(error, people) {
if (error) {
throw error;}
draw(people);
});

</script>

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 1 خرداد 1395 ساعت: 8:38

صفحه بندی