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

d3-funnel

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-funnel

A library for rendering SVG funnel charts using D3.js

  • 0.6.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.9K
decreased by-10.64%
Maintainers
1
Weekly downloads
 
Created
Source

D3 Funnel

D3Funnel is an extensible, open-source JavaScript library for rendering funnel charts using the D3.js library.

D3Funnel is focused on providing practical and visually appealing funnels through a variety of customization options. Check out the examples page to get a showcasing of the several possible options.

Usage

To use this library, you must include include D3.js and the D3Funnel source file:

<script src="d3.min.js"></script>
<script src="d3-funnel.js"></script>

Basic

Drawing the funnel is relatively easy:

HTML

<div id="funnel"></div>

JavaScript

var data = [
    ["Plants",     5000],
    ["Flowers",    2500],
    ["Perennials", 200],
    ["Roses",      50]
];

var chart = new D3Funnel("#funnel");
chart.draw(data);

Advanced

The following options may also be specified through the second parameter to D3Funnel.draw:

var options = {
    width: 350,           // In pixels; defaults to container's width (if non-zero)
    height: 400,          // In pixels; defaults to container's height (if non-zero)
    bottomWidth: 1/3,     // The percent of total width the bottom should be
    bottomPinch: 0,       // How many sections to pinch
    isCurved: false,      // Whether the funnel is curved
    curveHeight: 20,      // The curvature amount
    fillType: "solid",    // Either "solid" or "gradient"
    isInverted: false,    // Whether the funnel is inverted
    hoverEffects: false,  // Whether the funnel has effects on hover
    dynamicArea: false ,  // Whether the funnel should calculate the blocks by
                          // the count values rather than equal heights
    label: {
        fontSize: "14px"  // Any valid font size
    }
};
chart.draw(data, options);

You can also specify overriding colors for any data point (hex only):

var data = [
    ["Teal",      12000, "#008080"],
    ["Byzantium", 4000,  "#702963"],
    ["Persimmon", 2500,  "#ff634d"],
    ["Azure",     1500,  "#007fff"]
];

License

MIT license.

FAQs

Package last updated on 07 Feb 2015

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