Charts in Moodle Mobile

Charts in Moodle Mobile

by Inês de Sousa Lopes -
Number of replies: 2

Hello,


I know that Moodle has a Chart API. I use that API to build a chart on my Moodle site (in a new block plugin). 

Now, I wanted  to develop the mobile version of that block plugin but I don't know how to add a chart since mobile templates are built using Angular Ionic.


Can someone tell me what should I do?


Thank you smile

Average of ratings: -
In reply to Inês de Sousa Lopes

Re: Charts in Moodle Mobile

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Hi,

the Moodle app also has the ChartJS library, it is used in a couple of places like in the choice activity. We developed an Angular component to easily use it, in here you can see how it is used in the choice activity.

In this file you'll see the implementation of that component.

Basically you need to supply:

  • The type of chart (pie, doughnut, ...).
  • An array with each value to display in the chart.
  • An array with the labels (text) for each value.

There are other configuration parameters, but I think those are the required ones to make it work.

Cheers,

Dani