AreaChart

This example shows how to create beautiful AreaChart

coder commits

The above example shows you how to create AreaChart 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>AreaChart</h1>
        <p class="lead">
            This example shows how to create beautiful AreaChart
        </p>
    </div>

    <style>
        .apexcharts_wrapper>div,
        .apexcharts-canvas {
            margin: 0 auto;
        }

        #wrapper {}

        .github-style {
            /* display: flex; */
            /* justify-content: left; */
            font-weight: 400;
            height: 40px;
            margin-left: auto;
        }

        .github-style a {
            color: #0366d6;
            font-size: 18px;
        }

        .github-style .cmeta {
            display: block;
            color: #777;
            font-weight: 400;
            font-size: 14px;
        }

        .github-style .userimg {
            float: left;
            display: block;
            border-radius: 3px;
        }

        .github-style .userdetails {
            float: left;
            margin-left: 10px;
        }
    </style>

    <div id="wrapper">
        <?php
        $data = [
            [
                "date",
                "commits"
            ],
            [
                "11/11/2012",
                13
            ],
            [
                "11/18/2012",
                11
            ],
            [
                "11/25/2012",
                13
            ],
            [
                "12/2/2012",
                27
            ],
            [
                "12/9/2012",
                0
            ],
            [
                "12/16/2012",
                0
            ],
            [
                "12/23/2012",
                0
            ],
            [
                "12/30/2012",
                12
            ],
            [
                "1/6/2013",
                0
            ],
            [
                "1/13/2013",
                0
            ],
            [
                "1/20/2013",
                0
            ],
            [
                "1/27/2013",
                0
            ],
            [
                "2/3/2013",
                0
            ],
            [
                "2/10/2013",
                0
            ],
            [
                "2/17/2013",
                0
            ],
            [
                "2/24/2013",
                0
            ],
            [
                "3/3/2013",
                0
            ],
            [
                "3/10/2013",
                0
            ],
            [
                "3/17/2013",
                6
            ],
            [
                "3/24/2013",
                0
            ],
            [
                "3/31/2013",
                0
            ],
            [
                "4/7/2013",
                0
            ],
            [
                "4/14/2013",
                0
            ],
            [
                "4/21/2013",
                0
            ],
            [
                "4/28/2013",
                0
            ],
            [
                "5/5/2013",
                0
            ],
            [
                "5/12/2013",
                0
            ],
            [
                "5/19/2013",
                0
            ],
            [
                "5/26/2013",
                0
            ],
            [
                "6/2/2013",
                0
            ],
            [
                "6/9/2013",
                0
            ],
            [
                "6/16/2013",
                0
            ],
            [
                "6/23/2013",
                0
            ],
            [
                "6/30/2013",
                0
            ],
            [
                "7/7/2013",
                0
            ],
            [
                "7/14/2013",
                0
            ],
            [
                "7/21/2013",
                0
            ],
            [
                "7/28/2013",
                9
            ],
            [
                "8/4/2013",
                0
            ],
            [
                "8/11/2013",
                0
            ],
            [
                "8/18/2013",
                0
            ],
            [
                "8/25/2013",
                0
            ],
            [
                "9/1/2013",
                12
            ],
            [
                "9/8/2013",
                9
            ],
            [
                "9/15/2013",
                3
            ],
            [
                "9/22/2013",
                20
            ],
            [
                "9/29/2013",
                1
            ],
            [
                "10/6/2013",
                0
            ],
            [
                "10/13/2013",
                0
            ],
            [
                "10/20/2013",
                0
            ],
            [
                "10/27/2013",
                0
            ],
            [
                "11/3/2013",
                0
            ],
            [
                "11/10/2013",
                0
            ],
            [
                "11/17/2013",
                0
            ],
            [
                "11/24/2013",
                0
            ],
            [
                "12/1/2013",
                0
            ],
            [
                "12/8/2013",
                0
            ],
            [
                "12/15/2013",
                0
            ],
            [
                "12/22/2013",
                0
            ],
            [
                "12/29/2013",
                0
            ],
            [
                "1/5/2014",
                0
            ],
            [
                "1/12/2014",
                0
            ],
            [
                "1/19/2014",
                0
            ],
            [
                "1/26/2014",
                0
            ],
            [
                "2/2/2014",
                0
            ],
            [
                "2/9/2014",
                0
            ],
            [
                "2/16/2014",
                0
            ],
            [
                "2/23/2014",
                0
            ],
            [
                "3/2/2014",
                0
            ],
            [
                "3/9/2014",
                0
            ],
            [
                "3/16/2014",
                0
            ],
            [
                "3/23/2014",
                0
            ],
            [
                "3/30/2014",
                0
            ],
            [
                "4/6/2014",
                0
            ],
            [
                "4/13/2014",
                0
            ],
            [
                "4/20/2014",
                0
            ],
            [
                "4/27/2014",
                0
            ],
            [
                "5/4/2014",
                0
            ],
            [
                "5/11/2014",
                0
            ],
            [
                "5/18/2014",
                0
            ],
            [
                "5/25/2014",
                0
            ],
            [
                "6/1/2014",
                0
            ],
            [
                "6/8/2014",
                11
            ],
            [
                "6/15/2014",
                0
            ],
            [
                "6/22/2014",
                0
            ],
            [
                "6/29/2014",
                0
            ],
            [
                "7/6/2014",
                0
            ],
            [
                "7/13/2014",
                0
            ],
            [
                "7/20/2014",
                34
            ],
            [
                "7/27/2014",
                18
            ],
            [
                "8/3/2014",
                13
            ],
            [
                "8/10/2014",
                1
            ],
            [
                "8/17/2014",
                0
            ],
            [
                "8/24/2014",
                0
            ],
            [
                "8/31/2014",
                1
            ],
            [
                "9/7/2014",
                0
            ],
            [
                "9/14/2014",
                0
            ],
            [
                "9/21/2014",
                0
            ],
            [
                "9/28/2014",
                0
            ],
            [
                "10/5/2014",
                0
            ],
            [
                "10/12/2014",
                0
            ],
            [
                "10/19/2014",
                0
            ],
            [
                "10/26/2014",
                0
            ],
            [
                "11/2/2014",
                0
            ],
            [
                "11/9/2014",
                0
            ],
            [
                "11/16/2014",
                0
            ],
            [
                "11/23/2014",
                0
            ],
            [
                "11/30/2014",
                0
            ],
            [
                "12/7/2014",
                0
            ],
            [
                "12/14/2014",
                0
            ],
            [
                "12/21/2014",
                0
            ],
            [
                "12/28/2014",
                0
            ],
            [
                "1/4/2015",
                0
            ],
            [
                "1/11/2015",
                0
            ],
            [
                "1/18/2015",
                0
            ],
            [
                "1/25/2015",
                0
            ],
            [
                "2/1/2015",
                8
            ],
            [
                "2/8/2015",
                1
            ],
            [
                "2/15/2015",
                0
            ],
            [
                "2/22/2015",
                4
            ],
            [
                "3/1/2015",
                0
            ],
            [
                "3/8/2015",
                0
            ],
            [
                "3/15/2015",
                4
            ],
            [
                "3/22/2015",
                0
            ],
            [
                "3/29/2015",
                0
            ],
            [
                "4/5/2015",
                0
            ],
            [
                "4/12/2015",
                0
            ],
            [
                "4/19/2015",
                0
            ],
            [
                "4/26/2015",
                0
            ],
            [
                "5/3/2015",
                0
            ],
            [
                "5/10/2015",
                0
            ],
            [
                "5/17/2015",
                0
            ],
            [
                "5/24/2015",
                1
            ],
            [
                "5/31/2015",
                18
            ],
            [
                "6/7/2015",
                0
            ],
            [
                "6/14/2015",
                2
            ],
            [
                "6/21/2015",
                3
            ],
            [
                "6/28/2015",
                3
            ],
            [
                "7/5/2015",
                0
            ],
            [
                "7/12/2015",
                0
            ],
            [
                "7/19/2015",
                0
            ],
            [
                "7/26/2015",
                0
            ],
            [
                "8/2/2015",
                0
            ],
            [
                "8/9/2015",
                0
            ],
            [
                "8/16/2015",
                0
            ],
            [
                "8/23/2015",
                0
            ],
            [
                "8/30/2015",
                0
            ],
            [
                "9/6/2015",
                0
            ],
            [
                "9/13/2015",
                0
            ],
            [
                "9/20/2015",
                12
            ],
            [
                "9/27/2015",
                0
            ],
            [
                "10/4/2015",
                0
            ],
            [
                "10/11/2015",
                5
            ],
            [
                "10/18/2015",
                3
            ],
            [
                "10/25/2015",
                1
            ],
            [
                "11/1/2015",
                18
            ],
            [
                "11/8/2015",
                39
            ],
            [
                "11/15/2015",
                7
            ],
            [
                "11/22/2015",
                1
            ],
            [
                "11/29/2015",
                0
            ],
            [
                "12/6/2015",
                5
            ],
            [
                "12/13/2015",
                0
            ],
            [
                "12/20/2015",
                2
            ],
            [
                "12/27/2015",
                0
            ],
            [
                "1/3/2016",
                0
            ],
            [
                "1/10/2016",
                0
            ],
            [
                "1/17/2016",
                0
            ],
            [
                "1/24/2016",
                0
            ],
            [
                "1/31/2016",
                0
            ],
            [
                "2/7/2016",
                0
            ],
            [
                "2/14/2016",
                1
            ],
            [
                "2/21/2016",
                0
            ],
            [
                "2/28/2016",
                1
            ],
            [
                "3/6/2016",
                0
            ],
            [
                "3/13/2016",
                0
            ],
            [
                "3/20/2016",
                0
            ],
            [
                "3/27/2016",
                0
            ],
            [
                "4/3/2016",
                3
            ],
            [
                "4/10/2016",
                9
            ],
            [
                "4/17/2016",
                0
            ],
            [
                "4/24/2016",
                0
            ],
            [
                "5/1/2016",
                0
            ],
            [
                "5/8/2016",
                0
            ],
            [
                "5/15/2016",
                0
            ],
            [
                "5/22/2016",
                0
            ],
            [
                "5/29/2016",
                0
            ],
            [
                "6/5/2016",
                0
            ],
            [
                "6/12/2016",
                0
            ],
            [
                "6/19/2016",
                0
            ],
            [
                "6/26/2016",
                1
            ],
            [
                "7/3/2016",
                0
            ],
            [
                "7/10/2016",
                0
            ],
            [
                "7/17/2016",
                15
            ],
            [
                "7/24/2016",
                4
            ],
            [
                "7/31/2016",
                0
            ],
            [
                "8/7/2016",
                0
            ],
            [
                "8/14/2016",
                0
            ],
            [
                "8/21/2016",
                0
            ],
            [
                "8/28/2016",
                0
            ],
            [
                "9/4/2016",
                1
            ],
            [
                "9/11/2016",
                0
            ],
            [
                "9/18/2016",
                0
            ],
            [
                "9/25/2016",
                0
            ],
            [
                "10/2/2016",
                0
            ],
            [
                "10/9/2016",
                0
            ],
            [
                "10/16/2016",
                0
            ],
            [
                "10/23/2016",
                0
            ],
            [
                "10/30/2016",
                0
            ],
            [
                "11/6/2016",
                0
            ],
            [
                "11/13/2016",
                0
            ],
            [
                "11/20/2016",
                0
            ],
            [
                "11/27/2016",
                1
            ],
            [
                "12/4/2016",
                0
            ],
            [
                "12/11/2016",
                1
            ],
            [
                "12/18/2016",
                0
            ],
            [
                "12/25/2016",
                0
            ],
            [
                "1/1/2017",
                0
            ],
            [
                "1/8/2017",
                0
            ],
            [
                "1/15/2017",
                0
            ],
            [
                "1/22/2017",
                0
            ],
            [
                "1/29/2017",
                0
            ],
            [
                "2/5/2017",
                0
            ],
            [
                "2/12/2017",
                0
            ],
            [
                "2/19/2017",
                0
            ],
            [
                "2/26/2017",
                0
            ],
            [
                "3/5/2017",
                0
            ],
            [
                "3/12/2017",
                0
            ],
            [
                "3/19/2017",
                0
            ],
            [
                "3/26/2017",
                0
            ],
            [
                "4/2/2017",
                0
            ],
            [
                "4/9/2017",
                0
            ],
            [
                "4/16/2017",
                0
            ],
            [
                "4/23/2017",
                0
            ],
            [
                "4/30/2017",
                0
            ],
            [
                "5/7/2017",
                0
            ],
            [
                "5/14/2017",
                0
            ],
            [
                "5/21/2017",
                0
            ],
            [
                "5/28/2017",
                0
            ],
            [
                "6/4/2017",
                0
            ],
            [
                "6/11/2017",
                0
            ],
            [
                "6/18/2017",
                0
            ],
            [
                "6/25/2017",
                0
            ],
            [
                "7/2/2017",
                0
            ],
            [
                "7/9/2017",
                0
            ],
            [
                "7/16/2017",
                0
            ],
            [
                "7/23/2017",
                0
            ],
            [
                "7/30/2017",
                0
            ],
            [
                "8/6/2017",
                0
            ],
            [
                "8/13/2017",
                0
            ],
            [
                "8/20/2017",
                0
            ],
            [
                "8/27/2017",
                0
            ],
            [
                "9/3/2017",
                0
            ],
            [
                "9/10/2017",
                0
            ],
            [
                "9/17/2017",
                2
            ],
            [
                "9/24/2017",
                4
            ],
            [
                "10/1/2017",
                0
            ],
            [
                "10/8/2017",
                0
            ],
            [
                "10/15/2017",
                0
            ],
            [
                "10/22/2017",
                0
            ],
            [
                "10/29/2017",
                0
            ],
            [
                "11/5/2017",
                0
            ],
            [
                "11/12/2017",
                0
            ],
            [
                "11/19/2017",
                0
            ],
            [
                "11/26/2017",
                0
            ],
            [
                "12/3/2017",
                0
            ],
            [
                "12/10/2017",
                0
            ],
            [
                "12/17/2017",
                0
            ],
            [
                "12/24/2017",
                0
            ],
            [
                "12/31/2017",
                0
            ],
            [
                "1/7/2018",
                0
            ],
            [
                "1/14/2018",
                0
            ],
            [
                "1/21/2018",
                0
            ],
            [
                "1/28/2018",
                0
            ],
            [
                "2/4/2018",
                0
            ],
            [
                "2/11/2018",
                0
            ],
            [
                "2/18/2018",
                0
            ],
            [
                "2/25/2018",
                0
            ],
            [
                "3/4/2018",
                0
            ],
            [
                "3/11/2018",
                0
            ],
            [
                "3/18/2018",
                12
            ],
            [
                "3/25/2018",
                0
            ],
            [
                "4/1/2018",
                0
            ],
            [
                "4/8/2018",
                0
            ],
            [
                "4/15/2018",
                0
            ],
            [
                "4/22/2018",
                0
            ],
            [
                "4/29/2018",
                0
            ],
            [
                "5/6/2018",
                0
            ],
            [
                "5/13/2018",
                0
            ],
            [
                "5/20/2018",
                1
            ]
        ];
        \koolreport\apexcharts\BrushCharts::create(array(
            "dataSource" => $data,
            "columns" => array(
                "date" => [
                    "label" => "Date",
                    "categoryType" => "datetime",
                ],
                "commits" => [
                    "chartType" => "area",
                    "charts" => [1, 2]
                ],
            ),
            "brushMap" => [
                2 => 1,
            ],
            "options" => [],
            'strokeWidth' => 0,
            'fillOpacity' => 1,
            'fillType' => 'solid',
            'showLabel' => false,
            "showYaxis" => false,
            "showLegend" => false,
            // "showLabel" => true,
            // "height" => "600px",
            // "width" => "85%",
            "maxWidth" => 800,

            "settings_1" => [
                'options' => [
                    "chart | events" => [
                        "mounted" => "function (chart) {
                            // console.log('chart mounted event');
                            var commitsEl = document.querySelector('.cmeta span.commits');
                            var commits = chart.getSeriesTotalXRange(chart.w.globals.minX, chart.w.globals.maxX)
                            commitsEl.innerHTML = commits
                        }",
                        "updated" => "function (chart) {
                            // console.log('chart updated event');
                            var commitsEl = document.querySelector('.cmeta span.commits');
                            var commits = chart.getSeriesTotalXRange(chart.w.globals.minX, chart.w.globals.maxX)
                            commitsEl.innerHTML = commits
                        }"
                    ],
                    'legend' => [
                        'position' => 'top',
                        'horizontalAlign' => 'left'
                    ],
                    'yaxis | tickAmount' => 3,
                ],
                'colors' => [
                    '#7BD39A'
                ],
                'widthHeightAutoRatio' => 3.5,
                // 'height' => 160,
            ],

            "settings_2" => [
                "options" => [],
                'colors' => [
                    '#FF7F00'
                ],
                'widthHeightAutoRatio' => 3,
                // "height" => 200
            ]
        ));
        ?>

        <div style="margin: 0 auto; max-width: 800px;">
            <h5 class="github-style">
                <img class="userimg" src="https://picsum.photos/200/200/?image=1031" data-hovercard-user-id="634573" alt="" width="38" height="38" />
                <div class="userdetails">
                    <a class="username">coder</a>
                    <span class="cmeta">
                        <span class="commits"></span> commits
                    </span>
                </div>
            </h5>
        </div>

    </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