tableToChartJS

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

Audit

Macro ID
tableToChartJS
Source
Chart.js Integration
Type
Generator
Classification reason
The macro has no content: its output, a chart drawn in the browser, comes from the table of the page that its id parameter points to, like the xdom source of chart, and the table is not wrapped or decorated by the macro.
Status
Reviewed
Criteria version
15.20
XWiki version
18.8.0
Audit date
2026-10-20
Auditor
Compared macros
chart liveData

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.js%20Integration/#HUsage-1
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-contrib/application-chartjs/blob/master/application-chartjs-ui/src/main/resources/XWiki/ChartJS/TableToChartJS.xml
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, D3chart, liveData
Other sources specific to this macro
  • TableToChartJS.xml: a wiki macro of the XAR, with no content, whose Velocity code reads the table of the page by its id and calls the chartjs macro with the same type, options, width, height, cssClass, title and id, and declares no inline support.
  • Chart.js Integration: the legacy documentation page of both macros of the extension, the only documentation of the parameters.
  • ChartJS macro audit: the other macro of the extension, audited at the same time, whose ratings for what the two share are kept the same.
CriterionResultNotes
D1 wordingOK"Table to ChartJS" says that a table becomes a chart, in the user's words, and the library name only tells it apart from the Chart macro of XWiki Standard, which draws an image from the same kind of table. It is not a code identifier.
D2 summaryKO"Draws a chart using ChartJS and the data read from a table." is the name spelled out, "Table to ChartJS", with a verb added. It does not state the rule the user needs to insert the macro: the table must be on the same page and carry an id, set with (% id="singleDataSet" %) in the source or in the Advanced tab of the table properties of the editor, and the macro gets that id in its table parameter. Without it, nothing is drawn and nothing says why, see E2.
D3 categoryOKin Content, like chart and liveData, the compared macros, and like ChartJS, the other macro of the extension.
D4 quick-actionKOQuick Actions finds the macro first for its ID "tableToChartJS", for its name "Table to ChartJS" and for the French name "Tableau à ChartJS", which differs from the English one. The synonym "chart" ranks it 2nd, after Chart. The synonyms "graph", "diagram", "bar chart", "pie chart" and "plot" do not find it: "graph" lists Paragraph, Chart and map, "diagram" the Diagram macros and kroki, "pie chart" only jiraPieChart, and the other two nothing. The rule for a technical macro named after its technology does not apply, since the macro is for every user, in Content, and these are the words a user would type for a chart. Same result as chart, which is KO for the same reason.
L1 consistencyOKcompared with chart and liveData, two generators of the Content category that display data. Like chart, type is mandatory, and so is table, so Quick Actions opens the Edit Macro dialog instead of inserting the macro right away, which liveData does not need. The difference is not by design for type, since a default type would work, so it is counted under C2 of type. Unlike chart, the macro has no content, which is by design: the data is a table of the page, picked by its id, like the xdom source of chart. The defaults are not declared, except the unchecked multipleDataSets, as for liveData.
L2 doc-parametersKOthe parameters are only documented on the legacy extensions.xwiki.org page of the extension, Chart.js Integration, not in the new documentation. The ten parameters of the macro are all there, with the same mandatory flags and default, but the type list "line, bar, radar, pie, doughnut, polarArea, bubble, scatter" misses horizontalBar, which the last example of the page uses. The page documents width and height with no unit, while its own source uses height="200px" in a test, and says that cssClass can set the canvas dimensions at the CSS level, which is the only way to set them with the default options, see C8. The options that make the macro useful, like backgroundColors or skipZeros, are documented for the chartjs macro only, and this page points to it.
L3 doc-exampleOKthe most common example is "Single Data Set", {{tableToChartJS type="polarArea" table="singleDataSet" /}} with a 3 row table with the id singleDataSet. Example 1 of the Usage block, with "..." values, is a template, not an example. The five examples render a chart in view mode, after the JavaScript runs, with no error in the page or the console. The id of the table can be set in the editor, in the Advanced tab of the table properties, so the examples can be reproduced there.
I1 patternOKQuick Actions and the Insert Macro dialog both open the Edit Macro dialog, since type and table are mandatory, the behavior of a generator that needs a value to work, like include, and the one of chart. One entry lists the macro.
I2 zero-configOKsubmitting the Edit Macro dialog with the default values keeps it open with no message, since type and table are required: the generic behavior of the dialog. {{tableToChartJS/}} renders "Failed to execute the [tableToChartJS] macro. Cause: [Parameter [type] is mandatory]", a configuration a generator may require. With a type and a table, the chart renders in view mode.
I3 instantN/A
I4 cursorN/A
I5 focusOKtype and table, the only mandatory parameters, come first, outside the Optional parameters tab, and the focus is on table, so every mandatory parameter is visible without scrolling.
E1 wysiwygKOthe editor shows the table, and in place of the macro an empty area: the canvas of the chart stays blank, with no chart, no placeholder and no text, 2, 10 and 30 seconds after the insertion and after saving and reopening the page, where view mode draws the polar area chart with its legend after the JavaScript runs. Nothing in the editor says that a chart is there or what it shows. The hidden macro placeholder of the editor stays hidden. Same as the chartjs macro of the extension. To reproduce: insert the most common example and wait.
E2 errorsKOmost invalid values are accepted with no message in view mode, in the page or in the console, so the user gets a wrong or missing chart. type="unknownChart" and type="polararea" , the wrong case, draw nothing, and leave a blank area under the table. table="noSuchTable" draws an empty polar grid, with a TypeError in the console only, and table="" is accepted as well. multipleDataSets="maybe" is read as false. dataSetLabel="abc" is ignored and dataSetLabel="9" draws empty bars with a nameless legend, since the column does not exist. options="{not json" is ignored and the default options apply. width="abc" and height="-3" are accepted, and width and height have no visible effect with the default options anyway, see C8. id="my chart" is written as given, an invalid HTML id, cssClass="a b" adds two classes, which is valid. A missing type or table gives a clear error, "Parameter [type] is mandatory", which names the parameter. An unknown parameter, noSuchParameter="x" , is generic and not counted.
E3 nestingKOin a list item and in a table cell, like * {{tableToChartJS type="polarArea" table="singleDataSet" /}} , the macro renders "The [tableToChartJS] macro is a standalone macro and it cannot be used inline. Click on this message for details." in the editor and in view mode, a standalone error. In a box it renders, and the chart is drawn in view mode, like at the top level. The macro has no content, so the second half of the measure does not apply. Same as the chartjs macro.
E4 inline-supportOKthe macro declares no inline support, and its output is a responsive block container that Chart.js sizes to the width of its parent, which is a technical reason to stay standalone. In a sentence it renders the same standalone error as in E3, with the table in the sentence.
E5 emptyN/A
E6 inplaceN/A

