html - d3 Adding cells to an existing table -


i'm having problems getting work. have existing html table , use d3 append data table.

here's html table:

<table>      <thead>      <tr id="table_header">        <th>header 1</th>        <th>header 2</th>        <th>header 3</th>        <th>header 4</th>        <th>header 5</th>        <th>header 6</th>      </tr>        </thead>      <tbody id="data_table">      </tbody>   </table> 

for want append additional headers use d3

<script>     d3.json("data.php", function(monthly_growth) {      d3.select("#table_header").selectall("th").data(monthly_growth).enter().append("th").text(function(d) {return d.month;});      }); </script> 

i hope isn't hard understand without having actual data available. data set has values every month next several years. want create new header each month in data set. code above appending headers original table it's missing first 6 months of data set. suspect d3 code starting append data @ first header not want obviously.

i tried giving 6th header id , appending didn't quite work out well. seemed have started new row of headers underneath it. besides feel isn't proper way of doing this.

did creating new class d3 appends new types of instead of "thinking" want select there.:

<script>     d3.json("data.php", function(monthly_growth) {      d3.select("#table_header").selectall("th.month").data(monthly_growth).enter().append("th").attr('class', 'month').text(function(d) {return d.month;});      }); </script> 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -