class

function

namespace

Documentation

This documentation is for the new d3plus 2.0. For 1.0 documentation, please visit the wiki: https://github.com/alexandersimoes/d3plus/wiki

Area <>

This is a global class, and extends all of the methods and functionality of Shape.

# new Area()

Creates SVG areas based on an array of data.

# Area.render([callback]) <>

Draws the area polygons.

This is a static method of Area, and is chainable with other methods of this Class.

# Area.curve([value]) <>

If value is specified, sets the area curve to the specified string and returns the current class instance. If value is not specified, returns the current area curve.

This is a static method of Area, and is chainable with other methods of this Class.

# Area.defined([value]) <>

If value is specified, sets the defined accessor to the specified function and returns the current class instance. If value is not specified, returns the current defined accessor.

This is a static method of Area, and is chainable with other methods of this Class.

# Area.x([value]) <>

If value is specified, sets the x accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current x accessor.

This is a static method of Area, and is chainable with other methods of this Class.

# Area.x0([value]) <>

If value is specified, sets the x0 accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current x0 accessor.

This is a static method of Area, and is chainable with other methods of this Class.

# Area.x1([value]) <>

If value is specified, sets the x1 accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current x1 accessor.

This is a static method of Area, and is chainable with other methods of this Class.

# Area.y([value]) <>

If value is specified, sets the y accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current y accessor.

This is a static method of Area, and is chainable with other methods of this Class.

# Area.y0([value]) <>

If value is specified, sets the y0 accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current y0 accessor.

This is a static method of Area, and is chainable with other methods of this Class.

# Area.y1([value]) <>

If value is specified, sets the y1 accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current y1 accessor.

This is a static method of Area, and is chainable with other methods of this Class.


AreaPlot <>

This is a global class, and extends all of the methods and functionality of Plot.

# new AreaPlot()

Creates an area plot based on an array of data.

the equivalent of calling:

new d3plus.Plot()
  .baseline(0)
  .discrete("x")
  .shape("Area")


Axis <>

This is a global class, and extends all of the methods and functionality of BaseClass.

# new Axis()

Creates an SVG scale based on an array of data.

# Axis.render([callback]) <>

Renders the current Axis to the page. If a callback is specified, it will be called once the legend is done drawing.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.align([value]) <>

If value is specified, sets the horizontal alignment to the specified value and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.barConfig([value]) <>

If value is specified, sets the axis line style and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.domain([value]) <>

If value is specified, sets the scale domain of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.duration([value]) <>

If value is specified, sets the transition duration of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.grid([value]) <>

If value is specified, sets the grid values of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.gridConfig([value]) <>

If value is specified, sets the grid style of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.gridSize([value]) <>

If value is specified, sets the grid size of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.height([value]) <>

If value is specified, sets the overall height of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.labels([value]) <>

If value is specified, sets the visible tick labels of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.orient([orient]) <>

If orient is specified, sets the orientation of the shape and returns the current class instance. If orient is not specified, returns the current orientation.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.outerBounds() <>

If called after the elements have been drawn to DOM, will returns the outer bounds of the axis content.

This is a static method of Axis.

{"width": 180, "height": 24, "x": 10, "y": 20}

# Axis.padding([value]) <>

If value is specified, sets the padding between each tick label to the specified number and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.paddingInner([value]) <>

If value is specified, sets the inner padding of band scale to the specified number and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.paddingOuter([value]) <>

If value is specified, sets the outer padding of band scales to the specified number and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.range([value]) <>

If value is specified, sets the scale range (in pixels) of the axis and returns the current class instance. The given array must have 2 values, but one may be undefined to allow the default behavior for that value.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.scale([value]) <>

If value is specified, sets the scale of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.select([selector]) <>

If selector is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If selector is not specified, returns the current SVG container element.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.shape([value]) <>

If value is specified, sets the tick shape constructor and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.shapeConfig([value]) <>

If value is specified, sets the tick style of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.tickFormat([value]) <>

If value is specified, sets the tick formatter and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.ticks([value]) <>

If value is specified, sets the tick values of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.tickSize([value]) <>

If value is specified, sets the tick size of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.title([value]) <>

If value is specified, sets the title of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.titleConfig([value]) <>

If value is specified, sets the title configuration of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.

# Axis.width([value]) <>

If value is specified, sets the overall width of the axis and returns the current class instance.

This is a static method of Axis, and is chainable with other methods of this Class.


AxisBottom <>

This is a global class, and extends all of the methods and functionality of Axis.

# new AxisBottom()

Shorthand method for creating an axis where the ticks are drawn below the horizontal domain path. Extends all functionality of the base Axis class.


AxisLeft <>

This is a global class, and extends all of the methods and functionality of Axis.

# new AxisLeft()

Shorthand method for creating an axis where the ticks are drawn to the left of the vertical domain path. Extends all functionality of the base Axis class.


AxisRight <>

This is a global class, and extends all of the methods and functionality of Axis.

# new AxisRight()

Shorthand method for creating an axis where the ticks are drawn to the right of the vertical domain path. Extends all functionality of the base Axis class.


AxisTop <>

This is a global class, and extends all of the methods and functionality of Axis.

# new AxisTop()

Shorthand method for creating an axis where the ticks are drawn above the vertical domain path. Extends all functionality of the base Axis class.


Bar <>

This is a global class, and extends all of the methods and functionality of Shape.

# new Bar()

Creates SVG areas based on an array of data.

# Bar.render([callback]) <>

Draws the bars.

This is a static method of Bar, and is chainable with other methods of this Class.

# Bar.height([value]) <>

If value is specified, sets the height accessor to the specified function or number and returns the current class instance.

This is a static method of Bar, and is chainable with other methods of this Class.

function(d) {
  return d.height;
}

# Bar.width([value]) <>

If value is specified, sets the width accessor to the specified function or number and returns the current class instance.

This is a static method of Bar, and is chainable with other methods of this Class.

function(d) {
  return d.width;
}

# Bar.x0([value]) <>

If value is specified, sets the x0 accessor to the specified function or number and returns the current class instance.

This is a static method of Bar, and is chainable with other methods of this Class.

# Bar.x1([value]) <>

If value is specified, sets the x1 accessor to the specified function or number and returns the current class instance.

This is a static method of Bar, and is chainable with other methods of this Class.

# Bar.y0([value]) <>

If value is specified, sets the y0 accessor to the specified function or number and returns the current class instance.

This is a static method of Bar, and is chainable with other methods of this Class.

# Bar.y1([value]) <>

If value is specified, sets the y1 accessor to the specified function or number and returns the current class instance.

This is a static method of Bar, and is chainable with other methods of this Class.


BarChart <>

This is a global class, and extends all of the methods and functionality of Plot.

# new BarChart()

Creates a line plot based on an array of data.

the equivalent of calling:

new d3plus.Plot()
  .discrete("x")
  .shape("Line")


BaseClass <>

This is a global class.

# BaseClass.config([value]) <>

If value is specified, sets the methods that correspond to the key/value pairs and returns this class. If value is not specified, returns the current configuration.

This is a static method of BaseClass, and is chainable with other methods of this Class.

# BaseClass.on([typenames], [listener]) <>

Adds or removes a listener to each object for the specified event typenames. If a listener is not specified, returns the currently assigned listener for the specified event typename. Mirrors the core d3-selection behavior.

This is a static method of BaseClass, and is chainable with other methods of this Class.

Param Type
[typenames] String
[listener] function

By default, listeners apply globally to all objects, however, passing a namespace with the class name gives control over specific elements:

new Plot
  .on("click.Shape", function(d) {
    console.log("data for shape clicked:", d);
  })
  .on("click.Legend", function(d) {
    console.log("data for legend clicked:", d);
  })


Button <>

This is a global class, and extends all of the methods and functionality of BaseClass.

# new Button()

Creates a set of HTML radio input elements.

# Button.render() <>

Renders the element to the page.

This is a static method of Button, and is chainable with other methods of this Class.

# Button.buttonStyle([value]) <>

Sets the css styles for the elements.

This is a static method of Button, and is chainable with other methods of this Class.

# Button.container([selector]) <>

If selector is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If selector is not specified, returns the current SVG container element, which is undefined by default.

This is a static method of Button, and is chainable with other methods of this Class.

# Button.text([value]) <>

Sets the inner text for each

This is a static method of Button, and is chainable with other methods of this Class.

# Button.value([value]) <>

Sets the value for each

This is a static method of Button, and is chainable with other methods of this Class.


Circle <>

This is a global class, and extends all of the methods and functionality of Shape.

# new Circle()

Creates SVG circles based on an array of data.

# Circle.render([callback]) <>

Draws the circles.

This is a static method of Circle, and is chainable with other methods of this Class.

# Circle.r([value]) <>

If value is specified, sets the radius accessor to the specified function or number and returns the current class instance.

This is a static method of Circle, and is chainable with other methods of this Class.

function(d) {
  return d.r;
}


ColorScale <>

This is a global class, and extends all of the methods and functionality of BaseClass.

# new ColorScale()

Creates an SVG scale based on an array of data. If data is specified, immediately draws based on the specified array and returns the current class instance. If data is not specified on instantiation, it can be passed/updated after instantiation using the data method.

# ColorScale.render([callback]) <>

Renders the current ColorScale to the page. If a callback is specified, it will be called once the ColorScale is done drawing.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.axisConfig([value]) <>

If value is specified, sets the axis configuration of the ColorScale and returns the current class instance. If value is not specified, returns the current axis configuration.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.align([value]) <>

