dc.js - How to fix the height of each bar on a rowChart? -


i have rowchart can have more or less bars based on filter on other graphs.

the problem if set height of graph e.g. 500, if have 50 bars 10px height if have one, 500px

var graph = dc.rowchart (".graph")   .margins({top: 0, right: 10, bottom: 20, left: 10})   .height(300)   .width(200)   .gap(0)   .x(d3.scale.ordinal())   .elasticx(true) .ordering(function(d){return -d.value})   .dimension(dim)   .group(filteredgroup); 

the group return top 10, if filter (using other graphs, might have low single item. in case, bar 300px height , looks not (and in general, having height change not pleasant imo).

is there way leave height of graph flexible height of each bar fixed?

so each bar has height of 30, height of graph going adjust 30 300.

according latest documentation dc row charts:

.fixedbarheight([height])

get or set fixed bar height. default [false] auto-scale bars. example, if want fix height specific number of bars (useful in topn charts) fix height follows (where count = total number of bars in topn , gap vertical gap space).

example:

var chartheight = 500; var gap = 5; var count = 20; var spaceforscales = 70; c.fixedbarheight((chartheight - (count + 1) * gap - spaceforscales) / count); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -