Commit 37039c21 authored by César's avatar César
Browse files

Fix color differentiation in Pie chart

parent 08090b61
......@@ -20,7 +20,14 @@ class CRM_Reportplus_Utils_ChartJS {
'#166a8f',
'#00a950',
'#58595b',
'#8549ba'
'#8549ba',
'#F0E68C',
'#CD5C5C',
'#4169E1',
'#98FB98',
'#F4A460',
'#FFC0CB',
'#008080',
];
/**
......@@ -123,17 +130,22 @@ class CRM_Reportplus_Utils_ChartJS {
private static function pie($rows, $params = []) {
$i = 0;
$colors = [];
$datasets = [];
foreach ($rows as $yLabel => $row) {
//$color = self::$_colours[$i % (count(self::$_colours))];
foreach ($row as $value) {
$colors[] = self::$_colours[$i];
$i = ($i == count(self::$_colours) - 1) ? 0 : ($i + 1);
}
if ($colors[0] == $colors[count($colors) - 1]) {
$colors[count($colors) - 1] = self::$_colours[1];
}
$datasets[] = [
'label' => $yLabel,
//color(window.chartColors.red).alpha(0.5).rgbString(),
'backgroundColor' => array_slice(self::$_colours, count(array_values($row))),
'backgroundColor' => $colors,
'data' => array_values($row),
];
$i++;
}
return $datasets;
......
......@@ -12,13 +12,13 @@
<url desc="Main Extension Page">https://lab.civicrm.org/extensions/reportplus</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-07-30</releaseDate>
<version>2.4.4</version>
<releaseDate>2021-09-03</releaseDate>
<version>2.4.5</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.33</ver>
</compatibility>
<comments>This is a new, undeveloped module</comments>
<comments>ReportPlus extends the default CiviCRM Form's Framework adding new features</comments>
<classloader>
<psr4 prefix="Civi\" path="Civi"/>
</classloader>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment