Display pie chart on Moodle Mobile

Display pie chart on Moodle Mobile

by Sarath P -
Number of replies: 5
Picture of Plugin developers

Hello everyone,

I have created a custom block to display basic user data and extended mobile support so that it is visible on my app. I am able to display the content both on the web and moodle mobile and using a mustache template.

Now I am trying to display a simple pie chart on my mobile. For the web, I am able to display the chart but not on mobile.

Can someone please tell me how to do that?

Moodle version 4.0.7+ 

Thanks in advance.

Average of ratings: -
In reply to Sarath P

Re: Display pie chart on Moodle Mobile

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

ho do you want to display that pie chart?

The app supports chart.js, you can use it with the "core-chart" component. For example, you can use this in your template:

<core-chart type="pie" [data]="[60, 40]" [labels]="['Label A', 'Label B']" height="100"></core-chart>

Cheers,
Dani
Average of ratings:Useful (1)
In reply to Dani Palou

Re: Display pie chart on Moodle Mobile

by Sarath P -
Picture of Plugin developers
Hi,
Thank you for your response. Where can I find similar examples to explore different ways to display data on the Mobile app?
In reply to Sarath P

Re: Display pie chart on Moodle Mobile

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

currently we only use core-chart in 2 places in the app: in mod choice and in mod feedback. I don't know if there is any 3rd party plugin using this component.

Cheers,
Dani
In reply to Dani Palou

Re: Display pie chart on Moodle Mobile

by Sarath P -
Picture of Plugin developers
Hi,

how can I change the default colors of the pie chart?