API: Mini-tooltip

Mini Tooltip Component reusable API class that renders a simple and configurable tooltip element for Britechart's bar and step chart.

(require("Mini-tooltip"))(_selection)

This function creates the graph using the selection as container
Parameters:
Name Type Description
_selection D3Selection A d3 selection that represents the container(s) where the chart(s) will be rendered
Source:

Requires

  • module:d3

Methods


module:Mini-tooltip(_selection)

This function creates the graph using the selection as container
Parameters:
Name Type Description
_selection D3Selection A d3 selection that represents the container(s) where the chart(s) will be rendered
Source:

<static> hide()

Hides the tooltip
Source:
Returns:
Tooltip module to chain calls
Type
Module

<static> nameLabel(_x)

Gets or Sets data's nameLabel
Parameters:
Name Type Description
_x text Desired nameLabel
Source:
Returns:
nameLabel or Step Chart module to chain calls
Type
text | module

<static> numberFormat( [_x])

Gets or Sets the number format for the value displayed on the tooltip
Parameters:
Name Type Argument Default Description
_x string <optional>
".2f" Desired number format
Source:
Returns:
Current numberFormat or Chart module to chain calls
Type
string | module

<static> show()

Shows the tooltip
Source:
Returns:
Tooltip module to chain calls
Type
Module

<static> title(_x)

Gets or Sets the title of the tooltip
Parameters:
Name Type Description
_x string Desired title
Source:
Returns:
Current title or module to chain calls
Type
string | module

<static> update(dataPoint, mousePosition, chartSize)

Updates the position and content of the tooltip
Parameters:
Name Type Description
dataPoint Object Datapoint of the hovered element
mousePosition Array Mouse position relative to the parent chart [x, y]
chartSize Array Parent chart size [x, y]
Source:
Returns:
Current component
Type
module

<static> valueFormatter(_x)

Gets or Sets the formatter function for the value displayed on the tooltip. Setting this property makes the tooltip ignore numberFormat. Set by default to d3-format formatter with numberFormat.
Parameters:
Name Type Description
_x function Desired formatter function
Source:
Returns:
Current valueFormatter or Chart module to chain calls
Type
function | module
Example
tooltipChart.valueFormatter(value => value.toString().length.toString())

<static> valueLabel(_x)

Gets or Sets data's valueLabel
Parameters:
Name Type Description
_x text Desired valueLabel
Source:
Returns:
valueLabel or Step Chart module to chain calls
Type
text | module