Custom colors for pie chart

Custom colors for pie chart

by Pedro Perez -
Number of replies: 3

Hi all,

Is there a way to change the default colors in the pie chart?
What i'm trying to do is to use a different color palette.


Thanks,
Pedro.



Average of ratings: Useful (1)
In reply to Pedro Perez

Re: Custom colors for pie chart

by Gisele Brugger -

pie

the colors are very similar...

I need to change the colors too.

Any solution?



in moodle/blocks/configurable_reports/components/plot/pie/graph.php

   $Test->createColorGradientPalette(195,204,56,223,110,41,5);


in file /moodle/blocks/configurable_reports/lib/pChart/pChart.class  have

/* pChart class definition */

 class pChart

  {

   /* Palettes definition */

   var $Palette = array("0"=>array("R"=>188,"G"=>224,"B"=>46),

                        "1"=>array("R"=>224,"G"=>100,"B"=>46),

                        "2"=>array("R"=>224,"G"=>214,"B"=>46),

                        "3"=>array("R"=>46,"G"=>151,"B"=>224),

                        "4"=>array("R"=>176,"G"=>46,"B"=>224),

                        "5"=>array("R"=>224,"G"=>46,"B"=>117),

                        "6"=>array("R"=>92,"G"=>224,"B"=>46),

                        "7"=>array("R"=>224,"G"=>176,"B"=>46));

In reply to Gisele Brugger

Re: Custom colors for pie chart

by Gisele Brugger -

I am using version = 2011040115 configurable report with moodle 2.7.2

In reply to Gisele Brugger

Re: Custom colors for pie chart

by Richard Flurey -

Hi Gisele,

I am surprised nobody got back to you. This is something we've done on many installations of Moodle. It is just a PHP coding customisation rather than a Moodle thing.


You can simply change the following line in graph.php:

$Test->createColorGradientPalette(195,204,56,223,110,41,5);


Change it To:

$Test->createColorGradientPalette(249,186,17,166,6,195,0);


That will give a little more variety to the colours, rather than the many shades of yellow and orange. It should be as simple as that.


I hope that helps.


Cheers,

Richard

Average of ratings: Useful (2)