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

hourgraph

v1.0.4

Published

SVG time plan / gantt chart generator

Downloads

2

Readme

hourgraph

Creates an SVG from a TOML definition of a time plan / gantt chart

Originally written for my PhD panel 1 topic project analysis report, as I realised that not only have I manually creates a number of these, but I'm going to have to create a bunch more in the future....

  • Current version: current npm version - see the GitHub releases
  • Changelog: https://github.com/sbrl/hourgraph/blob/master/Changelog.md

Installation

Install with npm:

sudo npm install --global hourgraph

Or locally:

npm install hourgraph

Usage

There are 2 parts to using hourgraph. First, you need a configuration / definition file for your time plan / gantt chart. Then, you need to call the CLI to render it to SVG (PNG is currently not supported, but Inkscape can be used to convert - see below).

Definition file

hourgraph takes a TOML file as input. Examples files can be found in the examples directory. In short, the format of a valid time plan file is as follows:

# Specify global options here
width = 1920
height = 1080

# Tasks are defined next. Each should be headed with "[[task]]" like so:
[[task]]
name = "Make apple juice"
start = 2
duration = 2

# The above are the minimum required properties.
# Detailed explanations can be found below.


# Optional section, allows customisation of the visual style of the resulting svg
[style]
# Styling options go in here. See default.toml in the src/ directory for more information as to supported properties here.
# Link: https://github.com/sbrl/hourgraph/blob/master/src/default.toml

Detailed explanation of the properties on a [[task]]:

Property | Type | Required | Meaning ------------|-----------|-----------|-------------- name | string | yes | The name of the task (multiline strings are not currently handled correctly) start | number | yes | The point at which the task starts duration | number | yes | The number of units which the task lasts for. colour | string | no | The colour of the bar on the graph for this task. Overrides the global value specified in the [style] section. ghost_colour| string | no | Specifies the colour of the ghost bar from the left-hand side up to the actual bar itself. Overrides the global value specified in the [style] section.

CLI

If you've installed hourgraph locally, substitute all instances of hourgraph for path/to/node_modules/.bin/hourgraph (basically the path to the hourgraph entry point).

Once you've got your definition file written, you can now call hourgraph to render it. By default, hourgrah reads and writes from and to the standard input and output:

hourgraph <path/to/file.toml >path/to/file.svg

However, the --input and --output flags can be used to specify filenames to read from and/or write to instead:

hourgraph --input path/to/file.toml --output path/to/file.svg

Help text can be displayed using the --help argument:

hourgraph --help

Once you've got your SVG, you're done! If you'd prefer a PNG though, you can use the Inkscape CLI to convert it:

inkscape -o path/to/output.png path/to/file.svg

You can also specify a custom width or height to render to (maintaining aspect ratio):

# Specify the width:
inkscape -w 3840 -e path/to/output.png path/to/file.svg
# Specify the height:
inkscape -h 2160 -e path/to/output.png path/to/file.svg

Read-world use

  • I'm using it in reports for my PhD in Computer Science!
  • (Are you using this project? Get in touch by opening an issue)

Contributing

Contributions are welcome as PRs! Don't forget to say that you donate your contribution under the Mozilla Public License 2.0 in your PR comment.

Licence

This project is licensed under the Mozilla Public License 2.0. See the LICENSE file in this repository for the full text.