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

@openownership/bods-dagre

v0.3.8

Published

BODS-Dagre is a small javascript library for automatic generation of directed graphs representing Beneficial Ownership Data for the web. It relies on d3, dagre-d3 and bezier-js to do all the heavy lifting.

Downloads

873

Readme

BODS-Dagre

BODS-Dagre is a small javascript library for automatic generation of directed graphs representing Beneficial Ownership Data for the web. It relies on d3, dagre-d3 and bezier-js to do all the heavy lifting.

The tool accepts Beneficial Ownership Data Standard (BODS) JSON as an input and outputs SVG content on a webpage which contains the appropriate placeholder HTML.

For a hosted version you can use directly, see our main website's installation

Installation & Usage

Through your package manager:

$ npm install @openownership/bods-dagre

Or as a script tag:

<script src="https://unpkg.com/@openownership/bods-dagre/dist/bods-dagre.js"></script>

Then in your application:

// Your BODS data
const data = JSON.parse('some JSON string');
// Where you want the SVG drawn
const container = document.getElementById('some-id');
// Where you're serving the bundled images from (see below)
const imagesPath = '/some/folder';
// Set a node limit above which labels will no longer be shown 
const labelLimit = 8

BODSDagre.draw(data, container, imagesPath);

Full demo applications are hosted from this repo:

  • Using webpack
  • Using a script tag

Images

The library includes license-free SVG images for world flags, as well as some generic icons from our Beneficial Ownership Visualisation System.

You can find these inside the dist/images folder, but you need to make them available at some URL path in your application and tell the library what that path is when you call it.

Zoom

The functionality has been included for two zoom buttons. These must be added to the page, along with the placeholder, with the correct IDs for the code to pick them up:

<button id="zoom_in">+</button>
<button id="zoom_out">-</button>

Save

The functionality has been included for two save buttons. These must be added to the page, along with the placeholder, with the correct IDs for the code to pick them up:

<button id="download-svg">Download SVG</button>
<button id="download-png">Download PNG</button>

It should be noted that the PNG output will provide an image that is scaled to the canvas. The resolution is likely to be poor.

The SVG download button provides the complete graph in the SVG markup format.

Node types

At present the tool provides visualisation of the following entity types (based on personStatements and entityStatements):

  • knownPerson
  • anonymousPerson
  • unknownPerson
  • registeredEntity
  • registeredEntityListed
  • legalEntity
  • arrangement
  • anonymousEntity
  • unknownEntity
  • state
  • stateBody

If the entity type is not recognised then it will default to the unknown type.

Country flags

If the country is not present or is not recognised then no flag will be displayed.

Development

Please see the developer guide for more information.