Skip to content

Latest commit

 

History

History
141 lines (81 loc) · 3.09 KB

Utility.md

File metadata and controls

141 lines (81 loc) · 3.09 KB

Table of Contents

makeAccessorFunction

Handle cases where the user specifies an accessor string instead of an accessor function.

Parameters

  • functionOrString (Function | String) accessor string/function to be made an accessor function

Returns Function accessor function

isArrayOfArrays

Check if an array is an array of arrays.

Parameters

  • arr Array array to be checked.

Returns Boolean whether or not the given array is an array of arrays.

isArrayOfObjects

Check if an array is an array of objects.

Parameters

  • arr Array array to be checked.

Returns Boolean whether or not the given array is an array of arrays.

isArrayOfObjectsOrEmpty

Check if an array is an array of objects or empty.

Parameters

  • arr Array array to be checked.

Returns Boolean whether or not the array is an array of objects or empty.

randomId

Generate a random id. Used to create ids for clip paths, which need to be referenced by id.

Returns String random id string.

getPixelDimension

Get height or width in pixels.

Parameters

  • target String d3 select specifier.
  • dimension String height or width.

Returns Number width or height in pixels.

getWidth

Get width of element.

Parameters

  • isFullWidth Boolean whether or not to stretch the element to full width.
  • width Number custom width if applicable.
  • target String d3 select specifier.

Returns Number width of element.

getHeight

Get height of element.

Parameters

  • isFullHeight Boolean whether or not to stretch the element to full height.
  • height Number custom height if applicable.
  • target String d3 select specifier.

Returns Number height of element.