Giter Club home page Giter Club logo

graphin's Introduction

Graphin

A React toolkit for graph analysis based on G6

Version NPM downloads Latest commit

English | 简体中文

🌾 New Products!

2022.06.06, this day coincides with the 4th anniversary of the open source of G6, which is also the traditional Chinese solar term: "Grain in Ear", G6VP, a new product in the direction of graph analysis. Users can complete the visualization, exploration and analysis tasks of relational data online without code development. You can also export the SDK with one click and integrate it into the business system to help developers improve R&D efficiency.

The SDK exported by G6VP is encapsulated based on Graphin. If you want to understand the capabilities of Graphin, you can take a look at the product G6VP

demo2

✨ Features

🎨 Good-looking elements, standardized style configuration

Graphin standardizes the visual mapping of graph elements. A Graphin's built-in node contains 5 parts: keyshape, label, halo, icon, and badges, each part can be driven by data. The built-in edges include three parts: keyshape, label, and halo. There are also corresponding style configurations for commonly used features, such as label backgrounds, self-loops, polygons, and dashed lines, etc. Try it online

node-style edge-style

📦 Automatic layout, easy to handle complex scenarios

Graphin has 10 built-in network graph layouts and 4 tree graph layouts to meet your needs of layout for different data types and different analysis scenarios. For features in complex business scenarios, such as layout switching, dynamic layouts, sub-graph layouts, etc., can be easily realized through data-driven layout. Try it online

node-expand layout-switch

📝 Thoughtful interactions, easy to customize

Graphin provides 13 interactive components, including canvas zooming, panning, brush selection, lasso select , automatic resize, and also element dragging, selection, hovering, highlighting, expanding and collapsing, etc., to meet your interactive needs for different analysis scenarios Try it online

behaviors

🚀 Rich components, derived from precipitation of business development

Currently Graphin provides 7 analysis components: ContextMenu, Tooltip, MiniMap, Toolbar, FishEye, Hull, and Legend. 17+ analysis components will be provided in the future. Try it online components

⚙️ Comfortable development experience, in line with React users' cognition

typescript

🖥 Browser support

  • Graphin icons use Proxy, the font icon may not be displayed correctly on some browsers that do not support Proxy syntax
  • The Graphin rendering engine of Graphin is G6, which relies on the browser API and does not support SSR
IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
IE11, Edge last 2 versions last 2 versions last 2 versions

📦 Installation

If you are using React, then you can use Graphin as a normal React component.

It uses yarn to install dependencies in this article, while npm is also fine. The following commands install Graphin's core components @antv/graphin and analysis components @antv/graphin-components, and Graphin's official icon library @antv/graphin-icons

yarn add @antv/graphin@latest --save
yarn add @antv/graphin-components@latest --save
yarn add @antv/graphin-icons --save

🔨 Usage

Use Graphin Core Component

import React from 'react';
import Graphin from '@antv/graphin';
// mock data
const data = Utils.mock(10).circle().graphin();
export default () => {
  return <Graphin data={data} />;
};

Use Graphin Analysis Components

import React from 'react';
import Graphin, { Components, Utils } from '@antv/graphin';
const { MiniMap } = Components;
// mock data
const data = Utils.mock(10).circle().graphin();
export default () => {
  return (
    <Graphin data={data}>
      <MiniMap />
    </Graphin>
  );
};

Use Graphin font icon

import React from 'react';
import Graphin from '@antv/graphin';
// Import icon resource files
import iconLoader from '@antv/graphin-icons';
import '@antv/graphin-icons/dist/index.css';
// mock data
const data = Utils.mock(10).circle().graphin();
// Register in Graphin
const { fontFamily, glyphs } = iconLoader();
const icons = Graphin.registerFontFamily(iconLoader);
// Use icons
data.nodes.forEach(node => {
  node.style = {
    icon: {
      type: 'font', // Specify the icon to be Font type
      fontFamily: fontFamily, // Specify FontFamily
      value: icons.home, // Specify the value of the icon
    },
  };
});
export default () => {
  return <Graphin data={data} />;
};

👨‍💻 Upgrade Guide

If you are a user from Graphin1.x, this Upgrade Guide may help you. If you encounter upgrade problems, you can go to github issue section, and feel free to create issues if it's not already there.

⌨️ Development Guide

If you want to run Graphin locally, you may wish to read this Contribution Guide. We hope more contributors can join our team to make Graphin better together.

More Info

graphin's People

Contributors

