d3plus-export
Export methods for transforming and downloading SVG.
Last updated 4 months ago by davelandry .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install d3plus-export 
SYNC missed versions from official npm registry.

d3plus-export

NPM Release Build Status Dependency Status Gitter

Export methods for transforming and downloading SVG.

Installing

If you use NPM, run npm install d3plus-export --save. Otherwise, download the latest release. The released bundle supports AMD, CommonJS, and vanilla environments. You can also load directly from d3plus.org:

<script src="https://d3plus.org/js/d3plus-export.v0.3.full.min.js"></script>

API Reference

  • dom2canvas - Renders HTML/SVG elements to a shared canvas.
  • htmlPresets - Adds HTML default styles to a d3 selection in order to render it properly.
  • saveElement - Downloads an HTML Element as a bitmap PNG image.
  • svgPresets - Adds SVG default attributes to a d3 selection in order to render it properly.

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.canvas] HTMLElement A canvas DOM element to draw onto. If no element is supplied, a canvas element will be created in memory and passed to the callback function when drawing is complete.
[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.htmlPresets(selection) <>

Adds HTML default styles to a d3 selection in order to render it properly.

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.svgPresets(selection) <>

Adds SVG default attributes to a d3 selection in order to render it properly.

This is a global function.


Documentation generated on Tue, 07 Jul 2020 16:10:15 GMT

Current Tags

  • 0.3.19                                ...           latest (4 months ago)

24 Versions

  • 0.3.19                                ...           4 months ago
  • 0.3.18                                ...           6 months ago
  • 0.3.17                                ...           a year ago
  • 0.3.16                                ...           a year ago
  • 0.3.15                                ...           a year ago
  • 0.3.14                                ...           a year ago
  • 0.3.13                                ...           2 years ago
  • 0.3.12                                ...           2 years ago
  • 0.3.11                                ...           2 years ago
  • 0.3.10                                ...           2 years ago
  • 0.3.9                                ...           2 years ago
  • 0.3.8                                ...           2 years ago
  • 0.3.7                                ...           2 years ago
  • 0.3.6                                ...           2 years ago
  • 0.3.5                                ...           2 years ago
  • 0.3.4                                ...           3 years ago
  • 0.3.3                                ...           3 years ago
  • 0.3.2                                ...           3 years ago
  • 0.3.1                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 6
Dependencies (5)
Dev Dependencies (1)

Copyright 2014 - 2016 © taobao.org |