If value is specified, sets the horizontal alignment to the specified value and returns the current class instance. If value is not specified, returns the current horizontal alignment.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.color([value]) <>

Defines the color or colors to be used for the scale. If only a single color is given as a String, then the scale is interpolated by lightening that color. Otherwise, the function expects an Array of color values to be used in order for the scale.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.data([data]) <>

If data is specified, sets the data array to the specified array and returns the current class instance. If data is not specified, returns the current data array. A shape key will be drawn for each object in the array.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.duration([value]) <>

If value is specified, sets the transition duration of the ColorScale and returns the current class instance. If value is not specified, returns the current duration.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.height([value]) <>

If value is specified, sets the overall height of the ColorScale and returns the current class instance. If value is not specified, returns the current height value.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.orient([value]) <>

Sets the flow of the items inside the ColorScale. If no value is passed, the current flow will be returned.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.outerBounds() <>

If called after the elements have been drawn to DOM, will returns the outer bounds of the ColorScale content.

This is a static method of ColorScale.

{"width": 180, "height": 24, "x": 10, "y": 20}

# ColorScale.padding([value]) <>

If value is specified, sets the padding between each key to the specified number and returns the current class instance. If value is not specified, returns the current padding value.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.rectConfig([value]) <>

Provides access to the config method of the Rect class used to create the different rectangle color buckets.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.scale([value]) <>

If value is specified, sets the scale of the ColorScale and returns the current class instance. If value is not specified, returns the current scale value.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.select([selector]) <>

If selector is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If selector is not specified, returns the current SVG container element.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.size([value]) <>

The height of horizontal color scales, and width when positioned vertical.

This is a static method of ColorScale, and is chainable with other methods of this Class.

# ColorScale.value([value]) <>

If value is specified, sets the value accessor to the specified function or string and returns the current class instance. If value is not specified, returns the current value accessor.

This is a static method of ColorScale, and is chainable with other methods of this Class.

function value(d) {
  return d.value;
}

# ColorScale.width([value]) <>

If value is specified, sets the overall width of the ColorScale and returns the current class instance. If value is not specified, returns the current width value.

This is a static method of ColorScale, and is chainable with other methods of this Class.


Donut <>

This is a global class, and extends all of the methods and functionality of Pie.

# new Donut()

Extends the Pie visualization to create a donut chart.


Geomap <>

This is a global class, and extends all of the methods and functionality of Viz.

# new Geomap()

Creates a geographical map with zooming, panning, image tiles, and the ability to layer choropleth paths and coordinate points. See this example for help getting started.

# Geomap.fitFilter([value]) <>

Topojson files sometimes include small geographies that negatively impact how the library determines the default zoom level (for example, a small island or territory far off the coast that is barely visible to the eye). The fitFilter method can be used to remove specific geographies from the logic used to determine the zooming.

The value passed can be a single id to remove, an array of ids, or a filter function. Take a look at the Choropleth Example to see it in action.

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.fitKey(value) <>

If the topojson being used to determine the zoom fit (either the main topojson object or the fitObject) contains multiple geographical sets (for example, a file containing state and county boundaries), use this method to indentify which set to use for the zoom fit.

If not specified, the first key in the Array returned from using Object.keys on the topojson will be used.

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.fitObject(data, [formatter]) <>

The topojson to be used for the initial projection fit extent. The value passed should either be a valid Topojson Object or a String representing a filepath or URL to be loaded.

Additionally, a custom formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function needs to return the final Topojson Object.

This is a static method of Geomap, and is chainable with other methods of this Class.

Param Type Description
data Object | String = undefined
[formatter] function  

# Geomap.ocean([value]) <>

The color visible behind any shapes drawn on the map projection. By default, a color value matching the color used in the map tiles is used to help mask the loading time needed to render the tiles. Any value CSS color value may be used, including hexidecimal, rgb, rgba, and color strings like "blue" and "transparent".

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.padding([value]) <>

The outer padding between the edge of the visualization and the shapes drawn. The value passed can be either a single number to be used on all sides, or a CSS string pattern (ie. "20px 0 10px").

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.point([value]) <>

The accessor to be used when detecting coordinate points in the objects passed to the data method. Values are expected to be in the format [longitude, latitude], which is in-line with d3’s expected coordinate mapping.

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.pointSize([value]) <>

The accessor or static value to be used for sizing coordinate points.

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.pointSizeMax([value]) <>

The maximum pixel radius used in the scale for sizing coordinate points.

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.pointSizeMin([value]) <>

The minimum pixel radius used in the scale for sizing coordinate points.

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.tiles([value]) <>

Toggles the visibility of the map tiles.

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.tileUrl([url]) <>

By default, d3plus uses the light_all style provided by CARTO for it’s map tiles. The tileUrl method changes the base URL used for fetching the tiles, as long as the string passed contains {x}, {y}, and {z} variables enclosed in curly brackets for the zoom logic to load the correct tiles.

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.topojson(data, [formatter]) <>

The topojson to be used for drawing geographical paths. The value passed should either be a valid Topojson Object or a String representing a filepath or URL to be loaded.

Additionally, a custom formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final Topojson Obejct.

This is a static method of Geomap, and is chainable with other methods of this Class.

Param Type Description
data Object | String = []
[formatter] function  

# Geomap.topojsonFilter([value]) <>

If the topojson being used contains boundaries that should not be shown, this method can be used to filter them out of the final output. The value passed can be a single id to remove, an array of ids, or a filter function.

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.topojsonKey(value) <>

If the topojson contains multiple geographical sets (for example, a file containing state and county boundaries), use this method to indentify which set to use.

If not specified, the first key in the Array returned from using Object.keys on the topojson will be used.

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.topojsonId(value) <>

The accessor used to map each topojson geometry to it’s corresponding data point.

This is a static method of Geomap, and is chainable with other methods of this Class.

# Geomap.zoom([value]) <>

Toggles the ability to zoom/pan the map.

This is a static method of Geomap, and is chainable with other methods of this Class.


Image <>

This is a global class.

# new Image()

Creates SVG images based on an array of data.

a sample row of data

var data = {"url": "file.png", "width": "100", "height": "50"};

passed to the generator

new Image().data([data]).render();

creates the following

<image class="d3plus-Image" opacity="1" href="file.png" width="100" height="50" x="0" y="0"></image>

this is shorthand for the following

image().data([data])();

which also allows a post-draw callback function

image().data([data])(function() { alert("draw complete!"); })

# Image.render([callback]) <>

Renders the current Image to the page. If a callback is specified, it will be called once the images are done drawing.

This is a static method of Image, and is chainable with other methods of this Class.

# Image.data([data]) <>

If data is specified, sets the data array to the specified array and returns the current class instance. If data is not specified, returns the current data array. An tag will be drawn for each object in the array.

This is a static method of Image, and is chainable with other methods of this Class.

# Image.duration([ms]) <>

If ms is specified, sets the animation duration to the specified number and returns the current class instance. If ms is not specified, returns the current animation duration.

This is a static method of Image, and is chainable with other methods of this Class.

# Image.height([value]) <>

If value is specified, sets the height accessor to the specified function or number and returns the current class instance.

This is a static method of Image, and is chainable with other methods of this Class.

function(d) {
  return d.height;
}

# Image.id([value]) <>

If value is specified, sets the id accessor to the specified function and returns the current class instance.

This is a static method of Image, and is chainable with other methods of this Class.

function(d) {
  return d.id;
}

# Image.pointerEvents([value]) <>

If value is specified, sets the pointer-events accessor to the specified function or string and returns the current class instance.

This is a static method of Image, and is chainable with other methods of this Class.

# Image.select([selector]) <>

If selector is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If selector is not specified, returns the current SVG container element.

This is a static method of Image, and is chainable with other methods of this Class.

# Image.url([value]) <>

If value is specified, sets the URL accessor to the specified function and returns the current class instance.

This is a static method of Image, and is chainable with other methods of this Class.

function(d) {
  return d.url;
}

# Image.width([value]) <>

If value is specified, sets the width accessor to the specified function or number and returns the current class instance.

This is a static method of Image, and is chainable with other methods of this Class.

function(d) {
  return d.width;
}

# Image.x([value]) <>

If value is specified, sets the x accessor to the specified function or number and returns the current class instance.

This is a static method of Image, and is chainable with other methods of this Class.

function(d) {
  return d.x || 0;
}

# Image.y([value]) <>

If value is specified, sets the y accessor to the specified function or number and returns the current class instance.

This is a static method of Image, and is chainable with other methods of this Class.

function(d) {
  return d.y || 0;
}


Legend <>

This is a global class, and extends all of the methods and functionality of BaseClass.

# new Legend()

Creates an SVG scale based on an array of data. If data is specified, immediately draws based on the specified array and returns the current class instance. If data is not specified on instantiation, it can be passed/updated after instantiation using the data method.

# Legend.render([callback]) <>

Renders the current Legend to the page. If a callback is specified, it will be called once the legend is done drawing.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.active([value]) <>

If value is specified, sets the active method for all shapes to the specified function and returns the current class instance. If value is not specified, returns the current active method.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.align([value]) <>

If value is specified, sets the horizontal alignment to the specified value and returns the current class instance. If value is not specified, returns the current horizontal alignment.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.data([data]) <>

If data is specified, sets the data array to the specified array and returns the current class instance. If data is not specified, returns the current data array. A shape key will be drawn for each object in the array.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.direction([value]) <>

Sets the flow of the items inside the legend. If no value is passed, the current flow will be returned.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.duration([value]) <>

If value is specified, sets the transition duration of the legend and returns the current class instance. If value is not specified, returns the current duration.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.height([value]) <>

If value is specified, sets the overall height of the legend and returns the current class instance. If value is not specified, returns the current height value.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.hover([value]) <>

If value is specified, sets the hover method for all shapes to the specified function and returns the current class instance. If value is not specified, returns the current hover method.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.id([value]) <>

If value is specified, sets the id accessor to the specified function and returns the current class instance. If value is not specified, returns the current id accessor.

This is a static method of Legend, and is chainable with other methods of this Class.

function value(d) {
  return d.id;
}

# Legend.label([value]) <>

If value is specified, sets the label accessor to the specified function or string and returns the current class instance. If value is not specified, returns the current label accessor, which is the id accessor by default.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.outerBounds() <>

If called after the elements have been drawn to DOM, will returns the outer bounds of the legend content.

This is a static method of Legend.

{"width": 180, "height": 24, "x": 10, "y": 20}

# Legend.padding([value]) <>

If value is specified, sets the padding between each key to the specified number and returns the current class instance. If value is not specified, returns the current padding value.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.select([selector]) <>

If selector is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If selector is not specified, returns the current SVG container element.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.shape([value]) <>

If value is specified, sets the shape accessor to the specified function or string and returns the current class instance. If value is not specified, returns the current shape accessor.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.shapeConfig([config]) <>

If config is specified, sets the methods that correspond to the key/value pairs for each shape and returns the current class instance. If config is not specified, returns the current shape configuration.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.title([value]) <>

If value is specified, sets the title of the legend and returns the current class instance. If value is not specified, returns the current title.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.titleConfig([value]) <>

If value is specified, sets the title configuration of the legend and returns the current class instance. If value is not specified, returns the current title configuration.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.verticalAlign([value]) <>

If value is specified, sets the vertical alignment to the specified value and returns the current class instance. If value is not specified, returns the current vertical alignment.

This is a static method of Legend, and is chainable with other methods of this Class.

# Legend.width([value]) <>

If value is specified, sets the overall width of the legend and returns the current class instance. If value is not specified, returns the current width value.

This is a static method of Legend, and is chainable with other methods of this Class.


Line <>

This is a global class, and extends all of the methods and functionality of Shape.

# new Line()

Creates SVG lines based on an array of data.

# Line.render([callback]) <>

Draws the lines.

This is a static method of Line, and is chainable with other methods of this Class.

# Line.curve([value]) <>

If value is specified, sets the line curve to the specified string and returns the current class instance. If value is not specified, returns the current line curve.

This is a static method of Line, and is chainable with other methods of this Class.

# Line.defined([value]) <>

If value is specified, sets the defined accessor to the specified function and returns the current class instance. If value is not specified, returns the current defined accessor.

This is a static method of Line, and is chainable with other methods of this Class.


LinePlot <>

This is a global class, and extends all of the methods and functionality of Plot.

# new LinePlot()

Creates a line plot based on an array of data.

the equivalent of calling:

new d3plus.Plot()
  .discrete("x")
  .shape("Line")


Network <>

This is a global class, and extends all of the methods and functionality of Viz.

# new Network()

Creates a network visualization based on a defined set of nodes and edges. Click here for help getting started using the Network class.

# Network.links([links]) <>

A predefined Array of edges that connect each object passed to the node method. The source and target keys in each link need to map to the nodes in one of three ways:

  1. The index of the node in the nodes array (as in this example).
  2. The actual node Object itself.
  3. A String value matching the id of the node.

This is a static method of Network, and is chainable with other methods of this Class.

# Network.nodeGroupBy([value]) <>

If value is specified, sets the node group accessor(s) to the specified string, function, or array of values and returns the current class instance. This method overrides the default .groupBy() function from being used with the data passed to .nodes(). If value is not specified, returns the current node group accessor.

This is a static method of Network, and is chainable with other methods of this Class.

# Network.nodes([nodes]) <>

If nodes is specified, sets the nodes array to the specified array and returns the current class instance. If nodes is not specified, returns the current nodes array.

This is a static method of Network, and is chainable with other methods of this Class.

# Network.size([value]) <>

If value is specified, sets the size accessor to the specified function or data key and returns the current class instance. If value is not specified, returns the current size accessor.

This is a static method of Network, and is chainable with other methods of this Class.

# Network.sizeMax([value]) <>

If value is specified, sets the size scale maximum to the specified number and returns the current class instance. If value is not specified, returns the current size scale maximum. By default, the maximum size is determined by half the distance of the two closest nodes.

This is a static method of Network, and is chainable with other methods of this Class.

# Network.sizeMin([value]) <>

If value is specified, sets the size scale minimum to the specified number and returns the current class instance. If value is not specified, returns the current size scale minimum.

This is a static method of Network, and is chainable with other methods of this Class.

# Network.sizeScale([value]) <>

If value is specified, sets the size scale to the specified string and returns the current class instance. If value is not specified, returns the current size scale.

This is a static method of Network, and is chainable with other methods of this Class.

# Network.x([value]) <>

If value is specified, sets the x accessor to the specified function or string matching a key in the data and returns the current class instance. The data passed to .data() takes priority over the .nodes() data array. If value is not specified, returns the current x accessor. By default, the x and y positions are determined dynamically based on default force layout properties.

This is a static method of Network, and is chainable with other methods of this Class.

# Network.y([value]) <>

If value is specified, sets the y accessor to the specified function or string matching a key in the data and returns the current class instance. The data passed to .data() takes priority over the .nodes() data array. If value is not specified, returns the current y accessor. By default, the x and y positions are determined dynamically based on default force layout properties.

This is a static method of Network, and is chainable with other methods of this Class.

# Network.zoom([value]) <>

If value is specified, toggles overall zooming to the specified boolean and returns the current class instance. If value is not specified, returns the current overall zooming value.

This is a static method of Network, and is chainable with other methods of this Class.

# Network.zoomMax([value]) <>

If value is specified, sets the max zoom scale to the specified number and returns the current class instance. If value is not specified, returns the current max zoom scale.

This is a static method of Network, and is chainable with other methods of this Class.

# Network.zoomPan([value]) <>

If value is specified, toggles panning to the specified boolean and returns the current class instance. If value is not specified, returns the current panning value.

This is a static method of Network, and is chainable with other methods of this Class.

# Network.zoomScroll([value]) <>

If value is specified, toggles scroll zooming to the specified boolean and returns the current class instance. If value is not specified, returns the current scroll zooming value.

This is a static method of Network, and is chainable with other methods of this Class.


Path <>

This is a global class, and extends all of the methods and functionality of Shape.

# new Path()

Creates SVG Paths based on an array of data.

# Path.render([callback]) <>

Draws the paths.

This is a static method of Path, and is chainable with other methods of this Class.

# Path.d([value]) <>

If value is specified, sets the “d” attribute accessor to the specified function or number and returns the current class instance.

This is a static method of Path, and is chainable with other methods of this Class.

function(d) {
  return d.path;
}


Pie <>

This is a global class, and extends all of the methods and functionality of Viz.

# new Pie()

Uses the d3 pie layout to creates SVG arcs based on an array of data.

# Pie.innerRadius([value]) <>

If value is specified, sets the inner radius accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current inner radius accessor.

This is a static method of Pie.

# Pie.padAngle([value]) <>

If value is specified, sets the arc padding to the specified radian value and returns the current class instance. If value is not specified, returns the current radian padding.

This is a static method of Pie.

# Pie.padPixel([value]) <>

If value is specified, sets the arc padding to the specified pixel value and returns the current class instance. If value is not specified, returns the current pixel padding.

This is a static method of Pie.

# Pie.sort([comparator]) <>

If comparator is specified, sets the sort order for the pie slices using the specified comparator function. If comparator is not specified, returns the current sort order, which defaults to descending order by the associated input data’s numeric value attribute.

This is a static method of Pie.

function comparator(a, b) {
  return b.value - a.value;
}

# Pie.value([value]) <>

If value is specified, sets the value accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current value accessor.

This is a static method of Pie.

function value(d) {
  return d.value;
}


Plot <>

This is a global class, and extends all of the methods and functionality of Viz.

# new Plot()

Creates an x/y plot based on an array of data.

# Plot.barPadding([value]) <>

Sets the pixel space between each bar in a group of bars.

This is a static method of Plot.

# Plot.baseline([value]) <>

If value is specified, sets the baseline for the x/y plot and returns the current class instance. If value is not specified, returns the current baseline.

This is a static method of Plot.

# Plot.discrete([value]) <>

If value is specified, sets the discrete axis to the specified string and returns the current class instance. If value is not specified, returns the current discrete axis.

This is a static method of Plot.

# Plot.groupPadding([value]) <>

Sets the pixel space between groups of bars.

This is a static method of Plot.

# Plot.stacked([value]) <>

If value is specified, toggles shape stacking and returns the current class instance. If value is not specified, returns the current stack value.

This is a static method of Plot.

# Plot.stackOffset([value]) <>

If value is specified, sets the stack offset and returns the current class instance. If value is not specified, returns the current stack offset function.

This is a static method of Plot.

# Plot.stackOrder([value]) <>

If value is specified, sets the stack order and returns the current class instance. If value is not specified, returns the current stack order function.

This is a static method of Plot.

# Plot.x([value]) <>

If value is specified, sets the x accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current x accessor.

This is a static method of Plot.

# Plot.xConfig([value]) <>

If value is specified, sets the config method for the x-axis and returns the current class instance. If value is not specified, returns the current x-axis configuration.

