Renaming a text
| Text | Written with |
|---|---|
| The title | updateChartSpec, as spec.title |
| An axis title | updateChartAxis, as title of that axis |
| A series name in the legend | updateChartData, as the header of its column |
| A category label, or a pie part | updateChartData, 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.seriesstill 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 })