JSPM

  • Created
  • Published
  • Downloads 706
  • Score
    100M100P100Q9706F
  • License MIT

Beautiful javascript scales and axes.

Package Exports

  • d3plus-axis

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (d3plus-axis) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

d3plus-axis

NPM Release Build Status Dependency Status Slack

Beautiful javascript scales and axes.

Installing

If you use NPM, npm install d3plus-axis. Otherwise, download the latest release. The released bundle supports AMD, CommonJS, and vanilla environments. Create a custom bundle using Rollup or your preferred bundler. You can also load directly from d3plus.org:

<script src="https://d3plus.org/js/d3plus-axis.v0.1.full.min.js"></script>

API Reference

Classes

AxisBaseClass
AxisBottomAxis
AxisLeftAxis
AxisRightAxis
AxisTopAxis

Axis ⇐ BaseClass

Kind: global class
Extends: BaseClass

new Axis()

Creates an SVG scale based on an array of data. If data is specified, immediately draws based on the specified array and returns the current class instance. If data is not specified on instantiation, it can be passed/updated after instantiation using the data method.

Axis.align([value])

If value is specified, sets the horizontal alignment to the specified value and returns the current class instance. If value is not specified, returns the current horizontal alignment.

Kind: static method of Axis

Param Type Default Description
[value] String "center" Supports "left" and "center" and "right".

Axis.barConfig([value])

If value is specified, sets the axis line style and returns the current class instance. If value is not specified, returns the current axis line style.

Kind: static method of Axis

Param Type
[value] Object

Axis.domain([value])

If value is specified, sets the scale domain of the axis and returns the current class instance. If value is not specified, returns the current scale domain.

Kind: static method of Axis

Param Type Default
[value] Array [0, 10]

Axis.duration([value])

If value is specified, sets the transition duration of the axis and returns the current class instance. If value is not specified, returns the current duration.

Kind: static method of Axis

Param Type Default
[value] Number 600

Axis.grid([value])

If value is specified, sets the grid values of the axis and returns the current class instance. If value is not specified, returns the current grid values, which by default are interpreted based on the domain and the available width.

Kind: static method of Axis

Param Type
[value] Array

Axis.gridConfig([value])

If value is specified, sets the grid style of the axis and returns the current class instance. If value is not specified, returns the current grid style.

Kind: static method of Axis

Param Type
[value] Object

Axis.gridSize([value])

If value is specified, sets the grid size of the axis and returns the current class instance. If value is not specified, returns the current grid size, which defaults to taking up as much space as available.

Kind: static method of Axis

Param Type
[value] Number

Axis.height([value])

If value is specified, sets the overall height of the axis and returns the current class instance. If value is not specified, returns the current height value.

Kind: static method of Axis

Param Type Default
[value] Number 100

Axis.orient([orient])

If orient is specified, sets the orientation of the shape and returns the current class instance. If orient is not specified, returns the current orientation.

Kind: static method of Axis

Param Type Default Description
[orient] String "bottom" Supports "top", "right", "bottom", and "left" orientations.

Axis.outerBounds()

If called after the elements have been drawn to DOM, will returns the outer bounds of the axis content.

Kind: static method of Axis
Example

{"width": 180, "height": 24, "x": 10, "y": 20}

Axis.padding([value])

If value is specified, sets the padding between each key to the specified number and returns the current class instance. If value is not specified, returns the current padding value.

Kind: static method of Axis

Param Type Default
[value] Number 10

Axis.range([value])

If value is specified, sets the scale range (in pixels) of the axis and returns the current class instance. The given array must have 2 values, but one may be undefined to allow the default behavior for that value. If value is not specified, returns the current scale range.

Kind: static method of Axis

Param Type
[value] Array

Axis.render([callback])

Renders the current Axis to the page. If a callback is specified, it will be called once the legend is done drawing.

Kind: static method of Axis

Param Type
[callback] function

Axis.scale([value])

If value is specified, sets the scale of the axis and returns the current class instance. If value is not specified, returns the current this._d3Scale

Kind: static method of Axis

Param Type Default
[value] String "linear"

Axis.select([selector])

If selector is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If selector is not specified, returns the current SVG container element.

Kind: static method of Axis

Param Type Default
[selector] String | HTMLElement d3.select("body").append("svg")

Axis.tickConfig([value])

If value is specified, sets the tick style of the axis and returns the current class instance. If value is not specified, returns the current tick style.

Kind: static method of Axis

Param Type
[value] Object

Axis.tickLabels([value])

If value is specified, sets the visible tick labels of the axis and returns the current class instance. If value is not specified, returns the current visible tick labels, which defaults to showing all labels.

Kind: static method of Axis

Param Type
[value] Array

Axis.ticks([value])

If value is specified, sets the tick values of the axis and returns the current class instance. If value is not specified, returns the current tick values, which by default are interpreted based on the domain and the available width.

Kind: static method of Axis

Param Type
[value] Array

Axis.tickSize([value])

If value is specified, sets the tick size of the axis and returns the current class instance. If value is not specified, returns the current tick size.

Kind: static method of Axis

Param Type Default
[value] Number 5

Axis.title([value])

If value is specified, sets the title of the axis and returns the current class instance. If value is not specified, returns the current title.

Kind: static method of Axis

Param Type
[value] String

Axis.titleConfig([value])

If value is specified, sets the title configuration of the axis and returns the current class instance. If value is not specified, returns the current title configuration.

Kind: static method of Axis

Param Type
[value] Object

Axis.width([value])

If value is specified, sets the overall width of the axis and returns the current class instance. If value is not specified, returns the current width value.

Kind: static method of Axis

Param Type Default
[value] Number 400

AxisBottom ⇐ Axis

Kind: global class
Extends: Axis

new AxisBottom()

Shorthand method for creating an axis where the ticks are drawn below the horizontal domain path. Extends all functionality of the base Axis class.

AxisLeft ⇐ Axis

Kind: global class
Extends: Axis

new AxisLeft()

Shorthand method for creating an axis where the ticks are drawn to the left of the vertical domain path. Extends all functionality of the base Axis class.

AxisRight ⇐ Axis

Kind: global class
Extends: Axis

new AxisRight()

Shorthand method for creating an axis where the ticks are drawn to the right of the vertical domain path. Extends all functionality of the base Axis class.

AxisTop ⇐ Axis

Kind: global class
Extends: Axis

new AxisTop()

Shorthand method for creating an axis where the ticks are drawn above the vertical domain path. Extends all functionality of the base Axis class.

Documentation generated on Thu, 18 Aug 2016 18:28:15 GMT