plouc / nivo

nivo provides a rich set of dataviz components, built on top of the awesome d3 and React libraries
https://nivo.rocks
MIT License
13.19k stars 1.03k forks source link

Combined stacked bar with line chart #678

Closed MatheusPopp closed 4 years ago

MatheusPopp commented 5 years ago

Is it possible to build a stacked bar with a line chart? Like a composed chart? If isn't, is there any plan to build this feature on the future?

airhorns commented 5 years ago

👍 for this feature -- it's a genuinely common need in data visualization! It poses some uncomfortable questions for the nivo React API because it seems like most components "own" the whole charting surface as opposed to compose all nice. Recharts has a bunch of much smaller grained components so that it can support these composed charts, but, the API is much lower level because of that.

MatheusPopp commented 5 years ago

@airhorns i've tried recharts too, but the component Composed Chart didn't work with stacked bar and line charts, just work with normal bar and line. Have you ever tried on rechart stacked bar with line?

taschetto commented 5 years ago

This is much needed in nivo. Unfortunately I'm using Recharts for this, but I'd love to change it for a nivo implementation.

GeekOnCoffee commented 4 years ago

I've found https://codesandbox.io/s/91l6kj5wop on another issue, but it only gets you part of the way.

fftristan commented 4 years ago

Hi. What if I wanted to use { ResponsiveLine } from '@nivo/line' and have a Bar component as one of the layers to the ResponsiveLine? These bar and line combination sandbox examples are great (https://codesandbox.io/s/m4ro13jjn8?file=/src/index.js, https://codesandbox.io/s/91l6kj5wop), but I am actually looking for kinda the opposite of those examples: I would like to build around the the ResponsiveLine as opposed to the Bar because I prefer the tooltip/crosshairs of the ResponsiveLine. Basically what I am aiming for is the line component makes up a running total, while the bars as each additional amount, added up equal that total (line over bars). I don't need a tooltip/crosshairs for the bar component. Any ideas on how I can add a bar layer or a d3-shape layer to the line component that is pretty straightforward? Thanks for any help!

RealAdamSinger commented 4 years ago

Yeah it would be nice to see a proper way to impliment this. I am not sure exactly what the differences between the bar and line components are but what seems like the simple approach to me is to start with the line series example and just add an option to render a series as a bar. This would essentially have all the functionality of the line chart but be rendered as a bar.

RealAdamSinger commented 4 years ago

@plouc would it be possible to retrofit the generateVerticalStackedBars logic into layers in a line chart?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] commented 4 years ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

Michael-Xie commented 2 years ago

Any updates to this feature? I think this would be very useful for data viz.

felipeblobo commented 1 year ago

Somebody has news?