This is a static method of Plot.

# Plot.x2Config([value]) <>

If value is specified, sets the config method for the secondary x-axis and returns the current class instance. If value is not specified, returns the current secondary x-axis configuration.

This is a static method of Plot.

# Plot.xDomain([value]) <>

If value is specified, sets the x domain to the specified array and returns the current class instance. If value is not specified, returns the current x domain. Additionally, if either value of the array is undefined, it will be calculated from the data.

This is a static method of Plot.

# Plot.xSort([value]) <>

Defines a custom sorting comparitor function to be used for discrete x axes.

This is a static method of Plot.

# Plot.y([value]) <>

If value is specified, sets the y accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current y accessor.

This is a static method of Plot.

# Plot.yConfig([value]) <>

If value is specified, sets the config method for the y-axis and returns the current class instance. If value is not specified, returns the current y-axis configuration. Note:* If a “domain” array is passed to the y-axis config, it will be reversed.

This is a static method of Plot.

# Plot.y2Config([value]) <>

If value is specified, sets the config method for the secondary y-axis and returns the current class instance. If value is not specified, returns the current secondary y-axis configuration.

This is a static method of Plot.

# Plot.yDomain([value]) <>

If value is specified, sets the y domain to the specified array and returns the current class instance. If value is not specified, returns the current y domain. Additionally, if either value of the array is undefined, it will be calculated from the data.

This is a static method of Plot.

# Plot.ySort([value]) <>

Defines a custom sorting comparitor function to be used for discrete y axes.

This is a static method of Plot.


Priestley <>

This is a global class, and extends all of the methods and functionality of Viz.

# new Priestley()

Creates a priestley timeline based on an array of data.

# Priestley.axisConfig([value]) <>

If value is specified, sets the config method for the axis and returns the current class instance. If value is not specified, returns the current axis configuration.

This is a static method of Priestley, and is chainable with other methods of this Class.

# Priestley.end([value]) <>

If value is specified, sets the end accessor to the specified function or key and returns the current class instance. If value is not specified, returns the current end accessor.

This is a static method of Priestley, and is chainable with other methods of this Class.

# Priestley.start([value]) <>

If value is specified, sets the start accessor to the specified function or key and returns the current class instance. If value is not specified, returns the current start accessor.

This is a static method of Priestley, and is chainable with other methods of this Class.


Radio <>

This is a global class, and extends all of the methods and functionality of BaseClass.

# new Radio()

Creates a set of HTML radio input elements.

# Radio.data([value]) <>

Defines the array of values to be created as

This is a static method of Radio, and is chainable with other methods of this Class.

# Radio.render() <>

Renders the element to the page.

This is a static method of Radio, and is chainable with other methods of this Class.

# Radio.checked([value]) <>

Defines the checked input.

This is a static method of Radio, and is chainable with other methods of this Class.

# Radio.container([selector]) <>

If selector is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If selector is not specified, returns the current SVG container element, which is undefined by default.

This is a static method of Radio, and is chainable with other methods of this Class.

# Radio.labelStyle([value]) <>

Sets the css styles for the

This is a static method of Radio, and is chainable with other methods of this Class.

# Radio.legend([value]) <>

Creates a <legend> tag for the

This is a static method of Radio, and is chainable with other methods of this Class.

# Radio.legendStyle([value]) <>

Sets the css styles for the <legend> element.

This is a static method of Radio, and is chainable with other methods of this Class.

# Radio.options([value]) <>

Defines the array of values to be used as

This is a static method of Radio, and is chainable with other methods of this Class.

# Radio.radioStyle([value]) <>

Sets the css styles for the elements.

This is a static method of Radio, and is chainable with other methods of this Class.

# Radio.text([value]) <>

Sets the inner text for each

This is a static method of Radio, and is chainable with other methods of this Class.

# Radio.value([value]) <>

Sets the value for each

This is a static method of Radio, and is chainable with other methods of this Class.


Rect <>

This is a global class, and extends all of the methods and functionality of Shape.

# new Rect()

Creates SVG rectangles based on an array of data. See this example for help getting started using the rectangle generator.

# Rect.render([callback]) <>

Draws the rectangles.

This is a static method of Rect, and is chainable with other methods of this Class.

# Rect.height([value]) <>

If value is specified, sets the height accessor to the specified function or number and returns the current class instance.

This is a static method of Rect, and is chainable with other methods of this Class.

function(d) {
  return d.height;
}

# Rect.width([value]) <>

If value is specified, sets the width accessor to the specified function or number and returns the current class instance.

This is a static method of Rect, and is chainable with other methods of this Class.

function(d) {
  return d.width;
}


Select <>

This is a global class, and extends all of the methods and functionality of BaseClass.

# new Select()

Creates an HTML select element.

# Select.render() <>

Renders the element to the page.

This is a static method of Select, and is chainable with other methods of this Class.

# Select.container([selector]) <>

If selector is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If selector is not specified, returns the current SVG container element, which is undefined by default.

This is a static method of Select, and is chainable with other methods of this Class.

# Select.label([value]) <>

Creates a

This is a static method of Select, and is chainable with other methods of this Class.

# Select.labelStyle([value]) <>

Sets the css styles for the

This is a static method of Select, and is chainable with other methods of this Class.

# Select.options([value]) <>

Defines the array of values to be used as

This is a static method of Select, and is chainable with other methods of this Class.

# Select.optionStyle([value]) <>

Sets the css styles for the

This is a static method of Select, and is chainable with other methods of this Class.

# Select.selected([value]) <>

Defines the selected option.

This is a static method of Select, and is chainable with other methods of this Class.

# Select.selectStyle([value]) <>

Sets the css styles for the

This is a static method of Select, and is chainable with other methods of this Class.

# Select.text([value]) <>

Sets the inner text for each

This is a static method of Select, and is chainable with other methods of this Class.

# Select.value([value]) <>

Sets the value for each

This is a static method of Select, and is chainable with other methods of this Class.


Shape <>

This is a global class, and extends all of the methods and functionality of BaseClass.

# new Shape()

An abstracted class for generating shapes.

# Shape.render([callback]) <>

Renders the current Shape to the page. If a callback is specified, it will be called once the shapes are done drawing.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.active([value]) <>

If value is specified, sets the highlight accessor to the specified function and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.activeOpacity([value]) <>

If value is specified, sets the active opacity to the specified function and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.backgroundImage([value]) <>

If value is specified, sets the background-image accessor to the specified function or string and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.data([data]) <>

If data is specified, sets the data array to the specified array and returns the current class instance. If data is not specified, returns the current data array. A shape will be drawn for each object in the array.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.duration([ms]) <>

If ms is specified, sets the animation duration to the specified number and returns the current class instance. If ms is not specified, returns the current animation duration.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.fill([value]) <>

If value is specified, sets the fill accessor to the specified function or string and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.fillOpacity([value]) <>

Defines the “fill-opacity” attribute for the shapes.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.hover([value]) <>

If value is specified, sets the highlight accessor to the specified function and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.hoverOpacity([value]) <>

If value is specified, sets the hover opacity to the specified function and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.hitArea([bounds]) <>

If bounds is specified, sets the mouse hit area to the specified function and returns the current class instance. If bounds is not specified, returns the current mouse hit area accessor.

This is a static method of Shape, and is chainable with other methods of this Class.

function(d, i, shape) {
  return {
    "width": shape.width,
    "height": shape.height,
    "x": -shape.width / 2,
    "y": -shape.height / 2
  };
}

# Shape.id([value]) <>

If value is specified, sets the id accessor to the specified function and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.label([value]) <>

If value is specified, sets the label accessor to the specified function or string and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.labelBounds([bounds]) <>

If bounds is specified, sets the label bounds to the specified function and returns the current class instance. If bounds is not specified, returns the current inner bounds accessor.

This is a static method of Shape, and is chainable with other methods of this Class.

function(d, i, shape) {
  return {
    "width": shape.width,
    "height": shape.height,
    "x": -shape.width / 2,
    "y": -shape.height / 2
  };
}

# Shape.labelConfig([value]) <>

A pass-through to the config method of the TextBox class used to create a shape’s labels.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.labelPadding([value]) <>

If value is specified, sets the label padding to the specified number and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.opacity([value]) <>

If value is specified, sets the opacity accessor to the specified function or number and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.rx([value]) <>

Defines the “rx” attribute for the shapes.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.ry([value]) <>

Defines the “rx” attribute for the shapes.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.scale([value]) <>

If value is specified, sets the scale accessor to the specified function or string and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.select([selector]) <>

If selector is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If selector is not specified, returns the current SVG container element.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.shapeRendering([value]) <>

If value is specified, sets the shape-rendering accessor to the specified function or string and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

function(d) {
  return d.x;
}

# Shape.sort([value]) <>

If value is specified, sets the sort comparator to the specified function and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.stroke([value]) <>

If value is specified, sets the stroke accessor to the specified function or string and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.strokeDasharray([value]) <>

Defines the “stroke-dasharray” attribute for the shapes.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.strokeLinecap([value]) <>

Defines the “stroke-linecap” attribute for the shapes. Accepted values are "butt", "round", and "square".

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.strokeOpacity([value]) <>

Defines the “stroke-opacity” attribute for the shapes.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.strokeWidth([value]) <>

If value is specified, sets the stroke-width accessor to the specified function or string and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.textAnchor([value]) <>

If value is specified, sets the text-anchor accessor to the specified function or string and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.vectorEffect([value]) <>

