npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

antv-tree-graph

v0.0.2

Published

a base in G6 tree graph module

Readme

tree-graph 基于 G6 的开箱即用应用
安装

yarn add tree-graph --save --registry https://nexus.alltosea.com/repository/nhc-npm-group/

主要实现功能
  •  右键菜单
  •  节点 hover 效果
  • 数据驱动
  • 画布自适应
demo
 import TreeGraph from 'tree-graph';
 const data = {

    "id": "0",
    "level": 0,
    "collapsed": false,
    "dataType": "root",
    "name": "2020.03.12 13:03 hwx测试",
    "data": {},
    "children": [
      {
        "id": "1336529001644064",
        "fid": "0",
        "level": 1,
        "collapsed": true,
        "dataType": "",
        "name": "2020.03.12 13:03 申请资源名称2",
         "conextMenu": []
        "data": {
          "isImmediate": true,

        },
        "children": [
          {
            "id": "1336534944972832",
            "fid": "1336529001644064",
            "level": 2,
            "collapsed": true,
            "dataType": "",
            "name": "测试三",
            "data": {}
          }
        ]
      },
      {
        "id": "1336528909369376",
        "fid": "0",
        "level": 1,
        "collapsed": true,
        "dataType": "",
        "name": "2020.03.12 13:03 申请资源名称",
        "conextMenu": [
            {
              "name": "资源表:来穗人口调查",
              "data": {}
            },
            {
              "name": "附件",
              "data": {}
            }
          ]
        "data": {

        }
      },
      {
        "id": "1336532740866080",
        "fid": "0",
        "level": 1,
        "collapsed": true,
        "dataType": "",
        "name": "测试",
        "data": {}
      }
    ]

}
 const config = { data:data, container:'container'};
 console.log('config', config);
 const taskRelationshipDiagram = new TreeGraph(config);

API

data

| 参数 | 说明 | 类型 | 默认值 | require | | ----------------- | ------------------------------ | ------- | ------ | ------- | | id | 节点唯一标识 | string | - | true | | fid | 父节点 id(最顶层节点可不传)  | string | - | true | | level | 节点层次 | number | - | false | | collapsed | 是否展开 | boolean | false | false | | name | 节点 title | string | - | false | | data | 模型数据 | object | - | false | | conextMenu | 右键菜单 | array | - | false | | children | 子节点 | object | - | false | | disableExpandIcon | 隐藏展开收宿 icon | boolean | false | false |

data.conextMenu

| 参数 | 说明 | 类型 | 默认值 | require | | ---- | ------------------ | ------ | ------ | ------- | | name | 右键菜单列表 title | string | - | true | | data | 右键菜单列表数据   | object | - | false |

treeGraph.Graph

返回图表的载体,等同 G6.Graph 用  法可参考 https://g6.antv.vision/zh/docs/api/Graph

回调参数

treeGraph.conextMenuClick

右键菜单回调函数

| 名称 | 类型 | 描述 | | ---- | ------ | -------------------- | | data | object | conextMenu.data 数据 |

例:treeGraph.conextMenuClick(
  function(data) {}
)