Editing in the picture

In an editable editor, a double click on a text of a chart opens a field over it with that text, and the new text is written into the chart's data or settings.
Pro ExtensionAlphaPilot program
New tab

Renaming a text

TextWritten with
The titleupdateChartSpec, as spec.title
An axis titleupdateChartAxis, as title of that axis
A series name in the legendupdateChartData, as the header of its column
A category label, or a pie partupdateChartData, as the label cell of its row
  • Enter, or leaving the field, writes the text, as one undo step.
  • Escape closes the field unchanged.
  • A column keeps its id when its header is renamed, so spec.series still applies to it.
  • With encoding.seriesIn: 'rows' a series name is the label cell of a row, and a category label is a column header.
  • A chart linked to a read-only Data Source opens the field for its title and axis titles only. Its series and categories are the source's.
  • The Renderer finds the text. The ECharts and d3 Renderers do. The Mermaid chart Renderer shows the picture only. A Renderer of your own reports texts through onTextDoubleClick.
  • Value labels on an axis are not stored, so they open nothing.

Without a picture

renameChartDataText from @tiptap-pro/extension-diagrams/core renames a series or a category in Chart Data without a picture.

import { parseChartSyntax, renameChartDataText } from '@tiptap-pro/extension-diagrams/core'

const { data } = parseChartSyntax('Month | Sales\nJan | 2\nFeb | 4')
const renamed = renameChartDataText({
  data,
  target: { kind: 'series', column: 'sales' },
  text: 'Revenue',
})
editor.commands.updateChartData({ data: renamed ?? data })