BarChart

This example shows how to create beautiful BarChart

Marine Sprite
Striking Calf
Tank Picture
Bucket Slope
Reborn Kid
445541372243215332335213433212171191511209758694251431212319109321382581241301087200820082009200920102010201220122013201320142014160K160K120K120K80K80K40K40K0K0KFiction Books Sales
Download SVG
Download PNG
Download CSV

The above example shows you how to create BarChart 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>BarChart</h1>
        <p class="lead">
            This example shows how to create beautiful BarChart
        </p>
    </div>
    <style>
        .apexcharts-canvas {
            margin: 0 auto;
        }
    </style>
    <div style="margin-bottom:50px;">
        <?php
        $data = [
            [
                'year',
                'Marine Sprite',
                'Striking Calf',
                'Tank Picture',
                'Bucket Slope',
                'Reborn Kid',
            ],
            [
                2008,
                44,
                53,
                12,
                9,
                25
            ],
            [
                2009,
                55,
                32,
                17,
                7,
                12
            ],
            [
                2010,
                41,
                33,
                11,
                5,
                19
            ],
            [
                2011,
                37,
                52,
                9,
                8,
                32
            ],
            [
                2012,
                22,
                13,
                15,
                6,
                25
            ],
            [
                2013,
                43,
                43,
                11,
                9,
                24
            ],
            [
                2014,
                21,
                32,
                20,
                4,
                10
            ]
        ];
        \koolreport\apexcharts\BarChart::create(array(
            "title" => "Fiction Books Sales",
            "dataSource" => $data,
            "columns" => array(
                'year',
                'Marine Sprite',
                'Striking Calf',
                'Tank Picture',
                'Bucket Slope',
                'Reborn Kid',
            ),
            "options" => [
                'plotOptions | bar | dataLabels | total' => [
                    'enabled' => true,
                    'offsetX' => 0,
                    'style | fontSize' => '13px',
                    'style | fontWeight' => 900,
                ],
                'stroke | colors' => [
                    '#fff'
                ],
                'xaxis | labels | formatter' => 'function (val) {
                    return val + "K"
                }',
                'tooltip | y | formatter' => 'function (val) {
                    return val + "K"
                }',
                'legend' => [
                    'position' => 'top',
                    'horizontalAlign' => 'left',
                    'offsetX' => 40
                ]
            ],
            "stacked" => true,
            "yTitle" => null,
            "strokeWidth" => 1,
            "fillOpacity" => 1,
            // "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