Axis Label Position

The above example shows you how to create LineChart using D3 package. 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.

The example show how to create line chart with axis label position.

Set the display position of the label relative to the axis.

For example:

...
"options" => array(
    ...
    "axis" => array(
        "x" => array(
            'label' => array(
                "text" => 'X Label',
                'position' => 'outer-center'
            )
        ),
        "y" => array(
            'label' => array(
                "text" => 'Y Label',
                'position' => 'outer-middle'
            )
        ),
        "y2" => array(
            "show" => true,
            "label" => array(
                "text" => 'Y2 Label',
                'position' => 'outer-middle'
            )
        )
    )
)
...
<?php
require_once "../../../../load.koolreport.php";
require_once "MyReport.php";
$report = new MyReport;
$report->run();
$report->render();
<?php

class MyReport extends \koolreport\KoolReport
{

}
<h1 class='title'>Axis Label Position</h1>
<?php
$data = [
    ['sample1' =>  30, 'sample2' => 430],
    ['sample1' => 200, 'sample2' => 300],
    ['sample1' => 100, 'sample2' => 500],
    ['sample1' => 400, 'sample2' => 400],
    ['sample1' => 150, 'sample2' => 650],
    ['sample1' => 250, 'sample2' => 250]
];

\koolreport\d3\LineChart::create(array(
    "dataSource" => $data,
    "columns" => array(
        'sample1',
        'sample2'
    ),
    "options" => array(
        "data" => array(
            "axes" => array(
                "sample1" => 'y',
                "sample2" => 'y2'
            )
        ),
        "axis" => array(
            "x" => array(
                'label' => array(
                    "text" => 'X Label',
                    'position' => 'outer-center'
                )
            ),
            "y" => array(
                'label' => array(
                    "text" => 'Y Label',
                    'position' => 'outer-middle'
                )
            ),
            "y2" => array(
                "show" => true,
                "label" => array(
                    "text" => 'Y2 Label',
                    'position' => 'outer-middle'
                )
            )
        )
    )
));

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