Gathering detailed insights and metrics for react-gojs
Gathering detailed insights and metrics for react-gojs
Gathering detailed insights and metrics for react-gojs
Gathering detailed insights and metrics for react-gojs
gojs-react
A set of React components to manage GoJS Diagrams, Palettes, and Overviews
eigen-gojs
基于gojs封装的编辑器组件,参考[AntV g6-editor](https://www.yuque.com/antv/g6-editor)设计,目前仅提供react版本
peacetrue-gojs
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
custome-go-react
A set of React components to manage GoJS Diagrams, Palettes, and Overviews
npm install react-gojs
Typescript
Module System
Node Version
NPM Version
TypeScript (80.97%)
JavaScript (19.03%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
61 Stars
149 Commits
23 Forks
8 Watchers
1 Branches
20 Contributors
Updated on Oct 13, 2024
Latest Version
4.9.0
Package Id
react-gojs@4.9.0
Unpacked Size
53.96 kB
Size
13.65 kB
File Count
18
NPM Version
6.14.6
Node Version
12.18.3
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
:warning: react-gojs is no longer under active development. Now, Northwoods provides an official React integration for GoJS: https://github.com/NorthwoodsSoftware/gojs-react. I will not add new features to this lib, only bug fixes. The migration to the official library is pretty easy. I migrated my example here.
react-gojs is a GoJS React integration.
Install it from npm. It has peer dependencies of react and react-dom, which will have to be installed as well.
1npm install --save react-gojs
or:
1yarn add react-gojs
Import GojsDiagram
in your React component:
1import GojsDiagram from 'react-gojs';
To create a GoJS diagram, just use the GojsDiagram React component:
1<GojsDiagram 2 diagramId="myDiagramDiv" 3 model={this.props.model} 4 createDiagram={this.createDiagram} 5 className="myDiagram" 6 onModelChange={this.modelChangedhandler} 7 updateDiagramProps={this.updateDiagramProps} 8/>
GojsDiagram is a generic React component which is responsible for rendering and updating (when the model changes) the diagram. The render step is based on the model and the go.Diagram object provided as props. It acts as a go.Diagram wrapper.
GojsDiagram props:
Model type: DiagramModel<N extends BaseNodeModel, L extends LinkModel>
Example (Typescript / Javascript):
1const model = { 2 nodeDataArray: [ 3 { key: 'Alpha', color: 'lightblue' }, 4 { key: 'Beta', color: 'orange' }, 5 { key: 'Gamma', color: 'lightgreen' }, 6 { key: 'Delta', color: 'pink' }, 7 { key: 'Omega', color: 'grey' } 8 ], 9 linkDataArray: [ 10 { from: 'Alpha', to: 'Beta' }, 11 { from: 'Alpha', to: 'Gamma' }, 12 { from: 'Beta', to: 'Delta' }, 13 { from: 'Gamma', to: 'Omega' } 14 ] 15};
Typescript example:
1const createDiagram = (diagramId: string): Diagram => {
2 const $ = go.GraphObject.make;
3
4 const myDiagram: Diagram = $(go.Diagram, diagramId, {
5 initialContentAlignment: go.Spot.LeftCenter
6 });
7
8 myDiagram.nodeTemplate = $(
9 go.Node,
10 'Auto',
11 $(go.Shape, 'RoundedRectangle', { strokeWidth: 0 }, new go.Binding('fill', 'color')),
12 $(go.TextBlock, { margin: 8 }, new go.Binding('text', 'key'))
13 );
14
15 return myDiagram;
16};
Javascript (ES6) example:
1const createDiagram = diagramId => {
2 const $ = go.GraphObject.make;
3
4 const myDiagram = $(go.Diagram, diagramId, {
5 initialContentAlignment: go.Spot.LeftCenter
6 });
7
8 myDiagram.nodeTemplate = $(
9 go.Node,
10 'Auto',
11 $(go.Shape, 'RoundedRectangle', { strokeWidth: 0 }, new go.Binding('fill', 'color')),
12 $(go.TextBlock, { margin: 8 }, new go.Binding('text', 'key'))
13 );
14
15 return myDiagram;
16};
Example:
1.myDiagram { 2 width: 70%; 3 height: 400px; 4}
For example, in a Redux environment, the diagram model should be immutable (and stored in the redux store). The onModelChange handler can dispatch actions to update the model.
Example 1:
const updateDiagramProps = (myDiagram: Diagram): void => {
myDiagram.layout = go.GraphObject.make(go.LayeredDigraphLayout, { direction: 90 });
// User can add more properties here.
};
Example 2:
const updateDiagramProps = (myDiagram: Diagram): void => {
// Empty method.
};
Typescript: You can find a react / redux / react-gojs example + live demo here.
Javascript (ES6): You can find a react / react-gojs example + live demo here.
yarn install
yarn build
yarn test
git checkout -b my-new-feature
yarn lint
git commit -am 'Add some feature'
git push origin my-new-feature
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 20/22 approved changesets -- score normalized to 9
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
60 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More