Parameters

ParameterC1 clarityC2 mandatoryC3 defaultsC4 input-assistanceC5 groupsC6 orderC7 alternativesC8 advancedC9 technicalC13 constraintsNotes
typeKOKON/AKOOKOKN/AOKOKN/A

C1, minor: "The type of chart. Choose from: line, bar, radar, pie, doughnut, polarArea, bubble, scatter." says what it sets and gives the values, but the list is presented as complete while the horizontalBar of the last example of the documentation works and is not in it, and the values are the Chart.js identifiers, written as is, with the case that matters, see E2.

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: {{tableToChartJS table="singleDataSet" /}} would give a chart instead of the error "Parameter [type] is mandatory". Because of it, Quick Actions opens the Edit Macro dialog, see L1.

C4: a free text field, although the accepted values are a short list of chart types: a select, ideally with a preview of each type, could be used. type="unknownChart" and type="polararea" are accepted and draw nothing, see E2.

C5: outside any group, with table, so 2 fields, and the Optional parameters group comes after.

C6: second of the dialog, after table, and set by the most common example, which sets only table and type.

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

multipleDataSetsKOOKOKOKKOOKN/AOKOKN/A

C1, minor: "Whether the specified table includes multiple data sets." uses a Chart.js term and does not say what the table must look like: the first column holds the labels and each other column is one data set, with the header cell as its name. Four of the five examples need it, since they have two data columns.

