Skip to content

Commit 4136a4a

Browse files
committed
feat: update docs
1 parent 21f5172 commit 4136a4a

33 files changed

+203
-53
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { useState, useEffect, useLayoutEffect } from 'react';
2+
import { useTheme } from './useTheme';
3+
export function useUrlChange() {
4+
const [currentUrl, setCurrentUrl] = useState('');
5+
6+
// 处理 URL 变化的通用函数
7+
const handleUrlChange = () => {
8+
const newUrl = window.location.href;
9+
setCurrentUrl(newUrl); // 更新状态
10+
};
11+
12+
useEffect(() => {
13+
// 保存原始的 pushState 和 replaceState 方法
14+
const originalPushState = history.pushState;
15+
const originalReplaceState = history.replaceState;
16+
17+
// 重写 pushState 方法
18+
history.pushState = function (...args) {
19+
originalPushState.apply(this, args);
20+
window.dispatchEvent(new Event('urlchange'));
21+
};
22+
23+
// 重写 replaceState 方法
24+
history.replaceState = function (...args) {
25+
originalReplaceState.apply(this, args);
26+
window.dispatchEvent(new Event('urlchange'));
27+
};
28+
29+
// 监听 popstate 事件(浏览器前进/后退)
30+
window.addEventListener('popstate', handleUrlChange);
31+
32+
// 监听自定义的 urlchange 事件
33+
window.addEventListener('urlchange', handleUrlChange);
34+
35+
// 清理监听器
36+
return () => {
37+
window.removeEventListener('popstate', handleUrlChange);
38+
window.removeEventListener('urlchange', handleUrlChange);
39+
};
40+
}, []); // 不依赖任何变量
41+
42+
return { currentUrl, handleUrlChange };
43+
}
44+
45+
export const useImageTheme = () => {
46+
const theme = useTheme();
47+
const { currentUrl } = useUrlChange();
48+
useLayoutEffect(() => {
49+
let timer = setTimeout(() => {
50+
const images = document.getElementsByTagName('img');
51+
for (let i = 0; i < images.length; i++) {
52+
const image = images[i];
53+
image.style.filter = theme === 'light' ? 'none' : 'invert(1)';
54+
}
55+
}, 16);
56+
return () => {
57+
clearTimeout(timer);
58+
};
59+
}, [theme, currentUrl]);
60+
61+
return null;
62+
};

docs/interactive/pages/_app.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
// import "../styles.css";
2-
1+
2+
import React, { useEffect } from 'react';
3+
import { useImageTheme } from '../components/Hooks/useUrl'
34
export default function ReadingNotes({ Component, pageProps }) {
5+
useImageTheme()
46
return <Component {...pageProps} />;
57
}
8+
9+
10+

docs/interactive/pages/interactive/visualization/_meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"introduction": "Introduction",
33
"create_graph": "Create Graph",
44
"data_modeling": "Visual Modeling",
5+
"visual_importing": "Visual Importing",
56
"data_querying": "Visual Querying",
67
"data_exploration": "Visual Exploration"
78
}

docs/interactive/pages/interactive/visualization/create_graph.mdx renamed to docs/interactive/pages/interactive/visualization/create_graph.md

File renamed without changes.

docs/interactive/pages/interactive/visualization/data_exploration.mdx renamed to docs/interactive/pages/interactive/visualization/data_exploration.md

File renamed without changes.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: Visual Modeling
3+
---
4+
5+
After creating the draft instance, we need to click on "Modeling" to enter the visual graph modeling page.
6+
Here, we have two ways to build the model:
7+
8+
## Create Graph Model
9+
10+
### Options 1: Manual Creation
11+
12+
#### Create Vertex and Vertex Properties
13+
14+
We need to click the fourth button, "Create new vertex," in the sidebar to create a node on the canvas. The initial name of the node will be "Vertex_1.
15+
16+
After clicking on the node, we can manually modify its label in the right-hand panel, or simply double-click the node to edit it directly on the canvas.
17+
<img src="/visualization/modeling/add_vertex_edit.png" />
18+
19+
Next, following the prompts, we need to complete the property information for this node. Click the "Plus" button under Properties to add attributes, and fill them out one by one.
20+
<img src="/visualization/modeling/add_property.png" />
21+
22+
If we want to delete a node’s property, check the properties you wish to remove in the Checkbox area and click the delete button.
23+
<img src="/visualization/modeling/delete_property.png" />
24+
25+
#### Create Edges
26+
27+
Now let's create edges. To create an edge, hover over the edge of the starting node, then click and drag.
28+
<img src="/visualization/modeling/drag_start.png" />
29+
30+
If the endpoint is an empty area of the canvas, a new node will automatically be created.
31+
<img src="/visualization/modeling/drag_end.png" />
32+
33+
If the endpoint is another existing node, an edge will be established between the two nodes.
34+
<img src="/visualization/modeling/drag_other_edge_end.png" />
35+
36+
### Option 2: Parsing CSV Files for Creation
37+
38+
Manually creating a graph model is particularly helpful when designing complex business models. However, when we already have some graph data, automatically deriving the graph model based on the existing data becomes a more convenient approach.
39+
40+
Note: There are two constraints for the CSV files here:
41+
42+
- Each CSV file, by default, represents one type of label. The file name should ideally be the label name, such as person.csv.
43+
- The CSV file must include a header row.
44+
45+
When the above two requirements are met, we can utilize the "Automatic Parsing and Modeling" feature provided by GraphScope Portal, which is located in the second option of the right-hand sidebar.
46+
<img src="/visualization/modeling/auto_parse_1.png" />
47+
48+
After uploading the data, we only need to verify each CSV file to ensure that the automatically inferred node and edge types are accurate.
49+
50+
<img src="/visualization/modeling/auto_parse_2.png" />
51+
52+
Once confirmed, we can click "Generate Graph Model" , and the system will automatically derive the graph model.
53+
54+
<img src="/visualization/modeling/auto_parse_3.png" />
55+
56+
## Save Model
57+
58+
Once the model is created and passes the system's validation, we can save the model. Here,there are two key points that <strong> require special attention:</strong>
59+
60+
> - Each `vertex label` must have a `primary key` in its properties, and each `edge label` can only have one property field.
61+
> - <span style='color:red'>The `GraphScope Interactive` engine does not support modifications to the graph model. If you need to modify the graph model, you must create a new graph instance.</span>
62+
63+
<img src="/visualization/modeling/save_model.png" />
64+
65+
Now, let's goto importing page

docs/interactive/pages/interactive/visualization/data_modeling.mdx

Lines changed: 0 additions & 46 deletions
This file was deleted.

docs/interactive/pages/interactive/visualization/data_querying.mdx renamed to docs/interactive/pages/interactive/visualization/data_querying.md

File renamed without changes.
907 KB
Loading

docs/interactive/pages/interactive/visualization/introduction.mdx renamed to docs/interactive/pages/interactive/visualization/introduction.md

File renamed without changes.

0 commit comments

Comments
 (0)