If value is specified, sets the vector-effect accessor to the specified function or string and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.verticalAlign([value]) <>

If value is specified, sets the vertical alignment accessor to the specified function or string and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

# Shape.x([value]) <>

If value is specified, sets the x accessor to the specified function or number and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

function(d) {
  return d.x;
}

# Shape.y([value]) <>

If value is specified, sets the y accessor to the specified function or number and returns the current class instance.

This is a static method of Shape, and is chainable with other methods of this Class.

function(d) {
  return d.y;
}


StackedArea <>

This is a global class, and extends all of the methods and functionality of Area.

# new StackedArea()

Creates a stacked area plot based on an array of data.

the equivalent of calling:

new d3plus.Area()
  .stacked(true)


TextBox <>

This is a global class, and extends all of the methods and functionality of BaseClass.

# new TextBox()

Creates a wrapped text box for each point in an array of data. See this example for help getting started using the TextBox class.

# TextBox.render([callback]) <>

Renders the text boxes. If a callback is specified, it will be called once the shapes are done drawing.

This is a static method of TextBox.

# TextBox.data([data]) <>

Sets the data array to the specified array. A text box will be drawn for each object in the array.

This is a static method of TextBox.

# TextBox.delay([value]) <>

Sets the animation delay to the specified number in milliseconds.

This is a static method of TextBox.

# TextBox.duration([value]) <>

Sets the animation duration to the specified number in milliseconds.

This is a static method of TextBox.

# TextBox.ellipsis([value]) <>

Sets the ellipsis method to the specified function or string, which simply adds an ellipsis to the string by default.

This is a static method of TextBox. default accessor

function(d) {
  return d + "...";
}

# TextBox.fontColor([value]) <>

Sets the font color to the specified accessor function or static string, which is inferred from the DOM selection by default.

This is a static method of TextBox.

# TextBox.fontFamily([value]) <>

Defines the font-family to be used. The value passed can be either a String name of a font, a comma-separated list of font-family fallbacks, an Array of fallbacks, or a Function that returns either a String or an Array. If supplying multiple fallback fonts, the fontExists function will be used to determine the first available font on the client’s machine.

This is a static method of TextBox.

# TextBox.fontMax([value]) <>

Sets the maximum font size to the specified accessor function or static number, which is used when dynamically resizing fonts.

This is a static method of TextBox.

# TextBox.fontMin([value]) <>

Sets the minimum font size to the specified accessor function or static number, which is used when dynamically resizing fonts.

This is a static method of TextBox.

# TextBox.fontResize([value]) <>

Toggles font resizing, which can either be defined as a static boolean for all data points, or an accessor function that returns a boolean. See this example for a side-by-side comparison.

This is a static method of TextBox.

# TextBox.fontSize([value]) <>

Sets the font size to the specified accessor function or static number, which is inferred from the DOM selection by default.

This is a static method of TextBox.

# TextBox.fontWeight([value]) <>

Sets the font weight to the specified accessor function or static number, which is inferred from the DOM selection by default.

This is a static method of TextBox.

# TextBox.height([value]) <>

Sets the height for each box to the specified accessor function or static number.

This is a static method of TextBox. default accessor

function(d) {
  return d.height || 200;
}

# TextBox.id([value]) <>

Defines the unique id for each box to the specified accessor function or static number.

This is a static method of TextBox. default accessor

function(d, i) {
  return d.id || i + "";
}

# TextBox.lineHeight([value]) <>

Sets the line height to the specified accessor function or static number, which is 1.4 times the font size by default.

This is a static method of TextBox.

# TextBox.overflow([value]) <>

Sets the text overflow to the specified accessor function or static boolean.

This is a static method of TextBox.

# TextBox.pointerEvents([value]) <>

Sets the pointer-events to the specified accessor function or static string.

This is a static method of TextBox.

# TextBox.rotate([value]) <>

Sets the rotate percentage for each box to the specified accessor function or static string.

This is a static method of TextBox.

# TextBox.select([selector]) <>

Sets the SVG container element to the specified d3 selector or DOM element. If not explicitly specified, an SVG element will be added to the page for use.

This is a static method of TextBox.

# TextBox.split([value]) <>

Sets the word split behavior to the specified function, which when passed a string is expected to return that string split into an array of words.

This is a static method of TextBox.

# TextBox.text([value]) <>

Sets the text for each box to the specified accessor function or static string.

This is a static method of TextBox. default accessor

function(d) {
  return d.text;
}

# TextBox.textAnchor([value]) <>

Sets the horizontal text anchor to the specified accessor function or static string, whose values are analagous to the SVG text-anchor property.

This is a static method of TextBox.

# TextBox.verticalAlign([value]) <>

Sets the vertical alignment to the specified accessor function or static string. Accepts "top", "middle", and "bottom".

This is a static method of TextBox.

# TextBox.width([value]) <>

Sets the width for each box to the specified accessor function or static number.

This is a static method of TextBox. default accessor

function(d) {
  return d.width || 200;
}

# TextBox.x([value]) <>

Sets the x position for each box to the specified accessor function or static number. The number given should correspond to the left side of the textBox.

This is a static method of TextBox. default accessor

function(d) {
  return d.x || 0;
}

# TextBox.y([value]) <>

Sets the y position for each box to the specified accessor function or static number. The number given should correspond to the top side of the textBox.

This is a static method of TextBox. default accessor

function(d) {
  return d.y || 0;
}


Timeline <>

This is a global class, and extends all of the methods and functionality of Axis.

# Timeline.render([callback]) <>

Draws the timeline.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.brushing([value]) <>

If value is specified, toggles the brushing value and returns the current class instance. If value is not specified, returns the current brushing value.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.brushFilter([value]) <>

If value is specified, sets the brush event filter and returns the current class instance. If value is not specified, returns the current brush event filter.

This is a static method of Timeline, and is chainable with other methods of this Class.

function() {
  return !event.button && event.detail < 2;
}

# Timeline.handleConfig([value]) <>

If value is specified, sets the handle style and returns the current class instance. If value is not specified, returns the current handle style.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.handleSize([value]) <>

If value is specified, sets the handle size and returns the current class instance. If value is not specified, returns the current handle size.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.on([typename], [listener]) <>

Adds or removes a listener for the specified brush event typename. If a listener is not specified, returns the currently-assigned listener for the specified event typename. Mirrors the core d3-brush behavior.

This is a static method of Timeline, and is chainable with other methods of this Class.

Param Type
[typename] String | Object
[listener] function

# Timeline.selectionConfig([value]) <>

If value is specified, sets the selection style and returns the current class instance. If value is not specified, returns the current selection style.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.selection([value]) <>

If value is specified, sets the selection and returns the current class instance. If value is not specified, returns the current selection. Defaults to the most recent year in the timeline.

This is a static method of Timeline, and is chainable with other methods of this Class.

# Timeline.snapping([value]) <>

If value is specified, toggles the snapping value and returns the current class instance. If value is not specified, returns the current snapping value.

This is a static method of Timeline, and is chainable with other methods of this Class.


Tooltip <>

This is a global class, and extends all of the methods and functionality of BaseClass.

# new Tooltip()

Creates HTML tooltips in the body of a webpage.

# Tooltip.background([value]) <>

If value is specified, sets the background accessor to the specified function or string and returns this generator. If value is not specified, returns the current background accessor.

This is a static method of Tooltip.

# Tooltip.body([value]) <>

If value is specified, sets the body accessor to the specified function or string and returns this generator. If value is not specified, returns the current body accessor.

This is a static method of Tooltip. default accessor

function value(d) {
  return d.body || "";
}

# Tooltip.bodyStyle([value]) <>

If value is specified, sets the body styles to the specified values and returns this generator. If value is not specified, returns the current body styles.

This is a static method of Tooltip. default styles

{
  "font-family": "Verdana",
  "font-size": "10px",
  "font-weight": "400"
}

# Tooltip.border([value]) <>

If value is specified, sets the border accessor to the specified function or string and returns this generator. If value is not specified, returns the current border accessor.

This is a static method of Tooltip.

# Tooltip.borderRadius([value]) <>

If value is specified, sets the border-radius accessor to the specified function or string and returns this generator. If value is not specified, returns the current border-radius accessor.

This is a static method of Tooltip.

# Tooltip.className([value]) <>

If value is specified, sets the class name to the specified string and returns this generator. If value is not specified, returns the current class name.

This is a static method of Tooltip.

# Tooltip.data([data]) <>

If data is specified, sets the data array to the specified array and returns this generator. If data is not specified, returns the current data array.

This is a static method of Tooltip.

# Tooltip.duration([ms]) <>

If ms is specified, sets the duration accessor to the specified function or number and returns this generator. If ms is not specified, returns the current duration accessor.

This is a static method of Tooltip.

# Tooltip.footer([value]) <>

If value is specified, sets the footer accessor to the specified function or string and returns this generator. If value is not specified, returns the current footer accessor.

This is a static method of Tooltip. default accessor

function value(d) {
  return d.footer || "";
}

# Tooltip.footerStyle([value]) <>

If value is specified, sets the footer styles to the specified values and returns this generator. If value is not specified, returns the current footer styles.

This is a static method of Tooltip. default styles

{
  "font-family": "Verdana",
  "font-size": "10px",
  "font-weight": "400"
}

# Tooltip.height([value]) <>

If value is specified, sets the height accessor to the specified function or string and returns this generator. If value is not specified, returns the current height accessor.

This is a static method of Tooltip.

# Tooltip.id([value]) <>

If value is specified, sets the id accessor to the specified function or string and returns this generator. If value is not specified, returns the current id accessor.

