API: Tooltip

Tooltip Component reusable API class that renders a simple and configurable tooltip element for Britechart's line chart or stacked area chart.

(require("Tooltip"))(_selection, _data)

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
_data Object The data to attach and generate the chart
Source:

Requires

  • module:d3-array,

Members


<static> axisTimeCombinations

constants to be used to force the x axis to respect a certain granularity current options: HOUR_DAY, DAY_MONTH, MONTH_YEAR
Source:
Example
tooltip.dateFormat(tooltip.axisTimeCombinations.HOUR_DAY)

Methods


module:Tooltip(_selection, _data)

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
_data Object The data to attach and generate the chart
Source:

<static> dateCustomFormat(_x)

Exposes the ability to use a custom date format
Parameters:
Name Type Description
_x String Desired custom format
Source:
Returns:
Current format or module to chain calls
Type
String | module
Example
tooltip.dateFormat(tooltip.axisTimeCombinations.CUSTOM);
tooltip.dateCustomFormat('%H:%M %p')

<static> dateFormat(_x)

Exposes the ability to force the tooltip to use a certain date format
Parameters:
Name Type Description
_x String Desired format
Source:
Returns:
Current format or module to chain calls
Type
String | module

<static> dateLabel(_x)

Gets or Sets the dateLabel of the data
Parameters:
Name Type Description
_x String Desired dateLabel
Source:
Returns:
Current dateLabel or Chart module to chain calls
Type
String | module

<static> hide()

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

<static> locale(_x)

Pass locale for the tooltip to render the date in
Parameters:
Name Type Description
_x String Must be a locale tag like 'en-US' or 'fr-FR'
Source:
Returns:
Current locale or module to chain calls
Type
String | module

<static> nameLabel(_x)

Gets or Sets the nameLabel of the data
Parameters:
Name Type Description
_x String Desired nameLabel
Source:
Returns:
Current nameLabel or Chart module to chain calls
Type
String | module

<static> shouldShowDateInTitle(_x)

Gets or Sets shouldShowDateInTitle
Parameters:
Name Type Description
_x Boolean Desired value
Source:
Returns:
Current shouldShowDateInTitle or Chart module to chain calls
Type
Boolean | 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 (to only show the date, set a blank title)
Parameters:
Name Type Description
_x String Desired title
Source:
Returns:
Current title or module to chain calls
Type
String | module

<static> tooltipOffset(tooltipOffset)

Pass an override for the offset of your tooltip
Parameters:
Name Type Description
tooltipOffset Object Object representing the X and Y offsets
Source:
Returns:
Current tooltipOffset
Type
Object | module

<static> topicLabel(_x)

Gets or Sets the topicLabel of the data
Parameters:
Name Type Description
_x String Desired topicLabel
Source:
Returns:
Current topicLabel or Chart module to chain calls
Type
String | module

<static> topicsOrder(_x)

Pass an override for the ordering of your tooltip
Parameters:
Name Type Description
_x Array.<String> Array of the names of your tooltip items
Source:
Returns:
Current overrideOrder or Chart module to chain calls
Type
Array.<String> | module

<static> update(dataPoint, colorMapping, position)

Updates the position and content of the tooltip
Parameters:
Name Type Description
dataPoint Object Datapoint to represent
colorMapping Object Color scheme of the topics
position Number X-scale position in pixels
Source:
Returns:
Tooltip module to chain calls
Type
Module

<static> valueFormat(_x)

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

<static> valueLabel(_x)

Gets or Sets the valueLabel of the data
Parameters:
Name Type Description
_x String Desired valueLabel
Source:
Returns:
Current valueLabel or Chart module to chain calls
Type
String | module