ticktext

0.1.2 • Public • Published

WIP

A small utility to correct the alignment of radially positioned SVG text elements.

Purpose

When placed radially, like on a gauge or dial, SVG text elements can look awful unless their positions are corrected for the eye.

In the following illustration, the red elements show text placement on the basis of polar to cartesian coordinates. The green elements illustrate the correction made by the ticktext function.

SVG Text Alignment and Correction

Installation

npm install --save ticktext

Usage

import ticktext from 'ticktext';


const originalCoordinate = {x: 100, y: 100};
const angle = 90; // degrees
const text = '000'
const fontSize = 12;
const inside = true;


const newCoordinate = ticktext(originalCoordinate, angle, text, fontSize, inside);

Readme

Keywords

none

Package Sidebar

Install

npm i ticktext

Weekly Downloads

3

Version

0.1.2

License

MIT

Last publish

Collaborators

  • juniperchicago