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

@ekisa-cdk/graph-drawing

v1.1.0

Published

๐Ÿ“ˆ Dynamically draw graphs on SVG elements

Downloads

3

Readme

@ekisa-cdk/graph-drawing

NPM version

Table of contents

Getting started

1. Install package:

npm i @ekisa-cdk/graph-drawing

Basic usage

1. Import LineGraphDrawing class:

import { LineGraphDrawing } from '@ekisa-cdk/graph-drawing';

2. Create instance, mount scoped frame & run process:

const graph = new LineGraphDrawing({
  canDrawLines: true,
  canRemoveNodes: true,
})
  .mountScopedFrame({
    image: {
      src: 'some-image.png',
      alt: 'Some description',
      objectFit: 'fill',
    },
    container: {
      boundaries: [
        // top
        {
          width: '100%',
          height: '116px',
          inset: '0',
          cursor: 'url("https://i.stack.imgur.com/bUGV0.png"), auto',
        },
        // right
        {
          width: '114px',
          height: '100%',
          inset: '0 0 0 auto',
          cursor: 'url("https://i.stack.imgur.com/bUGV0.png"), auto',
        },
        // bottom
        {
          width: '100%',
          height: '98px',
          inset: 'auto auto 0 auto',
          cursor: 'url("https://i.stack.imgur.com/bUGV0.png"), auto',
        },
        // left
        {
          width: '88px',
          height: '100%',
          inset: '0 auto 0 0',
          cursor: 'url("https://i.stack.imgur.com/bUGV0.png"), auto',
        },
      ],
      styles: {
        width: '1000px',
        heigth: '800px',
      },
    },
    frame: {
      styles: {
        cursor: 'crosshair',
      },
    },
  })
  .startProcess();

Scoped frame options

{
  image: {
    src: string;
    alt?: string;
    objectFit?: 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
  };
  container?: {
    boundaries?: Array<
      Partial<{
        width: string;
        height: string;
        inset: string;
        backgroundColor?: string;
        opacity?: number;
        cursor?: Cursor;
      }>
    >;
    styles?: Partial<{
      width: string;
      heigth: string;
    }>;
  };
  frame?: {
    styles?: {
      backgroundColor?: string;
      opacity?: number;
      cursor?: Cursor;
    };
  };
}

API usage

Get nodes

graph.getNodes();

Get frame coordinate

graph.getContainerElement();

Load coordinates on the frame

graph.loadCoordinates([
  { x: 94, y: 165, order: 0 },
  { x: 507, y: 166, order: 1 },
  { x: 172, y: 366, order: 2 },
]);

Redraw nodes

graph.redraw();

Export graph

graph.exportAs('image/jpeg');
graph.exportAs('image/png');

Enable lines drawing

graph.enableDrawingLines();

Disable lines drawing

graph.disableDrawingLines();

Enable nodes removal

graph.enableNodesRemoval();

Disable nodes removal

graph.disableNodesRemoval();

License

MIT License ยฉ 2021 Ekisa Team