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

Change funnel orientation #23

Open
rviquez opened this issue Jul 16, 2015 · 11 comments
Open

Change funnel orientation #23

rviquez opened this issue Jul 16, 2015 · 11 comments

Comments

@rviquez
Copy link

rviquez commented Jul 16, 2015

Is there any way to change the funnel from a vertical view to a horizontal view?
I haven't look into the code to check how that can be done but wanted to check first to see if there is any possibility to do this.

@jakezatecky
Copy link
Owner

There is no way to do this as it stands in the current implementation.

However, you can use SVG transformations to rotate the funnel. Assuming you wanted a left-to-right funnel, you could do the following after the funnel has been drawn:

d3.select('#funnel svg')
    .attr('transform', 'translate(0, ' + width + ')rotate(270)')
    .attr('width', height)
    .attr('height', width);

You can also rotate the labels such that they are oriented correctly. However, it's likely the text will overflow the block:

d3.selectAll('#funnel text').each(function () {
    var element = d3.select(this).attr(),
        x = element.attr('x'),
        y = element.attr('y');
    element.attr('transform', 'rotate(90, ' + x + ', ' + y + ')');
});

See complete example below:

https://jsfiddle.net/w8ch2c41/

@jakezatecky
Copy link
Owner

I am thinking about adding an option in a future release, such as the following:

{
    orientation: 'top-to-bottom',  // Default
    orientation: 'right-to-left',  // Opposite of most horizontal funnels
    orientation: 'bottom-to-top',  // Equivalent to `isInverted` option
    orientation: 'left-to-right'   // Most horizontal funnels
}

It might make sense to also allow a rotation degree (0 - 360). This would naturally complicate some of the math that goes on.

@jakezatecky jakezatecky added this to the Release 0.7.1 milestone Aug 20, 2015
@dearsaturn
Copy link

Any word on the progress of this?

@jakezatecky
Copy link
Owner

@dearsaturn No recent progress on this. It is one of the more "doable" outstanding issues, so I might pick it up in the coming holidays when I have more availability.

@dearsaturn
Copy link

💯 happy holidays!

jakezatecky added a commit that referenced this issue Dec 23, 2015
@jakezatecky
Copy link
Owner

While I could do a scale() then rotate(), that would really screw the dimensions of the text and look very bad. Will need to construct the resulting trapezoids according to a new paradigm and rotate the text as appropriate.

jakezatecky added a commit that referenced this issue May 25, 2016
Also remove #23, as it will take a little more effort.
@jakezatecky jakezatecky modified the milestones: Release 1.0, Release 0.7.x Jul 14, 2016
@amitb009
Copy link

amitb009 commented Apr 21, 2017

Is there any way to divide funnel horizontally and vertically both?
Please check the funnel digram designed by me. is this possible with d3.
https://drive.google.com/file/d/0ByB4z_WuoNl0Wl9Kd2FINklJOUU/view?usp=sharing

@jakezatecky
Copy link
Owner

@amitb009 That is a very interesting visualization. It could be supported in a future version, but is not quite on the horizon. It is a bit different than this issue, though, so it might make sense to create a new issue allowing for block partitions.

@jakezatecky jakezatecky modified the milestones: Release 1.2, Release 1.1 Jul 31, 2017
@iftahb
Copy link

iftahb commented Oct 22, 2018

Dear Jake,
Thanks for the very nice work.
However, I am not sure I understand - does the funnel chart already support orientation change or not?

@jakezatecky
Copy link
Owner

No, it does not. It is a high priority enhancement, however, and will be included in the next feature release (whenever that is).

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

No branches or pull requests

5 participants