[英]D3.js is not recognized by PyCharm
Also imported the src using <script src="https://d3js.org/d3.v4.min.js"></script>
还使用
<script src="https://d3js.org/d3.v4.min.js"></script>
导入了src
Here is my app.py: 这是我的app.py:
@app.route('/') def my_form(): return render_template('circle.html')
Here is circle.html 这是circle.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="https://d3js.org/d3.v4.min.js"></script> </head> <body> <script> var canvas = d3.select("body") .append("svg") .attr("width",500) .attr("width",300); var circle = canvas.append("circle") .attr("cx", 250) .attr("cy", 250) .attr("r", 50) .attr("fill","red"); </script> </body> </html>
Anybody knows why? 有人知道为什么吗?
The problem is, I suppose, a typo in your Javascript code: 我想问题是您的Javascript代码中有错字:
var canvas = d3.select("body")
.append("svg")
.attr("width",500)
.attr("width",300);
As you can see, you didn't set the height property; 如您所见,您没有设置height属性; instead you set twice the width property.
而是将宽度属性设置为两倍。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.