Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example UsageArgumentsReturn Value
var button = bns.button(div, id, gid, cb, tooltip);

div - d3 selection of the div that the button will be in

id - globally unique button ID string

gid - the glyph ID string to be used for the button

cb - a function reference to be executed when the button is clicked

tooltip - (optional) string of tooltip to appear on hover

creates a button with the given information

returns an object with an API (see below)

Returned API Example UsageArgumentsReturn Value
button.id; *none

string that is the ID of the button

button.width();nonenumber that is the width of the button plus padding (in pixels)

This * This API property is not a function.

...

Example UsageArgumentsReturn Value
var toggle = bns.toggle(div, id, gid, initState, cb, tooltip);

div - d3 selection of the div that the toggle will be in

id - globally unique toggle ID string

gid - the glyph ID string to be used for the toggle

initState - whether the toggle should be "selected" or "unselected" to begin with. Truthy values will be active and falsy values will be inactive.

cb - a function reference to be executed when the toggle is clicked. This callback ("cb") function should take an argument of the selected state of the button.

tooltip - (optional) string of tooltip to appear on hover

creates a toggle with the given information

Returned API Example UsageArgumentsReturn Value
toggle.id *nonestring that is the ID of the toggle
toggle.width();nonenumber that is the width of the toggle plus padding (in pixels)
toggle.selected();none

boolean of the state of the toggle

true - toggle is selected

false - toggle is unselected

toggle.toggle();

none

this toggles the state of the button and executes cb with the selected state
toggle.toggleNoCb();nonetoggles the state of the button but does not execute cb

This * This API property is not a function.

...