d3-czip
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

d3-czip

BSD 3-Clause License NPM version npm downloads Dependency Status Coverage percentage

Buy me a coffee

Generates a collection from multiple arrays

Installing

If you use NPM, npm install --save d3-czip. If you use Bower, bower install --save d3-czip. Otherwise, download the latest release.

<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/d3-czip@latest"></script>
<script>

var w = 960,
    h = 500,
    svg = d3.select("#chart")
      .append("svg")
      .attr("width",w)
      .attr("height",h),
    data = {
      x: [100, 200, 300, 400, 500, 600, 700, 800],
      y: [50, 150, 80, 200, 300, 120, 350, 210],
      r: [50, 10, 30, 20, 60, 15, 40, 25],
      c: ['red', 'blue', 'green', 'yellow', 'cyan', 'coral', 'black', 'grey']
    };

svg.selectAll("circle")
    .data(d3.czip(data))
    .enter()
    .append("circle")
    .attr("cx", function(d) { return d.x; })
    .attr("cy", function(d) { return d.y; })
    .attr("r", function(d) { return d.r; })
    .attr("fill", function(d) { return d.c; });

</script>

API Reference

# d3.czip(objWithArrays);

Creates a collection of the arrays.

Readme

Keywords

Package Sidebar

Install

npm i d3-czip

Weekly Downloads

1

Version

1.0.1

License

BSD-3-Clause

Unpacked Size

61.8 kB

Total Files

34

Last publish

Collaborators

  • smartin85