northwoodssoftware / gojs-react Goto Github PK
View Code? Open in Web Editor NEWA set of React components to manage GoJS Diagrams, Palettes, and Overviews
License: Other
A set of React components to manage GoJS Diagrams, Palettes, and Overviews
License: Other
I recently installed gojs-react to my react native app, but I keep getting this error:
TypeError: undefined is not an object (evaluating 'x.navigator.userAgent.indexOf')
Any help on how I can fix this?
Thanks
When I pass new props.project.nodes
array, it gets ignored - however new link in props.project.edges
correctly displays. Is there anything I could be doing wrong?
Both values are obtained through the same GraphQL query.
// Diagram usage
export function ProjectDiagram(props: GetProject) {
return (
<div>
<ReactDiagram
skipsDiagramUpdate={false}
initDiagram={initDiagram}
divClassName="diagram-component"
nodeDataArray={props.project.nodes.map((node) => ({
key: node.uniqueName,
text: node.uniqueName,
}))}
linkDataArray={props.project.edges.map((edge) => ({
key: edge.id,
from: edge.sourceNodeId,
to: edge.targetNodeId,
}))}
onModelChange={handleModelChange}
/>
</div>
);
}
// GraphQL query which's results are in props
export const GET_PROJECT = gql`
query GetProject($id: String!) {
project(id: $id) {
id
name
createdAt
edges {
id
sourceNodeId
targetNodeId
}
nodes {
uniqueName
}
users {
id
role
}
}
}
`;
Hi! I think I found a bug in gojs-react.
Im trying to run my gojs app using React and Electron. During my rewrite I noticed that scrollMargin
parameter in 'go.Diagram' was causing the following errors:
go.js:773 Uncaught TypeError: this.Yq is not a function
at Q.set (go.js:773)
at zj (go.js:651)
at Ll (go.js:929)
at Jl (go.js:924)
at Object.initDiagram (DiagramWrapper.tsx:70)
at ReactDiagram../node_modules/gojs-react/lib/esm/gojsreact.js.ReactDiagram.componentDidMount (gojsreact.js:23)
at commitLifeCycles (react-dom.development.js:22101)
at commitLayoutEffects (react-dom.development.js:25344)
at HTMLUnknownElement.callCallback (react-dom.development.js:336)
at Object.invokeGuardedCallbackDev (react-dom.development.js:385)
and
react-dom.development.js:12212 Uncaught TypeError: this.Yq is not a function
at Q.set (go.js:773)
at zj (go.js:651)
at Ll (go.js:929)
at Jl (go.js:924)
at Object.initDiagram (DiagramWrapper.tsx:70)
at ReactDiagram../node_modules/gojs-react/lib/esm/gojsreact.js.ReactDiagram.componentDidMount (gojsreact.js:23)
at commitLifeCycles (react-dom.development.js:22101)
at commitLayoutEffects (react-dom.development.js:25344)
at HTMLUnknownElement.callCallback (react-dom.development.js:336)
at Object.invokeGuardedCallbackDev (react-dom.development.js:385)
And NOTHING shows on the screen. Even stuff unrelated to GoJS.
It's something about this 'Yq' function. I haven't looked into it deeper. Here's my code for reference:
const diagram =
$(go.Diagram,
{
scrollMargin: 2000,
[other params]
});
const diagram =
$(go.Diagram,
{
[other params]
});
FIX
For anyone having this problem: only removing this parameter worked for me so that's I guess what you have to do until it's fixed if you want your app to show anything.
If anyone knows a workaround without tradeoffs please share.
ReactDiagram uses Model.mergeLinkDataArray() in componentDidMount and componentDidUpdate.
This method pushes users to make key property in linkDataArray, though most of linkDataArray object has no key property.
你好,这个怎么运行呢
Please do not use the GitHub issue tracker, unless you are reporting a potential bug.
For help and support, please use the GoJS forum: https://forum.nwoods.com/c/gojs
os: linux ubuntu 16.04
node: 15.0.1
gojs: 2.1.31
gojs-react: 1.0.10
react: 17.0.1
webpack: 5.10.0
Trying to start following this project README but getting such error. After removing it, gojs start to complain that GraphLinksModel.linkKeyProperty must be not empty string.
Using modelData from https://gojs.net/latest/samples/flowchart.html
Debugging shows that passing modelData, nodeDataArray and linkDataArray to component not helping at all, linkKeyPropety is empty string same as dataArray.
Setting a new NodeDataArray with different group create issue.
Ex array :
[{
key:1
name:"child",
category:"child",
group:2
},
{
key:2
name:"group",
isGroup:true
category:"group"
}]
Then we use setState with :
[{
key:1
name:"child",
category:"child",
},
{
key:2
name:"group",
isGroup:true
category:"group"
}]
And the node "child" will still be inside the group.
It seems like those lines are missing from gojs-react :
diagram.startTransaction(); diagram.updateAllRelationshipsFromData(); diagram.updateAllTargetBindings(); diagram.commitTransaction("update");
Hi.
I have a few different diagrams (Layered, Force, Radial, Sankey, etc) and I wanted to migrate from react-gojs to your official version. First thing I notice it is new addition of the toIncrementalData, this method is called in the onModelChange. So far so good, until we want to disable undoManager. Then onModelChange it is not triggered anymore.
https://codesandbox.io/s/interesting-gauss-9pofo
In that url you could find a modification of your example(https://github.com/NorthwoodsSoftware/gojs-react-basic). The only 2 things I modified from the original it is:
Added console.log in the handleModelChange
in App.tsx
Changed "undoManager.isEnabled": false
in Diagram.tsx
What I detected is in const dataChanges = e.model!.toIncrementalData(e);
in Diagram file it is always null with this options to false, meanwhile if you put to true is working as expected.
I report it as issues because I expected this is called no matter if undoManager is or not enable, but maybe I missing something.
Regards.
I am converting the javascript palette code to reactjs but cant able to pass "myDiagram" object from initDiagram to initPalette. Please provide a way to do it
I checked out the tiger example on your website. Is there a way to use SVGs without having to parse the svg file?
https://github.com/NorthwoodsSoftware/GoJS/blob/master/samples/tiger.html
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.