dc-js / dc.js

Multi-Dimensional charting built to work natively with crossfilter rendered with d3.js
Apache License 2.0
7.42k stars 1.81k forks source link

please make barChart also available horizontally #693

Open d2a-raudenaerde opened 10 years ago

d2a-raudenaerde commented 10 years ago

I know it becomes more of a 'rowChart' then, but the functionality of both charts is different (label placement, etc), and I need the bars to go from left-to-right.

awjreynolds commented 10 years ago

What functionality is missing from a rowchart? On 4 Sep 2014 08:21, "Rob" notifications@github.com wrote:

I know it becomes more of a 'rowChart' then, but the functionality of both charts is different (label placement, etc), and I need the bars to go from left-to-right.

— Reply to this email directly or view it on GitHub https://github.com/dc-js/dc.js/issues/693.

d2a-raudenaerde commented 10 years ago

Labels on the left size, like barchart. In row chart they are mingled in the bars. I saw the stackality is already in place, my dc.js download was old and did not have this.

gordonwoodhull commented 10 years ago

I agree they should have exactly the same functionality. I don't think row charts are stackable (although there are forks floating around which provide this), and similarly, the bar chart (technically a 'column chart') is not cappable.

A row chart does not actually use a scale for the Y axis - usually it's used for ordinal domains, so this doesn't bite people too often, but it's an annoying inconsistency when the domain is not ordinal.

It seems like the proper design is to have a bar chart which provides all the same functionality for both, and then row chart and column chart are derived, just providing different layout. Of course this would be a breaking change.

d2a-raudenaerde commented 10 years ago

Hi Gordon, I agree it is a breaking change. I was trying to do a quick-hack conversion of barchart to a 'row'-chart, but ran into a lot of hard-coded x-axis dependencies..

I figure it will be a big refactor to make this possible, but if done correctly, it would be very powerful to build on.

nordfjord commented 9 years ago

Any progress on at least getting labels on the left side? I find it incredibly frustrating to try to read text when there's no bar behind it, it is in fact impossible to read white on white.

gordonwoodhull commented 9 years ago

@nordfjord, please submit a patch. I think the workaround most people use is to reverse the color of the text.

nordfjord commented 9 years ago

@gordonwoodhull I haven't familiarized myself with your source, but I'll get on it when I have time, and will try to find a working way to provide reasonable label positioning by default. similar to bar chart

In my opinion the bar chart , or in the case of dc the 'row chart', was perfected when it was invented by William Playfair, and we have only found ways to make it worse since. You can see the original bar chart here

gordonwoodhull commented 9 years ago

Heh, too true. Hand-design does have the advantage of customizability, if time consuming.

I think the tricky thing here is to adjust the margin to fit the text. If you don't worry about that and just set the margin manually, then I think it's just a matter of right-aligning the text against the Y axis instead of left-aligning it. (dc.js mostly does not set the margins automatically, a frequent complaint.)

nordfjord commented 9 years ago

Indeed, and it gets especially tricky once you have N rows. Are there any plans to support something like a minimap, so that you could reasonably have N rows and then simply scroll, in stead of reducing the height of bars below 1px, and therefore being completely useless?