PHP code example of atelier / chart

1. Go to this page and download the library: Download atelier/chart library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

atelier / chart example snippets


use Atelier\Chart\Chart;

echo Chart::render(Chart::bar()
    ->series('Revenue', ['Q1' => 18, 'Q2' => 27, 'Q3' => 24, 'Q4' => 35])
    ->build());



declare(strict_types=1);

use Atelier\Chart\Chart;

  ->description('Revenue by quarter for 2025 and 2026, in millions.')
    ->series('2025', ['Q1' => 18, 'Q2' => 32, 'Q3' => 24, 'Q4' => 42])
    ->series('2026', ['Q1' => 26, 'Q2' => 24, 'Q3' => 38, 'Q4' => 35])
    ->build();

echo Chart::render($model);

use Atelier\Chart\Theme\Theme;

echo Chart::render($model, Theme::warm());

use Atelier\Chart\Renderer\Svg\SvgRenderOptions;

echo Chart::render($model, options: new SvgRenderOptions(
    classes: true,
    dataAttributes: true,
));
bash
php examples/generate.php