未捕获的ReferenceError:未找到[function],但在js文件中定义了这些函数

时间:2019-05-02 16:30:26

标签: javascript html

该函数在js文件中定义,但是它仍然向我抛出未捕获的引用错误。

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="vis"></div>
    <script src="https://d3js.org/d3.v5.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script src="http://d3js.org/topojson.v1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>
    <script src="https://raw.githubusercontent.com/thinkingmachines/cartogramph/master/demo/js/cartogramph.js"></script>

    <script type="text/javascript">
        var GEODATA = "d3js_projects/ph.json"; //link to the map json source file
        var POPULATION = "d3js_projects/scores.csv"; //link to population data
        var POPULATION_COL = "score"; //thematic variable
        var POPULATION_LABEL = "Accessibility Score"; //label

//declare variables
        var customDataSource = "d3js_projects/scores.csv"; //link to population data
        var customColumn = "score"; //thematic variable
        var customLabel = "Accessibility Score"; //label of variable

        var chloroplethDataSource = "d3js_projects/scores.csv"; //link to poverty data
        var chloroplethColumn = "score"; //variable you want to map (0-100%)
        var chloroplethLabel = "Accessibility Score"; //label of variable

        // makecartogram(vis,geoData,customDataSource,customColumn,customLabel,chloroplethDataSource,chloroplethColumn,chloroplethLabel,'#ef4631')

        chloroplethCartogram("#vis",chloroplethDataSource,chloroplethColumn,chloroplethLabel,"#c30202");
    </script>
</body>
</html>
  

错误:project_1.html:30未捕获的参考错误:chloroplethCartogram未定义

我还尝试下载js文件并使用该文件,但是它显示了相同的错误。我不确定为什么它不能正常工作,感谢您的帮助。谢谢!

0 个答案:

没有答案