PHP code example of dobron / data-grid-visualizer

1. Go to this page and download the library: Download dobron/data-grid-visualizer 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/ */

    

dobron / data-grid-visualizer example snippets


echo Patient::query()->dataGridVisualizer([
    'visualize' => [
        'birth_year',
        function ($birthYear) {
            if ($birthYear < 1930) {
                return '#0e4429';
            }

            if ($birthYear < 1960) {
                return '#006d32';
            }

            if ($birthYear < 1990) {
                return '#26a641';
            }

            return '#39d353';
        }
    ],
])

DB::table('patients')->whereIn('birth_year', [1996, 2000])->dataGridVisualizer([
    'visualize' => [
        'birth_year',
        [
            1996 => '#800000'
            2000 => '#ffc800'
        ],
    ],
]);

$query->dataGridVisualizer([...])->image();

$query->dataGridVisualizer([...])->image('graph.png');