This is a static method of Tooltip. default accessor

function value(d, i) {
  return d.id || "" + i;
}

# Tooltip.offset([value]) <>

If value is specified, sets the offset accessor to the specified function or number and returns this generator. If value is not specified, returns the current offset accessor.

This is a static method of Tooltip.

# Tooltip.padding([value]) <>

If value is specified, sets the padding accessor to the specified function or string and returns this generator. If value is not specified, returns the current padding accessor.

This is a static method of Tooltip.

# Tooltip.pointerEvents([value]) <>

If value is specified, sets the pointer-events accessor to the specified function or string and returns this generator. If value is not specified, returns the current pointer-events accessor.

This is a static method of Tooltip.

# Tooltip.tableStyle([value]) <>

If value is specified, sets the table styles to the specified values and returns this generator. If value is not specified, returns the current table styles.

This is a static method of Tooltip. default styles

{
  "border-spacing": "0",
  "width": "100%"
}

# Tooltip.tbody([value]) <>

If value is specified, sets the contents of the table body to the specified array of functions or strings and returns this generator. If value is not specified, returns the current table body data.

This is a static method of Tooltip.

# Tooltip.tbodyStyle([value]) <>

If value is specified, sets the table body styles to the specified values and returns this generator. If value is not specified, returns the current table body styles.

This is a static method of Tooltip. default styles

{
  "font-family": "Verdana",
  "font-size": "10px",
  "font-weight": "600",
  "text-align": "center"
}

# Tooltip.thead([value]) <>

If value is specified, sets the contents of the table head to the specified array of functions or strings and returns this generator. If value is not specified, returns the current table head data.

This is a static method of Tooltip.

# Tooltip.theadStyle([value]) <>

If value is specified, sets the table head styles to the specified values and returns this generator. If value is not specified, returns the current table head styles.

This is a static method of Tooltip. default styles

{
  "font-family": "Verdana",
  "font-size": "10px",
  "font-weight": "600",
  "text-align": "center"
}

# Tooltip.title([value]) <>

If value is specified, sets the title accessor to the specified function or string and returns this generator. If value is not specified, returns the current title accessor.

This is a static method of Tooltip. default accessor

function value(d) {
  return d.title || "";
}

# Tooltip.titleStyle([value]) <>

If value is specified, sets the title styles to the specified values and returns this generator. If value is not specified, returns the current title styles.

This is a static method of Tooltip. default styles

{
  "font-family": "Verdana",
  "font-size": "12px",
  "font-weight": "600",
  "padding-bottom": "5px"
}

# Tooltip.translate([value]) <>

If value is specified, sets the translate accessor to the specified function or array and returns this generator. If value is not specified, returns the current translate accessor.

This is a static method of Tooltip. default accessor

function value(d) {
  return [d.x, d.y];
}

# Tooltip.width([value]) <>

If value is specified, sets the width accessor to the specified function or string and returns this generator. If value is not specified, returns the current width accessor.

This is a static method of Tooltip.


Tree <>

This is a global class, and extends all of the methods and functionality of Viz.

# new Tree()

Uses d3’s tree layout to create a tidy tree chart based on an array of data.

# Tree.orient([value]) <>

If value is specified, sets the orientation to the specified value. If value is not specified, returns the current orientation.

This is a static method of Tree.

# Tree.separation([value]) <>

If value is specified, sets the separation accessor to the specified function. If value is not specified, returns the current separation accessor.

From the d3-hierarchy documentation:

The separation accessor is used to separate neighboring nodes. The separation function is passed two nodes a and b, and must return the desired separation. The nodes are typically siblings, though the nodes may be more distantly related if the layout decides to place such nodes adjacent.

This is a static method of Tree.

function separation(a, b) {
  return a.parent === b.parent ? 1 : 2;
}


Treemap <>

This is a global class, and extends all of the methods and functionality of Viz.

# new Treemap()

Uses the d3 treemap layout to creates SVG rectangles based on an array of data. See this example for help getting started using the treemap generator.

# Treemap.padding([value]) <>

If value is specified, sets the inner and outer padding accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current padding accessor.

This is a static method of Treemap.

# Treemap.sort([comparator]) <>

If comparator is specified, sets the sort order for the treemap using the specified comparator function. If comparator is not specified, returns the current group sort order, which defaults to descending order by the associated input data’s numeric value attribute.

This is a static method of Treemap.

function comparator(a, b) {
  return b.value - a.value;
}

# Treemap.sum([value]) <>

If value is specified, sets the sum accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current sum accessor.

This is a static method of Treemap.

function sum(d) {
  return d.sum;
}

# Treemap.tile([value]) <>

If value is specified, sets the tiling method to the specified function and returns the current class instance. If value is not specified, returns the current tiling method.

This is a static method of Treemap.


Viz <>

This is a global class, and extends all of the methods and functionality of BaseClass.

# new Viz()

Creates an x/y plot based on an array of data. If data is specified, immediately draws the tree map based on the specified array and returns the current class instance. If data is not specified on instantiation, it can be passed/updated after instantiation using the data method. See this example for help getting started using the treemap generator.

# Viz.render([callback]) <>

Draws the visualization given the specified configuration.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.active([value]) <>

If value is specified, sets the active method to the specified function and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.aggs([value]) <>

If value is specified, sets the aggregation method for each key in the object and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.backConfig([value]) <>

If value is specified, sets the config method for the back button and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.cache([value]) <>

Enables a lru cache that stores up to 5 previously loaded files/URLs. Helpful when constantly writing over the data array with a URL in the render function of a react component.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.color([value]) <>

Defines the main color to be used for each data point in a visualization. Can be either an accessor function or a string key to reference in each data point. If a color value is returned, it will be used as is. If a string is returned, a unique color will be assigned based on the string.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.colorScale([value]) <>

Defines the value to be used for a color scale. Can be either an accessor function or a string key to reference in each data point.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.colorScaleConfig([value]) <>

A pass-through to the config method of ColorScale.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.colorScalePosition([value]) <>

Defines which side of the visualization to anchor the color scale. Acceptable values are "top", "bottom", "left", "right", and false. A false value will cause the color scale to not be displayed, but will still color shapes based on the scale.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.controls([value]) <>

Defines a list of controls to be rendered at the bottom of the visualization.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.controlConfig([value]) <>

If value is specified, sets the config method for the controls and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.data(data, [formatter]) <>

Sets the primary data array to be used when drawing the visualization. The value passed should be an Array of objects or a String representing a filepath or URL to be loaded. The following filetypes are supported: csv, tsv, txt, and json.

Additionally, a custom formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final array of obejcts to be used as the primary data array. For example, some JSON APIs return the headers split from the data values to save bandwidth. These would need be joined using a custom formatter.

If data is not specified, this method returns the current primary data array, which defaults to an empty array ([]);

This is a static method of Viz, and is chainable with other methods of this Class.

Param Type Description
data Array | String = []
[formatter] function  

# Viz.depth([value]) <>

If value is specified, sets the depth to the specified number and returns the current class instance. The value should correspond with an index in the groupBy array.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.detectResize(value) <>

If the width and/or height of a Viz is not user-defined, it is determined by the size of it’s parent element. When this method is set to true, the Viz will listen for the window.onresize event and adjust it’s dimensions accordingly.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.detectResizeDelay(value) <>

When resizing the browser window, this is the millisecond delay to trigger the resize event.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.detectVisible(value) <>

Toggles whether or not the Viz should try to detect if it visible in the current viewport. When this method is set to true, the Viz will only be rendered when it has entered the viewport either through scrolling or if it’s display or visibility is changed.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.detectVisibleInterval(value) <>

The interval, in milliseconds, for checking if the visualization is visible on the page.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.discrete([value]) <>

If value is specified, sets the discrete accessor to the specified method name (usually an axis) and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.downloadButton([value]) <>

Shows a button that allows for downloading the current visualization.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.downloadConfig([value]) <>

Sets specific options of the saveElement function used when downloading the visualization.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.downloadPosition([value]) <>

Defines which control group to add the download button into.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.duration([ms]) <>

If ms is specified, sets the animation duration to the specified number and returns the current class instance. If ms is not specified, returns the current animation duration.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.filter([value]) <>

If value is specified, sets the filter to the specified function and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.groupBy([value]) <>

If value is specified, sets the group accessor(s) to the specified string, function, or array of values and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

function value(d) {
  return d.id;
}

# Viz.height([value]) <>

If value is specified, sets the overall height to the specified number and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.hover([value]) <>

If value is specified, sets the hover method to the specified function and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.label([value]) <>

If value is specified, sets the label accessor to the specified function or string and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.legend([value]) <>

If value is specified, toggles the legend based on the specified boolean and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.legendConfig([value]) <>

If value is specified, the object is passed to the legend’s config method.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.legendTooltip([value]) <>

If value is specified, sets the config method for the legend tooltip and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.legendPosition([value]) <>

Defines which side of the visualization to anchor the legend. Expected values are "top", "bottom", "left", and "right".

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.locale([value]) <>

If value is specified, sets the locale to the specified string and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.message([value]) <>

Toggles the visibility of the status message that is displayed when loading AJAX requests and displaying errors.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.messageHTML([value]) <>

Sets the inner HTML of the status message that is displayed when loading AJAX requests and displaying errors. Must be a valid HTML string or a function that, when passed this Viz instance, returns a valid HTML string.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.messageMask([value]) <>

Sets the color of the mask used underneath the status message that is displayed when loading AJAX requests and displaying errors. Additionally, false will turn off the mask completely.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.messageStyle([value]) <>

