Mini-tooltip

Mini Tooltip Component reusable API class that renders a simple and configurable tooltip element for Britechart's bar and step chart.
Description:
  • Mini Tooltip Component reusable API class that renders a simple and configurable tooltip element for Britechart's bar and step chart.
Source:
Tutorials:
  • Tutorial: bar
Example
var barChart = line(),
    miniTooltip = miniTooltip();

barChart
    .width(500)
    .height(300)
    .on('customMouseHover', miniTooltip.show)
    .on('customMouseMove', miniTooltip.update)
    .on('customMouseOut', miniTooltip.hide);

select('.css-selector')
    .datum(dataset)
    .call(barChart);

select('.metadata-group .mini-tooltip-container')
    .datum([])
    .call(miniTooltip);

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

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

Requires

  • module:d3

Methods

module:Mini-tooltip(_selection)

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

(static) ariaDescription(_xopt) → {String|module}

Description:
  • Sets the accessible description announced for the chart.
Source:
Parameters:
Name Type Attributes Description
_x String <optional>
Description rendered in the SVG desc
Returns:
Current description or the chart for chaining
Type
String | module

(static) ariaLabel(_xopt) → {String|module}

Description:
  • Sets the accessible name announced for the chart.
Source:
Parameters:
Name Type Attributes Description
_x String <optional>
Label rendered in the SVG title
Returns:
Current label or the chart for chaining
Type
String | module

(static) autoResize(_xopt) → {Boolean|module}

Description:
  • Redraw when the parent container changes size.
Source:
Parameters:
Name Type Attributes Description
_x Boolean <optional>
true to follow the container with a ResizeObserver
Returns:
Current flag or the chart for chaining
Type
Boolean | module

(static) hide() → {Module}

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

(static) nameLabel(_x) → {text|module}

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

(static) numberFormat(_xopt) → {string|module}

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

(static) show() → {Module}

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

(static) title(_x) → {string|module}

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

(static) update(dataPoint, mousePosition, chartSize) → {module}

Description:
  • Updates the position and content of the tooltip
Source:
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]
Returns:
Current component
Type
module

(static) valueFormatter(_x) → {function|module}

Description:
  • 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.
Source:
Example
tooltipChart.valueFormatter(value => value.toString().length.toString())
Parameters:
Name Type Description
_x function Desired formatter function
Returns:
Current valueFormatter or Chart module to chain calls
Type
function | module

(static) valueLabel(_x) → {text|module}

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