Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.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 D3未显示在jupyter笔记本中_Javascript_Html_D3.js_Data Visualization_Jupyter Notebook - Fatal编程技术网

Javascript D3未显示在jupyter笔记本中

Javascript D3未显示在jupyter笔记本中,javascript,html,d3.js,data-visualization,jupyter-notebook,Javascript,Html,D3.js,Data Visualization,Jupyter Notebook,我正在jupyter笔记本中编写这个html/javascript/d3代码,它运行时没有任何错误,但没有显示任何内容。理想情况下,它应该显示两个圆圈,一个是蓝色,另一个是绿色。有什么问题 HTML('<script src="http://d3js.org/d3.v3.min.js"></script>') HTML(''' <div class="legend">Sample</div> <div id="sample">&

我正在jupyter笔记本中编写这个html/javascript/d3代码,它运行时没有任何错误,但没有显示任何内容。理想情况下,它应该显示两个圆圈,一个是蓝色,另一个是绿色。有什么问题

HTML('<script src="http://d3js.org/d3.v3.min.js"></script>')

HTML('''
<div class="legend">Sample</div>   
<div id="sample"></div>
 <script type="text/javascript">

 var svg=d3.select("#sample").append("svg").attr("width",500).attr("height",200);
 var dataset = [
{
    x: 10,
    y: 10,
    r: 2,
    text:"a",
    color:"blue"
},
{
    x: 20,
    y: 10,
    r: 2,
    text:"b",
    color:"green"
}];
 svg.selectAll("circle")
 .data(dataset)
 .enter()
 .append("circle")
 .attr("cx",function(d){return d.x;})
 .attr("cy",function(d){return d.y;})
 .attr("r",function(d){return d.r;})
 .attr("fill",function(d){return d.color;})
 .text(function(d){return d.text;});

 ''')
HTML(“”)
HTML(“”)
样品
var svg=d3.select(#sample”).append(“svg”).attr(“width”,500).attr(“height”,200);
变量数据集=[
{
x:10,
y:10,
r:2,
案文:“a”,
颜色:“蓝色”
},
{
x:20,
y:10,
r:2,
案文:“b”,
颜色:“绿色”
}];
svg.selectAll(“圆圈”)
.数据(数据集)
.输入()
.附加(“圆圈”)
.attr(“cx”,函数(d){return d.x;})
.attr(“cy”,函数(d){返回d.y;})
.attr(“r”,函数(d){返回d.r;})
.attr(“fill”,函数(d){返回d.color;})
.text(函数(d){返回d.text;});
''')

可能的问题:您忘记关闭
谢谢