C3: the box is unchecked, the declared default false, the value of the most common example.

C4: a checkbox for a boolean.

C5, minor: the 8 fields of the Optional parameters group are above 7, mixing the options of the data, multipleDataSets and dataSetLabel, with the display options, width, height, cssClass, title and id. The same holds for every parameter of the group.

C6: fifth of the Optional parameters group, in alphabetical order, below cssClass, dataSetLabel, height and id, but visible without scrolling, and not set by the most common example.

C8: set by four of the five examples of the documentation, so not rarely used.

tableKOOKN/AKOOKOKN/AOKOKN/A

C1: "Identifies the source table." does not say what to type: the id of a table of the same page, which has to be set on the table first, see D2. It gives no possible value for a free field. To reproduce: open the Edit Macro dialog from Quick Actions.

C2: mandatory, since the macro cannot guess which table of the page to draw.

C4: a free text field for a reference to an element of the page, where a picker listing the tables of the page that have an id could be used. A misspelled id gives an empty chart with no message, see E2.

C5: outside any group, with type, so 2 fields.

C6: first of the dialog, with the focus, and set by the most common example.

dataSetLabelKOOKOKKOKOOKN/AKOOKKO

C1: "The index of the table column that represents the data set label." does not say that it only has an effect together with multipleDataSets, nor where the index starts: the last example sets "1" for a table whose second column, Project, holds the label, so it starts at 0. It uses developer terms, index and data set.

C3: the field opens empty, which stands for no label column, the value of the most common example.

C4: a plain text field for a column number, which a number field, or a select of the columns of the table, would fit.

C5, minor: the 8 fields of the Optional parameters group are above 7, see the note of multipleDataSets.

C6: third of the group, not set by the most common example.

C8, minor: set by one of the five examples, and only useful for a table with a label column among its data columns.

C13: a column number with no declared range, and the macro is a wiki macro, whose parameters cannot declare a range or a format, see XWIKI-25197 in the Cross-macro findings. dataSetLabel="abc" is ignored, and dataSetLabel="9" draws empty bars with a nameless legend, see E2.

optionsOKOKOKOKKOOKN/AKOOKKO

C1: "Advanced chart options specified as JSON. Checkout the Chart.js documentation for the available configuration options." gives the format and where the keys are listed. The keys that the macro adds, like backgroundColors, are not named, they are on the documentation page of the chartjs macro.

C3: the field opens empty, for the default options of Chart.js, the value of the most common example.

C4: a one line text field for a JSON object. A custom picker for this mini-syntax would be overkill, so the text field is OK, as long as the description explains the format, which it does.

C5, minor: the 8 fields of the Optional parameters group are above 7, see the note of multipleDataSets.

C6: sixth of the group, not set by the most common example.

C8: the description itself says "Advanced", and the field is not marked advanced, while only the last example of five sets it.

C13: a JSON format that the macro cannot declare, since the parameters of a wiki macro cannot declare a format, see XWIKI-25197 in the Cross-macro findings. options="{not json" is accepted and ignored, see E2.

widthKOOKOKKOKOOKN/AKOOKKO

C1: "Width of the generated chart." gives no unit and does not say that it has no visible effect with the default options. The name is the ID, "width", and the description is not translated in French and German. To reproduce: open the Edit Macro dialog from Quick Actions.

C3: the field opens empty, which stands for the width of the parent, the value of the most common example.

C4: a plain text field for a number of pixels, the value of the width attribute of the canvas.

C5, minor: the 8 fields of the Optional parameters group are above 7, see the note of multipleDataSets. The field is the last of the dialog, below the fold.

