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

Bidirectional two-stack row chart #510

Open
mmmdreg opened this issue Jan 28, 2014 · 6 comments
Open

Bidirectional two-stack row chart #510

mmmdreg opened this issue Jan 28, 2014 · 6 comments
Milestone

Comments

@mmmdreg
Copy link

mmmdreg commented Jan 28, 2014

See this image for an example.
These charts are similar to stacked charts for paired data (e.g. male/female). Whereas a usual stacked chart is good at showing the aggregate of two or more stacks (or the composition of the total i.e. a + b + c = total), a bi-directional chart more effectively shows the difference between two stacks across different bins.

An ideal implementation would use the same scale on both halves and be implemented as a stacked row chart (issue #397) with 2 and only 2 stacks, with an option 'bi-directional' which only takes effect if there are only 2 stacks.

In the meantime, it may be simulated by firstly allowing the regular row chart to be flipped horizontally (i.e. vertical axis and origin move to the right side of the graph) and then displaying the graph adjacent to a regular row chart.

@jefffriesen
Copy link

Seems like this would be a good candidate for using a renderlet (instead of a unique chart type). Here is an example of using a renderlet to create a stacked row chart from a bar chart:
http://jsfiddle.net/jrideout/RWs67/

@mmmdreg
Copy link
Author

mmmdreg commented Jan 30, 2014

I am currently using a stacked bar chart similar to your example, but it doesn't allow centered bars with a two-way axis from the origin (e.g. +10..0...+10, with no negative values). See the image in the first post for an example chart.

Additionally it's less straightforward with bar charts to do things like stacked top 10 charts with an ordinal x (e.g. top 10 car manufacturers by total quantity = sedans + trucks), as the ordinals have to be manually dynamically generated whereas the row chart generates them automatically.

@gordonwoodhull
Copy link
Contributor

It occurs to me that this is a variety of "facet" or "small multiple" #160.

Currently dc.js only supports composites for multiple graphs in one - the charts usually share one or both scales and are superimposed in the z dimension. If instead they were offset in x or y, we are halfway there.

The other part would be having the same scale for the two halves, only mirrored.

@gordonwoodhull gordonwoodhull added this to the v2.1 milestone Jun 6, 2014
@gordonwoodhull gordonwoodhull changed the title Bi-drectional two-stack row chart Bi-directional two-stack row chart Jun 5, 2015
@gordonwoodhull gordonwoodhull changed the title Bi-directional two-stack row chart Bidirectional two-stack row chart Jun 5, 2015
@moshequ
Copy link

moshequ commented Jul 12, 2017

@jefffriesen Your jsfiddle doesn't work anymore I've created a working version http://jsfiddle.net/moshequ/RWs67/111/

@jefffriesen
Copy link

@moshequ cool, thanks for updating it.

@gordonwoodhull
Copy link
Contributor

Cf. #1053 #1068

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

4 participants