Socket
Book a DemoInstallSign in
Socket

phylocanvas-plugin-metadata

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phylocanvas-plugin-metadata

Display binary data adjacent to tree leaves.

2.2.0
latest
Source
npmnpm
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source

phylocanvas-plugin-metadata

Display metadata blocks adjacent to tree leaves.

Usage

npm install phylocanvas phylocanvas-plugin-metadata
import Phylocanvas from 'phylocanvas';
import metadataPlugin from 'phylocanvas-plugin-metadata';

Phylocanvas.plugin(metadataPlugin);

const tree = Phylocanvas.createTree('id', {
  metadata: {
    active: true,
    showHeaders: true,
    showLabels: true,
    blockLength: 32,
    blockSize: null,
    padding: 8,
    columns: [],
    propertyName: 'data',
    underlineHeaders: true,
    headerAngle: 90,
    fillStyle: 'black',
    strokeStyle: 'black',
    lineWidth: 1,
    font: null,
  }
})

tree.on('loaded', function () {
  // add metadata to leaves
  for (const leaf of tree.leaves) {
    leaf.data = {
      columnA: 'value',
      columnB: true,
      columnC: 10,
    };
  }
  tree.viewMetadataColumns();
  tree.draw();
});

Options

A list of available options:

  • active: A boolean flag to show or hide the metadata blocks on the tree. The default value is true.
  • showHeaders: A boolean flag to show or hide header labels. The default value is true.
  • showLabels: A boolean flag to show or hide block labels. The default value is true.
  • blockLength: The length of each block is treated as:
    • the width of the block on rectangular and diagonal trees,
    • the height of the block on hierarchical trees,
    • the width of the block on circular and radial trees.
  • blockSize: The size of each block is treated as:
    • the height of the block on rectangular and diagonal trees,
    • the width of the block on hierarchical trees,
    • the height of the block on circular and radial trees.
  • padding: The padding between the metadata blocks. The default value is 0.
  • columns: An array of column names to be displayed on the tree. The default value is an empty array which displays all columns.
  • propertyName: The name of the property on the branch object which contains the metadata values. The default value is 'data'.
  • headerAngle: An angle (in degrees) to rotate the header labels. The default value is 90 degrees.
  • underlineHeaders: A boolean flag to draw a line under header labels. The default value is false.
  • fillStyle: A valid stroke style (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle) to be used when drawing. The default value is 'black'.
  • strokeStyle: A valid stroke style (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyle) to be used when drawing. The default value is 'black'.
  • lineWidth: The line width used for drawing lines under header labels. The default value is 1.
  • font: A valid CSS font value (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font) to be used for header and block labels. When a null is set as font, the values of tree.textSize and tree.font will be used. The default value is null.

Keywords

phylocanvas

FAQs

Package last updated on 02 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.