chart

Last modified by Lucas Charpentier on 2026/10/27 10:27

Audit

Macro ID
chart
Source
XS
Type
Generator
Classification reason
The content can hold the data table, but the output is a chart image computed from it, and the data can also come from a table of another page.
Status
Reviewed
Criteria version
15.20
XWiki version
18.8.0
Audit date
2026-10-19
Auditor
Compared macros
liveData documents

Sources

Where to gather the information the criteria are checked against, see Gather the sources.

SourceWhat it givesUsed forWhere
DocumentationParameters, default values and examples, including the most common exampleL2, L3, and the criteria measured with the most common examplehttps://extensions.xwiki.org/xwiki/bin/view/Extension/Chart%20Macro#HUsage
Source codeHow the macro declares its parameters and content: types, groups, features, advanced and hidden flags, constraints, content type, inline supportC4, C5, C7, C8, C9, C13, E4, E6https://github.com/xwiki/xwiki-platform/blob/xwiki-platform-18.8.0/xwiki-platform-core/xwiki-platform-chart/xwiki-platform-chart-macro/src/main/java/org/xwiki/rendering/macro/chart/ChartMacroParameters.java
Macro descriptorWhat the Edit Macro dialog is built from, on design.xwiki.orgD1, D2, C1 to C9, E4Descriptor, list of macros with their categories
TranslationsThe name, description and parameter names in each languageD1, D2, D4, C1l10n.xwiki.org
Uses in XWiki pagesHow XWiki itself uses the macro, a realistic example when the documentation has noneL3, C2, C3, C6, C8, C9Search the xwiki organization on GitHub
Compared macrosThe audits of the macros of the same typeL1, D3liveData, documents
Other sources specific to this macro
  • ChartMacro.java, 18.8.0: the source defaults to inline when the macro has content and to xdom otherwise, params is split on ";" and ":" with no escaping, and the title is the only alt text of the image.
  • PlotType.java, 18.8.0: the 12 accepted values of type.
  • Help.Macros.Chart: the uses of the macro in XWiki Standard, all inline tables with params="range:B2-D5;series:columns".
CriterionResultNotes
D1 wordingOK"Chart" is the user's word for what the macro produces.
D2 summaryOKthe description, "Displays a graphical chart generated from miscellaneous data sources.", says what the macro adds, in 10 words. "Miscellaneous data sources" is vague, where it means a table in the macro content or a table of a page, but it is more than a repetition of the name.
D3 categoryOKin Content, like liveData and documents, the compared macros, and like ChartJS and Table to ChartJS, the other chart macros of the audit instance.
D4 quick-actionKOQuick Actions finds the macro first for "chart" and "Chart", and for the French name "Graphique". The synonym "graph" ranks it 2nd, after Paragraph. The synonyms "plot", "pie" and "bar" do not find it: "pie" only lists jiraPieChart, "bar" only job, "plot" nothing. "diagram" lists the Diagram application macros and kroki, not chart, although the German name of the macro is "Diagramm".
L1 consistencyOKcompared with liveData and documents, two generators of the Content category that display data. Unlike them, chart has a mandatory parameter, type, so Quick Actions opens the Edit Macro dialog instead of inserting the macro right away. The difference is not by design, since a default type would work: it is counted under C2 of type, whose ticket covers it. Like them, the content is optional, and the defaults it declares, width and height, are shown in the dialog.
L2 doc-parametersKOthe parameters are only documented on the legacy extensions.xwiki.org page, not in the new documentation. That page also lists colors as a parameter of the macro, while it is a key of params, as its own Custom Colors example shows: {{chart type="pie" params="range:B2-D5" colors="FF0000,00FF00,0000FF,000000"}} renders with the default colors and no message. It documents width and height as strings, where the macro declares integers, and the content only in the Usage section, not in the parameter table.
L3 doc-exampleOKthe most common example is "Example for an "inline" data source Pie chart", {{chart type="pie" source="inline" params="range:B2-D5;series:columns;" title="Chart Test" width="320" height="240"}} with a table of 4 rows and 3 series as content, the same form as the 6 examples of the Help pages of XWiki Standard. It renders without error. The "Usage" blocks with placeholder values are templates, not examples, and the xdom examples need a page holding a table with an id, a setup step the documentation states.
I1 patternOKQuick Actions and the Insert Macro dialog both open the Edit Macro dialog, since type is mandatory. This is the generic behavior of a macro with a mandatory parameter, see the C2 note of type.
I2 zero-configOKsubmitting the Edit Macro dialog with the default values does nothing, with no message, since type is required: the generic behavior of the dialog. {{chart type="pie"/}} renders "Failed to execute the [chart] macro. Cause: [Unable to find a matching data table.]", a configuration a generator may require.
I3 instantN/A
I4 cursorN/A
I5 focusOKtype, the only mandatory parameter, comes first, above the Optional parameters tab, and has the focus. The range in params, without which the documented table fails, see the C3 note of params, is not mandatory.
E1 wysiwygOKthe editor shows the same chart image as view mode, inside the macro frame.
E2 errorsKOmost invalid values give a technical message that does not say what to type. Added to the most common example, source="foo" gives "Can't find descriptor for the component with type [interface org.xwiki.rendering.internal.macro.chart.source.DataSource] and hint [foo]". width="320px" , width="50%" and width="-5" give messages like "Width (0) and height (300) cannot be <= 0", which does not say that a number of pixels is expected. params="range:Z9-ZZ99;series:columns" gives "Index 8 out of bounds for length 5", params="range:B2-D5;series:columns;colors:zzz" gives "/ by zero", and a table without the range, params="garbage" or no params at all, gives "Invalid number: [].". params="range:B2-D5;series:columns;noSuchKey:1" is accepted silently. type="foo" gives "Invalid value for parameter [type]: [foo]", which names the parameter but not the accepted values, and type="Pie" fails the same way, the value being case sensitive. The messages for params="range:B2-D5;series:foo" , for width="5000" and for a page that does not exist are clear.
E3 nestingOKin a list item, in a table cell and in a box, like * {{chart type="pie" source="inline" params="range:B2-D5;series:columns;"}}...{{/chart}} , the chart renders and can be edited as at the top level. The content is a data table typed in wiki syntax in a dialog text area, so inserting a list or a box in it does not apply: both give "Unable to locate a suitable data table.", which is clear. A table with fewer columns than the range gives the technical message of E2.
E4 inline-supportOKthe macro declares inline support, and the most common example in a sentence, Before {{chart ...}}...{{/chart}} after. , renders the image inside the sentence, with no block element.
E5 emptyN/A
E6 inplaceN/A

