Optional Y Grid Lines

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 optional y grid lines.

Show additional grid lines along y axis.

This option accepts array including object that has value, text, position and class.

Default: []

For example:

...
"options" => array(
    ...
    "grid" => array(
        "y" => array(
            "lines" => array(
                array(
                    "value" => 50,
                    "text" => 'Label 50  for  y'
                ),
                array(
                    "value" => 1300,
                    "text" => 'Label 1300 for y2',
                    "axis" => 'y2',
                    "position" => 'start'
                ),
                array(
                    "value" => 350,
                    "text" => 'Label 350 for y',
                    "position" => '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'>Optional Y Grid Lines</h1>
<?php
$data = [
    ['sample' =>  30, 'sample2' => 1300],
    ['sample' => 200, 'sample2' => 1200],
    ['sample' => 100, 'sample2' => 1100],
    ['sample' => 400, 'sample2' => 1400],
    ['sample' => 150, 'sample2' => 1500],
    ['sample' => 250, 'sample2' => 1250]
];

\koolreport\d3\LineChart::create(array(
    "dataSource" => $data,
    "columns" => array(
        'sample',
        'sample2'
    ),
    "options" => array(
        "data" => array(
            "axes" => array(
                "sample2" => 'y2'
            )
        ),
        "axis" => array(
            "y2" => array(
                "show" => true
            )
        ),
        "grid" => array(
            "y" => array(
                "lines" => array(
                    array(
                        "value" => 50,
                        "text" => 'Label 50  for  y'
                    ),
                    array(
                        "value" => 1300,
                        "text" => 'Label 1300 for y2',
                        "axis" => 'y2',
                        "position" => 'start'
                    ),
                    array(
                        "value" => 350,
                        "text" => 'Label 350 for y',
                        "position" => '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