Stacked bar chart?
peterbe opened this issue · 8 comments
Can this be done or is this a feature request?
Hey @peterbe, currently this would be a feature request.
It's something I'd like to add as well, maybe this weekend :)
I should mention if you/anyone wants to submit a pr that’d be awesome as well and I’d be super down to assist 😎
I doubt that I'll get around to it. I'm currently not blocked as this is just an experiment I was planning to do. Perhaps when my experiment materializes more I might be capable to help out but I doubt it's an investment I'm ready to do any time soon.
If you get around to it, it would be great but don't hope for me being a good open-source citizen :)
No worries! I'll make sure to ping you when one is added
Can I try?
@jolo-dev yep!
Some advice: If you look at, say, the Bar
class, there's a lot of stuff you can reuse (at some point I'll throw these into an ABC).
Basically, when defining a new chart, you just need to define 2-3 methods:
drawFromFile()
:roughjs
code for data from files.drawFromObject()
:roughjs
code for data from parameters.addInteraction
: This is where the original, non-roughd3
code goes. Basically, you just create a stacked barchart as normal ind3
that will exist behind theroughjs
version. This allows for interactivity on hover.
Note that much of the code for the above methods in the Bar
class may itself be recycled.
You should be able to reuse all of the other methods. If you need to update the axis values, edit the addAxes()
method (no need to touch makeAxesRough()
.
Feel free to reach out with any questions if you decide to approach this, and thanks for the interest!