Cap bar charts
Im quite surprised to see you can cap row charts but not bar charts? Whats the workaround to tell a bar chart to only show the top k bars (as defined by ordering)?
As an aside: it would also be useful to be able to say "plot as many bars as you can as long as the bar width remains at least 20" (again as defined by ordering). This now requires quite some manual twiddling which I am trying to figure out.
Yes, this is peculiar. My understanding is that this came about because the two charts were written by two different people with different requirements. A lot of dc.js "just happened" in that way, without being planned.
The workaround shouldn't be so bad, but I don't have an example just yet. Use the "fake group" technique described here: https://github.com/dc-js/dc.js/wiki/FAQ#filter-the-data-before-its-charted
If you can contribute an example until this is fixed properly, it would be a great help to everyone. This is frequently requested.
Thanks for the reply @gordonwoodhull . I did see the fake group example and actually tried it in various forms but interestingly never got it to work. It never seemed to actually do anything (not for capping, nor for filtering groups). It was part of the reason I had to abandon my dc usage for a particular project as I was pushing towards a deadline.
However, will be having another shot and will report back here with concrete issues If I can replicate the problems.
Well, it is a horrible hack after all, and it may be more difficult than it sounds to get it working.
There's an interesting question here about what belongs to the chart and what belongs to some prefiltering component. I plan to explore this for 2.1.
Hello i too search for a possibility to limit the numbers of bars in the barchart .... still no chance for doing this? I don't like to use the rowchart in this example ...
Hello I too search for a possibility to limit the numbers of bars in the barchart .Is there a solution to this urgent?
Hi @sevilylmz, I checked Stack Overflow but I was surprised not to find an answer.
Would you be so kind as to post a question there, and I will answer promptly? If you can include sample data and code, that would help.