LineChart

This example shows how to create beautiful LineChart

Analysis: 5 daysCode: 2 daysTest: 4 daysValidation: 4 daysDeployment: 6 days27 Feb27 FebMar '19Mar '1903 Mar03 Mar05 Mar05 Mar07 Mar07 Mar09 Mar09 Mar11 Mar11 Mar13 Mar13 Mar15 Mar15 Mar17 Mar17 Mar19 Mar19 Mar21 Mar21 Mar
Download SVG
Download PNG
Download CSV

The above example shows you how to create TimeLineChart using ApexCharts 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.

<?php

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

$report = new MyReport;
$report->run()->render();
<?php

class MyReport extends \koolreport\KoolReport
{

}
<div class="report-content">
    <div class="text-center">
        <h1>LineChart</h1>
        <p class="lead">
            This example shows how to create beautiful LineChart
        </p>
    </div>
    <style>
        .apexcharts-canvas {
            margin: 0 auto;
        }
    </style>
    <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js"></script> -->
    <div style="margin-bottom:50px;">
        <?php
        $data = [
            [
                'phase',
                'timeline_start',
                'timeline_end',
            ],
            [
                "Analysis",
                "2019-02-27",
                "2019-03-04"
            ],
            [
                "Code",
                "2019-3-2",
                "2019-3-4"
            ],
            [
                "Test",
                "2019-3-4",
                "2019-3-8"
            ],
            [
                "Validation",
                "2019-3-8",
                "2019-3-12"
            ],
            [
                "Deployment",
                "2019-3-12",
                "2019-3-18"
            ]
        ];
        \koolreport\apexcharts\TimeLineChart::create(array(
            "dataSource" => $data,
            "jsFiles" => ["moment"],
            "columns" => array(
                "phase" => [
                    "label" => "Phase",
                ],
                'timeline' => [
                    'combination' => [
                        'timeline_start',
                        'timeline_end',
                    ]
                ]
            ),
            "options" => [
                'plotOptions | bar' => [
                    'distributed' => true,
                    'dataLabels | hideOverflowingLabels' => false
                ],
                'dataLabels' => [
                    'formatter' => "function(val, opts) {
                        var label = opts.w.globals.labels[opts.dataPointIndex]
                        var a = moment(val[0])
                        var b = moment(val[1])
                        var diff = b.diff(a, 'days')
                        return label + ': ' + diff + (diff > 1 ? ' days' : ' day')
                    }",
                    'style | colors' => [
                        '#f3f4f5',
                        '#fff'
                    ],
                ],
                'yaxis | show' => false,
                'xaxis | type' => 'datetime',
                'grid | row' => [
                    'colors' => [
                        '#f3f4f5',
                        '#fff'
                    ],
                    'opacity' => 1
                ],
            ],
            "colors" => ["#008FFB", "#00E396", "#775DD0", "#FEB019", "#FF4560"],
            "showLegend" => false,
            "showLabel" => true,
            // "height" => "600px",
            // "width" => "85%",
            "maxWidth" => "800px",
        ));
        ?>
    </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