Parameters

ParameterC1 clarityC2 mandatoryC3 defaultsC4 input-assistanceC5 groupsC6 orderC7 alternativesC8 advancedC9 technicalC13 constraintsNotes
$contentKOOKN/AKON/AOKN/AN/AN/AN/A

C1: "Input data for the chart macro (e.g. for 'inline' source mode)" does not say what to type: a table in the syntax of the page, with a header row and a first column of labels, and which cells hold the data, see the range of params. "'inline' source mode" is a developer term. To reproduce: open the Edit Macro dialog from Quick Actions.

C2: optional, since the data can come from a table of another page with source="xdom".

C4: a plain text area, where the user has to type a table in wiki syntax, like |=|=X|=Y , from the WYSIWYG editor. A table editor, or editing the table in place next to the chart, could be used.

C6: first in the Optional parameters tab, and set by the most common example.

heightKOOKOKKOOKOKN/AOKOKKO

C1, minor: "The height of the generated chart image" does not give the unit, pixels, which the documentation states.

C3: the field preselects the declared default, 300. The most common example sets 240, a value specific to that example: the examples of the Help pages of XWiki Standard keep the default.

C4: a plain text field for a number of pixels.

C13: a number, typed int, with no declared range, while only a positive number up to the limit of 2048 pixels of xwiki.properties is accepted: height="0" or height="abc" is accepted by the dialog and fails at rendering with "Width (400) and height (0) cannot be <= 0", and height="5000" with "Maximum chart width or height exceeded (limit is: [2048]x[2048]).".

paramsKOOKKOOKOKOKOKOKOKKO

C1: the label "Params" is an abbreviation of the ID, and the description, "Additional parameters for the data source", gives neither the format, key:value pairs separated by ";", nor the keys, range and series for a table, document and table for another page, and the colors and display options. Nothing says that the range is needed for the documented table, see C3. To reproduce: open the Edit Macro dialog from Quick Actions.

C3: the field opens empty, which stands for the whole table, header row and label column included, and fails for the table of the most common example: {{chart type="pie"}} with that table renders "Invalid number: [].". The example needs range:B2-D5 , or range:B2-.. for the whole data, a value no field preselects.

C4: a free text field for several settings in a dedicated syntax, like the parameters of jira. A custom picker for this mini-syntax would be overkill, so the text field is OK, as long as the description explains the syntax, which it does not, see C1.

C7: the document and table keys are an alternative to the content, with source="xdom": only parameters can be part of a feature, see the Cross-macro findings.

C13: a list of key:value pairs, with no declared format: params="range:B2-D5;series:columns;noSuchKey:1" is accepted and ignored, and params="garbage" fails at rendering with "Invalid number: [].".

sourceKOOKKOKOOKOKOKOKOKN/A

C1: "The string describing the type of input data source (e.g. xdom or inline)" uses developer terms, "string" and "xdom", the internal name of a table of another page, and does not say that an empty value picks inline when the macro has content and xdom otherwise. The "e.g." suggests other values while there are only two. To reproduce: open the Edit Macro dialog from Quick Actions.

C3: the field opens empty, which stands for inline when the macro has content, the value of the most common example, so the example renders, but the field does not show which value it stands for.

C4: a free text field, although the accepted values are inline and xdom: a select could be used. source="foo" is accepted and fails at rendering, see E2.

C7: xdom, with the document and table keys of params, is an alternative to the content: only parameters can be part of a feature, see the Cross-macro findings.

