canvas
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJSON Canvas Visualizer
JSON Canvas 可视化工具
Quick Start: Define nodes with , , , , , → Plan layout on 100px grid → Connect edges with / → Apply colors (1-6) → Wrap in fence. Origin (0,0) at top-left, X right, Y down. Obsidian Canvas compatible.
idtypexywidthheightfromNodetoNode```canvas快速入门: 定义包含、、、、、的节点 → 在100px网格上规划布局 → 使用/连接边 → 应用颜色(1-6) → 包裹在代码块中。原点(0,0)位于左上角,X轴向右,Y轴向下。兼容Obsidian Canvas。
idtypexywidthheightfromNodetoNode```canvasCritical Syntax Rules
关键语法规则
1. Structure Format
1. 结构格式
canvas
{
"nodes": [
{"id": "n1", "type": "text", "text": "Node 1", "x": 0, "y": 0, "width": 120, "height": 50}
],
"edges": []
}canvas
{
"nodes": [
{"id": "n1", "type": "text", "text": "Node 1", "x": 0, "y": 0, "width": 120, "height": 50}
],
"edges": []
}2. Node Types
2. 节点类型
| Type | Required Fields | Purpose |
|---|---|---|
| | Display custom text content |
| | Reference external files |
| | External URL references |
| | Visual container for grouping |
| 类型 | 必填字段 | 用途 |
|---|---|---|
| | 显示自定义文本内容 |
| | 引用外部文件 |
| | 引用外部URL |
| | 用于分组的可视化容器 |
3. Required Node Attributes
3. 节点必填属性
All nodes require: , , , , ,
idtypexywidthheight所有节点均需包含:、、、、、
idtypexywidthheight4. Color Presets
4. 颜色预设
| Value | Color |
|---|---|
| Red |
| Orange |
| Yellow |
| Green |
| Cyan |
| Purple |
| 值 | 颜色 |
|---|---|
| 红色 |
| 橙色 |
| 黄色 |
| 绿色 |
| 青色 |
| 紫色 |
5. Edge Connections
5. 边连接
json
{
"id": "e1",
"fromNode": "n1",
"fromSide": "right",
"toNode": "n2",
"toSide": "left",
"toEnd": "arrow"
}json
{
"id": "e1",
"fromNode": "n1",
"fromSide": "right",
"toNode": "n2",
"toSide": "left",
"toEnd": "arrow"
}6. Coordinate System
6. 坐标系
- Origin (0,0) at top-left
- X increases to the right
- Y increases downward
- 原点(0,0)位于左上角
- X轴向右递增
- Y轴向下递增
7. Node Sizing
7. 节点尺寸设置
- Consider text content when setting node dimensions
- Multi-line text requires more height to display all lines
- Long words require more width to avoid overflow
- 设置节点尺寸时需考虑文本内容
- 多行文本需要更大的高度以显示所有行
- 长单词需要更大的宽度以避免溢出
Common Pitfalls
常见问题与解决方法
| Issue | Solution |
|---|---|
| Nodes overlapping | Increase spacing (100+ px) |
| Edges not visible | Verify |
| Invalid JSON | Check quotes and commas |
| IDs invalid | Use only a-z, A-Z, 0-9, -, _ |
| 问题 | 解决方案 |
|---|---|
| 节点重叠 | 增加间距(100px以上) |
| 边不可见 | 验证 |
| JSON无效 | 检查引号和逗号 |
| ID无效 | 仅使用a-z、A-Z、0-9、-、_ |
Output Format
输出格式
markdown
```canvas
{
"nodes": [...],
"edges": [...]
}
```markdown
```canvas
{
"nodes": [...],
"edges": [...]
}
```Related Files
相关文件
For detailed syntax and advanced features, refer to references below:
- syntax.md — Complete attribute reference: node types, edge properties, group styling, and advanced examples
如需了解详细语法和高级功能,请参考以下资料:
- syntax.md — 完整属性参考:节点类型、边属性、分组样式及高级示例