API Docs for: 0.0.1
Show:

Cartesian Class

Module: niviz

The Cartesian class is a means to bundle Axis objects and provides neat accessors to calculate pixel/coord of two Axis objects at a time, a x-axis and a y-axis.

Constructor

Cartesian

()

Item Index

Methods

addx

(
  • name
  • min
  • max
  • pxmin
  • pxmax
)

Add an x-axis to the cartesian instance.

Parameters:

  • name String

    Name of axis to add

  • min Number

    Minimal coordinate

  • max Number

    Maximal coordinate

  • pxmin Number

    Pixel value for minimal coordinate

  • pxmax Number

    Pixel value for maximal coordinate

addy

(
  • name
  • min
  • max
  • pxmin
  • pxmax
)

Add an y-axis to the cartesian instance.

Parameters:

  • name String

    Name of axis to add

  • min Number

    Minimal coordinate

  • max Number

    Maximal coordinate

  • pxmin Number

    Pixel value for minimal coordinate

  • pxmax Number

    Pixel value for maximal coordinate

coord

(
  • namex
  • namey
  • px
  • py
)
Object

Get coord for a given (px, py) pixel value (not rounded).

Parameters:

  • namex String

    The name of the x-axis

  • namey String

    The name of the y-axis

  • px Number

    Pixel (should be between pixel minimum and pixel maximum)

  • py Number

    Pixel (should be between pixel minimum and pixel maximum)

Returns:

Object:

Object with x and y property

coordx

(
  • namex
  • x
)
Number

Get coordinate value for a given pixel (not rounded) on the x-axis.

Parameters:

  • namex String

    The name of the x-axis

  • x Number

    Pixel (should be between pixel minimum and pixel maximum)

Returns:

coordy

(
  • namey
  • y
)
Number

Get coordinate value for a given pixel (not rounded) on the y-axis.

Parameters:

  • namey String

    The name of the y-axis

  • y Number

    Pixel (should be between pixel minimum and pixel maximum)

Returns:

invert

(
  • name
)

Invert the axis (swap minimum for maximum)

Parameters:

  • name String

    Name of axis to invert

pixel

(
  • namex
  • namey
  • x
  • y
)
Object

Get pixel value for a given (x, y) coord (not rounded).

Parameters:

  • namex String

    The name of the x-axis

  • namey String

    The name of the y-axis

  • x Number

    Coordinate (should be between minimum and maximum)

  • y Number

    Coordinate (should be between minimum and maximum)

Returns:

Object:

Object with x and y property

px

(
  • namex
  • x
)
Number

Get pixel value for a given coord (not rounded) on x-axis.

Parameters:

  • namex String

    The name of the x-axis

  • x Number

    Coordinate (should be between minimum and maximum)

Returns:

py

(
  • namey
  • y
)
Number

Get pixel value for a given coord (not rounded) on y-axis.

Parameters:

  • namey String

    The name of the y-axis

  • y Number

    Coordinate (should be between minimum and maximum)

Returns: