Custom Axis

The above example shows you how to create BarChart using built-in Google Charts. In this example, for purpose of chart demonstration only, we do use mock-up data from array. As you can see, the KoolReport's widget in general support dataSource could be DataStore, Process, DataSource or even simple array.

For example:

...
"options" => array(
            "hAxis" => [
                "title" => 'Total Population',
                "minValue" => 0,
                "textStyle" => [
                    "bold" => true,
                    "fontSize" => 12,
                    "color" => '#4d4d4d'
                ],
                "titleTextStyle" => [
                    "bold" => true,
                    "fontSize" => 18,
                    "color" => '#4d4d4d'
                ]
            ],
            "vAxis" => [
                "title" => 'City',
                "textStyle" => [
                    "fontSize" => 14,
                    "bold" => true,
                    "color" => '#848484'
                ],
                "titleTextStyle" => [
                    "fontSize" => 14,
                    "bold" => true,
                    "color" => '#848484'
                ]
            ]
        )
<?php

require_once "../../../../load.koolreport.php";
require_once "MyReport.php";

$report = new MyReport;
$report->run()->render();
<?php
require_once "../../../../load.koolreport.php";
class MyReport extends \koolreport\KoolReport
{

}
<?php

use \koolreport\widgets\google\BarChart;

$data = [
    ['City', '2010 Population', '2000 Population'],
    ['New York City, NY', 8175000, 8008000],
    ['Los Angeles, CA', 3792000, 3694000],
    ['Chicago, IL', 2695000, 2896000],
    ['Houston, TX', 2099000, 1953000],
    ['Philadelphia, PA', 1526000, 1517000]
];
?>
<div class="report-content">
    <div class="text-center">
        <h1>Custom Axis</h1>
    </div>
    <div style="margin-bottom:50px;">
        <?php
        BarChart::create(array(
            "dataSource" => $data,
            "columns" => array(
                'City',
                '2010 Population',
                '2000 Population'
            ),
            "options" => array(
                "title" => "Population of Largest U.S. Cities",
                "hAxis" => [
                    "title" => 'Total Population',
                    "minValue" => 0,
                    "textStyle" => [
                        "bold" => true,
                        "fontSize" => 12,
                        "color" => '#4d4d4d'
                    ],
                    "titleTextStyle" => [
                        "bold" => true,
                        "fontSize" => 18,
                        "color" => '#4d4d4d'
                    ]
                ],
                "vAxis" => [
                    "title" => 'City',
                    "textStyle" => [
                        "fontSize" => 14,
                        "bold" => true,
                        "color" => '#848484'
                    ],
                    "titleTextStyle" => [
                        "fontSize" => 14,
                        "bold" => true,
                        "color" => '#848484'
                    ]
                ]
            )
        ));
        ?>
    </div>

</div>

What People Are Saying

"KoolReport helps me very much in creating data report for my corporate! Keep up your good work!"
-- Alain Melsens

"The first use of your product. I was impressed by its easiness and powerfulness. This product is a great and amazing."
-- Dr. Lew Choy Onn

"Fantastic framework for reporting!"
-- Greg Schneider

Download KoolReport Get KoolReport Pro