Skip to content

Commit ffd7888

Browse files
author
Xing Han Lu
committed
Change App.js react demo data to be local
1 parent 86876e5 commit ffd7888

File tree

2 files changed

+70
-50337
lines changed

2 files changed

+70
-50337
lines changed

src/demo/App.js

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,75 @@
11
/* eslint no-magic-numbers: 0 */
22
import React from 'react';
33
import Cytoscape from '../lib/components/Cytoscape.react.js';
4-
// Data from this example: https://github.com/cytoscape/cytoscape.js/blob/master/documentation/demos/tokyo-railways/tokyo-railways.js
5-
import data from './data.json'
4+
5+
6+
const elements = [
7+
{
8+
data: {id: 'one', label: 'Node 1'},
9+
position: {x: 50, y: 50}
10+
},
11+
{
12+
data: {id: 'two', label: 'Node 2'},
13+
position: {x: 200, y: 200}
14+
},
15+
{
16+
data: {id: 'three', label: 'Node 3'},
17+
position: {x: 100, y: 150}
18+
},
19+
{
20+
data: {id: 'four', label: 'Node 4'},
21+
position: {x: 400, y: 50}
22+
},
23+
{
24+
data: {id: 'five', label: 'Node 5'},
25+
position: {x: 250, y: 100}
26+
},
27+
{
28+
data: {id: 'six', label: 'Node 6', parent: 'three'},
29+
position: {x: 150, y: 150}
30+
},
31+
32+
{data: {
33+
source: 'one',
34+
target: 'two',
35+
label: 'Edge from Node1 to Node2'
36+
}},
37+
{data: {
38+
source: 'one',
39+
target: 'five',
40+
label: 'Edge from Node 1 to Node 5'
41+
}},
42+
{data: {
43+
source: 'two',
44+
target: 'four',
45+
label: 'Edge from Node 2 to Node 4'
46+
}},
47+
{data: {
48+
source: 'three',
49+
target: 'five',
50+
label: 'Edge from Node 3 to Node 5'
51+
}},
52+
{data: {
53+
source: 'three',
54+
target: 'two',
55+
label: 'Edge from Node 3 to Node 2'
56+
}},
57+
{data: {
58+
source: 'four',
59+
target: 'four',
60+
label: 'Edge from Node 4 to Node 4'
61+
}},
62+
{data: {
63+
source: 'four',
64+
target: 'six',
65+
label: 'Edge from Node 4 to Node 6'
66+
}},
67+
{data: {
68+
source: 'five',
69+
target: 'one',
70+
label: 'Edge from Node 5 to Node 1'
71+
}},
72+
];
673

774
class App extends React.Component {
875
constructor(props) {
@@ -11,7 +78,7 @@ class App extends React.Component {
1178

1279
render() {
1380
return <Cytoscape
14-
elements={data.elements}
81+
elements={elements}
1582
/>
1683
}
1784
}

0 commit comments

Comments
 (0)