Comments on Chart.js Integration
Last modified by sequilox on 2024/02/19 00:12
- Manage
- Copy
- Actions
- Export
- Print Preview
- Viewers
- Source
- Children
- Content
- Attachments (7)
- History
- Information
- Likes
Export
Choose the export format from the list below:
$services.rendering.render($uix.execute(), 'html/5.0')
- Office Formats (1)
-
Export as Portable Document Format (PDF) using the Web Browser
-
- Other Formats (1)
-
Export as HyperText Markup Language (HTML)
-
Export as
Select the pages to export:
- Legend:
- Created Page
- Modified Extension Page
- Clean Extension Page
Hi,
is it possible to use json/xml as datasource? Or is there a way how to use data from sql query? I would prefer not to use tables...
Hi Martin,
I'm not sure I understand your question. The documentation says:
Moreover, the chartjs macro (like any other macro or wiki syntax in general) can be put inside a Velocity macro, so you can generate the JSON dynamically.
...
{{chartjs type="pie"}}
$jsontool.serialize($javaMapThatHoldsTheData)
{{/chartjs}}
{{/velocity}}
That is exactly what I needed. My problem was the empty line between {velocity} and {chartjs} so I saw "inline" error. Thank you.
It seems that changing the background color or the border color doesn't work on a line chart. I tried:
{
"labels": [
"2016-01-08",
"2016-01-15",
"2016-01-22",
"2016-01-29",
"2016-02-05",
"2016-02-12",
"2016-02-19",
"2016-02-26",
"2016-03-04",
"2016-03-11"
],
"datasets": [{
"label": "The Label",
"data": [3, 8, 12, 17, 17, 22, 25, 30, 35, 38],
"backgroundColor": "rgb(239, 239, 239)"
}]
}
{{/chartjs}}
Please use the XWiki forum to ask questions. Thx
Hi,
I suggest to add an additional option "fills" (use like "backgroundColors") for tableToChartJS to get line charts without area fills.
I modified the javascript extension JSX by adding
if (options.fills) {
if (data.datasets.length == options.fills.length) {
// One fill value per dataset, from the options.
dataSet.fill = options.fills[index];
} else {
// One fill per value, from the options.
dataSet.fill = options.fills;
}
}
which manages the task by setting e.g. options='{ "fills" : [false,false] }'
Hello everyone,
first of all, thanks for the great extension.
Unfortunately the included chart.js version is now outdated.
Are there any plans for an update?
Thanks a lot!