C6: last of the group, not set by the most common example.

C8: not marked advanced, and with the default options it changes nothing: width="300" is written on the canvas, which Chart.js resizes to the width of its container, 803 pixels in the audit. It only applies with options='{"responsive": false}' .

C13: a number of pixels with no declared range, and the parameters of a wiki macro cannot declare one, see XWIKI-25197 in the Cross-macro findings. width="abc" is accepted, see E2.

heightKOOKOKKOKOOKN/AKOOKKO

C1: "Height of the generated chart." gives no unit and does not say that it has no visible effect with the default options. The name is the ID, "height", and the description is not translated in French and German. The test page of the extension itself sets height="200px" , which is not a number of pixels.

C3: the field opens empty, which stands for the height that Chart.js computes from the width, the value of the most common example.

C4: a plain text field for a number of pixels, the value of the height attribute of the canvas.

C5, minor: the 8 fields of the Optional parameters group are above 7, see the note of multipleDataSets.

C6: third of the group, not set by the most common example.

C8: not marked advanced, and with the default options it changes nothing: height="150" is overridden by the aspect ratio of Chart.js. It only applies with options='{"maintainAspectRatio": false}' , where the height is then 150 pixels, or with responsive set to false in the options.

C13: a number of pixels with no declared range, and the parameters of a wiki macro cannot declare one, see XWIKI-25197 in the Cross-macro findings. height="-3" is accepted, see E2.

cssClassOKOKOKOKKOOKN/AKOOKN/A

C1: "Additional CSS class to be added to the chart container." is a technical term for a styling hook, which another wording would only make more confusing. The name is the ID and the description is not translated in French and German.

C4: a text field for CSS classes, which is the usual input for a styling hook.

C5, minor: the 8 fields of the Optional parameters group are above 7, see the note of multipleDataSets.

C6: first of the group, not set by the most common example.

C8: a rarely used styling hook, not marked advanced.

titleKOOKOKOKKOOKN/AOKOKN/A

C1: "Chart title, added as aria-label to the generated canvas" uses developer terms, and the name suggests a title drawn on the chart, like the title of the Chart macro of XWiki Standard, while it is only the text alternative of the canvas, which no title is drawn from. The meaning is clear once read, so the KO is minor. The name is the ID and the description is not translated in French and German.

C3: the field opens empty, for no text alternative, the value of the most common example. A chart with no title has an img role and no name.

C5, minor: the 8 fields of the Optional parameters group are above 7, see the note of multipleDataSets. The field is below the fold.

C6: seventh of the group, not set by the most common example.

C8: the only text alternative of a chart that screen readers cannot read, so it is not a rarely used parameter, even if the examples do not set it.

idOKOKOKOKKOOKN/AKOOKKO

C1: "Chart identifier" is a technical term for a hook, the id of the canvas, which another wording would only make more confusing. The name is the ID and the description is not translated in French and German.

C5, minor: the 8 fields of the Optional parameters group are above 7, see the note of multipleDataSets.

C6: fourth of the group, not set by the most common example.

C8: a rarely used hook, not marked advanced.

C13: an HTML id has no space and is unique in the page, a format that the macro cannot declare, since the parameters of a wiki macro cannot declare one, see XWIKI-25197 in the Cross-macro findings. id="my chart" is accepted and written on the canvas as given, an invalid id, see E2.

Other notes

Bug outside the criteria: the title parameter is only the aria-label of the canvas and no title is drawn on the chart, unlike the title of the Chart macro of XWiki Standard, see the C1 note of title.

