Replaces the data of a chart in a template, found by a placeholder in its alt text, such as {{sales}}, keeping its
look: its type, title, colours, fonts, labels, axes and legend. Give it as a patch to patchDocument, with the
placeholder's key.
Each series' name and data are replaced, in the order the series are plotted, and its data is written in the
chart's own number formats, such as "0%".
New series copy the look of the template's last series, in their own colour, the next of the theme's accents, as
ChartRun colours them. Series the new data doesn't have are removed, with any axes only they used.
Points past the new data lose their own colours and labels. When each slice of a pie has its own colour, new
slices take the next of the theme's accents.
The chart's workbook is replaced with one holding the new data, so Word's "Edit Data" opens it.
The alt text's description is replaced with a description of the new data.
The patch checks the data against the chart's type when the document is patched: a pie chart has one series, a
scatter or bubble chart's series have points, and a stock chart has prices, with opening prices and volumes if the
template's has them. Put the placeholder in the chart's alt text in Word, in "Alt Text" or "Edit Alt Text". A
placeholder in the document's text is left as it is.
If there are no series, a series has no name, or has neither values nor points, some series have values
and others points, series with values have no categories, or a value, category or point is wrong, as for
ChartRun
If the drawing isn't a chart, is a type of chart this can't patch, such as a surface chart, or has something
that refers to its workbook's cells other than its data, such as labels from cells, or the data isn't for the
chart's type, such as two series for a pie chart
Replaces the data of a chart in a template, found by a placeholder in its alt text, such as
{{sales}}, keeping its look: its type, title, colours, fonts, labels, axes and legend. Give it as a patch topatchDocument, with the placeholder's key.ChartRuncolours them. Series the new data doesn't have are removed, with any axes only they used.The patch checks the data against the chart's type when the document is patched: a pie chart has one series, a scatter or bubble chart's series have points, and a stock chart has prices, with opening prices and volumes if the template's has them. Put the placeholder in the chart's alt text in Word, in "Alt Text" or "Edit Alt Text". A placeholder in the document's text is left as it is.
Public Api
Example