Code-to-graph allows you to create simple diagrams using code syntax. This feature is available on Pro, Team, Education, Cacoo for Business MAX, and Free plans.
In this overview, we’ll go over:
- Creating a diagram
- Code-to-graph syntax
- Customizing a diagram
- Managing version history
- Editing a diagram
Creating a diagram
To create a diagram using code-to-graph:
- Select “Code-to-graph” from the tool menu.
- Enter your code syntax in the editor.
- Select “Generate” or, if you changed the code, “Enter.”
In the “Help” menu at the bottom of the editor, you’ll find syntax available for constructing code and example diagrams. Selecting an example diagram automatically adds it to your sheet and populates the code-to-graph editor.
Code-to-graph syntax
Function | Example | Result |
One-to-one connection | a -> b | Creates a connection from shape a to shape b. |
One-to-many connection | a -> b,c,d | Connects shape a to shapes b, c, and d. |
Statement terminator | ; or newline character | Ends a statement |
Text in shapes | [Hello World] or "Hello World" | Creates a rectangle containing the text |
Customizing a diagram
To customize a diagram:
- Select the “Properties” icon at the bottom of the editor.
- Adjust any of the following:
- Node layout: Long straight lines (default), balanced, or vertical aligned
- Line type: Corner (default), straight, or elbows
- Node size
- Vertical spacing: Distance between nodes (default: 50 px)
- Select “Save” to apply changes or “Restore defaults” to restore default properties.
- Select “Generate” to update the editor values.
Managing version history
The last 15 versions of the code history are available via the icon at the bottom of the editor.
You can restore any of the versions by selecting the date from the list, which will populate the editor. Select “Generate” to update the diagram.
Editing a diagram
You can edit a diagram using the code editor or by making changes directly in the diagram.
In the editor, make any changes and select “Generate.”
Changes that can be made directly in the diagram include shape style, text and text style, and node position. Any other types of changes may not sync with the editor.
To clear the code, use the icon at the bottom of the editor. To delete the diagram, select and delete objects directly in the sheet.