Coder Social home page Coder Social logo

kristyhoran / phylocanvas-plugin-scalebar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phylocanvas/phylocanvas-plugin-scalebar

0.0 1.0 0.0 26 KB

Visual scale-bar for Phylocanvas

License: GNU Lesser General Public License v3.0

HTML 7.20% JavaScript 92.80%

phylocanvas-plugin-scalebar's Introduction

Phylocanvas Scale-bar Plugin

Visual History for Phylocanvas.

Usage

npm install phylocanvas phylocanvas-plugin-scalebar
import Phylocanvas from 'phylocanvas';
import scalebarPlugin from 'phylocanvas-plugin-scalebar';

Phylocanvas.plugin(scalebarPlugin);

Phylocanvas.createTree('id', {
  // config defaults
  scalebar: {
    active: true,
    width: 100,
    height: 20,
    fillStyle: 'black',
    strokeStyle: 'black',
    lineWidth: 1,
    fontFamily: 'Sans-serif',
    fontSize: 16,
    textBaseline: 'bottom',
    textAlign: 'center',
    digits: 2,
    position: {
      bottom: 10,
      left: 10,
    },
  }
})

Options

A list of available options:

  • active: Show the scale-bar. The default is true.
  • width: The width of the scale-bar in pixels. The default is 100 pixels.
  • height: The height of the scale-bar in pixels. The default is 20 pixels.
  • lineWidth: The thickness of scale-bar lines in space units. The default is 1 pixel.
  • strokeStyle: Specifies the colour or style to use for scale-bar lines. The default is #000 (black).
  • fillStyle: Specifies the colour or style to use for scale-bar label. The default is #000 (black).
  • fontFamily: Specifies the font family used when drawing scale-bar label. The default is Sans-serif.
  • fontSize: Specifies the font size (pixels) used when drawing scale-bar label. The default is 16 pixels.
  • digits: The number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive. The default is 2 digits.
  • position: Specifies the scale-bar position on the canvas. Two keys should be provided, one for the vertical position and one for the horizontal position. The default value is { bottom: 10, left: 10 }.
    • Supported vertical position keys are top, middle, or bottom.
    • Supported horizontal position keys are left, centre, or right.

phylocanvas-plugin-scalebar's People

Contributors

kabudahab avatar richardgoater avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.