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

svg-plot

v0.0.6

Published

Simple Offline SVG Plot Generator

Downloads

4

Readme

svg-plot.js

MIT license

svg-plot.js is a simple library to programatically create svg plots from csv formatted data. This is designed for regression testing where a visual component of data is desired.

Install:

nmp install svg-plot

Usage:

var svg_plot = require('svg-plot.js');
svg_plot.plot(csvData,options)

Column CSV Example:

var fs = require('fs');
var svg_plot = require('../svg-plot.js')
var csvString = fs.readFileSync('testThermal.csv').toString();

svg_plot.plot(csvString,{
    fileName:'myPlot',
    timeKey:'Time'
});

// Generates myPlot.svg

Usage Output: examples/myPlot.svg

Note, this will render on github but may not on npm's registery. See examples/myPlot.svg for reference.

CSV Format examples/testThermal.csv

Time,On,Temperature,Setpoint
0,63,60,70
10,68,59.97222222222222,70
20,68,60.01396604938272,70
30,68,60.05559392146776,70
40,68,60.097106160574796,70
...

Pivot(row) CSV Example:

This example demonstrates a pivot style csv file where the key is contained within the row itself. This example also demonstrates some more optional arguments.

var fs = require('fs');
var svg_plot = require('../svg-plot.js')
var csvString = fs.readFileSync('testpivotThermal.csv').toString();

svg_plot.plot(csvString,{
    fileName:'mypivotPlot',
    timeKey:'Time',
    pivotCSV:true,
    pivotKey:'Point',
    pivotValue:'Value',
    y2List:['heat1'],
    includeList:['activeSp','temperature','heat1'],
    title: 'Heating Example',
    y2Range:[0,3]
});

Usage Output: examples/myPivotPlot.svg

CSV Format examples/testPivotThermal.csv

Event,Point,Value,Time,Info
[COV],temperature,70.000,0.000,
[COV],temperature_cov,0.100,0.000,
[COV],temperature_period,5000.000,0.000,
[COV],humidity,1.000,0.000,
[COV],humidity_cov,0.500,0.000,
[COV],csp,72.000,0.000,
[COV],hsp,72.000,0.000,
[COV],cspLimit,50.000,0.000,
[COV],hspLimit,99.000,0.000,
...

Required Arguments:

| Key | Type | Example | Description | | ----- | ----- | ------ | ----- | | fileName | string | myFile.svg | Name of the svg file to be generated | | timeKey | string | Date | Name of the key that defines time. E.g: Date,Timestamp,Time

Optional Arguments:

| Key | Type | Example | Description | | ----- | ----- | ------ | ----- | | pivotCSV | bool | false | Defines whether the key is in a column or a row. When the key is in the row, pivotCSV should be true | | pivotKey | string | 'PointName' | Only applicable if pivotCSV is true: Define the column key which defines the row key. See pivot(row) CSV Example example. | | pivotValue | string | 'Value' | Only applicable if pivotCSV is true: Define the column key which defines the row value. See pivot(row) CSV Example example. | | y2List | string array | ['heat','cool'] | Defines what, if any, keys get assigned to the y2 axis. | | ignoreList| string array | ['heat','cool'] | If defined, it defines what keys are ignored / not plotted. | includeList | string array | ['heat','cool'] | If defined, it defines what keys are plotted |y1Curve| d3.[curveType] | d3.curveLinear | If defined, defines the curve style. See http://bl.ocks.org/emmasaunders/c25a147970def2b02d8c7c2719dc7502 | y2Curve| d3.[curveType] | d3.curveLinear | If defined, defines the curve style. See http://bl.ocks.org/emmasaunders/c25a147970def2b02d8c7c2719dc7502 | | title | string | 'MyTitle' | If defined, it defines the title of the plot |
| y2Range | float array | [0,100] | If defined, it defines the [min,max] of the yRange.

About:

This library is a wrapper around d3-node which is a wrapper around d3.