Coder Social home page Coder Social logo

topoview's Introduction

TopoView

使用d3.js做的一个拓扑展示的js工具

示例:

TopoView.html是一个已经写好的实例,直接在浏览器打开即可

TopoView.js使用方法:

1 html中需要一个容器,如下:

<div id="topoView">
	<svg>
	</svg>
</div>

2 引入d3库(v4版本)和TopoView.js

	<script src="./d3.min.js"></script>
	<script src="./topoView.js"></script>

3 提供拓扑数据

var snodes = [{
     "id": "1"
    }, {
     "id": "2"
    }, {
        "id": "3"
    }];
var hnodes = [{
        "id": "5"
    }, {
        "id": "6"
    }];
var links = [{
        "source": "1",
        "target": "2"
    }, {
        "source": "2",
        "target": "3"
    }, {
        "source": "5",
        "target": "1"
    }, {
        "source": "6",
        "target": "3"
    }]

4 创建TopoView对象,构造方法参数为html容器ID

var topoView = new TopoView("topoView"); 

5 设置拓扑数据并更新视图

topoView.setTopoInfo(snodes, hnodes, links);
topoView.updateTopoView();

topoview's People

Contributors

zsvic 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.