dcodegroup/gantt

v1.0.6 2018-04-16 00:13 UTC

This package is auto-updated.

Last update: 2024-09-14 04:27:52 UTC


README

甘特图

composer.json

    "autoload": {
        ...
        "psr-4": {
            ...,
            "DcodeGroup\\": "vendor/dcodegroup/"
        }
    },

实例化

$groupedCols = \DcodeGroup\Gantt\DatesHelper::ganttColGroups(
    ($_GET['start'] ?? time()),
    ($_GET['end'] ?? null)
);
$gantt = \DcodeGroup\Gantt\Factory::newGantt($groupedCols, $rows, ['isMobile' => $agent->isMobile()]);

配置

# custom bar text
$gantt->barTextFunction = function(\DcodeGroup\Gantt\Bar $bar) {
    return date('j M Y', strtotime($bar->start_date)) . ' - ' . date('j M Y', strtotime($bar->end_date));
};

# disable bar text
$gantt->barTitleAttrs = false;
$gantt->barTextShow = false;

如果你禁用了 barTitleAttrs,则条形图将具有一个 data-text 属性