128Echarts - 关系图(NPM Dependencies)

简介: 128Echarts - 关系图(NPM Dependencies)
效果图

源代码
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>ECharts</title>
    <!-- 引入 echarts.js -->
    <script src="js/echarts.min.js"></script>
    <script src="js/jquery-1.11.0.min.js"></script>
    <script src="dist/extension/dataTool.js"></script>
  </head>
  <body>
    <!-- 为ECharts准备一个具备大小(宽高)的Dom -->
    <div id="main" style="width: 600px;height:400px;"></div>
    <script type="text/javascript">
      // 基于准备好的dom,初始化echarts实例
      var myChart = echarts.init(document.getElementById('main'));
      var option;
      myChart.showLoading();
      $.getJSON('data/test.json', function(json) {
        myChart.hideLoading();
        myChart.setOption(option = {
          title: {
            text: 'NPM Dependencies'
          },
          animationDurationUpdate: 1500,
          animationEasingUpdate: 'quinticInOut',
          series: [{
            type: 'graph',
            layout: 'none',
            // progressiveThreshold: 700,
            data: json.nodes.map(function(node) {
              return {
                x: node.x,
                y: node.y,
                id: node.id,
                name: node.label,
                symbolSize: node.size,
                itemStyle: {
                  normal: {
                    color: node.color
                  }
                }
              };
            }),
            edges: json.edges.map(function(edge) {
              return {
                source: edge.sourceID,
                target: edge.targetID
              };
            }),
            label: {
              emphasis: {
                position: 'right',
                show: true
              }
            },
            roam: true,
            focusNodeAdjacency: true,
            lineStyle: {
              normal: {
                width: 0.5,
                curveness: 0.3,
                opacity: 0.7
              }
            }
          }]
        }, true);
      });
      //myChart.setOption(option);
    </script>
  </body>
</html>
目录
相关文章
|
10月前
130Echarts - 关系图(Graph Webkit Dep)
130Echarts - 关系图(Graph Webkit Dep)
35 0
|
12月前
124Echarts - 关系图(Graph Dynamic)
124Echarts - 关系图(Graph Dynamic)
53 0
|
5月前
|
JavaScript
echarts_自定义graph关系图
echarts_自定义graph关系图
88 0
|
12月前
131Echarts - 关系图(Calendar Graph)
131Echarts - 关系图(Calendar Graph)
41 0
|
10月前
|
JSON 数据格式
echarts关系图
echarts关系图
66 0
|
12月前
269Echarts - GL 关系图(1w 节点 2w7 边的NPM 依赖图)
269Echarts - GL 关系图(1w 节点 2w7 边的NPM 依赖图)
77 0
|
12月前
268Echarts - GL 关系图(GraphGL - Large Internet)
268Echarts - GL 关系图(GraphGL - Large Internet)
103 0
|
12月前
|
异构计算
267Echarts - GL 关系图(GraphGL GPU Layout)
267Echarts - GL 关系图(GraphGL GPU Layout)
78 0
|
12月前
129Echarts - 关系图(Simple Graph)
129Echarts - 关系图(Simple Graph)
43 0
|
12月前
127Echarts - 关系图(Graph Life Expectancy)
127Echarts - 关系图(Graph Life Expectancy)
33 0

热门文章

最新文章

推荐镜像

更多
下一篇
无影云桌面