Commands
Every change to a chart or a diagram is a command. Each one is described in full on the page of its topic.
AlphaPilot program
editor.commands.updateChartSpec({ spec: { type: 'area', stacked: true } })
editor.chain().focus().insertDiagramInput({ type: 'pie' }).run()How every command behaves
A command that takes pos acts on the chart or diagram at that position. Without pos, it acts
on the selected one. When there is nothing to act on, it returns false and changes nothing.
You never need a command to read a chart or a diagram. The functions that read them are on
editor.storage.diagrams.
Charts
| Command | What it does | Page |
|---|---|---|
insertChart | Inserts a chart from Chart Data and a Chart Spec | Charts |
insertChartFrom | Inserts a chart written in a registered format | Charts |
importMermaidChart | Inserts a chart from Mermaid chart source, such as pie | Charts |
insertFromText | Inserts whatever a text is, as a paste would | Pasting |
convertCodeBlockToChart | Replaces a code block of Mermaid chart source with the chart | Charts |
insertDiagramInput | Opens an empty Quick Input | Charts |
updateChartSpec | Changes fields of the Chart Spec | Appearance |
setChartRenderer | Chooses the Renderer of one chart | Appearance |
updateChartAxis | Changes one axis: title, range, lines, step, labels | Axes |
applyChartLook | Gives a chart the look of another one | Looks |
convertChartToImage | Replaces a chart with an image of it | Export |
convertImageToChart | Turns such an image back into the chart | Export |
redrawChartImage | Draws such an image again from the chart it keeps | Export |
Data
| Command | What it does | Page |
|---|---|---|
updateChartData | Replaces the Chart Data | Data |
setChartLabelColumn | Chooses the column that names the rows | Data |
setChartSeriesIn | Swaps rows and columns of what is drawn | Data |
updateChartFrom | Replaces data and spec from text in a format | Data |
updateChartFromGrid | Replaces the data from a grid of strings | Data |
updateChartFromTable | Replaces the data from table JSON | Data |
confirmDiagramInput | Turns the open Quick Input into a chart | Quick Input |
setDiagramInputType | Sets the type the open Quick Input becomes | Quick Input |
setDiagramInputView | Switches the open input between text and table | Quick Input |
setDiagramInputDelimiter | Fixes the delimiter of the open Quick Input | Quick Input |
editChartAsText | Turns a chart into a Quick Input of its data | Quick Input |
editChartAsTable | Turns a chart into a table of its data while editing | Quick Input |
editDiagramAsText | Turns a Mermaid diagram into a Quick Input of its source | Quick Input |
convertTableToChart | Replaces a table with a chart of its data | Tables |
convertChartToTable | Replaces a chart with a table of its data | Tables |
insertLinkedChart | Inserts a chart that follows a table | Tables |
updateLinkedTable | Changes how a chart or a diagram reads its table | Tables |
setChartLayout | Shows the chart, its table, or both in the document | Tables |
linkChartToTable | Makes a chart follow a table anywhere in the document | Tables |
linkChartSource | Links a chart to a Data Source | Data Sources |
syncChartData | Writes new data from the Data Source into the chart | Data Sources |
detachChartSource | Stops following the source, keeps the snapshot | Data Sources |
relinkChartSource | Follows the source again | Data Sources |
Diagrams
| Command | What it does | Page |
|---|---|---|
insertFlowDiagram | Inserts a diagram from Mermaid, draw.io or BPMN source | Diagrams |
updateFlowDiagram | Changes source, format, title or description | Diagrams |
setFlowDiagramView | Shows the drawn diagram or its source text | Diagrams |
convertCodeBlockToDiagram | Replaces a code block of Mermaid source with the diagram | Diagrams |
insertDiagramFromTable | Inserts a flowchart drawn from a table | From a table |
linkDiagramToTable | Draws a diagram from a table and follows it | From a table |
detachDiagramFromTable | Stops following the table | From a table |
renameDiagramLane | Renames a lane in every row of the table | From a table |
setDiagramNodePosition | Moves a shape of a flowchart | Editing |
resetDiagramPositions | Puts every moved shape back | Editing |
Charts and diagrams
| Command | What it does | Page |
|---|---|---|
setDiagramSize | Gives a chart or a diagram a size | Size and view |
setDiagramAlign | Places it left, centered or right | Size and view |
updateFromText | Changes a chart or a diagram from its text | Text beside the picture |