@@ -4,8 +4,11 @@ section: 1
4
4
tags : []
5
5
---
6
6
import TypeLink from ' ../../components/TypeLink.astro'
7
+ import Video from ' ../../components/Video.astro'
8
+ import videoImage from ' ./yt-react-components_organization-chart.png'
7
9
8
10
# Getting Started
11
+ <Video image = { videoImage } url = " https://youtu.be/bXjnKJkiApo" />
9
12
10
13
## Prerequisites
11
14
@@ -19,95 +22,99 @@ You can learn how to work with the yFiles npm module in our [Developer’s Guide
19
22
20
23
1 . ** Installation**
21
24
22
- In addition to yFiles, the Organization Chart component requires React to be installed in your project.
23
- If you want to start your project from scratch, we recommend using vite:
24
- ```
25
- npm create vite@latest my-orgchart-app -- --template react-ts
26
- ```
25
+ In addition to yFiles, the Organization Chart component requires React to be installed in your project.
26
+ If you want to start your project from scratch, we recommend using vite:
27
+ ```
28
+ npm create vite@latest my-orgchart-app -- --template react-ts
29
+ ```
27
30
28
- Add the yFiles dependency:
29
- ```
30
- npm install <yFiles package path>/lib-dev/yfiles-26.0.0+dev.tgz
31
- ```
31
+ Add the yFiles dependency:
32
+ ```
33
+ npm install <yFiles package path>/lib-dev/yfiles-26.0.0+dev.tgz
34
+ ```
32
35
33
- <details >
36
+ <details >
34
37
35
- <summary >Sample <code >package.json</code > dependencies</summary >
36
- The resulting package.json dependencies should resemble the following:
38
+ <summary >Sample <code >package.json</code > dependencies</summary >
39
+ The resulting package.json dependencies should resemble the following:
37
40
38
- ``` json
39
- "dependencies" : {
40
- "react" : " ^18.2.0" ,
41
- "react-dom" : " ^18.2.0" ,
42
- "yfiles" : " ./lib-dev/yfiles-26.0.0.tgz"
43
- }
44
- ```
45
- </details >
41
+ ``` json
42
+ "dependencies" : {
43
+ "react" : " ^18.2.0" ,
44
+ "react-dom" : " ^18.2.0" ,
45
+ "yfiles" : " ./lib-dev/yfiles-26.0.0.tgz"
46
+ }
47
+ ```
48
+ </details >
46
49
47
- Now, the component itself can be installed:
48
- ``` bash
49
- npm install @yworks/react-yfiles-orgchart
50
- ```
50
+ Now, the component itself can be installed:
51
+ ``` bash
52
+ npm install @yworks/react-yfiles-orgchart
53
+ ```
51
54
52
- 2 . ** License**
55
+ 2 . ** License**
53
56
54
- Be sure to invoke <TypeLink type = " registerLicense" /> before using the Organization Chart React component.
55
- When evaluating yFiles, the license JSON file is found in the ` lib/ ` folder of the yFiles for HTML evaluation package.
56
- For licensed users, the license data is provided separately.
57
+ Be sure to invoke <TypeLink type = " registerLicense" /> before using the Organization Chart React component.
58
+ When evaluating yFiles, the license JSON file is found in the ` lib/ ` folder of the yFiles for HTML evaluation package.
59
+ For licensed users, the license data is provided separately.
57
60
58
- <details >
61
+ <details >
59
62
60
- <summary >License registration</summary >
63
+ <summary >License registration</summary >
61
64
62
- Import or paste your license data and register the license , e .g . in ` App.tsx ` :
65
+ Import or paste your license data and register the license, e.g. in ` App.tsx ` :
63
66
64
- ``` js
65
- import yFilesLicense from ' ./license.json'
67
+ ``` js
68
+ import yFilesLicense from ' ./license.json'
66
69
67
- registerLicense (yFilesLicense)
68
- ```
69
- </details >
70
+ registerLicense (yFilesLicense)
71
+ ```
72
+ </details >
70
73
71
- 3 . ** Stylesheet**
74
+ 3 . ** Stylesheet**
72
75
73
- Make sure to import the CSS stylesheet as well:
76
+ Make sure to import the CSS stylesheet as well:
74
77
75
- ``` js
76
- import ' @yworks/react-yfiles-orgchart/dist/index.css'
77
- ```
78
+ ``` js
79
+ import ' @yworks/react-yfiles-orgchart/dist/index.css'
80
+ ```
78
81
79
- 4 . ** Usage**
82
+ 4 . ** Usage**
80
83
81
- You are now all set to utilize the Organization Chart component with your data!
82
- See a basic example ` App.tsx ` below:
84
+ You are now all set to utilize the Organization Chart component with your data!
85
+ See a basic example ` App.tsx ` below:
83
86
84
- ``` tsx
85
- import {
86
- CustomOrgChartData ,
87
- OrgChart ,
88
- registerLicense
89
- } from ' @yworks/react-yfiles-orgchart'
87
+ ``` tsx
88
+ import {
89
+ CustomOrgChartData ,
90
+ OrgChart ,
91
+ registerLicense
92
+ } from ' @yworks/react-yfiles-orgchart'
90
93
91
- import ' @yworks/react-yfiles-orgchart/dist/index.css'
94
+ import ' @yworks/react-yfiles-orgchart/dist/index.css'
92
95
93
- import yFilesLicense from ' ./license.json'
96
+ import yFilesLicense from ' ./license.json'
94
97
95
- registerLicense (yFilesLicense )
98
+ registerLicense (yFilesLicense )
96
99
97
- const data = [
98
- { id: 0 , name: ' Eric Joplin' , subordinates: [1 , 2 ] },
99
- { id: 1 , name: ' Amy Kain' },
100
- { id: 2 , name: ' David Kerry' }
101
- ] satisfies CustomOrgChartData <{name: string }>
100
+ const data = [
101
+ {id: 0 , name: ' Eric Joplin' , subordinates: [1 , 2 ]},
102
+ {id: 1 , name: ' Amy Kain' },
103
+ {id: 2 , name: ' David Kerry' }
104
+ ] satisfies CustomOrgChartData
105
+ <
106
+ {name : string }>
102
107
103
- function App() {
104
- return <OrgChart data = { data } ></OrgChart >
105
- }
108
+ function App() {
109
+ return <OrgChart data = { data } ></OrgChart >
110
+ }
106
111
107
- export default App
108
- ```
112
+ export default App
113
+ ```
109
114
110
- > ** Note:** By default, the <TypeLink type = " OrgChart" /> component adjusts its size to match the size of its parent element. Therefore, it is necessary to set the dimensions of the containing element or apply styling directly to the <TypeLink type = " OrgChart" /> component. This can be achieved by defining a CSS class or applying inline styles.
115
+ > ** Note:** By default, the <TypeLink
116
+ type = " OrgChart" /> component adjusts its size to match the size of its parent element. Therefore, it is necessary to set the dimensions of the containing element or apply styling directly to the
117
+ <TypeLink type="OrgChart" /> component. This can be achieved by defining a CSS class or applying inline styles.
111
118
112
119
## Learn More
113
120
0 commit comments