Empirical
Public Member Functions | Protected Attributes | List of all members
D3::ToolTip Class Reference

Create a tooltup using the d3.tip Javascript library. More...

#include <d3_init.h>

Inheritance diagram for D3::ToolTip:
D3::D3_Base

Public Member Functions

 ToolTip ()
 Default constructor - displays whatever data is bound on mouseover. More...
 
 ToolTip (std::string func)
 
void SetHtml (std::string func)
 
int GetID () const
 
void Log () const
 

Protected Attributes

int id
 

Detailed Description

Create a tooltup using the d3.tip Javascript library.

Constructor & Destructor Documentation

D3::ToolTip::ToolTip ( )
inline

Default constructor - displays whatever data is bound on mouseover.

D3::ToolTip::ToolTip ( std::string  func)
inline

Cosntructor that allows you to specify a function that returns the html for the tooltip. As input, this function should take 3 parameters: the bound data, the index of this item in the selection (int), and a placeholder (int).

Example:

`D3::FormatFunction rounded = D3::FormatFunction(".2f");

std::function<double, int, int)> tooltip_display = [this](double d, int i, int k) {return "Data: " + to_string(rounded(d));}

D3::ToolTip tip = D3::ToolTip(tooltip_display);

D3::Selection example_selection = D3::SelectAll("circle");

example_selection.SetupToolTip(tip);'

Mousing over a circle in the example selection will display "Data: " followed by the value of d, rounded to two decimal points.

Member Function Documentation

int D3::D3_Base::GetID ( ) const
inlineinherited
void D3::D3_Base::Log ( ) const
inlineinherited
void D3::ToolTip::SetHtml ( std::string  func)
inline

Member Data Documentation

int D3::D3_Base::id
protectedinherited

The documentation for this class was generated from the following file: