Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update d3-funnel-charts.js #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Peteraa
Copy link

@Peteraa Peteraa commented Oct 31, 2014

Hi,
Edit: I updated this so the call back function is easier and less retarded.

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'], ['data 2', 171, '#a7d04c'], ['data 3', 51, '#4cbde8'], ['Data 4', 11, '#9cd8ef']];
var chart = new FunnelChart({
data: data,
width: 450,
height: 550,
bottomPct: 1 / 3,
callBack: FunnelCallback,
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant