想要制作带有凹坑的图形,从他们提供的示例中获取大部分代码。
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://dimplejs.org/dist/dimple.v2.1.6.min.js"></script>
</head>
<body>
<div id="chartContainer">
<script src="/lib/d3.v3.4.8.js"></script>
<script src="http://dimplejs.org/dist/dimple.v2.1.6.min.js"></script>
<script type="text/javascript">
var svg = dimple.newSvg("#chartContainer", 590, 400);
d3.tsv("C:/Users/Stephan/Downloads/baseball_data.csv", function (data) {
var myChart = new dimple.chart(svg, data);
myChart.setBounds(60, 30, 505, 305);
var x = myChart.addCategoryAxis("x", "HR");
x.addOrderRule("Date");
myChart.addMeasureAxis("y", "height");
var s = myChart.addSeries(null, dimple.plot.line);
myChart.draw();
});
</script>
</div>
</body>
</html>
当我在我的小python本地服务器上加载页面时,我在控制台中收到以下错误: 谁能告诉我那里发生了什么? :) (是的,文件和路径存在) 获取http://localhost:8000/lib/d3.v3.4.8.js d3.v3.min.js:1 XMLHttpRequest无法加载file:/// C:/Users/Stephan/Downloads/baseball_data.csv。交叉源请求仅支持协议方案:http,data,chrome,chrome-extension,https,chrome-extension-resource.i.send @ d3.v3.min.js:1forEach.i。(匿名函数)@ d3 .v3.min.js:1Nt @ d3.v3.min.js:1e @ d3.v3.min.js:3(匿名函数)@ tesst123.html:13 d3.v3.min.js:1 Uncaught NetworkError:无法执行&#39;发送&#39; on&#39; XMLHttpRequest&#39;:无法加载&#39; file:/// C:/Users/Stephan/Downloads/baseball_data.csv'。