Skip to main content

Tooltip helpers

markLabelSet(tooltip, labelName)​

Records that a tooltip's label was set through its setter, so a chart never replaces it with the one it would choose. The tooltip's label setters call this.

Kind: global function

ParamTypeDescription
tooltipObjectThe tooltip module
labelNameStringThe label's setter name, such as 'topicLabel'

applyChartLabels(tooltip, labels)​

Sets the labels a chart needs on a tooltip, leaving the ones its user set

Kind: global function

ParamTypeDescription
tooltipObjectThe tooltip module
labelsObjectThe labels the chart needs, by setter name

registerTooltipGroup(tooltip, group)​

Records the group a tooltip drew itself in. The tooltip calls this each time it builds one.

Kind: global function

ParamTypeDescription
tooltipObjectThe tooltip module
groupElementThe tooltip's group

claimTooltip(chart, tooltip)​

Makes a chart the tooltip's only chart. Throws when another chart has it: a tooltip draws into one chart, and a second chart would move it between them on every draw.

Kind: global function

ParamTypeDescription
chartObjectThe chart module
tooltipObjectThe tooltip module

releaseTooltip(chart, tooltip)​

Takes a tooltip off a chart: stops the chart's events from reaching it, removes the group it drew, and frees it for another chart

Kind: global function

ParamTypeDescription
chartObjectThe chart module
tooltipObjectThe tooltip module

connectTooltip(chart, tooltip, svg, labels, [toDataPoint])​

Connects a tooltip to a chart that has drawn: sets the labels the chart needs, follows the chart's pointer and keyboard events, and draws the tooltip into the chart's vertical marker, or its metadata group when it has no marker. The handlers go under their own namespace, so the user's handlers on the same events keep running.

Kind: global function

ParamTypeDescription
chartObjectThe chart module
tooltipObjectThe tooltip module
svgD3SelectionThe chart's svg
labelsObjectThe labels the chart needs
[toDataPoint]functionTurns what the chart sends into the data point the tooltip shows