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

quiche

v0.3.0

Published

Google Chart Tools: Image Chart & Infographics wrapper for Node.js

Downloads

618

Readme

Build Status

Quiche

Easy to use Node.js wrapper for Google Image Charts - Chart Tools (deprecated by Google) that also supports Image-Charts, a drop-in replacement for Google Image Charts.

Examples

Pie chart

Look, a pie chart Look, a pie chart

 var Quiche = require('quiche');

 var pie = new Quiche('pie');
 pie.setTransparentBackground(); // Make background transparent
 pie.addData(3000, 'Foo', 'FF0000');
 pie.addData(2900, 'Bas', '0000FF');
 pie.addData(1500, 'Bar', '00FF00');
 pie.setLabel(['Foo','Bas','Bar']); // Add labels to pie segments
 var imageUrl = pie.getUrl(true); // First param controls http vs. https

Bar chart

Bar charts are so cool Bar charts are so cool

 var Quiche = require('quiche');

 var bar = new Quiche('bar');
 bar.setWidth(400);
 bar.setHeight(265);
 bar.setTitle('Some title or something');
 bar.setBarStacked(); // Stacked chart
 bar.setBarWidth(0);
 bar.setBarSpacing(6); // 6 pixles between bars/groups
 bar.setLegendBottom(); // Put legend at bottom
 bar.setTransparentBackground(); // Make background transparent

 bar.addData([19, 19, 21, 14, 19, 11, 10, 18, 19, 30], 'Foo', 'FF0000');
 bar.addData([4, 3, 2, 3, 0, 0, 3, 4, 2, 2], 'bar', '0000FF');
 bar.addData([10, 8, 2, 1, 18, 9, 20, 21, 19, 11], 'bin', '008000');
 bar.addData([2, 1, 1, 1, 1, 7, 3, 6, 2, 7], 'bash', '00FF00');
 bar.addData([1, 0, 0, 1, 2, 1, 0, 0, 0, 0], 'blah', '307000');     

 bar.setAutoScaling(); // Auto scale y axis
 bar.addAxisLabels('x', ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']);

 var imageUrl = bar.getUrl(true); // First param controls http vs. https

Line chart

Lines Lines

 var quiche = require('quiche');

 var chart = quiche('line');
 chart.setTitle('Something with lines');
 chart.addData([3000, 2900, 1500], 'Blah', '008000');
 chart.addData([1000, 1500, 2000], 'Asdf', '0000FF');
 chart.addAxisLabels('x', ['1800', '1900', '2000']);
 chart.setAutoScaling();
 chart.setAxixRange('y', 500, 3500, 250);
 chart.setTransparentBackground();

 var imageUrl = chart.getUrl(true); // First param controls http vs. https

QR Code

QR Code

 var quiche = require('quiche');

 var qr = quiche('qr');
 qr.setLabel('https://github.com/ryanrolds/quiche');
 qr.setWidth(100);
 qr.setHeight(100);

 var url = qr.getUrl(true); // First param controls http vs. https

Note: currently not supported by Image-Charts

Documentation

Install

 $ npm install quiche

API

Supported charts

  • line
  • pie
  • bar
  • qr

All charts

  • chart.setWidth(height [number]);
  • chart.setHeight(height [number]);
  • chart.setTitle(title [string]);
  • chart.setTitleColor(color [hex color]);
  • chart.setTitleSize(size [number]);
  • chart.setTitleRight();
  • chart.setTitleLeft();
  • chart.setLegendOrder(order [string])
  • chart.setLegendLeft();
  • chart.setLegendRight();
  • chart.setLegendBottom();
  • chart.setLegendTop();
  • chart.setLegendVertical();
  • chart.setLegendHorizontal();
  • chart.setLegendHidden();
  • chart.setLegendSize([number]);
  • chart.setTransparentBackground();
  • chart.addAxisLabels(axis [x | y | r], labels [array]);
  • chart.addData(data [number | array], label [string], color [hex color]);
  • chart.setAutoScaling();
  • chart.setHostname(hostname [string]); // e.g. 'image-charts.com' to use Image-Charts (default is the deprecated 'chart.googleapis.com')
  • chart.getUrl(https [boolean]); // true = https, false = http
  • chart.getReq(https [boolean], callback [function]);
  • chart.getPostReq(https [boolean], callback [function]);

Pie

  • pie.set3D();
  • pie.setLabel();
  • pie.addPercent();

Bar

  • bar.addData();
  • bar.setBarWidth([number]);
  • bar.setBarSpacing([number]);
  • bar.setBarVertical();
  • bar.setBarHorizontal();
  • bar.setBarGrouped();
  • bar.setBarStacked();
  • bar.setBarOverlapped();
  • bar.setAxisRange(axis ["x", "r", "y"], start [number], end [number], step [number]);

Line

  • line.addData(data [number | array], label [string], color [hex color], thickness [number], line length [number], space length [number]);
  • line.setSparklines();
  • line.setXY();
  • line.setAxisRange(axis ["x", "r", "y"], start [number], end [number], step [number]);

QR Code

  • qr.setLabel(data [string]);
  • qr.setEncoding(encoding [UTF-8 | Shift_JS | ISO-8859-1]);
  • qr.setErrorCorrectionLevel(level [string]) // https://developers.google.com/chart/infographics/docs/qr_codes
  • qr.setMargin(margin [number]); // Margin around graphic
  • qr.setWidth(width [number]);
  • qr.setHeight(height [number]);
  • qr.getUrl(https [boolean]); // true = https, false = http

Features

  • Pie charts
  • Bar charts
  • Auto scaling

TODO

  • Documentation
  • More chart types
  • Better confict handling