(Flask,d3)Uncaught ReferenceError:未定义d3

时间:2015-12-11 03:47:27

标签: javascript python d3.js

我是d3.js的新手。我正在尝试在Flask应用程序上部署this example。但是,它经常给我一个错误 - “Uncaught ReferenceError:d3未定义”。我甚至在服务器上下载了d3.v2.min.js文件,但它不起作用。 这是我的HTML代码:

<html>
<head>

    <title>Quarterly Report to the City and County of Denver</title>

    <script type="text/javascript" src=""{{ url_for('static', filename='js/d3.v2.min.js') }}" charset="utf-8"></script>

    <script type="text/javascript" src="{{ url_for('static', filename='js/makeMultiTable.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='js/setupPlot.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='js/drawLinePlot.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='js/toggleStat.js') }}"></script>

    <script type="text/javascript" src="{{ url_for('static', filename='js/load_qtrly_stats.js') }}"></script>

    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/line_plot.css') }}" />
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/table.css') }}" />

</head>

<body>

    <div id="table"></div>

    <div id="plot"></div>

</body>

1 个答案:

答案 0 :(得分:2)

<title>Quarterly Report to the City and County of Denver</title>
<!--- Fixed syntax error in the below line --->
<script type="text/javascript" src="{{ url_for('static', filename='js/d3.v2.min.js') }}" charset="utf-8"></script>

<script type="text/javascript" src="{{ url_for('static', filename='js/makeMultiTable.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/setupPlot.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/drawLinePlot.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/toggleStat.js') }}"></script>

<script type="text/javascript" src="{{ url_for('static', filename='js/load_qtrly_stats.js') }}"></script>

<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/line_plot.css') }}" />
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/table.css') }}" />
</head>
<body>
<div id="table"></div>
<div id="plot"></div>
</body>