How to use Chartjs to create reports?

Hi, In my application I want to create some reports. For that, I used the default reports which are provided by our mendix modeler. Now I don't want that reports. Beacause I am facing an issue with them when I am trying to import the reports. So for that I want to create reports using ChartJs. But I don't know how to use them. I tried to understand from the documentation, but I didn't get anything. So please help me in how to use ChartJs to create reports. I hope I am clear.   Thanks, Venkat.
3 answers

Unlike the Mendix built-in Reports which uses OQL queries, the ChartJS modules gets its data from a microflow. The first thing you need to do is make an entity model that looks something like this

So create your entities and then fill in all the attributes, you might want to put them in a separate module.

Then you can build your datasource microflow. In this microflow you need to retrieve data from your database (probably using XPath) and reformat it, by creating Datapoint objects with correct values. After you have all your DataPoint Objects you need to associate them with the correct Dataset object (in some cases you only need 1 Dataset object). The names can be a bit confusing but a data point is a single point on the graph, and a dataset is set of points that belong together and have the same label and color. 

Finally, you need to create 1 Chart object, associate it with all Dataset objects and return this as result in the microflow.

With all this in place, you just need to set  which microflow to use as datasource in the widget (double clicking on it, and then go to tab DataSource).

Here are two additional more in depth user-guides:


Venkat. the described solution of Andrej would not work without turning the image into png.

I am doing exact the same with Jfree, which is a Mendix app store module turning graphs into png's so you can include in your document generation.

I think that is your solution.


Hi Venkat,

Hope the following sample helps you to achieve the chartJs report.