d3-marcon
Margin conventions for d3-selection.
Installing
If you use NPM, npm install d3-marcon
. Otherwise, download the latest release.
You can also load directly from unpkg. You may use the entire D3.js library or, at a minimum, d3-selection.
A live example on bl.ocks.org.
API Reference
Constructs a visualization generator, or viz, on which you can set and get the dimensions and margins, and append an svg
element with a nested g
to a DOM element.
Selects a DOM element to append the viz to. Defaults to "body"
.
Sets or gets the viz's top margin. Defaults to 0
.
Sets or gets the viz's right margin. Defaults to 0
.
Sets or gets the viz's bottom margin. Defaults to 0
.
Sets or gets the viz's left margin. Defaults to 0
.
Sets or gets the viz's width. Defaults to 900
.
Sets or gets the viz's height. Defaults to 600
.
Gets the viz's innerWidth, which is equal to width - left - right
.
Gets the viz's innerHeight, which is equal to height - top - bottom
.
Renders the viz to the DOM.
Gets the svg
element that contains the viz. Returns undefined
if the viz has not yet been rendered.