# Global

##

### Members

#### (constant) colorNames :Array

Definition of CSS color names

Source:
  - colorHelper.js, line 6

##### Type:

- `Array`

#### (constant) countries :Array

List of Countries

Source:
  - randomData.js, line 8

##### Type:

- `Array`

#### (constant) dispatch :d3.dispatch

Custom Dispatch Events

Source:
  - events.js, line 8

##### Type:

- `d3.dispatch`

#### (constant) fruit :Array

List of Fruit

Source:
  - randomData.js, line 15

##### Type:

- `Array`

### Methods

#### attachEventListners(el)

Attach Event Listeners to Shape

Detect X3DOM events and convert them into D3 dispatch events.

Source:
  - events.js, line 17

##### Parameters:

Name | Type | Description
--- | --- | ---
`el` |  |

#### colorParse(color) → {string}

X3D Color Parser

Source:
  - colorHelper.js, line 149

##### Parameters:

Name | Type | Description
--- | --- | ---
`color` | `Rgb` | `Hsl` | `null` |

##### Returns:

Type:
  `string`

#### colourNameToHex(colorName) → {boolean|*}

Color Name to Hex

Source:
  - colorHelper.js, line 64

##### Parameters:

Name | Type | Description
--- | --- | ---
`colorName` | `string` |

##### Returns:

Type:
  `boolean` | `*`

#### colourNameToX3d(colorName) → {string}

Color Name to X3D RGB

Source:
  - colorHelper.js, line 138

##### Parameters:

Name | Type | Description
--- | --- | ---
`colorName` | `string` |

##### Returns:

Type:
  `string`

#### componentToHex(c) → {string}

Color Component to Hex

Source:
  - colorHelper.js, line 77

##### Parameters:

Name | Type | Description
--- | --- | ---
`c` | `number` |

##### Returns:

Type:
  `string`

#### dataset1() → {Array}

Random Dataset - Single Series

Source:
  - randomData.js, line 31

##### Returns:

Type:
  `Array`

#### dataset2() → {Array}

Random Dataset - Multi Series

Source:
  - randomData.js, line 53

##### Returns:

Type:
  `Array`

#### dataset3(points) → {Array}

Random Dataset - Single Series Scatter Plot

Source:
  - randomData.js, line 78

##### Parameters:

Name | Type | Description
--- | --- | ---
`points` | `number` | Number of data points.

##### Returns:

Type:
  `Array`

#### dataset4() → {Array}

Random Dataset - Surface Plot 1

Source:
  - randomData.js, line 100

##### Returns:

Type:
  `Array`

#### dataset5() → {Array}

Random Dataset - Surface Plot 2

Source:
  - randomData.js, line 158

##### Returns:

Type:
  `Array`

#### forwardEvent(event)

Forward X3DOM Event to D3

In X3DOM, it is the canvas which captures onclick events, therefore defining a D3 event handler on an single X3DOM element does not work. A workaround is to define an onclick handler which then forwards the call to the D3 "click" event handler with the event. Note: X3DOM and D3 event members slightly differ, so d3.mouse() function does not work.

Source:
  - events.js, line 39
See:
  - https://bl.ocks.org/hlvoorhees/5376764

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | `event` |

#### getEventCoordinates(event) → {Object}

Show Alert With Event Coordinate

Source:
  - events.js, line 51

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | `event` |

##### Returns:

Type:
  `Object`

#### getEventPagePoint(event) → {Object}

Inverse of coordinate transform defined by function mousePosition(evt) in x3dom.js

Source:
  - events.js, line 67

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | `event` |

##### Returns:

Type:
  `Object`

#### getX3domHolder(event) → {*}

Return the x3d Parent Holder

Find clicked element, walk up DOM until we find the parent x3d. Then return the x3d's parent.

Source:
  - events.js, line 105

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` |  |

##### Returns:

Type:
  `*`

#### hexToRgb(hex) → {*}

Color Hex to RGB

Source:
  - colorHelper.js, line 112

##### Parameters:

Name | Type | Description
--- | --- | ---
`hex` | `string` |

##### Returns:

Type:
  `*`

#### hexToX3d(hex) → {string}

Color Hex to X3D RGB

Source:
  - colorHelper.js, line 127

##### Parameters:

Name | Type | Description
--- | --- | ---
`hex` | `string` |

##### Returns:

Type:
  `string`

#### randomNum() → {number}

Random Number Generator between 1 and 10

Source:
  - randomData.js, line 22

##### Returns:

Type:
  `number`

#### rgb2Hex(rgbStr) → {string}

RGB Colour to Hex Converter

Source:
  - colorHelper.js, line 100

##### Parameters:

Name | Type | Description
--- | --- | ---
`rgbStr` | `string` | RGB colour string (e.g. "rgb(155, 102, 102)").

##### Returns:

Type:
  `string`

- Hex Color (e.g. "#9b6666").

#### rgbToHex(r, g, b) → {string}

Color RGB to Hex

Source:
  - colorHelper.js, line 90

##### Parameters:

Name | Type | Description
--- | --- | ---
`r` | `number` |
`g` | `number` |
`b` | `number` |

##### Returns:

Type:
  `string`