Skip to content

nkint/radial-label-placement

Repository files navigation

radial-label-placement

Simplistic label placement in a radial chart

screen

(demo)

Description

You have to do a pie chart for your cool dashboard, huh?

And you need to position label with polar coordinates with right text-align and text-baseline css/canvas prop, huh?

This is a really dumb way.

It works for most of the cases.

Zero depencencies, blazing fast, typed with Typescript 3.0, dumb proof.

Even if the only thing you need is just

{
  textAlign: 'center',
  textBaseline: 'middle'
}

Install

npm install radial-label-placement

or

yarn add radial-label-placement

Usage

import radialLabelPlacement from 'radial-label-placement'

// ...

API

radialLabelPlacement(input, [options])

input

Type: string

Lorem ipsum.

options

foo

Type: boolean
Default: false

Lorem ipsum.

Note

AVA typescript test are currently broken because ts-node does not support es6 import yet: TypeStrong/ts-node#313 To run test change module resolution to "commonjs" in tsconfig

License

MIT © alberto

About

Simplistic label placement in a radial chart

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published