Methods
(inner) createLegend(config, container) → {object}
- Source:
Creates the legend item list and appends into the container. The container consists of the canvas which houses the graph itself, and the legend
- which contains the list of data points labels and
their respective shapes.
Only if showLegend is enabled.
Parameters:
Name | Type | Description |
---|---|---|
config |
object | Graph config object derived from input JSON |
container |
object | d3 Container svg |
Returns:
- d3 svg object
- Type
- object
(inner) getDefaultLegendOptions(graphConfig, dataTarget) → {object}
- Source:
Validate and return the legendOptions property
Parameters:
Name | Type | Description |
---|---|---|
graphConfig |
object | config object of Graph API |
dataTarget |
object | Data points object |
Returns:
legendOptions - legendOptions for the legend
- Type
- object
(inner) getLegendPadding(config, inputLegendPadding) → {object}
- Source:
Helper function to set the right legend padding values based on input JSON.
Parameters:
Name | Type | Description |
---|---|---|
config |
object | config which needs to be updated |
inputLegendPadding |
object | input legend padding provided via input JSON. |
Returns:
- padding for Legend
- Type
- object
(inner) isLegendSelected(target) → {boolean}
- Source:
Returns a boolean after checking the attribute aria-current
.
Parameters:
Name | Type | Description |
---|---|---|
target |
HTMLElement | d3 svg object |
Returns:
- returns boolean
- Type
- boolean
(inner) legendClickHandler(element) → {object}
- Source:
Handler that will need to be called when a legend item is clicked along with any other operations that will be need to taken care of by the parent control.
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | d3 element of the legend item clicked |
Returns:
- d3 svg object
- Type
- object
(inner) legendHoverHandler(shownTargets, canvasSVG, key, hoverState, additionalHandlersopt) → {undefined}
- Source:
Hover handler for legend items.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
shownTargets |
Array | Targets/data sets that are currently displayed in graph |
|
canvasSVG |
d3.selection | d3 selection node of canvas svg |
|
key |
string | Data points set unique key |
|
hoverState |
string | state of mouse hover => enter or leave |
|
additionalHandlers |
Array |
<optional> |
Additional set of handlers that consumers can execute on top of the base hover handler |
Returns:
- returns nothing
- Type
- undefined
(inner) loadLegendItem(legendSVG, t, config, eventHandlers) → {object}
- Source:
Loads the legend items. The values are taken from the Labels property of the input JSON The click and the hover events are only registered when there are datapoints matching the unique ids or have the isDisabled flag turned off.
Parameters:
Name | Type | Description |
---|---|---|
legendSVG |
object | d3 element path of the legend from the parent control |
t |
object | input item object processed from the input JSON |
config |
object | Graph config object derived from input JSON |
eventHandlers |
object | Callback function object executed when legend item is clicked or hovered. Contains click and hover handlers as object property |
Returns:
returns the d3 element path for the legend
- Type
- object
(inner) loadPieLegendItem(legendSVG, dataTarget, hoverHandler, config) → {undefined}
- Source:
Pie chart legend items are non-clickable and they react only to hover or click performed on any of a slice in pie chart itself or hovered over a legend item.
Parameters:
Name | Type | Description |
---|---|---|
legendSVG |
object | d3 element path of the legend from the parent control |
dataTarget |
object | input item object processed from the input JSON |
hoverHandler |
function | Callback function to be called when hovered over the legend item |
config |
object | Graph config object derived from input JSON |
Returns:
returns nothing
- Type
- undefined
(inner) removeLegendItem(legendSVG, dataTarget) → {object}
- Source:
Removes the legend item from legend SVG in the graph
Parameters:
Name | Type | Description |
---|---|---|
legendSVG |
object | d3 svg object |
dataTarget |
object | Data points object |
Returns:
- d3 svg object
- Type
- object