Skip to content
ECharts graph modularity extension for community detection, and access to detection result.
Branch: master
Clone or download
Pull request Compare This branch is 1 commit ahead, 2 commits behind ecomfe:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
example
src
.gitignore
README.md
index.js
package.json
webpack.config.js

README.md

ECharts graph modularity extension

logo

Graph modularity extension will do community detection and partian a graph's vertices in several subsets. Each subset will be assigned a different color.

[New Feature] Add a method to access graph community detection result.

var communities = chart._api.getCommunities()

console.log(communities)

输出如下结果:

[
  {
    nodes: ["1"],       // 社群组成节点
    color: "#c23531"    // 节点颜色
  },
  {
    nodes: ["21", "41", "52"],
    color: "#d48265"
  },
  ...
]

Install

<script src="echarts.min.js"></script>
<script src="echarts-graph-modularity.min.js"></script>

Or

npm install echarts-graph-modularity
var echarts = require('echarts');
require('echarts-graph-modularity');

Usage

setOption({

    ...

    series: [{
        type: 'graph',
        layout: 'force',
        // Set modularity property true and extension will automatically detect different communities
        // and assign each different color.
        modularity: true

        // Specify resolution. Higher resolution will produce less communities
        modularity: {
            resolution: 5,
            // If sort the communities
            sort: false
        }

        ...
    }]
})
You can’t perform that action at this time.