@@ -4,8 +4,11 @@ section: 1
44tags : []
55---
66import TypeLink from ' ../../components/TypeLink.astro'
7+ import Video from ' ../../components/Video.astro'
8+ import videoImage from ' ./yt-react-components_organization-chart.png'
79
810# Getting Started
11+ <Video image = { videoImage } url = " https://youtu.be/bXjnKJkiApo" />
912
1013## Prerequisites
1114
@@ -19,95 +22,99 @@ You can learn how to work with the yFiles npm module in our [Developer’s Guide
1922
20231 . ** Installation**
2124
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+ ```
2730
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+ ```
3235
33- <details >
36+ <details >
3437
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:
3740
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 >
4649
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+ ```
5154
52- 2 . ** License**
55+ 2 . ** License**
5356
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.
5760
58- <details >
61+ <details >
5962
60- <summary >License registration</summary >
63+ <summary >License registration</summary >
6164
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 ` :
6366
64- ``` js
65- import yFilesLicense from ' ./license.json'
67+ ``` js
68+ import yFilesLicense from ' ./license.json'
6669
67- registerLicense (yFilesLicense)
68- ```
69- </details >
70+ registerLicense (yFilesLicense)
71+ ```
72+ </details >
7073
71- 3 . ** Stylesheet**
74+ 3 . ** Stylesheet**
7275
73- Make sure to import the CSS stylesheet as well:
76+ Make sure to import the CSS stylesheet as well:
7477
75- ``` js
76- import ' @yworks/react-yfiles-orgchart/dist/index.css'
77- ```
78+ ``` js
79+ import ' @yworks/react-yfiles-orgchart/dist/index.css'
80+ ```
7881
79- 4 . ** Usage**
82+ 4 . ** Usage**
8083
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:
8386
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'
9093
91- import ' @yworks/react-yfiles-orgchart/dist/index.css'
94+ import ' @yworks/react-yfiles-orgchart/dist/index.css'
9295
93- import yFilesLicense from ' ./license.json'
96+ import yFilesLicense from ' ./license.json'
9497
95- registerLicense (yFilesLicense )
98+ registerLicense (yFilesLicense )
9699
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 }>
102107
103- function App() {
104- return <OrgChart data = { data } ></OrgChart >
105- }
108+ function App() {
109+ return <OrgChart data = { data } ></OrgChart >
110+ }
106111
107- export default App
108- ```
112+ export default App
113+ ```
109114
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.
111118
112119## Learn More
113120
0 commit comments