Skip to content

Easy to use Node.JS/Browserify library to render time graph into SVG

License

Notifications You must be signed in to change notification settings

AaronO/svg-timegraph

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svg-timegraph

Easy to use Node.JS/Browserify library to render time graph into SVG.

Example

Example SVG

How to use it?

$ npm install svg-timegraph

Generate a time-graph using:

var SVGTimeGraph = require('svg-timegraph');

var output = SVGTimeGraph(
    // List of data series
    [
        {
            title: "Visits",
            color: "#1d7fb3",
            points: [
                {
                    value: 200,
                    date: new Date(2015, 06, 10)
                },
                {
                    value: 100,
                    date: new Date(2015, 06, 11)
                },
                {
                    value: 230,
                    date: new Date(2015, 06, 12)
                },
                {
                    value: 600,
                    date: new Date(2015, 06, 13)
                }
            ]
        }
    ],

    //
    {
        // Size of the SVG
        width: 800,
        height: 300,

        // Minimum value for the Y axe
        // if null, it will be extracted from data
        minValue: null,

        // Radius  of point
        pointRadius: 4,

        // Stroke width
        lineWidth: 1,

        // Color for axe
        axeColor: '#eee',

        // Text styling
        textColor: '#aaa',
        textFontSize: 10,
        textFontFamily: 'helvetica'
    }
);

About

Easy to use Node.JS/Browserify library to render time graph into SVG

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%