API Docs for: 0.0.1
Show:

Axis Class

Defined in: lib/graphs/axis.js:28
Module: niviz

The Axis class is a representation of a single axis as it is typically used in diagrams and charts. An Axis object has a minimum and a maximum value and associated minimum and maximum pixel values. Given a coordinate, that should lie within minimum and maximum, the Axis object can return the corresponding pixel value and vice versa. Furthermore the Axis class can be configured to enable a logarithmic scale and can invert the scale.

Constructor

Axis

(
  • min
  • max
  • pxmin
  • pxmax
  • [log]
)

Parameters:

  • min Number

    The minimal coordinate value for this axis

  • max Number

    The maximal coordinate value for this axis

  • pxmin Number

    The pixel value associated to the minimum

  • pxmax Number

    The pixel value associated to the maximum

  • [log] Boolean optional

    true = logarthmic scale, false = not logarithmic

Item Index

Properties

Methods

coord

(
  • pixel
)
Number

Get coordinate value for a given pixel (not rounded)

Parameters:

  • pixel Number

    Pixel (should be between pixel minimum and pixel maximum)

Returns:

invert

()

Invert the axis (swap minimum for maximum)

pixel

(
  • coord
)
Number

Get pixel value for a given coord (not rounded)

Parameters:

  • coord Number

    Coordinate (should be between minimum and maximum)

Returns:

pxrange

(
  • min
  • max
)

Redefine pixel range for current minimal and maximal coordinates

Parameters:

  • min Number

    Pixel value for minimal coordinate

  • max Number

    Pixel value for maximal coordinate

range

(
  • min
  • max
)

Redefine minimal and maximal coordinate of the axis

Parameters:

  • min Number

    Minimal coordinate

  • max Number

    Maximal coordinate

Properties

log

Boolean

Enable/disable logarithmic scaling