126Echarts - 关系图(Graph on Cartesian)

简介: 126Echarts - 关系图(Graph on Cartesian)
效果图

源代码
<!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;
      var axisData = ['周一', '周二', '周三', '很长很长的周四', '周五', '周六', '周日'];
      var data = axisData.map(function(item, i) {
        return Math.round(Math.random() * 1000 * (i + 1));
      });
      var links = data.map(function(item, i) {
        return {
          source: i,
          target: i + 1
        };
      });
      links.pop();
      option = {
        title: {
          text: '笛卡尔坐标系上的 Graph'
        },
        tooltip: {},
        xAxis: {
          type: 'category',
          boundaryGap: false,
          data: axisData
        },
        yAxis: {
          type: 'value'
        },
        series: [{
          type: 'graph',
          layout: 'none',
          coordinateSystem: 'cartesian2d',
          symbolSize: 40,
          label: {
            normal: {
              show: true
            }
          },
          edgeSymbol: ['circle', 'arrow'],
          edgeSymbolSize: [4, 10],
          data: data,
          links: links,
          lineStyle: {
            normal: {
              color: '#2f4554'
            }
          }
        }]
      };
      myChart.setOption(option);
    </script>
  </body>
</html>
目录
相关文章
193Echarts - 自定义系列(Custom Cartesian Polygon)
193Echarts - 自定义系列(Custom Cartesian Polygon)
56 0
130Echarts - 关系图(Graph Webkit Dep)
130Echarts - 关系图(Graph Webkit Dep)
44 0
|
7月前
|
JavaScript
echarts_自定义graph关系图
echarts_自定义graph关系图
150 0
131Echarts - 关系图(Calendar Graph)
131Echarts - 关系图(Calendar Graph)
50 0
|
JSON 数据格式
echarts关系图
echarts关系图
82 0
269Echarts - GL 关系图(1w 节点 2w7 边的NPM 依赖图)
269Echarts - GL 关系图(1w 节点 2w7 边的NPM 依赖图)
97 0
268Echarts - GL 关系图(GraphGL - Large Internet)
268Echarts - GL 关系图(GraphGL - Large Internet)
126 0
|
异构计算
267Echarts - GL 关系图(GraphGL GPU Layout)
267Echarts - GL 关系图(GraphGL GPU Layout)
107 0
265Echarts - GL 矢量场图(Flow on the cartesian)
265Echarts - GL 矢量场图(Flow on the cartesian)
80 0
182Echarts - 日历坐标系(Calendar Graph)
182Echarts - 日历坐标系(Calendar Graph)
39 0

热门文章

最新文章