# sysplot

2.1.0 • Public • Published

# SysPlot

A library that systematically generates a plane for plotting shapes, with a variety of algorithms to choose from.

## Install

``````\$ yarn add sysplot
``````

## Usage

SysPlot is used for generating XY coordinates for placing shapes. It is agnostic about the approach used for the visualisation, be it HTML, SVG, Canvas, WebGL.. etc.

Positions will be given starting from the center and will attempt to fill as much space as possible.

## Algorithms

#### `ArchimedesSpiral`

The Archimedean spiral (also known as the arithmetic spiral) is a spiral named after the 3rd century BC Greek mathematician Archimedes. It is the locus of points corresponding to the locations over time of a point moving away from a fixed point with a constant speed along a line which rotates with constant angular velocity.

Wikipedia - Archimedes Spiral

#### `ConcentricCircles`

In geometry, two or more objects are said to be concentric, coaxal, or coaxial when they share the same center or axis.

Wikipedia - Concentric Circles

#### `FermatSpiral`

Fermat's spiral (also known as a parabolic spiral) was first discovered by Pierre de Fermat. It is a type of Archimedean spiral

Wikipedia - Fermat Spiral

#### `UlamSpiral`

The Ulam spiral or prime spiral (in other languages also called the Ulam cloth) is a graphical depiction of the set of prime numbers... It is constructed by writing the positive integers in a square spiral and specially marking the prime numbers.

Wikipedia - Ulam Spiral

#### `VogelSpiral`

In disc phyllotaxis, as in the sunflower and daisy, the mesh of spirals occurs in Fibonacci numbers because divergence (angle of succession in a single spiral arrangement) approaches the golden ratio.

Wikipedia - Vogel Spiral

## API

#### SysPlot()

The main class for storing the environment and generating vectors and positions.

#### Sysplot.setConfig(configObject)

Updates the config and sets a flag to regenerate the plotting vectors and/or the positions on next `getPositions()` call.

#### SysPlot.setBounds(width, height)

Sets the bounds to generate the plotting vectors for.

#### SysPlot.setShapes(shapes)

Sets the shapes and sets a flag to regenerate positions on next `getPositions()` call.

#### SysPlot.getPositions()

Gets the positions for the set shapes. Returns XY coordinates in order of the shapes that were set. Any shapes they were unable to be positioned will be null.

#### SysPlot.getVectors()

Gets the vector points used for positioning (as XY coordinates) that the algorithm generated, radiating out from the center.

## Performance

Generating the vector points and positioning the shapes can be intensive depending on the algorithm used, the number of shapes and the spread option. SysPlot will only generate new vectors and positions if it needs to, which is determined when certain parts of the config, bounds or shapes change.

Use the `setBounds`, `setConfig` and `setShapes` methods when the environment changes.

## Package Sidebar

### Install

`npm i sysplot`

### Repository

github.com/HHogg/sysplot

1

2.1.0

MIT

247 kB

29