Hi Daniel,
To customize pivot table's or pivot matrix's headers or data cells, please their "map" property:
PivotTable::create([
...
'map' => array(
'rowHeader' => function($rowHeader, $headerInfo) {
// Util::prettyPrint($headerInfo);
$v = $rowHeader;
if (isset($headerInfo['childOrder']))
$v = $headerInfo['childOrder'] . ". " . $v;
return $v;
},
'columnHeader' => function($colHeader, $headerInfo) {
$v = $colHeader;
if ($headerInfo['fieldName'] === 'orderYear')
$v = 'Year-' . $v;
else if ($headerInfo['fieldName'] === 'orderQuarter')
$v = 'Quarter-' . $v;
if (isset($headerInfo['childOrder']))
$v = $headerInfo['childOrder'] . ". " . $v;
return $v;
},
'dataCell' => function($value, $cellInfo) {
// Util::prettyPrint($cellInfo);
$rfOrder = $cellInfo['row']['fieldOrder'];
$cfOrder = $cellInfo['column']['fieldOrder'];
$df = $cellInfo['fieldName'];
$dfOrder = $cellInfo['fieldOrder'];
// return "$rfOrder:$cfOrder:$df. $value";
return $cellInfo['formattedValue'];
},
),
...
]);
You could modify the values or put them in a classed element for setting colors with CSS, etc.
Let us know if you need further help. Thanks!