Icon set
An icon set draws a small icon to the left of the cell value based on the cell's relative position within the range. Common styles include three-colour traffic lights and five-star ratings.
Methods
ConditionalFormat::iconStyle(int $style): self
ConditionalFormat::reverseIcons(bool $on = true): self
ConditionalFormat::iconsOnly(bool $on = true): selfint $style
Icon style constant. See
\Vtiful\Kernel\ConditionalFormat::ICONS_3_*/ICONS_4_*/ICONS_5_*.
bool $on
Toggle, defaults to
true.reverseIconsflips the icon order (so high values use the "low" icon);iconsOnlyhides the cell value and shows only the icon.
Three-colour traffic lights
$config = ['path' => './tests'];
$excel = new \Vtiful\Kernel\Excel($config);
$cf = new \Vtiful\Kernel\ConditionalFormat();
$cf->type(\Vtiful\Kernel\ConditionalFormat::TYPE_ICON_SETS)
->iconStyle(\Vtiful\Kernel\ConditionalFormat::ICONS_3_TRAFFIC_LIGHTS_UNRIMMED);
$excel->fileName('tutorial.xlsx')
->header(['score'])
->data([[10], [40], [55], [60], [70], [80], [90], [100]])
->conditionalFormatRange('A2:A9', $cf)
->output();Five-star rating (icons only)
Reversed icon order
For example, three coloured arrows: by default "higher = green"; with reverseIcons it becomes "lower = green":
Icon style constants
All defined under \Vtiful\Kernel\ConditionalFormat:
Last updated
Was this helpful?