The English names of the parameters width, height, cssClass, title and id are their IDs, and their descriptions are not translated in French and German, which translate the other parameters and the name of the macro. The Insert Macro dialog capitalizes them, so only the lowercase ones in the descriptions read as IDs.

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
D2D2 summaryCHARTJS-40
D4D4 quick-actionXWIKI-25444
L2L2 doc-parametersXINFRA-525
E1E1 wysiwygXWIKI-22046 (partial)XWIKI-25523 (partial), CHARTJS-43
E2E2 errorsXWIKI-25197 (partial)XCOMMONS-3847 (partial), XRENDERING-823 (partial), CHARTJS-42 (partial)
E3E3 nestingXWIKI-23501
C1:typeC1 clarity, typeCHARTJS-40
C2:typeC2 mandatory, typeCHARTJS-41
C4:typeC4 input-assistance, typeXWIKI-23045 (partial)CHARTJS-42
C1:multipleDataSetsC1 clarity, multipleDataSetsCHARTJS-40
C5:multipleDataSetsC5 groups, multipleDataSetsCHARTJS-41
C1:tableC1 clarity, tableCHARTJS-40
C4:tableC4 input-assistance, tableXWIKI-23045 (partial)CHARTJS-42
C1:dataSetLabelC1 clarity, dataSetLabelCHARTJS-40
C4:dataSetLabelC4 input-assistance, dataSetLabelXWIKI-23045 (partial)CHARTJS-42
C5:dataSetLabelC5 groups, dataSetLabelCHARTJS-41
C8:dataSetLabelC8 advanced, dataSetLabelCHARTJS-41
C13:dataSetLabelC13 constraints, dataSetLabelXWIKI-25197
C5:optionsC5 groups, optionsCHARTJS-41
C8:optionsC8 advanced, optionsCHARTJS-41
C13:optionsC13 constraints, optionsXWIKI-25197
C1:widthC1 clarity, widthXWIKI-6061 (partial)CHARTJS-40
C4:widthC4 input-assistance, widthXWIKI-25197 (partial), XWIKI-25182 (partial)CHARTJS-42
C5:widthC5 groups, widthCHARTJS-41
C8:widthC8 advanced, widthCHARTJS-41
C13:widthC13 constraints, widthXWIKI-25197
C1:heightC1 clarity, heightXWIKI-6061 (partial)CHARTJS-40
C4:heightC4 input-assistance, heightXWIKI-25197 (partial), XWIKI-25182 (partial)CHARTJS-42
C5:heightC5 groups, heightCHARTJS-41
C8:heightC8 advanced, heightCHARTJS-41
C13:heightC13 constraints, heightXWIKI-25197
C5:cssClassC5 groups, cssClassCHARTJS-41
C8:cssClassC8 advanced, cssClassCHARTJS-41
C1:titleC1 clarity, titleXWIKI-6061 (partial)CHARTJS-40
C5:titleC5 groups, titleCHARTJS-41
C5:idC5 groups, idCHARTJS-41
C8:idC8 advanced, idCHARTJS-41
C13:idC13 constraints, idXWIKI-25197
Success

Every KO is covered by a ticket.

Tickets

TicketOriginKOs coveredKOs partly covered
XWIKI-22046ExistingE1
XWIKI-23501ExistingE3
XWIKI-25197ExistingC13:dataSetLabel C13:height C13:id C13:options C13:widthC4:width C4:height E2
XWIKI-6061ExistingC1:height C1:title C1:width
XCOMMONS-3847NewE2
XRENDERING-823NewE2
XWIKI-25444NewD4
CHARTJS-40NewC1:dataSetLabel C1:multipleDataSets C1:table C1:type D2 C1:width C1:height C1:title
CHARTJS-41NewC2:type C5:cssClass C5:dataSetLabel C5:height C5:id C5:multipleDataSets C5:options C5:title C5:width C8:cssClass C8:dataSetLabel C8:height C8:id C8:options C8:width
CHARTJS-42NewC4:type C4:table C4:dataSetLabel C4:width C4:heightE2
XWIKI-23045ExistingC4:type C4:table C4:dataSetLabel
XWIKI-25182ExistingC4:width C4:height
XINFRA-525NewL2
XWIKI-25523NewE1
CHARTJS-43NewE1

Known issues of this macro

No known issue is specific to this macro.
68 more known issues affect every macro: see the Known issues.

Get Connected