dc.js icon indicating copy to clipboard operation
dc.js copied to clipboard

Improve elastic y ==> incremental y

Open pdaems opened this issue 13 years ago • 5 comments

Im currently using the elastic y on my bar chart however if one of my values is very big then you cant see the others anymore. What i was thinking is to add some sort of .incrementalY(true) which would create the y axis based on a factor.

y axis would start from for example:

0 25 50 75 100 200 300 500 700 1000 1500 2000 3000 and so on...

bar

pdaems avatar Nov 21 '13 21:11 pdaems

Can you further elaborate? I'm not sure I understand how you intend incrementalY to work.

jrideout avatar Nov 21 '13 22:11 jrideout

I think it is a very excellent feature for the case pdaems explained above, and also I hunger for it because I had been in the same situation like that.

the problem is how to set the interval value for y axis. the value must be proper to show well all the bar in a graph even though the values among bars extremely different.

elsdy avatar Nov 21 '13 23:11 elsdy

I'm sure you've considered and rejected it, but the classic and general solution is a log scale.

gordonwoodhull avatar Nov 22 '13 00:11 gordonwoodhull

Below you can see an example:

scaling

I think this can be done by using a logarithmic scale http://en.wikipedia.org/wiki/Logarithmic_scale

pdaems avatar Nov 22 '13 08:11 pdaems

We probably won't support jumps in the scale unless d3 does, but you probably can get some of the way there by implementing a custom scale. Using logarithmic scale is easy if that is enough: chart.y(d3.scale.log()); You can also modify the Y axis labels by calling .ticks or .tickValues on the axis. The default logic behind .ticks already tries to use amounts in factors of 2, 5 or 10.

jrideout avatar Nov 25 '13 20:11 jrideout