Charts in Moodle Mobile

Charts in Moodle Mobile

על ידי Inês de Sousa Lopes בתאריך
מספר תגובות: 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 חיוך

ממוצע דרוגים: -
בתגובה ל: Inês de Sousa Lopes

Re: Charts in Moodle Mobile

על ידי Dani Palou בתאריך
תמונה של Core developers תמונה של Moodle HQ תמונה של Particularly helpful Moodlers תמונה של Peer reviewers תמונה של 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