Really Struggling
See original GitHub issueHello all, First and foremost, I’m a complete n00b to react and webpack. But I’d really like to use react-diagrams in my project, but can’t seem to get it to render properly.
Here is what I’ve done so far:
- cd into my project folder
- ran
npm install --save storm-react-diagrams
- Created a new page on my site and added the following code to it:
import React, { Component } from 'react';
import {
DiagramEngine,
DiagramModel,
DefaultNodeModel,
LinkModel,
DefaultPortModel,
DiagramWidget,
DefaultLinkModel
} from "storm-react-diagrams";
//1) setup the diagram engine
var engine = new DiagramEngine();
engine.installDefaultFactories();
//2) setup the diagram model
var model = new DiagramModel();
//3-A) create a default node
var node1 = new DefaultNodeModel("Node 1", "rgb(0,192,255)");
var port1 = node1.addPort(new DefaultPortModel(false, "out-1", "Out"));
node1.x = 100;
node1.y = 100;
//3-B) create another default node
var node2 = new DefaultNodeModel("Node 2", "rgb(192,255,0)");
var port2 = node2.addPort(new DefaultPortModel(true, "in-1", "IN"));
node2.x = 400;
node2.y = 100;
//3-C) link the 2 nodes together
var link1 = new LinkModel();
link1.setSourcePort(port1);
link1.setTargetPort(port2);
//4) add the models to the root graph
model.addNode(node1);
model.addNode(node2);
model.addLink(link1);
//5) load model into engine
engine.setDiagramModel(model);
class SandboxPage extends Component {
render() {
return (
<div>
<DiagramWidget diagramEngine={engine} />
</div>
);
}
}
export default SandboxPage;
But the page renders like this:
I pretty much copied the code from the simple demo example, but obviously, something is wrong.
Any help would be appreciated.
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (2 by maintainers)
Top Results From Across the Web
SAMHSA's National Helpline
Created for family members of people with alcohol abuse or drug abuse problems. Answers questions about substance abuse, its symptoms, different ...
Read more >Signs you may be struggling to cope - Samaritans
Struggling to cope with everyday life doesn't look or feel the same in everyone. We can't generalise about how it'll make you feel...
Read more >I Am Struggling - Please Live
What if you're struggling day in and day out and you don't really know why? If you're feeling this way, chances are you...
Read more >10 Things to Remember When You're Struggling & Feel Stuck
1. The problem is a symptom of something else. · 2. You are never alone. · 3. You can overcome. · 4. People...
Read more >What to do When You're Struggling Mentally
Talk to Someone You Trust. If you're struggling mentally, it's important to reach out for help. · Exercise and Eat Healthy. It's no...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
import “@projectstorm/react-diagrams/dist/style.min.css”; is not working for the latest update, can anyone help me on it.
then
but then the links only show on hover.