2017 © Pedro Peláez

library d3-funnel-charts



  • Monday, May 8, 2017
  • by bgauthier
  • Repository
  • 1 Watchers
  • 0 Stars
  • 36 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 25 Forks
  • 0 Open issues
  • 1 Versions
  • 13 % Grown



A funnel chart implementation using d3.js, (*1)


To begin, you must instantiate a FunnelChart. The options you can pass to the FunnelChart are the following (the only required option is data):, (*2)

data = an array containing arrays of categories and engagement in order from greatest expected funnel engagement to lowest., (*3)

width & height = width & height of chart (default is 400 and 600), (*4)

bottomPct = the percentage of the width the bottom base of the funnel trapezoid takes up. The top base always takes up the entire width, but the percentage of the total width that the bottom base takes up can be changed. (default = 1/3), (*5)

To actually draw the FunnelChart, call the draw method of the FunnelChart. The draw method takes in a selector for an element that the FunnelChart should be drawn in and a speed (default = 2.5). Make sure that you already have an element that corresponds to the selector you use because d3-funnel-charts doesn't create elements; it just uses an element you already have in your HTML as a container., (*6)

Example:, (*7)

<div id="funnelContainer"></div>
<script src="d3.min.js"></script> // Make sure to include d3.js first
<script src="d3-funnel-charts.min.js"></script>
<script type="text/javascript">
    var data = [['Video Views', 1500], ['Comments', 300], ['Video Responses', 150]];
    var chart = new FunnelChart({
                    data: data,
                    width: 650, 
                    height: 450, 
                    bottomPct: 1/4
    chart.draw('#funnelContainer', 2);

A demo of the above example can be found here, (*8)


MIT, (*9)

The Versions

08/05 2017



  Sources   Download