aarebecca avatar afc163 avatar baizn avatar blakko avatar brickmaker avatar budlion avatar codesarehonest avatar daniele-pini avatar dependabot-preview[bot] avatar dukesun99 avatar dulinrain avatar femiabdul avatar gazzamc avatar genert avatar jiangjun1994 avatar lloydzhou avatar niknbr avatar nwulqx avatar otto-j avatar pomelo-nwu avatar songhn233 avatar timlrx avatar totogo avatar v-jiepeng avatar xdddst avatar yangzy0603 avatar yanyan-wang avatar yjtm-1119 avatar yuiseki avatar zxc0328 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphin's Issues

Feature:力导支持向心力配置

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

支持vue吗

请问支持vue吗
具体怎么使用,谢谢

首页图片被压缩

Describe the bug

image

To Reproduce

https://graphin.antv.vision/zh

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

框选功能

你好,有没有框选多个节点或者边的功能,可以那道框选节点边的数据

节点类型声明

export interface Node {
    /** 节点源数据 */
    data: {
        /** 唯一标示ID,必选 */
        id: string;
        /** 节点数据类型 */
        type?: string;
        /** 节点文本 */
        label?: string;
        /** 节点属性 */
        properties?: any[]; // eslint-disable-line
    };
    /** 唯一标示ID,必选 */
    id: string;
    /** 节点类型 */
    shape?: string;
    /** 节点样式 */
    style?: Partial<NodeStyle>;
    /** 节点位置信息 */
    x?: number;
    y?: number;
    /** 内置的布局,追加的额外属性 */
    layout?: NodeLayoutType;
    /** 节点度数 */
    degree?: number;
    searchTypes?: string[];
}

想问一下,节点类型用string声明似乎不太方便,之后会调整吗?

Feature:Need to add a lock state to the node

Description: If the node is in the lock state, it will not participate in the layout. For example, in the force layout, the locked node will be fixed in place.

-- zh-CN --

功能描述:节点为lock状态,则不参与布局。比如在力导布局中,锁定的节点会固定在原处。

内置的icon无法显示

我本地运行能正常显示节点里面的图标,然后编译发布到dev环境后图标就显示不出来了,是什么原因呢?

ctrl+左键进行多选节点

如题,目前平台没有多选功能,期望能够增加节点多选。比如在多选操作之后,进行统一拖拽,统一扩展节点,统一合并到一个组等等的多节点操作。期望能够优先增强这些基础能力。

Sent with GitHawk

边优化

  • 边文字优化
    • 边文字背景
    • 自环边文字位置
  • 多边
  • 粗边
  • 边动画

TypeError: Cannot read property 'Marker' of undefined

package.json
{
"name": "data-driven",
"version": "1.0.0",
"description": "",
"keywords": [],
"main": "src/index.js",
"dependencies": {
"@antv/graphin": "1.0.3",
"antd": "3.25.2",
"react": "16.12.0",
"react-dom": "16.12.0",
"react-scripts": "3.3.1"
},
"devDependencies": {
"typescript": "3.7.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}

版本1.0.3,1.0.2运行报错,把@antv/graphin版本降到1.0.1好了

SubLayout 子图布局

Graphin 通过数据和布局驱动,支持子图布局。

  • 1.支持稳定布局算法的子图布局,比如Graphin.Layout.circle + Graphin.Layput.radial
  • 2.支持力导布局算法的子图布局,比如Graphin.Layout.force + Graphin.Layput.circle

📝 图可视分析 参考案例

https://help.aliyun.com/video_detail/63227.html?spm=a2c4g.11186623.4.5.7b57af833Sm9xs
https://grapheco.github.io/InteractiveGraph/dist/examples/example1.html
国内一些不错的案例产品,可以参考一些功能和操作形态!
本热使用过一些开源的软件,cytoscape (客户端版本)针对图的操作还是不错的,和gephi各有千秋
而针对品质来讲cytoscape更胜一筹,但是cytoscape有点太专业,尤其是左侧的针对图的操作见仁见智。
综上,I+平台的针对国内可视化网络分析的使用习惯,还是有很多借鉴的意义的。

不渲染 ,控制台输出: effect did-mount

Describe the bug
不渲染 ,控制台输出: effect did-mount
To Reproduce

// Add Code Sanbox reproduce link using this template: https://codesandbox.io/s/data-driven-3o71b

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • OS: [windows 10]
  • Browser [ chrome]
  • Version [1.0.0]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

document typo of Graphin

https://graphin.antv.vision/zh/docs/manual/main-concepts/data

trasform

<Graphin data={transform.(data)} />;

const trasform = (data: { nodes: NodeData[]; edges: EdgeData[] }) => {
    const nodes = (nodes: NodeData[]) => {
        return nodes.map(node => {
            return {
                id: node.id,
                data: node,
                // 根据type来指定渲染的shape
                shape: node.type === 'phone' ? 'MyCustomNode' : 'CircleNode',
                // 根据数据的渲染样式
                style: {
                    nodeSize: node.weight > 20 ? 50 : 20,
                },
            };
        });
    };
    const edges = (edges: EdgeData[]) => {
        return edges;
    };
    return {
        nodes: transform.nodes(data.nodes),
        edges: transform.edges(data.edges),
    };
};

<Graphin data={transform.(data)} />;

基础功能建议

针对选中节点需要提供如下操作:
1、隐藏节点、显示隐藏的节点、删除节点,恢复隐藏;删除和隐藏节点后,将图形界面上的和选中节点的边也隐藏或删除。
2、可以针对选中的节点(可能是多个)设置:大小,高亮,填充、颜色,标签(可多值)、轮廓、背景图片等主要控制显示的属性。
3、针对选中节点可以合并成一个Group,并对Group名称,类型、样式等参数提供编辑、如:将N个对象合并成一个群体。合并之后,节点隐藏,组节点显示。
4、针对Group类型的节点,支持“展开”操作,节点的组合和展开可以执行多次,即节点之间、节点与组,组之间可以反复组合和展开。
组合后,组外其他关联组内节点的边需要和组发生链接。(需要平衡边的显示方式)

选中边:
1、可设置边的颜色、线条、方向(最好能够无向图和有向图的混合显示,即画布上一部分节点之间是无向关联的,一部分是有向关联)、边粗细(体现关系密切程度,可考虑权重)、边的Label(针对复杂多类型关系网络关系类型很重要)。
2、边需要提供事件响应,比如:点击或双击边之后,右侧显示关系构成的情况,时间,内容等。

暂时先梳理了一些最为基础的功能要求。希望官方能够仔细参考,完善。

graphin-components 在 TS 项目中无法使用

Describe the bug
A clear and concise description of what the bug is.

使用 TS 的时候发现没有 types,看了一下 package.json 是指定了的,但是 types 在 ./dist/src/index.dsrc 被 .npmignore 忽略掉了。

"types": "./dist/src/index.d",

To Reproduce

// Add Code Sanbox reproduce link using this template: https://codesandbox.io/s/data-driven-3o71b

Expected behavior
A clear and concise description of what you expected to happen.

TS 项目能正常引入组件。

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Featrue : Need to support custom icons

Graphin needs a built-in icon library to help users set the icon for the node. There is also a need to support third-party icon libraries.

The method of extend.marker needs to be discarded,svg2marker seems to be a bit problem in rendering icons in @antv/g

--- zh-CN ---

Graphin需要一个内置的图标库,帮助用户设置节点的图标。同时也需要支持第三方图标库. Extend.marker_ 的方法需要废弃,svg2marker 在g中渲染图标似乎有点问题

Graphin Gallery

We need a Graphin gallery to help users quickly understand what Graphin can do.
Currently, a demo of graphin-studio is not enough. Part of the gallery is used for the demonstration of our basic capabilities, and part of it is used for the demonstration of richer demos.

---- zh-CN ---
我们需要一个Graphin的画廊,帮助用户快速了解Graphin能做那些事情
目前仅graphin-studio一个demo是不够的,画廊一部分用于我们基础能力的演示,一部分用与于更丰富的demo的展示

添加事件双击节点连线, 单击空白处删除连线, 报错

Describe the bug
image
添加事件双击节点连线, 单击空白处删除连线, 报错

"edge:click": "_click"

// 报错行 \graphin\packages\graphin\src\behaviors\graphin-highlight.ts
if (id === sourceNode.get('id') || id === targetNode.get('id')) {

To Reproduce
@镜曦 https://codesandbox.io/s/nodeedgestyle-n0rl4

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • OS: [windows]
  • Browser [chrome]
  • Version [ 78.0.3904.108]

网站菜单色彩问题

Describe the bug

image

To Reproduce

Visit:https://graphin.antv.vision/zh/examples/render/save

Expected behavior

应该和其他站点一样是紫色主色。

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

G6的Option,传入没有效果

https://graphin.antv.vision/zh/docs/api/graphin#options
说,“另外,这个 props.options 也支持传入 G6 的 Options。详见 G6 Options。”
但是,g6的option,fitView,autoPaint:true传入没有效果。
<Graphin data={transform(import_data)}
options = {{pixelRatio :100, keyShapeZoom:0.001, fitView:true, autoPaint:true}}
layout={{
name: "dagre",
options: {
center: [window.innerWidth / 3, window.innerHeight / 3], // 可选,中心点坐标
nodeSize: [15, 15], // 可选,节点大小
nodesep: 12, // 可选, 节点水平间距(px)
ranksep: 15, // 可选, 每一层节点之间间距
align: "UL", // 可选, 放置位置
rankdir: 'LR',
}
}}>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.