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

graph-svg

v1.0.0

Published

SVG library

Downloads

5

Readme

Graph SVG Library

A SVG library used by easyflow

Engine API

Graph(ready)

Dom ready wrapper.

Graph(function(){
	// create paper
    var paper = Graph.paper().render('#div');
    
    // draw some vector
    var path = paper.path('M 0 0 L 100 100 L 100 200 L 0 200 Z');
    var rect = paper.rect(0, 0, 100, 100);
    var circle = paper.circle(30, 30, 30);
    var ellipse = paper.ellipse(30, 30, 30, 30);
    var polygon = paper.polygon('0,0 100,100 100,200 0,200');
    
    // manipulate
    rect.rotate(45).scale(1.2).commit();
    polygon.transform('translate(100,100) scale(1.2) rotate(45)');
    
    // animate
    circle.animable().animate({cx: 200, cy: 200}, 1000, 'bounce');
    
    // etc...
});

Graph.paper([width = 800 [, height = 600]])

Create new paper.

var paper = Graph.paper(800, 600).render('#div');
// or
var paper = (new Graph.svg.Paper(800, 600)).render('#div');

Paper.rect([x = 0 [, y = 0 [, width = 0 [, height = 0]]]])

Create and render rectangle into paper

var r = paper.rect(20, 20, 100, 100);
// or
var r = (new Graph.svg.Rect(20, 20, 100, 100)).render(paper);

Paper.circle([cx = 0 [, cy = 0 [, r = 0]]])

Create and render circle into paper

var c = paper.circle(20, 20, 30);
// or
var r = (new Graph.svg.Circle(20, 20, 30)).render(paper);

Core Plugins

draggable([options])

Get or set drag plugin

var r = paper.rect();

r.draggable({
	ghost: true,
    hint: true,
    axis: 'x',
    grid: [10, 10]
});

// get plugin, then set snapping
r.draggable().snap([{x: 100}])

resizable([options])

Get or set resize plugin

var r = paper.rect();
r.resizable();

editable([options])

Get or set label editor plugin

var r = paper.rect();
r.editable();

connectable([options])

Get or set link provider plugin

var r = paper.rect();
r.connectable({
	wiring: 'h:h'
});

zoomable([options])

Get or set panzoom plugin

var p = Graph.paper();
p.zoomable();

animable([options])

Get or set animator plugin

var r = paper.rect();
r.animable().animate({x: 100}, 1000, 'bounce');

Layout

default

// create paper
var p = Graph.paper().render('#div');

// setup layout
p.layout('default', {
	router: {
    	type: 'orthogonal'
    },
    link: {
    	type: 'rounded'
    }
});

// add new rectangle
p.rect();

// refresh
p.layout().refresh();

Link (Connector)

By default, link type defined in layout

var p = Graph.paper().render('#div');
var a = p.rect();
var b = p.circle();

// connect two vector
p.connect(a, b);

Directed Link


var rect1 = paper.rect();
var rect2 = paper.rect();

var router = new Graph.router.Directed(rect1, rect2);
var link = new Graph.link.Directed(router);
link.connect();
link.render(paper);

Orthogonal Link


var rect1 = paper.rect();
var rect2 = paper.rect();

var router = new Graph.router.Orthogonal(rect1, rect2);
var link = new Graph.link.Orthogonal(router);
link.connect();
link.render(paper);