/**
 * Set chart show values flag true.
 *
 * @return self Returns instance of the Chart class.
 *
 * @access public
 */
public function showPercents(): self

Examples

Set Chart element type showPercents using fluent interface

use function Thermage\chart;
use function Thermage\render;

// ...

$data = [
    'apple' => [
        'label' => 'Apple',
        'value' => 100,
        'color' => 'red',
    ],
    'orange' => [
        'label' => 'Orange',
        'value' => 270,
        'color' => 'orange',
    ],
    'lime' => [
        'label' => 'Lime',
        'value' => 220,
        'color' => 'green',
    ],
];

render(
  chart()->data($data)->showPercents()
);

Set Chart element type showPercents using using magic classes pipeline

use function Thermage\chart;
use function Thermage\render;

// ...

$data = [
    'apple' => [
        'label' => 'Apple',
        'value' => 100,
        'color' => 'red',
    ],
    'orange' => [
        'label' => 'Orange',
        'value' => 270,
        'color' => 'orange',
    ],
    'lime' => [
        'label' => 'Lime',
        'value' => 220,
        'color' => 'green',
    ],
];

render(
  chart('', 'show-percents')->data($data)
);
Terminal
$ php thermage.php
Apple17%
Orange46%
Lime37%