Coder Social home page Coder Social logo

d3js_doc's Introduction

d3js中文参考文档

仅供参考,以原英文版为准


文档参考

安装

如果使用npm,则可以通过npm install d3来安装。此外还可以下载最新版,最新版支持AMD、CommonJS以及vanilla环境。可以使用Rollup创建自定义的库文件包,也可以直接从d3js.org引用:

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

压缩版:

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

你也可以单独使用d3中的某个模块,比如,单独使用d3-selection

<script src="https://d3js.org/d3-selection.v1.min.js"></script>

如果要使用某个固定的版本,则考虑CNDJS unpkg

支持环境

D3支持“现代”浏览器,也就是除IE8及以下的浏览器。D3针对Firefox,Chrome,Safari,Opera,IE9 +,Android和iOS进行测试,D3的一部分功能能在旧版的浏览器中运行,因为D3的核心功能对浏览器的要求比较低:JavaScript和 W3C DOM API。D3使用 Level 1级Selectors API,但是可以通过预先加载Sizzle来实现兼容。现代浏览器对SVGCSS3 Transition 的支持比较好。所以D3不支持更低级别的浏览器,如果你的浏览器不支持这些标准,那么祝你好运...

D3也可以运行在NodeWeb workers中. 在Node环境中使用DOM的时候,必须要提供自己的DOM实现。推荐使用JSDOM,为了避免定义全局document,建议将DOM传递给d3.select或者将NodeList传递给d3.selectAll,如下:

var d3 = require("d3"),
    jsdom = require("jsdom");

var document = jsdom.jsdom(),
    svg = d3.select(document.body).append("svg");

本地开发

由于浏览器的安全限制,不能直接读取本地文件。在本地开发的时候,必须要运行一个服务器环境而不是使用file://, 推荐使用Nodejs的http-server,安装方法:

npm install -g http-server

运行:

http-server & 

然后会在当前目录启动一个 http://localhost:8080 的服务。

d3js_doc's People

Contributors

xswei avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.