new Legend(options)
Legend class constructor
Parameters:
Name | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
options |
object | Object with the following properties: Properties
|
Methods
-
getDataName(d)
-
Get the name of the data
Parameters:
Name Type Description d
number The current data point
Returns:
- Type
- undefined
-
hover(i)
-
When user hover on the chart, the data displayed in the legend should be updated
Parameters:
Name Type Description i
number the index of data being hovered
Returns:
- Type
- undefined
-
init()
-
Initialise the legend
Returns:
- Type
- undefined
-
render()
-
render legend, create a div with tables to display legend and data
Returns:
- Type
- undefined
-
updateLegendIcon()
-
Update the icon for the legend The reason this is a seperate function is the legends have different icons when in normal mode and high contrast mode
Returns:
- Type
- undefined