Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/455.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript enter“selection。问题在于您定义输入selection的方式。此外,代码中的数据绑定不是惯用的D3。@Gerado不是我的代码,而是一个用法/结果混乱的示例。bubble chat.js将var“data”绘制为图形。如果我理解正确,则绘制的_Javascript_Arrays_D3.js - Fatal编程技术网

Javascript enter“selection。问题在于您定义输入selection的方式。此外,代码中的数据绑定不是惯用的D3。@Gerado不是我的代码,而是一个用法/结果混乱的示例。bubble chat.js将var“data”绘制为图形。如果我理解正确,则绘制的

Javascript enter“selection。问题在于您定义输入selection的方式。此外,代码中的数据绑定不是惯用的D3。@Gerado不是我的代码,而是一个用法/结果混乱的示例。bubble chat.js将var“data”绘制为图形。如果我理解正确,则绘制的,javascript,arrays,d3.js,Javascript,Arrays,D3.js,enter“selection。问题在于您定义输入selection的方式。此外,代码中的数据绑定不是惯用的D3。@Gerado不是我的代码,而是一个用法/结果混乱的示例。bubble chat.js将var“data”绘制为图形。如果我理解正确,则绘制的数据不是实际的cvs数据,而是非dom绑定”数据从select传递到bubble chart.js。是吗?是的,该bubble_chart.js中的数据不是由d3.csv函数创建的数据。 <script> d3.csv('


enter“selection。问题在于您定义输入selection的方式。此外,代码中的数据绑定不是惯用的D3。@Gerado不是我的代码,而是一个用法/结果混乱的示例。bubble chat.js将var“data”绘制为图形。如果我理解正确,则绘制的数据不是实际的cvs数据,而是非dom绑定”数据从select传递到bubble chart.js。是吗?是的,该bubble_chart.js中的
数据
不是由
d3.csv
函数创建的数据。
<script>

    d3.csv('medium_january.csv', function(error, data) {
      if (error) {
          console.error('Error getting or parsing the data.');
          throw error;
      }
      var chart = bubbleChart().width(600).height(400);
      d3.select('#chart').data(data).call(chart);
      //here data has 43 elements with the 1st beginning "how flex...
    });

</script>
function bubbleChart() {
    var width = 960,
        height = 960,
        maxRadius = 6,
        columnForColors = "category",
        columnForRadius = "views";

    function chart(selection) {
        var data = selection.enter().data();
//here data has 42 elements with the first being "How I went from zero


        var div = selection,
            svg = div.selectAll('svg');
        svg.attr('width', width).attr('height', height);
        //rest of script
d3.select('#chart').call(chart, data);
function chart(selection, data) {
    var div = selection,
        svg = div.selectAll('svg');
    svg.attr('width', width).attr('height', height);

    ...
d3.select('#chart').data(data).call(chart);
var sel = d3.select('#chart').data(data);
chart(sel);
console.log("the data array has " + data.length + " elements");
console.log("the enter selection has " + sel.enter().size() + " elements");
the data array has 43 elements
the enter selection has 42 elements
console.log(d3.select("#chart").datum())
Object {
    title: "How Flexbox works — explained with big, colorful, animated gifs", 
    category: "Design", 
    views: "5700"}
selection.selectAll("p")
    .data(data)
    .enter()
    .append("p")
    etc...