New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

d3-rect

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-rect

draw rectangles with paths

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
3
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

d3-rect

draw rectangles with path elements

demonstration

Overview

d3-shape provides handy tools which help with drawing many common shapes, but curiously enough, rectangles are not among them. In most situations it is sufficient to use a rect element, but rect elements do not have path strings, and thus cannot be interpolated into a different shape. This plugin is a tiny helper which draws your rectangles using path elements so they can be animated.

Installing

If you use NPM, npm install d3-rect. Otherwise, download the latest release.

Instructions

d3.rect is a function which returns a path string when passed an object containing x, y, height, and width properties.

// append a path element
d3.select('div').append('path')
    // set the path string
    .attr('d', function() {
        var dimensions,
            path_string;
        // specify the dimensions
        dimensions = {
            x: 10,
            y: 20,
            height: 100,
            width: 200
        };
        // calculate the path string from the dimensions
        path_string = d3.rect(dimensions);
        return path_string;
    });

Keywords

d3

FAQs

Package last updated on 29 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts