Adds data (a series, or a category) to a Microsoft chart in a Word or Powerpoint document.
Compatibility
The macro can be used in the highlighted input document types only. A greyed-out icon indicates not supported.
Usage
The chart should contain at least one series. A maximum of 701 additional series can be added. For Pie and Donut charts (and their variants, such as a 3D Pie chart), this macro only works when the 'type' parameter is set to 'Category', because those charts can ONLY contain one series - so it is not permitted to add more.
Recent Updates
[ 2026-04-01 ]Line and radar charts now properly update marker colours and series colours.
Mandatory (2)
| Parameter | Type | Purpose | Options | Default |
| String | The series (column) or category name (row). | N/A | N/A | |
| List<String> | The series (column) or category (row) values, in the form: value1;value2;value3;...Note that any additional values (e.g. you specified a row with 5 data points but you only have 3 series) are ignored. | N/A | N/A |
Behaviour (5)
| Parameter | Type | Presence | Purpose | Options | Default |
| Boolean | Optional | Should NCalc expression evaluation throw error on Overflow |
|
true | |
| String | Optional | The condition that must be true in order for the macro to be executed/evaluated. Must either evaluate to true or false, for example: "3+5=8" or "contains('abcd', 'z'). | N/A | true | |
| MacroMode | Optional | The mode in which variables are stored. In the legacy mode (default for Schedules), the variable created is a string and formatted. In the normal mode (default for Report Studio), the output variable is stored as a strongly-typed theObject, e.g. an Int32 or a List |
|
Legacy | |
| ObfuscationType | Optional | Obfuscation type. Use obfuscation to write reports where sensitive data is hidden. When used, ReportMagic guarantees that the same input string will map to the same output string for the whole of the report (but the next time the report runs, it will most likely map to a different value). If you use obfuscation, the property in your macro will not show up and instead, you will see a fake item of the obfuscation type chosen. |
|
None | |
| String | Optional | If specified, adds a warning message for this macro. This is processed as an NCalc, and the warning message will ALWAYS be present and will be the value of the evaluated NCalc expression. | N/A | N/A |
Colours (1)
| Parameter | Type | Presence | Purpose | Options | Default |
| Color | Optional | Optionally, when adding a series (does not apply to a category), specify the fill colour. When omitted, the built-in theme colour will be used and determined automatically. If the series has line markers, their fill and outline colours will also be set to this colour. This parameter has no effect when 'type' is set to 'Category'. |
|
N/A |
Output (2)
| Parameter | Type | Presence | Purpose | Options | Default |
| String | Optional | The text to display should the macro fail to execute. Note that a poorly-specified macro (e.g. omitting mandatory parameters) will still result in an error message. | N/A | N/A | |
| String | Optional | The name of a variable to create should the macro fail to execute. The variable will be a text variable, and will contain either the failure text (only if the failureText parameter is set), otherwise it will contain the exception / failure message. | N/A | N/A |
General (8)
| Parameter | Type | Presence | Purpose | Options | Default |
| String | Mandatory | The series (column) or category name (row). | N/A | N/A | |
| List<String> | Mandatory | The series (column) or category (row) values, in the form: value1;value2;value3;...Note that any additional values (e.g. you specified a row with 5 data points but you only have 3 series) are ignored. | N/A | N/A | |
| String | Optional | Add a comment to make your document template more readable. The comment is discarded in the output document. | N/A | N/A | |
| ExecutionResult | Optional | If specified, asserts the expected execution result of the macro. The macro executes normally; if the actual result matches the desired value, the result is converted to Success. If the actual result does not match, the result is converted to MacroError with a descriptive message. This is primarily used for testing and diagnostic purposes. Valid values are: Unknown, Success, MacroError, WorkerStopped, Running, Warning, NeverRun, Cancelled, Pending, Paused, SystemError, Deferred, Stopped. |
|
N/A | |
| String | Optional | If specified, asserts the expected output type of the macro result. The macro executes normally; if the actual type does not match, a macro error is generated. Requires 'storeAs', 'storeAsHidden', or 'storeFormattedValueAs' to be set for typed validation. Valid types include CLR names (e.g. Int32, Int64, Single, Double, Boolean, String, JArray, JObject) and C# keyword aliases (e.g. int, long, float, double, bool, string, uint, ulong, short, ushort, byte, sbyte, decimal, char, object). The special value 'Number' matches any numeric type. | N/A | N/A | |
| String | Optional | If specified, asserts the expected output value of the macro result. The macro executes normally; if the actual value does not match, a macro error is generated. When 'storeAs' or 'storeAsHidden' is set, the stored variable value is compared. Otherwise, the document output text is compared. | N/A | N/A | |
| String | Optional | The chart ID, which you can set in it's Alt Text (right-click a chart, then select 'Edit Alt Text'). If you set id=foobar in your macro, the alt text needs to be exactly "foobar" (no quotes). When not set: in Word the previous chart will be used, and in PowerPoint it will find the first 'previous' chart encountered. | N/A | N/A | |
| GraphDataType | Optional | Whether the data in the 'values' parameter represents a row of category data for each series, or a column of series data for each category. |
|
Series |
Examples (2)
Example 1
This example adds a new series, sets the colour to blue, and specifies the values (a column):
[Graph.AddData: name=My Series, fillColor=Blue, type=Series, values=5;10;15;20]Example 2
This example adds a new set of data points, and specifies the values (a row):
[Graph.AddData: name=My Category, type=Category, values=5;10;15;20]