129Echarts - 关系图(Simple Graph)

简介: 129Echarts - 关系图(Simple Graph)
效果图

源代码
<!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;
      option = {
        title: {
          text: 'Graph 简单示例'
        },
        tooltip: {},
        animationDurationUpdate: 1500,
        animationEasingUpdate: 'quinticInOut',
        series: [{
          type: 'graph',
          layout: 'none',
          symbolSize: 50,
          roam: true,
          label: {
            normal: {
              show: true
            }
          },
          edgeSymbol: ['circle', 'arrow'],
          edgeSymbolSize: [4, 10],
          edgeLabel: {
            normal: {
              textStyle: {
                fontSize: 20
              }
            }
          },
          data: [{
            name: '节点1',
            x: 300,
            y: 300
          }, {
            name: '节点2',
            x: 800,
            y: 300
          }, {
            name: '节点3',
            x: 550,
            y: 100
          }, {
            name: '节点4',
            x: 550,
            y: 500
          }],
          // links: [],
          links: [{
            source: 0,
            target: 1,
            symbolSize: [5, 20],
            label: {
              normal: {
                show: true
              }
            },
            lineStyle: {
              normal: {
                width: 5,
                curveness: 0.2
              }
            }
          }, {
            source: '节点2',
            target: '节点1',
            label: {
              normal: {
                show: true
              }
            },
            lineStyle: {
              normal: {
                curveness: 0.2
              }
            }
          }, {
            source: '节点1',
            target: '节点3'
          }, {
            source: '节点2',
            target: '节点3'
          }, {
            source: '节点2',
            target: '节点4'
          }, {
            source: '节点1',
            target: '节点4'
          }],
          lineStyle: {
            normal: {
              opacity: 0.9,
              width: 2,
              curveness: 0
            }
          }
        }]
      };
      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月前
182Echarts - 日历坐标系(Calendar Graph)
182Echarts - 日历坐标系(Calendar Graph)
28 0
|
12月前
128Echarts - 关系图(NPM Dependencies)
128Echarts - 关系图(NPM Dependencies)
61 0

热门文章

最新文章

下一篇
无影云桌面