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

c3-chart-maker

v0.2.8

Published

A Node.js API and CLI tool for rendering a chart from a CSV file using a C3 spec.

Downloads

62

Readme

c3-chart-maker

THIS CODE IS NO LONGER MAINTAINED: For server side rendering of charts I recommend that you use Data-Forge Plot.

A Node.js module for rendering a chart from a CSV file using a C3 spec.

It can be used from the command line or as a code library. It's a great way to render server-side charts.

This library uses Data-Forge, Nightmare and C3.

For help please see this example repo and this post on The Data Wrangler.

If you are interested in server-side / Node.js charting and visualization my book Data Wrangling with JavaScript has a whole chapter on this.

Use from command line

Installation

npm install -g c3-chart-maker

Usage

c3-chart-maker <input-file> --chart=<c3-chart-file> --out=<output-image-file> [--export=<folder>] [--template=<chart-template-folder>] [--show] [--dump-chart] [--verbose]

Options

chart       Specifies the file that defines the chart.
out         Specifies the name of the image file to output for the chart.
export      Optionally specify a folder to export the interactive chart to.
show        Optional parameter that shows the browser that renders the chart.
dump-chart  Dump the expanded chart definition to standard out for debugging.
template    Template directory that contains the HTML and CSS files for the chart. You can use this to completely override the chart template.
verbose     Enable this option for verbose debug output.

Example

c3-chart-maker myspreadsheet.csv --chart=mychartspec.json --out=mychart.png --show --dump-chart 

Use as a code library

Installation

npm install --save c3-chart-maker

Usage

const c3ChartMaker = require('c3-chart-maker');

var inputFilePath = "your-input-file.csv"; // NOTE: This can also be a DataForge dataframe, an array of data or a path to a JSON file.
var chartTemplateFilePath = "my-chart-spec.json"; // NOTE: This can also be inline JSON or the path to a Node.js module with a function that builds the chart definition.
var outputFilePath = "your-chart-output-file.png";
var options: {
    show: true                  // Show browser used to render the chart.
    dumpChart: true,            // Dump the expanded chart definition to the console for debugging.
    export: "folder-path",      // Optionally specify a folder to export an interactive chart to.
    template: "folder-path"     // Optionally override the chart template with your own custom version.
};

c3ChartMaker(inputFilePath, chartTemplateFilePath, outputFilePath, options)
    .then(() => { 
        console.log('Done');
    })
    .catch(err => {
        console.error(err);
    });