D3.js数据函数

<!DOCTYPE html>
<html>
   <head>
      <script type = text/javascript src = https://d3js.org/d3.v4.min.js></script>
      <style>
         body { font-family: Arial; }
      </style>
   </head>

   <body>
      <p></p>
      <p></p>
      <p></p>
      <script>
         var data = [1, 2, 3];
         var paragraph = d3.select(body)
         .selectAll(p)
         .data(data)
         .text(function (d, i) {
            console.log(d:  + d);
            console.log(i:  + i);
            console.log(this:  + this);
            return The index is  + i +  and the data is  + d;
         });
      </script>
   </body>
</html>

相关文章

<!DOCTYPE html> <html> <head> <scri...
<!DOCTYPE html> <html> <head> <scri...
<!DOCTYPE html> <html> <head> <scri...
<!DOCTYPE html> <html> <head> <scri...
<!DOCTYPE html> <html> <head> <scri...
<!DOCTYPE html> <html> <head> <scri...