Commands

Every change to a chart or a diagram is a Command. Each Command is described on the page of its topic; this page lists them all.
Pro ExtensionAlphaPilot program
editor.commands.updateChartSpec({ spec: { type: 'area', stacked: true } })
editor.chain().focus().insertDiagramInput({ type: 'pie' }).run()

How every Command behaves

  • With pos a Command acts on the chart or diagram at that position.
  • Without pos it acts on the selected one.
  • With nothing to act on it returns false and changes nothing.
  • Reading never needs a Command. The readers 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
setChartLayoutChart, 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 a new snapshotData 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 picture or the sourceDiagrams
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