There is 1 update.
 
 
ChartJS Integration / cid:jira-generated-image-avatar-0e18145b-7ee8-479c-a8ae-c1c3848cae6d CHARTJS-42 Open

Use number fields and lists of values for the parameters of the chartjs and tableToChartJS macros

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-327938d7-3688-4a4e-9b01-b8d4857bf588 Changes by Charpentier Lucas on 23/Oct/26 16:53
 
Description: The chartjs and tableToChartJS macros take the chart type, the source table, a column and sizes in plain text fields of the Edit Macro dialog, so the user has to know the Chart.js identifiers and the ids of the page, and a wrong value draws nothing.

The macros to change, with the file where most of the fix is done:
* chartjs: [WebHome.xml|https://github.com/xwiki-contrib/application-chartjs/blob/master/application-chartjs-ui/src/main/resources/XWiki/ChartJS/WebHome.xml].
* tableToChartJS: [TableToChartJS.xml|https://github.com/xwiki-contrib/application-chartjs/blob/master/application-chartjs-ui/src/main/resources/XWiki/ChartJS/TableToChartJS.xml].

The main problems:
* The chart type is a short fixed list, which a wiki macro cannot declare, and would gain from a preview of each type.
* The table is the id of a table of the same page, and the data set label a column of that table, so their values depend on the page and on another field.
* The width and height are numbers of pixels declared as strings.

A value outside these lists must also fail when the macro renders, with an error that names the parameter and lists the accepted values, instead of being ignored or giving a technical message. The options of tableToChartJS must also be checked as JSON.

h2. Depends on
Most of these fields cannot be offered before these generic changes, each giving the macro the means to declare the expected value:
* XWIKI-25182, which gives a number input to the parameters of a numeric type.
* XWIKI-25197, which lets a wiki macro parameter declare its minimum and maximum.
* XWIKI-23045, which lets a parameter get its values from a provider, with or without custom values.
* XWIKI-25180, which lets a parameter depend on another one, whose value its list of values follows.

h2. KOs covered
||Macro||Criterion||Parameter||Problem||Depends on||
|[chartjs|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/chartjs/]|C4 input-assistance|{{type}}|A free text field for a Chart.js chart type, where a select, ideally with a preview of each type, could be used: {{Pie}} is accepted and draws nothing.|XWIKI-23045|
|[tableToChartJS|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/tableToChartJS/]|C4 input-assistance|{{type}}|A free text field for a Chart.js chart type, where a select, ideally with a preview of each type, could be used: {{polararea}} is accepted and draws nothing.|XWIKI-23045|
|[tableToChartJS|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/tableToChartJS/]|C4 input-assistance|{{table}}|A free text field for the id of a table 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.|XWIKI-23045|
|[tableToChartJS|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/tableToChartJS/]|C4 input-assistance|{{dataSetLabel}}|A plain text field for a column number, which a select of the columns of the chosen table, or a number field, would fit.|XWIKI-23045, XWIKI-25180|
|[tableToChartJS|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/tableToChartJS/]|C4 input-assistance|{{width}}|A plain text field for a number of pixels: {{width="abc"}} is accepted.|XWIKI-25182, XWIKI-25197|
|[tableToChartJS|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/tableToChartJS/]|C4 input-assistance|{{height}}|A plain text field for a number of pixels: {{height="-3"}} is accepted.|XWIKI-25182, XWIKI-25197|
|[tableToChartJS|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/tableToChartJS/]|E2 errors|{{type}}, {{table}}, {{dataSetLabel}}, {{options}}|type="unknownChart", or "polararea" with a wrong case, draws nothing; table="noSuchTable" draws an empty grid with a TypeError in the console only; dataSetLabel="9" draws empty bars for a column that does not exist; and options="{not json" is ignored; all with no message. Partly covered, see below.| |

h2. Impact found on macro fluidity
These
6 7 KOs come from the [WYSIWYG usability audit of the macros|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/], under the criterion criteria C4 input-assistance and E2 errors of its [usability criteria|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Usability%20criteria/]. The page of each macro, linked in the table, has the full notes and the steps to reproduce. Fixing them means changing the declaration of the parameters in the macro definitions.

The E2 errors KO of tableToChartJS is only partly covered here, for these parameters. The same KO also reports other invalid values, covered by the other issues listed on the page of the macro, among them XCOMMONS-3847 for the conversion of the values and XRENDERING-823 for the wording of the error. The width, height and id formats are covered by XWIKI-25197.