简体   繁体   English

无法实现示例d3.js文件

[英]Unable to implement sample d3.js flle

I tried to modify from this sample . 我试图从此示例进行修改。 https://bl.ocks.org/mbostock/1346395 https://bl.ocks.org/mbostock/1346395

I build a index.html and data.tsv with those codes inside . 我使用内部的那些代码构建了index.htmldata.tsv

Then ,I change <script src="//d3js.org/d3.v3.min.js"></script> to <script src="https://d3js.org/d3.v3.min.js"></script> 然后,我将<script src="//d3js.org/d3.v3.min.js"></script>更改为<script src="https://d3js.org/d3.v3.min.js"></script>

As a result , no charts are shown on index.html 结果, index.html上没有显示任何图表

Whats wrong with it? 它出什么问题了?

I put index.html and data.tsv in same directory 我将index.htmldata.tsv放在同一目录中

the code I have made changes 我已更改的代码

<script src="//d3js.org/d3.v3.min.js"></script>
<script>....

to

<script src="https://d3js.org/d3.v3.js"></script>
<script>..... 

Result: 结果:

Console : 安慰 : 在此处输入图片说明

I guess the problem is - you need a local server to test it with your local data. 我想问题是-您需要一个本地服务器才能用本地数据对其进行测试。 d3.tsv() - makes ajax call so it needs a server. d3.tsv()-进行ajax调用,因此需要服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM