vasturiano / d3-radial-axis

A radial implementation of the D3 axis component

Home Page:https://vasturiano.github.io/d3-radial-axis/example/arc-axis.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

d3-radial-axis

NPM package Build Size NPM Downloads

A radial implementation of the D3 axis component.

To use for instance in a clock or a gauge meter.

Quick start

import { axisRadialInner, axisRadialOuter } from 'd3-radial-axis';

or using a script tag

<script src="//unpkg.com/d3-radial-axis"></script>

then

const myAngleScale = d3.scaleLinear()
    .domain([-10, 10])
    .range([-Math.PI, Math.PI]);
const myRadius = 100;
const myRadialAxis = d3.axisRadialInner(myAngleScale, myRadius);

d3.select(<myDOMElement>).call(myRadialAxis);

API reference

Same features as the regular D3 axis.

d3.axisRadialOuter()
    .ticks()
    .tickArguments()
    .tickValues()
    .tickFormat()
    .tickSize()
    .tickSizeInner()
    .tickSizeOuter()
    .tickPadding()

Includes additional properties to configure the radial axis, the angleScale, and the axis radius.

Also supports the representation of a spiral axis when setting a pair of startRadius and endRadius.

d3.axisRadialOuter()
    .angleScale()
    .radius()
    .startRadius()
    .endRadius()

About

A radial implementation of the D3 axis component

https://vasturiano.github.io/d3-radial-axis/example/arc-axis.html

License:MIT License


Languages

Language:JavaScript 70.2%Language:HTML 29.8%