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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nextbitlabs/gantt-chart

v1.3.2

Published

Web component of a gantt chart.

Downloads

27

Readme

<gantt-chart>

Latest Release Published on webcomponents.org

Web component implementation of a Gantt chart.

Data model

{
  milestones: [
    {
      id: 1,
      taskId: 6, // Graphical hint, it may be latest task in the milestone.
      title: 'Milestone A',
      date: 'July 2019', // Optional.
      additionalVerticalShift: 1 // Optional.
    },
    ...
  ],
  tasks: [
    {
      id: 1,
      title: 'task 1',
      start: 0, // Week number.
      duration: 4, // Duration in weeks.
      class: 'c1',
      progress: // Optional, defaults to 0.
    },
    ...
  ]
}

Exposed attributes

  • width: chart width in pixels
  • height: chart height in pixels

Margins attributes help to ensure task and milestone titles are visible.

  • margin-top: space in pixel between the top border and the first task.
  • margin-bottom: space in pixel between the bottom border and the last task.
  • margin-left: space in pixel between the left border and the first task.
  • margin-right: space in pixel between the right border and the last task.

See section Usage for an example.

Exposed CSS Custom Properties

  • --font-family defaults to sans-serif
  • --font-size defaults to 12px
  • --background-color defaults to white
  • --visibility-ticks defaults to visible, set to hidden to hide the week ticks

Up to 10 classes can be passed:

  • --c1, the task color defaults to purple
  • --c2, the task color defaults to blue
  • --c3, the task color defaults to gold

See section Usage for an example.

Usage

In an html file

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <script type="module">
      import 'https://unpkg.com/@nextbitlabs/[email protected]/dist/gantt-chart.umd.js';
    </script>
  </head>
  <style>
    @import url('https://fonts.googleapis.com/css?family=Lato:400,700&display=swap');
    /*
      CSS custom properties penetrate the Shadow DOM,
      they are useful to provide custom styling.
      The gantt-chart webcomponent exposes font-size and font-family custom properties.
    */
    gantt-chart {
      --font-family: 'Lato', sans-serif;
      --c1: lightblue;
    }
  </style>
  <body>
    <!-- Set component attributes -->
    <gantt-chart
      width="1150"
      height="700"
      margin-top="40"
      margin-left="40"
      margin-right="40"
      margin-bottom="40"
    ></gantt-chart>
  </body>
  <script>
    const element = document.querySelector('gantt-chart');

    // Set gantt data: tasks and milestones.
    element.data = {
      milestones: [
        {
          id: 1,
          taskId: 1,
          title: 'Milestone A'
        },
      ],
      tasks: [
        {
          id: 1,
          title: 'task 1',
          start: 0,
          duration: 4,
          class: 'c1',
          progress: 0.65
        },
      ]
    };
  </script>
</html>

With npm:

npm i @nextbitlabs/gantt-chart

See demo.

Development

Install dependencies with

npm install

Update build on changes with

npm run dev

and see updates on ./demo/index.html running a local server from ./.

Release

npm run release

License

This project is licensed under the MIT License. See the license file for details.