npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

chartjs-plugin-gantt

v0.9.0

Published

Gantt series fo ChartJS library

Readme

Gantt plugin

plugin for draw gantt series in Chart.js library

Sample chart

Features

  • Setting color, border color, border width for:
    • all elements,
    • dataset,
    • some elements of dataset
  • Setting height/width elements
  • Supports time scale

Install

npm install chartjs-plugin-gantt --save

Usage

Basic

const chart = new Chart("chart", {
    type: "gantt",
    data: {
        datasets: [{
            label: "Gantt series",
            data: [
                {x: {from: 0, to: 8}, y: 0},
                {x: {from: 10, to: 18}, y: 5},
                {x: {from: 20, to: 28}, y: 10},
            ]
        }]
    },
});

Code Pen

Different styles

const chart = new Chart("chart", {
    type: "gantt",
    data: {
        datasets: [{
            label: "Default colors",
            data: [
                {x: {from: 0, to: 5}, y: 0},
                {x: {from: 6, to: 8}, y: 3},
                {x: {from: 8, to: 15}, y: 8},
            ]
        }, {
            // Set params for dataset
            borderWidth: 5,  // default options.elements.gantt.borderWidth
            borderColor: "rgba(0, 255, 0, 0.5)",  // default options.elements.gantt.borderColor
            backgroundColor: "rgba(255, 0, 0, 0.1)",  // default options.elements.gantt.backgroundColor
            label: "Override series",
            data: [
                {x: {from: 15, to: 20}, y: 0},
                {x: {from: 15, to: 20}, y: 5},
                // Set params for points
                {x: {from: 20, to: 25}, y: 1, backgroundColor: "rgba(0, 0, 255, 0.1)"},
                {x: {from: 25, to: 30}, y: 2, borderColor: "rgba(255, 255, 0, 0.5)"},
                {x: {from: 30, to: 35}, y: 3, borderWidth: 10},
            ]
        }]
    },
    options: {
        elements: {
            gantt: {
                // Set defaults params
                borderWidth: 3,  // default 1
                borderColor: "rgba(255, 0, 0, 0.1)",  // default options.defaultColor
                backgroundColor: "rgba(0, 255, 0, 0.1)",  // default options.defaultColor
            }
        }
    }
});

Code Pen

Different sizes

const chart = new Chart("chart", {
    type: "gantt",
    data: {
        datasets: [{
            height: 2,  // default 5
            width: 2,  // default 5
            label: "Size sample",
            data: [
                {x: 0, y: 0},  // Rect position ((x - width / 2, y - height / 2), (x + width / 2, y + height / 2))
                {x: {from: 1, to: 5}, y: 3},  // Rect position ((x.from, y - height / 2), (x.to, y + height / 2))
                {x: 7, y: {from: 4, to: 7}},  // Rect position ((x - width / 2, y.from), (x + width / 2, y.to))
                {x: {from: 8, to: 10}, y: {from: 7, to: 12}},  // Rect position ((x.from, y.from), (x.to, y.to))
            ]
        }]
    },
});

Code Pen

Time scale

function incHour(date, delta) {
    if (delta === undefined)
        delta = 1;
    date.setHours(date.getHours() + delta);
    return new Date(date);
}

const curDate = new Date(2019, 3, 15, 12, 0, 0);
const chart = new Chart("chart", {
    type: "gantt",
    data: {
        datasets: [{
            height: 2,  // default 5
            /*
             format for time scale:
               string "xd yh zm ps qms",
               object {d: x, h: y, m: z, s: p, ms:1} or
               number - milliseconds
             where:
               d: number of days,
               h: number of hours,
               m: number of minutes,
               s: number of seconds,
               ms: number of milliseconds.
             if the field is missing, then then is considered to be zero
             */
            width: "2h",
            label: "Time gantt",
            data: [
                {x: incHour(curDate, 0), y: 0},
                {x: {from: incHour(curDate), to: incHour(curDate, 3)}, y: 3},
            ]
        }]
    },
    options: {
        scales: {
            xAxes: [{
                type: "time-gantt",
                position: "bottom",
                time: {
                    displayFormats: {
                        millisecond: "HH:mm:ss",
                        second: "HH:mm:ss",
                        minute: "HH:mm:ss",
                        hour: "HH:mm:ss",
                        day: "HH:mm:ss",
                    },

                }
            }]
        }
    }
});

Code Pen

Other

Gantt dataset supports two types of axes:

  • linear-gantt — the scale is inherited from the linear scale
  • time-gantt — the scale is inherited from the time scale