Custom Axis

The above example shows you how to create LineChart 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" => 'Year',
                "textStyle" => [
                    "color" => '#01579b',
                    "fontSize" => 20,
                    "fontName" => 'Arial',
                    "bold" => true,
                    "italic" => true
                ],
                "titleTextStyle" => [
                    "color" => '#01579b',
                    "fontSize" => 16,
                    "fontName" => 'Arial',
                    "bold" => false,
                    "italic" => true
                ]
            ],
            "vAxis" => [
                "title" => 'Values',
                "textStyle" => [
                    "color" => '#1a237e',
                    "fontSize" => 24,
                    "bold" => true
                ],
                "titleTextStyle" => [
                    "color" => '#1a237e',
                    "fontSize" => 24,
                    "bold" => true
                ]
            ],
        )
<?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\LineChart;

$data = [
    ['Year', 'Sales', 'Expenses'],
    ['2004',  1000,      400],
    ['2005',  1170,      460],
    ['2006',  660,       1120],
    ['2007',  1030,      540]
];

?>
<div class="report-content">
    <div class="text-center">
        <h1>Custom Axis</h1>
    </div>
    <div style="margin-bottom:50px;">
        <?php
        LineChart::create(array(
            "title" => "Company Performance",
            "dataSource" => $data,
            "columns" => array(
                'Year',
                'Sales',
                'Expenses'
            ),
            "options" => array(
                "hAxis" => [
                    "title" => 'Year',
                    "textStyle" => [
                        "color" => '#01579b',
                        "fontSize" => 20,
                        "fontName" => 'Arial',
                        "bold" => true,
                        "italic" => true
                    ],
                    "titleTextStyle" => [
                        "color" => '#01579b',
                        "fontSize" => 16,
                        "fontName" => 'Arial',
                        "bold" => false,
                        "italic" => true
                    ]
                ],
                "vAxis" => [
                    "title" => 'Values',
                    "textStyle" => [
                        "color" => '#1a237e',
                        "fontSize" => 24,
                        "bold" => true
                    ],
                    "titleTextStyle" => [
                        "color" => '#1a237e',
                        "fontSize" => 24,
                        "bold" => true
                    ]
                ],
                "colors" => ['#a52714', '#097138']
            )
        ));
        ?>
    </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