Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3plus-common

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3plus-common

Common functions and methods used across D3plus modules.

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5K
decreased by-55.15%
Maintainers
1
Weekly downloads
 
Created
Source

d3plus-common

NPM Release Build Status Dependency Status Dependency Status

A starter environment for D3plus modules.

Installation Options

NPM

npm install d3plus-common

Browser

In a vanilla environment, a d3plus_common global is exported. To use a compiled version hosted on d3plus.org that includes all dependencies:

<script src="https://d3plus.org/js/d3plus-common.v0.1.min.js"></script>

Otherwise, click here to download the latest release.

AMD and CommonJS

The released bundle natively supports both AMD and CommonJS, and vanilla environments.

Custom Builds

The source code is written using standard import and export statements. Create a custom build using Rollup or your preferred bundler. Take a look at the index.js file to see the modules exported.


API Reference

Functions

accessor(key)

Wraps an object key in a simple accessor function.

colorNest(raw, fill, [groupBy])

Returns an Array of data objects based on a given color accessor and groupBy levels.

constant(value)

Wraps non-function variables in a simple return function.

getSize(elem)

Finds the available width and height for a specified HTMLElement, traversing it's parents until it finds something with constrained dimensions. Falls back to the inner dimensions of the browser window if none is found.

merge(objects)

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

accessor(key)

Wraps an object key in a simple accessor function.

Kind: global function

ParamTypeDescription
keyStringThe key to be returned from each Object passed to the function.

Example (this)

accessor("id");
    

Example (returns this)

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

colorNest(raw, fill, [groupBy])

Returns an Array of data objects based on a given color accessor and groupBy levels.

Kind: global function

ParamTypeDefaultDescription
rawArrayThe raw data Array to be grouped by color.
fillfunctionThe color accessor for each data object.
[groupBy]Array[]An optional array of grouping accessors. Will autodetect if a certain group by level is assigning the colors, and will return the appropriate accessor.

constant(value)

Wraps non-function variables in a simple return function.

Kind: global function

ParamTypeDescription
valueArray | Number | Object | StringThe value to be returned from the function.

Example (this)

constant(42);
    

Example (returns this)

function() {
  return 42;
}

getSize(elem)

Finds the available width and height for a specified HTMLElement, traversing it's parents until it finds something with constrained dimensions. Falls back to the inner dimensions of the browser window if none is found.

Kind: global function

ParamTypeDescription
elemHTMLElementThe HTMLElement to find dimensions for.

merge(objects)

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

Kind: global function

ParamTypeDescription
objectsArrayThe Array of objects to be merged together.

Example (this)

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

Example (returns this)

{"id": ["bar", "foo"], "group": "A", "value": 30}

Keywords

FAQs

Package last updated on 10 May 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc