D3图表没有显示出来 [英] D3 chart doesn't show up

查看:447
本文介绍了D3图表没有显示出来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想基于d3示例构建一个线和面积图( http://bl.ocks .ORG / rkirsling / 33a9e350516da54a5d4f )。我复制并粘贴了代码,并以正确的格式保存。但是,当我尝试通过本地文件或localhost查看它时,图表不会显示。该页面完全空白。

I want to build a line and area chart based on the d3 example (http://bl.ocks.org/rkirsling/33a9e350516da54a5d4f). I copied and pasted the code and saved them in the right format. However, when I tried to view it via either a local file or localhost, the chart doesn't show up. The page is completely blank.

没有控制台错误,HTML页面可以连接到javascript。

There are no console errors and the HTML page can connect to the javascript.

另外,我检查了一些以前的类似问题并添加Jquery代码:
但是,页面仍然是空白的。
有人可以告诉我有什么问题吗?我该怎么做才能让它显示在我的页面中?

Also, I checked some previous similar questions and add the Jquery code: However, the page is still blank. Can somebody tell me what is wrong? What should I do to make it show up in my page?

推荐答案

可以修复的事情。


  • 在app.css中更改

  • change in app.css


@import url(// fonts.googleapis.com/css?family=Open+Sans:400,700);

@import url(//fonts.googleapis.com/css?family=Open+Sans:400,700);

to


@import url( http://fonts.googleapis.com/css?family=Open+Sans:400,700 );


  • 确保你有正确的文件/目录结构。

  • make sure that you have right file/dir structure.


    /index.html

    /index.html

    /app.js

    /app.css

    / data。 json

    /data.json

    /markers.json

    /markers.json


  • 你需要一些服务器/ localhost在 app.js中加载 data.json markers.json 文件数据代码。

  • You need some server/localhost to load your data.json and markers.json files data in app.js code.

    这篇关于D3图表没有显示出来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