Defines the CSS style properties for the status message that is displayed when loading AJAX requests and displaying errors.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.select([selector]) <>

If selector is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If selector is not specified, returns the current SVG container element, which is undefined by default.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.shape([value]) <>

If value is specified, sets the shape accessor to the specified function or number and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.shapeConfig([value]) <>

If value is specified, sets the config method for each shape and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.time([value]) <>

If value is specified, sets the time accessor to the specified function or string and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.timeFilter([value]) <>

If value is specified, sets the time filter to the specified function and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.timeline([value]) <>

If value is specified, toggles the timeline based on the specified boolean and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.timelineConfig([value]) <>

If value is specified, sets the config method for the timeline and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.title([value]) <>

If value is specified, sets the title accessor to the specified function or string and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.titleConfig([value]) <>

If value is specified, sets the config method for the title and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.tooltip([value]) <>

If value is specified, toggles the tooltip based on the specified boolean and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.tooltipConfig([value]) <>

If value is specified, sets the config method for the tooltip and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.total([value]) <>

If value is specified, sets the total accessor to the specified function or string and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.totalConfig([value]) <>

If value is specified, sets the config method for the total and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.

# Viz.width([value]) <>

If value is specified, sets the overallwidth to the specified number and returns the current class instance.

This is a static method of Viz, and is chainable with other methods of this Class.


d3plus.accessor(key, [def]) <>

Wraps an object key in a simple accessor function.

This is a global function.

Param Type Description
key String The key to be returned from each Object passed to the function.
[def] \* A default value to be returned if the key is not present.

this

accessor("id");
    

returns this

function(d) {
  return d["id"];
}


d3plus.assign(…objects) <>

A deeply recursive version of Object.assign.

This is a global function. this

assign({id: "foo", deep: {group: "A"}}, {id: "bar", deep: {value: 20}}));
    

returns this

{id: "bar", deep: {group: "A", value: 20}}


d3plus.attrize(elem, attrs) <>

Applies each key/value in an object as an attr.

This is a global function.

Param Type Description
elem D3selection The D3 element to apply the styles to.
attrs Object An object of key/value attr pairs.


d3plus.closest(n, arr) <>

Finds the closest numeric value in an array.

This is a global function.

Param Type Description
n Number The number value to use when searching the array.
arr Array The array of values to test against.


d3plus.colorAdd(c1, c2, [o1], [o2]) <>

Adds two colors together.

This is a global function.

Param Type Default Description
c1 String   The first color, a valid CSS color string.
c2 String   The second color, also a valid CSS color string.
[o1] String 1 Value from 0 to 1 of the first color’s opacity.
[o2] String 1 Value from 0 to 1 of the first color’s opacity.


d3plus.colorAssign(c, [u]) <>

Assigns a color to a value using a predefined set of defaults.

This is a global function.

Param Type Default Description
c String   A valid CSS color string.
[u] Object defaults An object containing overrides of the default colors.


d3plus.colorContrast(c, [u]) <>

A set of default color values used when assigning colors based on data.

This is a global function.

Param Type Default Description
c String   A valid CSS color string.
[u] Object defaults An object containing overrides of the default colors.


d3plus.colorLegible(c) <>

Darkens a color so that it will appear legible on a white background.

This is a global function.


d3plus.colorLighter(c, [i]) <>

Similar to d3.color.brighter, except that this also reduces saturation so that colors don’t appear neon.

This is a global function.

Param Type Default Description
c String   A valid CSS color string.
[i] String 0.5 A value from 0 to 1 dictating the strength of the function.


d3plus.colorSubtract(c1, c2, [o1], [o2]) <>

Subtracts one color from another.

This is a global function.

Param Type Default Description
c1 String   The base color, a valid CSS color string.
c2 String   The color to remove from the base color, also a valid CSS color string.
[o1] String 1 Value from 0 to 1 of the first color’s opacity.
[o2] String 1 Value from 0 to 1 of the first color’s opacity.


d3plus.configPrep([config], [type], [nest]) <>

Preps a config object for d3plus data, and optionally bubbles up a specific nested type. When using this function, you must bind a d3plus class’ this context.

This is a global function.

Param Type Default Description
[config] Object this._shapeConfig The configuration object to parse.
[type] String "shape" The event classifier to user for “on” events. For example, the default event type of “shape” will apply all events in the “on” config object with that key, like “click.shape” and “mouseleave.shape”, in addition to any gloval events like “click” and “mouseleave”.
[nest] String   An optional nested key to bubble up to the parent config level.


d3plus.constant(value) <>

Wraps non-function variables in a simple return function.

This is a global function. this

constant(42);
    

returns this

function() {
  return 42;
}


d3plus.dataFold(json, [data], [headers]) <>

Given a JSON object where the data values and headers have been split into separate key lookups, this function will combine the data values with the headers and returns one large array of objects.

This is a global function.

Param Type Default Description
json Object   A JSON data Object with data and headers keys.
[data] String "data" The key used for the flat data array inside of the JSON object.
[headers] String "headers" The key used for the flat headers array inside of the JSON object.


d3plus.dataLoad(path, [formatter], [key], [callback]) <>

Loads data from a filepath or URL, converts it to a valid JSON object, and returns it to a callback function.

This is a global function.

Param Type Description
path Array | String The path to the file or url to be loaded. If an Array is passed, the xhr request logic is skipped.
[formatter] function An optional formatter function that is run on the loaded data.
[key] String The key in the this context to save the resulting data to.
[callback] function A function that is called when the final data is loaded. It is passed 2 variables, any error present and the data loaded.


d3plus.date(date) <>

Returns a javascript Date object for a given a Number (representing either a 4-digit year or milliseconds since epoch) or a String that is in valid dateString format. Besides the 4-digit year parsing, this function is useful when needing to parse negative (BC) years, which the vanilla Date object cannot parse.

This is a global function.


d3plus.dom2canvas(elem, [options]) <>

Renders HTML/SVG elements to a shared canvas.

This is a global function.

Param Type Default Description
elem HTMLElement | Object | Array   The element or array of elements to be rendered to a single canvas. Additionally, a complex object can be passed as an element which can contain specific other properties.
[elem.x] Number   The x offset of the element within the rendered canvas.
[elem.y] Number   The y offset of the element within the rendered canvas.
[options] Object   Additional options to specify.
[options.background] String   Background color of the rendered canvas.
[options.callback] function   Callback function to be passed the canvas element after rendering.
[options.excludes] Array   An array of HTMLElement objects to be excluded from the render.
[options.height] Number   Pixel height for the final output. If a height value has not been passed, it will be inferred from the sizing of the first DOM element passed.
[options.padding] Number 0 Outer padding for the final file.
[options.scale] Number 1 Scale for the final file.
[options.width] Number   Pixel width for the final output. If a width value has not been passed, it will be inferred from the sizing of the first DOM element passed.


d3plus.elem(selector, params) <>

Manages the enter/update/exit pattern for a single DOM element.

This is a global function.

Param Type Default Description
selector String   A D3 selector, which must include the tagname and a class and/or ID.
params Object   Additional parameters.
[params.condition] Boolean true Whether or not the element should be rendered (or removed).
[params.enter] Object {} A collection of key/value pairs that map to attributes to be given on enter.
[params.exit] Object {} A collection of key/value pairs that map to attributes to be given on exit.
[params.parent] D3Selection d3.select("body") The parent element for this new element to be appended to.
[params.transition] D3Transition d3.transition().duration(0) The transition to use when animated the different life cycle stages.
[params.update] Object {} A collection of key/value pairs that map to attributes to be given on update.


d3plus.fontExists(font) <>

Given either a single font-family or a list of fonts, returns the name of the first font that can be rendered, or false if none are installed on the user’s machine.

This is a global function.


d3plus.isObject(item) <>

Detects if a variable is a javascript Object.

This is a global function.


d3plus.largestRect(poly, [options]) <>

An angle of zero means that the longer side of the polygon (the width) will be aligned with the x axis. An angle of 90 and/or -90 means that the longer side of the polygon (the width) will be aligned with the y axis. The value can be a number between -90 and 90 specifying the angle of rotation of the polygon, a string which is parsed to a number, or an array of numbers specifying the possible rotations of the polygon.

This is a global function. Author: Daniel Smilkov [[email protected]]

Param Type Default Description
poly Array   An Array of points that represent a polygon.
[options] Object   An Object that allows for overriding various parameters of the algorithm.
[options.angle] Number | String | Array d3.range(-90, 95, 5) The allowed rotations of the final rectangle.
[options.aspectRatio] Number | String | Array   The ratio between the width and height of the rectangle. The value can be a number, a string which is parsed to a number, or an array of numbers specifying the possible aspect ratios of the final rectangle.
[options.maxAspectRatio] Number 15 The maximum aspect ratio (width/height) allowed for the rectangle. This property should only be used if the aspectRatio is not provided.
[options.minAspectRatio] Number 1 The minimum aspect ratio (width/height) allowed for the rectangle. This property should only be used if the aspectRatio is not provided.
[options.nTries] Number 20 The number of randomly drawn points inside the polygon which the algorithm explores as possible center points of the maximal rectangle.
[options.minHeight] Number 0 The minimum height of the rectangle.
[options.minWidth] Number 0 The minimum width of the rectangle.
[options.tolerance] Number 0.02 The simplification tolerance factor, between 0 and 1. A larger tolerance corresponds to more extensive simplification.
[options.origin] Array   The center point of the rectangle. If specified, the rectangle will be fixed at that point, otherwise the algorithm optimizes across all possible points. The given value can be either a two dimensional array specifying the x and y coordinate of the origin or an array of two dimensional points specifying multiple possible center points of the rectangle.


