smilli/d3-funnel-charts — pull request #3 by Peteraa (2014-10-31 10:12:41+00:00)
Title: Update d3-funnel-charts.js

Hi!

Thank you for a nice project. It helped me out a lot.

I added some stuff to your funnel code that you and others might find useful too so if you want you can use it in your project.

I added optional custom colors to the project, callback capability and the option to make the trapezoids of equal size.

Sample use:
function FunnelCallback(inputString) {
switch (inputString) {
case 'data 1':
DoStuffs1();
break;
case 'data 2':
DoStuffs2();
break;
case 'data 3':
DoStuffs3();
break;
case 'data 4':
DoStuffs4();
break;
default:
alert('Funnel callback not matching input');
break;
}
}

function MakeAFunnel() {
var data = [['data 1', 1711, '#4c689f', FunnelCallback], ['data 2', 171, '#a7d04c', FunnelCallback], ['data 3', 51, '#4cbde8', FunnelCallback], ['Data 4', 11, '#9cd8ef', FunnelCallback]];
var chart = new FunnelChart({
data: data,
width: 450,
height: 550,
bottomPct: 1 / 3,
equalSizedFunnelSteps: true
});
chart.draw('#funnelContainer', 2);
}

This is my first pull request so I apologize something does not make any sense for some reason...

Best,
Peter.