何らかの理由でd3.scale
が定義されていません。 D3が正しくロードされている。私の全体のHTMLファイルd3.scaleの取得は未定義です - codepenで動作します
InitiateChart_1();
function InitiateChart_1()
{
var data = [5,10,15,20,25];
var height = 500, width = 500;
var xScale = d3.scale.linear()
.domain([0,60])
.range([0,width]);
var canvas = d3.select("body")
.append("svg")
.attr("id","chart1")
.attr("width",width)
.attr("height",height);
var bars = canvas.selectAll("rect")
.data(data)
.enter()
.append("rect")
.attr("height",10)
.attr("width",function(d){return xScale(d);})
.attr("y",function(d,i){return i * 12;})
}
:
<!doctype html>
<html>
<head>
<title>SHED Report Prototype</title>
<meta charset='utf-8'>
<script src="https://d3js.org/d3.v4.min.js"></script>
</head>
<body>
<script src='js/studentloans.js'></script>
</body>
</html>
すべてのヘルプは非常にある私は、メインd3js.orgサイトに記載されている1 here.
にD3コードを扱う私のJSファイルを使用しています感謝。
[未定義のd3.scale in Typescript]の可能な複製(http://stackoverflow.com/questions/38218891/undefined-d3-scale-in-typescript) –