d3plus.lineIntersection(p1, q1, p2, q2) <>

Finds the intersection point (if there is one) of the lines p1q1 and p2q2.

This is a global function.

Param Type Description
p1 Array The first point of the first line segment, which should always be an [x, y] formatted Array.
q1 Array The second point of the first line segment, which should always be an [x, y] formatted Array.
p2 Array The first point of the second line segment, which should always be an [x, y] formatted Array.
q2 Array The second point of the second line segment, which should always be an [x, y] formatted Array.


d3plus.merge(objects, aggs) <>

Combines an Array of Objects together and returns a new Object.

This is a global function.

Param Type Description
objects Array The Array of objects to be merged together.
aggs Object An object containing specific aggregation methods (functions) for each key type. By default, numbers are summed and strings are returned as an array of unique values.

this

merge([
  {id: "foo", group: "A", value: 10, links: [1, 2]},
  {id: "bar", group: "A", value: 20, links: [1, 3]}
]);
    

returns this

{id: ["bar", "foo"], group: "A", value: 30, links: [1, 2, 3]}


d3plus.nest(data, keys) <>

This is a global function.

Param Type Description
data Array The data array to be nested.
keys Array An array of key accessors that signify each nest level.


d3plus.path2polygon(path, [segmentLength]) <>

Transforms a path string into an Array of points.

This is a global function.

Param Type Default Description
path String   An SVG string path, commonly the “d” property of a element.
[segmentLength] Number 20 The lenght of line segments when converting curves line segments. Higher values lower computation time, but will result in curves that are more rigid.


d3plus.pointDistance(p1, p2) <>

Calculates the pixel distance between two points.

This is a global function.

Param Type Description
p1 Array The first point, which should always be an [x, y] formatted Array.
p2 Array The second point, which should always be an [x, y] formatted Array.


d3plus.pointDistanceSquared(p1, p2) <>

Returns the squared euclidean distance between two points.

This is a global function.

Param Type Description
p1 Array The first point, which should always be an [x, y] formatted Array.
p2 Array The second point, which should always be an [x, y] formatted Array.


d3plus.pointRotate(p, alpha, [origin]) <>

Rotates a point around a given origin.

This is a global function.

Param Type Default Description
p Array   The point to be rotated, which should always be an [x, y] formatted Array.
alpha Number   The angle in radians to rotate.
[origin] Array [0, 0] The origin point of the rotation, which should always be an [x, y] formatted Array.


d3plus.polygonInside(polyA, polyB) <>

Checks if one polygon is inside another polygon.

This is a global function.

Param Type Description
polyA Array An Array of [x, y] points to be used as the inner polygon, checking if it is inside polyA.
polyB Array An Array of [x, y] points to be used as the containing polygon.


d3plus.polygonRayCast(poly, origin, [alpha]) <>

Gives the two closest intersection points between a ray cast from a point inside a polygon. The two points should lie on opposite sides of the origin.

This is a global function. Returns: Array - An array containing two values, the closest point on the left and the closest point on the right. If either point cannot be found, that value will be null.

Param Type Default Description
poly Array   The polygon to test against, which should be an [x, y] formatted Array.
origin Array   The origin point of the ray to be cast, which should be an [x, y] formatted Array.
[alpha] Number 0 The angle in radians of the ray.


d3plus.polygonRotate(poly, alpha, [origin]) <>

Rotates a point around a given origin.

This is a global function.

Param Type Default Description
poly Array   The polygon to be rotated, which should be an Array of [x, y] values.
alpha Number   The angle in radians to rotate.
[origin] Array [0, 0] The origin point of the rotation, which should be an [x, y] formatted Array.


d3plus.prefix() <>

Returns the appropriate CSS vendor prefix, given the current browser.

This is a global function.


d3plus.rtl() <>

Returns true if the HTML or body element has either the “dir” HTML attribute or the “direction” CSS property set to “rtl”.

This is a global function.


d3plus.saveElement(elem, [options], [renderOptions]) <>

Downloads an HTML Element as a bitmap PNG image.

This is a global function.

Param Type Default Description
elem HTMLElement | Array   A single element or array of elements to be saved to one file.
[options] Object   Additional options to specify.
[options.filename] String "download" Filename for the downloaded file, without the extension.
[options.type] String "png" File type of the saved document. Accepted values are "png" and "jpg".
[renderOptions] Object   Custom options to be passed to the dom2canvas function.


d3plus.segmentBoxContains(s1, s2, p) <>

Checks whether a point is inside the bounding box of a line segment.

This is a global function.

Param Type Description
s1 Array The first point of the line segment to be used for the bounding box, which should always be an [x, y] formatted Array.
s2 Array The second point of the line segment to be used for the bounding box, which should always be an [x, y] formatted Array.
p Array The point to be checked, which should always be an [x, y] formatted Array.


d3plus.segmentsIntersect(p1, q1, p2, q2) <>

Checks whether the line segments p1q1 && p2q2 intersect.

This is a global function.

Param Type Description
p1 Array The first point of the first line segment, which should always be an [x, y] formatted Array.
q1 Array The second point of the first line segment, which should always be an [x, y] formatted Array.
p2 Array The first point of the second line segment, which should always be an [x, y] formatted Array.
q2 Array The second point of the second line segment, which should always be an [x, y] formatted Array.


d3plus.shapeEdgePoint(angle, distance) <>

Calculates the x/y position of a point at the edge of a shape, from the center of the shape, given a specified pixel distance and radian angle.

This is a global function. Returns: String - [shape = “circle”] The type of shape, which can be either “circle” or “square”.

Param Type Description
angle Number The angle, in radians, of the offset point.
distance Number The pixel distance away from the origin.


d3plus.stringify(value) <>

Coerces value into a String.

This is a global function.


d3plus.strip(value) <>

Removes all non ASCII characters from a string.

This is a global function.


d3plus.stylize(elem, styles) <>

Applies each key/value in an object as a style.

This is a global function.

Param Type Description
elem D3selection The D3 element to apply the styles to.
styles Object An object of key/value style pairs.


d3plus.textSplit(sentence) <>

Splits a given sentence into an array of words.

This is a global function.


d3plus.textWidth(text, [style]) <>

Given a text string, returns the predicted pixel width of the string when placed into DOM.

This is a global function.

Param Type Description
text String | Array Can be either a single string or an array of strings to analyze.
[style] Object An object of CSS font styles to apply. Accepts any of the valid CSS font property values.


d3plus.textWrap() <>

Based on the defined styles and dimensions, breaks a string into an array of strings for each line of text.

This is a global function.

# d3plus..fontFamily([value]) <>

If value is specified, sets the font family accessor to the specified function or string and returns this generator. If value is not specified, returns the current font family.

This is a static method of textWrap.

# d3plus..fontSize([value]) <>

If value is specified, sets the font size accessor to the specified function or number and returns this generator. If value is not specified, returns the current font size.

This is a static method of textWrap.

# d3plus..fontWeight([value]) <>

If value is specified, sets the font weight accessor to the specified function or number and returns this generator. If value is not specified, returns the current font weight.

This is a static method of textWrap.

# d3plus..height([value]) <>

If value is specified, sets height limit to the specified value and returns this generator. If value is not specified, returns the current value.

This is a static method of textWrap.

# d3plus..lineHeight([value]) <>

If value is specified, sets the line height accessor to the specified function or number and returns this generator. If value is not specified, returns the current line height accessor, which is 1.1 times the font size by default.

This is a static method of textWrap.

# d3plus..overflow([value]) <>

If value is specified, sets the overflow to the specified boolean and returns this generator. If value is not specified, returns the current overflow value.

This is a static method of textWrap.

# d3plus..split([value]) <>

If value is specified, sets the word split function to the specified function and returns this generator. If value is not specified, returns the current word split function.

This is a static method of textWrap.

# d3plus..width([value]) <>

If value is specified, sets width limit to the specified value and returns this generator. If value is not specified, returns the current value.

This is a static method of textWrap.


d3plus.titleCase(str, [opts]) <>

Capitalizes the first letter of each word in a phrase/sentence.

This is a global function.

Param Type Description
str String The string to apply the title case logic.
[opts] Object Optional parameters to apply.
[opts.lng] String The locale to use when looking up all lowercase or uppecase words.


d3plus.trim(str) <>

Cross-browser implementation of trim.

This is a global function.


d3plus.trimLeft(str) <>

Cross-browser implementation of trimLeft.

This is a global function.


d3plus.trimRight(str) <>

Cross-browser implementation of trimRight.

This is a global function.


d3plus.uuid() <>

This is a global function.


colorDefaults <>

A set of default color values used when assigning colors based on data.

Name Default Description
dark #444444 Used in the contrast function when the color given is very light.
light #f7f7f7 Used in the contrast function when the color given is very dark.
missing #cccccc Used in the assign function when the value passed is null or undefined.
off #b22200 Used in the assign function when the value passed is false.
on #224f20 Used in the assign function when the value passed is true.
scale #b22200, #eace3f, #282f6b, #b35c1e, #224f20, #5f487c, #759143, #419391, #993c88, #e89c89, #ffee8d, #afd5e8, #f7ba77, #a5c697, #c5b5e5, #d1d392, #bbefd0, #e099cf An ordinal scale used in the assign function for non-valid color strings and numbers.

This is a global namespace.