d3_init.hpp

TODO.

namespace D3

Functions

int NextD3ID()
class D3_Base
#include <d3_init.hpp>

A base object that all D3 objects inherit from. Handles storing the object in Javascript You probably don’t want to instantiate this directly

Subclassed by D3::Axis< D3::LinearScale >, D3::SelectionOrTransition< Transition >, D3::SelectionOrTransition< Selection >, D3::Axis< SCALE_TYPE >, D3::Category10Scale, D3::Category20Scale, D3::Category20bScale, D3::Category20cScale, D3::Dataset, D3::FormatFunction, D3::Histogram, D3::JSFunction, D3::JSObject, D3::Layout, D3::Scale, D3::SelectionOrTransition< DERIVED >, D3::SvgShapeGenerator, D3::ToolTip

Public Functions

inline int GetID() const
inline void Log() const

Protected Functions

inline D3_Base()

Default constructor - adds placeholder to js.objects array in Javascript.

inline D3_Base(int id)

Construct an object pointing to a pre-determined location in js.objects. Warning: This trusts that you know what you’re doing in choosing an id.

inline D3_Base(const D3_Base &other)
inline D3_Base &operator=(const D3_Base &other)
inline ~D3_Base()

Protected Attributes

int id
class ToolTip : public D3::D3_Base
#include <d3_init.hpp>

Create a tooltup using the d3.tip Javascript library.

Public Functions

inline ToolTip()

Default constructor - displays whatever data is bound on mouseover.

inline ToolTip(std::string func)

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.

inline void SetHtml(std::string func)
class FormatFunction : public D3::D3_Base
#include <d3_init.hpp>

A callable string d3.format() string formatting function.

Public Functions

inline FormatFunction(std::string format = "")
inline std::string operator()(double d)
class JSObject : public D3::D3_Base
#include <d3_init.hpp>

Catch-all object for storing references to things created in JS.

Public Functions

inline JSObject()
class JSFunction : public D3::D3_Base
#include <d3_init.hpp>

Wrapper for creating functions in javascript and calling them there.

Public Functions

inline JSFunction()
inline JSFunction(std::string name)
inline void operator()()

Only works if function has no arguments or returns.