Class: CoordsGrid

CoordsGrid()

new CoordsGrid()

Grid space helper for parallel coordinates chart, including XSankey.

Note: x, y, z in world space of THREE coordinates.

Source:

Members

cent

Grid center index.

Properties:
Name Type Description
cent int

grid center, in grid index

Source:

grid

Grid bounds

Properties:
Name Type Description
grid array.<int>

grid bounds, [w, h, d]

Source:

scale

Scales convert 1 to world size.
x (coord), y (value), z (extrude), w (value)
where w = grid-yscale * range / domain

Properties:
Name Type Description
scale array.<int>

x, y, z scale

Source:

Methods

barHeight(val) → {number}

Get bar height in world.

Parameters:
Name Type Description
val number

vector value

Source:
Returns:

height in world position

Type
number

coordPos(gridx, buf) → {object}

Get world position and height stick to parallel coords (z = 0).

Note: x, y, z in world space of THREE coordinates.

Parameters:
Name Type Description
gridx array

grid index, [ coord-gridx, enum-val, h, y0 ]

buf array

position buffer

Source:
Returns:

{pos0, h} position z = 0 (buf) and bar height

Type
object

extrudePos(v, gridx, buf) → {array}

Get world position and height at extruded pivoting.

Parameters:
Name Type Description
v int

vector value

gridx array

grid index, [ x, y, z, y0, h(optional, will use the vector value) ]

buf array

position buffer

Source:
Returns:

position (buf)

Type
array

lerposes(cxyz,, …offset) → {array}

Get lerped posion in world .

Note: All position arrays, [x, y, z] are created in memory, user should being aware of performance problem.

Parameters:
Name Type Attributes Description
cxyz, array

[x, y, z] position count

offset array <repeatable>

[x, y, z], offset in grid

Source:
Returns:

4D array of positions, in [x, y, z] of x, y, z

Type
array

space(v) → {array|number}

Scale grid index value to world position.
E.g. if v = [0.2], grid scale is [5, 5, 1], return [1, 1, 0.2].

Note: [design MEMO]
User must take care of how the grid is scaled. It's y scale is usually useless as the scale is calculated from value range.
See D3Pie.pies source for how it's handled by user - scale for pie's width and height, set in Obj3.box.

Parameters:
Name Type Description
v array | vec3 | number

value in grid

Source:
Returns:

value in world

Type
array | number

spaceBound() → {array}

Get the grid bounds in world.

Source:
Returns:

x, y, z bounds in world

Type
array

worldPos(buf, gridx, …offset) → {object}

Get world position of gird index.

Note: x, y, z in world space of THREE coordinates.

Parameters:
Name Type Attributes Description
buf array

position buffer

gridx array

grid index, [ x, y = 0, z], if y ignored, return [x, 0, z] in world

offset array <repeatable>

[x, y, z], offset in grid

Source:
Returns:

position (buf)

Type
object

CoordsGrid(chart)

new CoordsGrid(chart)

Parameters:
Name Type Description
chart object

{grid: [w, h, d], grid-space: number, center, domain, range} chart.grid: grids count, [w, h, d]
chart.domain:
chart.range:
chart.grid-sapec: deprecated [optional] space between grids, [x, y, z]
chart.center: [optional] center index, default in the middle floor.

Source:

Members

cent

Grid center index.

Properties:
Name Type Description
cent int

grid center, in grid index

Source:

grid

Grid bounds

Properties:
Name Type Description
grid array.<int>

grid bounds, [w, h, d]

Source:

scale

Scales convert 1 to world size.
x (coord), y (value), z (extrude), w (value)
where w = grid-yscale * range / domain

Properties:
Name Type Description
scale array.<int>

x, y, z scale

Source:

Methods

barHeight(val) → {number}

Get bar height in world.

Parameters:
Name Type Description
val number

vector value

Source:
Returns:

height in world position

Type
number

coordPos(gridx, buf) → {object}

Get world position and height stick to parallel coords (z = 0).

Note: x, y, z in world space of THREE coordinates.

Parameters:
Name Type Description
gridx array

grid index, [ coord-gridx, enum-val, h, y0 ]

buf array

position buffer

Source:
Returns:

{pos0, h} position z = 0 (buf) and bar height

Type
object

extrudePos(v, gridx, buf) → {array}

Get world position and height at extruded pivoting.

Parameters:
Name Type Description
v int

vector value

gridx array

grid index, [ x, y, z, y0, h(optional, will use the vector value) ]

buf array

position buffer

Source:
Returns:

position (buf)

Type
array

lerposes(cxyz,, …offset) → {array}

Get lerped posion in world .

Note: All position arrays, [x, y, z] are created in memory, user should being aware of performance problem.

Parameters:
Name Type Attributes Description
cxyz, array

[x, y, z] position count

offset array <repeatable>

[x, y, z], offset in grid

Source:
Returns:

4D array of positions, in [x, y, z] of x, y, z

Type
array

space(v) → {array|number}

Scale grid index value to world position.
E.g. if v = [0.2], grid scale is [5, 5, 1], return [1, 1, 0.2].

Note: [design MEMO]
User must take care of how the grid is scaled. It's y scale is usually useless as the scale is calculated from value range.
See D3Pie.pies source for how it's handled by user - scale for pie's width and height, set in Obj3.box.

Parameters:
Name Type Description
v array | vec3 | number

value in grid

Source:
Returns:

value in world

Type
array | number

spaceBound() → {array}

Get the grid bounds in world.

Source:
Returns:

x, y, z bounds in world

Type
array

worldPos(buf, gridx, …offset) → {object}

Get world position of gird index.

Note: x, y, z in world space of THREE coordinates.

Parameters:
Name Type Attributes Description
buf array

position buffer

gridx array

grid index, [ x, y = 0, z], if y ignored, return [x, 0, z] in world

offset array <repeatable>

[x, y, z], offset in grid

Source:
Returns:

position (buf)

Type
object