What are some alternative ways to visually represent data in PHP, apart from treemaps?

When looking for alternative ways to visually represent data in PHP apart from treemaps, one option is to use bar charts. Bar charts are a simple and effective way to display data in a visually appealing manner. By using the GD library in PHP, we can easily generate bar charts to represent different data points.

<?php
// Sample data for the bar chart
$data = array(
    'January' => 100,
    'February' => 200,
    'March' => 150,
    'April' => 300,
);

// Create a new image with specified dimensions
$image = imagecreate(400, 300);

// Set the background color
$bg_color = imagecolorallocate($image, 255, 255, 255);

// Set the bar color
$bar_color = imagecolorallocate($image, 0, 0, 255);

// Set the font color
$font_color = imagecolorallocate($image, 0, 0, 0);

// Set the font size
$font_size = 12;

// Set the margin for the bars
$margin = 20;

// Set the starting position for the first bar
$x = $margin;

// Calculate the width of each bar
$bar_width = (400 - 2 * $margin) / count($data);

// Loop through the data and draw the bars
foreach ($data as $label => $value) {
    // Calculate the height of the bar based on the data value
    $bar_height = $value;

    // Draw the bar
    imagefilledrectangle($image, $x, 300 - $bar_height, $x + $bar_width, 300, $bar_color);

    // Draw the label below the bar
    imagestring($image, $font_size, $x + 5, 300 + 5, $label, $font_color);

    // Move to the next position for the next bar
    $x += $bar_width;
}

// Output the image
header('Content-type: image/png');
imagepng($image);

// Free up memory
imagedestroy($image);
?>