C13: the accepted values are a list rather than a format, so it is recorded N/A: the select of C4 would declare them.

titleOKOKOKOKOKOKN/AOKOKN/A

C1: "The title of the chart (appears on top of the chart image)" says what it sets. It does not say that it is also the only text alternative of the image, see the notes of the macro.

C3: the field opens empty, for no title, a sensible default: the title is specific to each chart.

typeOKKON/AKOOKOKN/AOKOKN/A

C1: the description, "The type of the chart (e.g. pie, line, area or bar)", says what it sets, and the field is labeled "Type". It lists 4 of the 12 accepted values, see C4.

C2: mandatory, while a default type, like bar, would work for the table of the most common example and for any table of the documentation: {{chart params="range:B2-D5"}} with that table would give a chart instead of the error "Property [type] mandatory". Because of it, Quick Actions opens the Edit Macro dialog, see L1.

C4: a free text field, although the accepted values are the 12 chart types, line, area, bar, stackedbar, bar3D, stackedbar3D, pie, line3D, xy_area, xy_line_and_shape, xy_line3D and xy_step: a select, ideally with a preview of each type, could be used. type="foo" and type="Pie" are accepted by the dialog and fail at rendering, see E2.

C13: the accepted values are a list rather than a format, so it is recorded N/A: the select of C4 would declare them.

widthKOOKOKKOOKOKN/AOKOKKO

C1, minor: "The width of the generated chart image" does not give the unit, pixels, which the documentation states.

C3: the field preselects the declared default, 400. The most common example sets 320, a value specific to that example: the examples of the Help pages of XWiki Standard keep the default.

C4: a plain text field for a number of pixels. The field is the last of the dialog, below the fold.

C13: a number, typed int, with no declared range, while only a positive number up to the limit of 2048 pixels of xwiki.properties is accepted: width="320px" or width="50%" is accepted by the dialog and fails at rendering with "Width (0) and height (300) cannot be <= 0", width="-5" with "Width (-5) and height (300) cannot be <= 0", and width="5000" with "Maximum chart width or height exceeded (limit is: [2048]x[2048]).".

Other notes

Without a title, the chart image has no text alternative: {{chart type="pie" params="range:B2-D5"}}...{{/chart}} renders an img element with no alt attribute, since the macro uses the title as the alt text. This is a bug outside the criteria, to file in JIRA.

The English names of the parameters are their IDs, "type", "params", "source", "title", "width" and "height", in ApplicationResources.properties, while French and German translate them; the dialog capitalizes them, so only "Params" reads as an ID, see its C1 note.

KOs and tickets

Every KO needs a ticket covering it, see Report the KOs. One ticket can cover several KOs. Known issues filed for this macro are suggested in italics: link them as existing tickets when they cover the KO.

KOCriterionExisting ticketsNew tickets
D4D4 quick-actionXWIKI-25444
L2L2 doc-parametersXINFRA-525
E2E2 errorsXCOMMONS-3847 (partial), XRENDERING-823 (partial), XWIKI-25503 (partial), XWIKI-25509 (partial)
C1:$contentC1 clarity, $contentXWIKI-25483
C4:$contentC4 input-assistance, $contentXWIKI-25443
C1:heightC1 clarity, heightXWIKI-25483
C4:heightC4 input-assistance, heightXWIKI-25182
C13:heightC13 constraints, heightXWIKI-25182
C1:paramsC1 clarity, paramsXWIKI-25483
C3:paramsC3 defaults, paramsXWIKI-25484
C13:paramsC13 constraints, paramsXWIKI-25509
C1:sourceC1 clarity, sourceXWIKI-25483
C3:sourceC3 defaults, sourceXWIKI-23759 (partial)XWIKI-25503 (partial)
C4:sourceC4 input-assistance, sourceXWIKI-25503
C2:typeC2 mandatory, typeXWIKI-16040
C4:typeC4 input-assistance, typeXWIKI-25503
C1:widthC1 clarity, widthXWIKI-25483
C4:widthC4 input-assistance, widthXWIKI-25182
C13:widthC13 constraints, widthXWIKI-25182
Success

Every KO is covered by a ticket.

Tickets

TicketOriginKOs coveredKOs partly covered
XWIKI-16040ExistingC2:type
XWIKI-23759ExistingC3:source
XWIKI-25182ExistingC13:height C13:width C4:height C4:width
XCOMMONS-3847NewE2
XRENDERING-823NewE2
XWIKI-25444NewD4
XWIKI-25483NewC1:$content C1:height C1:params C1:source C1:width
XWIKI-25484NewC3:params
XWIKI-25503NewC4:type C4:sourceE2 C3:source
XINFRA-525NewL2
XWIKI-25443NewC4:$content
XWIKI-25509NewC13:paramsE2

Known issues of this macro

IssueTitleStatusCriteria
XWIKI-16040The Chart macro doesn't have good default values for its parametersOpenC2

68 more known issues affect every macro: see the Known issues.

Get Connected