Commands

Every change to a chart or a diagram is a command. Each one is described in full on the page of its topic.
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

CommandWhat it doesPage
insertChartInserts a chart from Chart Data and a Chart SpecCharts
insertChartFromInserts a chart written in a registered formatCharts
importMermaidChartInserts a chart from Mermaid chart source, such as pieCharts
insertFromTextInserts whatever a text is, as a paste wouldPasting
convertCodeBlockToChartReplaces a code block of Mermaid chart source with the chartCharts
insertDiagramInputOpens an empty Quick InputCharts
updateChartSpecChanges fields of the Chart SpecAppearance
setChartRendererChooses the Renderer of one chartAppearance
updateChartAxisChanges one axis: title, range, lines, step, labelsAxes
applyChartLookGives a chart the look of another oneLooks
convertChartToImageReplaces a chart with an image of itExport
convertImageToChartTurns such an image back into the chartExport
redrawChartImageDraws such an image again from the chart it keepsExport

Data

CommandWhat it doesPage
updateChartDataReplaces the Chart DataData
setChartLabelColumnChooses the column that names the rowsData
setChartSeriesInSwaps rows and columns of what is drawnData
updateChartFromReplaces data and spec from text in a formatData
updateChartFromGridReplaces the data from a grid of stringsData
updateChartFromTableReplaces the data from table JSONData
confirmDiagramInputTurns the open Quick Input into a chartQuick Input
setDiagramInputTypeSets the type the open Quick Input becomesQuick Input
setDiagramInputViewSwitches the open input between text and tableQuick Input
setDiagramInputDelimiterFixes the delimiter of the open Quick InputQuick Input
editChartAsTextTurns a chart into a Quick Input of its dataQuick Input
editChartAsTableTurns a chart into a table of its data while editingQuick Input
editDiagramAsTextTurns a Mermaid diagram into a Quick Input of its sourceQuick Input
convertTableToChartReplaces a table with a chart of its dataTables
convertChartToTableReplaces a chart with a table of its dataTables
insertLinkedChartInserts a chart that follows a tableTables
updateLinkedTableChanges how a chart or a diagram reads its tableTables
setChartLayoutShows the chart, its table, or both in the documentTables
linkChartToTableMakes a chart follow a table anywhere in the documentTables
linkChartSourceLinks a chart to a Data SourceData Sources
syncChartDataWrites new data from the Data Source into the chartData Sources
detachChartSourceStops following the source, keeps the snapshotData Sources
relinkChartSourceFollows the source againData Sources

Diagrams

CommandWhat it doesPage
insertFlowDiagramInserts a diagram from Mermaid, draw.io or BPMN sourceDiagrams
updateFlowDiagramChanges source, format, title or descriptionDiagrams
setFlowDiagramViewShows the drawn diagram or its source textDiagrams
convertCodeBlockToDiagramReplaces a code block of Mermaid source with the diagramDiagrams
insertDiagramFromTableInserts a flowchart drawn from a tableFrom a table
linkDiagramToTableDraws a diagram from a table and follows itFrom a table
detachDiagramFromTableStops following the tableFrom a table
renameDiagramLaneRenames a lane in every row of the tableFrom a table
setDiagramNodePositionMoves a shape of a flowchartEditing
resetDiagramPositionsPuts every moved shape backEditing

Charts and diagrams

CommandWhat it doesPage
setDiagramSizeGives a chart or a diagram a sizeSize and view
setDiagramAlignPlaces it left, centered or rightSize and view
updateFromTextChanges a chart or a diagram from its textText beside the picture