Nivo: Add support for biaxial charts

Created on 16 Apr 2018  路  29Comments  路  Source: plouc/nivo

Hello,

I have looked around, i have checked the docs, I can't still figure out how to do a biaxial line chart. I have added the axisRight, but it is possible to use different key for that axis ?
I am looking for something that Left Axis is the line chart for 1 value and the Right Axis is a line for other type of value.

It is achievable with Nivo? I could show some examples if needed.
Thank you.

Most helpful comment

Hi @siemvaessen - just wondering if you made any progress on the biaxial chart? I looked through PRs and didn't see anything so thought I'd ask. Thanks!

All 29 comments

Hello,

For now, it's not, the only way to achieve this will be to stack 2 charts and hide x-axis for one of them, really hacky :/ There's an ongoing work on scales to be able to support multiple scales (and axes), but it requires a lot of work and unfortunately I don't have any time left for my side projects for now.

Oh, bad news! I really like how Nivo looks.
That solution seems a bit hacky, but i'll see how it goes.

Thank you so much for your work!

@dragosdydy did you manage to accomplish the biaxial chart with this hacky solution? and if yes, how?

@stephanoshadjipetrou not really, in the meantime I switched to another library with more options for advanced data viz (amCharts), but not so beautiful as nivo.

@plouc Hi again :)

In order to implement this bi-axial feature does it depend on some other libraries modifications/additions or this could be done "right away" in the @nivo/line package?

Thanks

@plouc - just wondering if you have any plans or that we can plan together on the implementation of this feature? Once we have some kind of plan based on the idea, we could potentially draw up some ETA's and see how has time to do what. We would like to contribute back and this seems like a proper contribution depending on time etc. When you talk abt 'a lot of work' could you define that a bit more? As in 30 hours lots of works or 30 days?

@plouc will this issue be re-opened?

I wonder if this could be achieve with the Layers api?

@wyze, this could be implemented using the layers API, but with a lot of manual work.
@siemvaessen, probably not 30 days :), IMO the hardest part is to define an API which allows this while keeping the most common implementation simple enough.

Ok @plouc thanks for the update and thanks for re-opening this ticket. Can we make a little plan for this, like a 'plan project' https://github.com/plouc/nivo/projects ? That way we can start some backlog of desired functionality and the steps toward adding that support. We @zimmerman-zimmerman are happy to invest resources into this part, seeing we will most definitely make use it. Team member @stephanoshadjipetrou will also be happy to chip in here.

Awaiting your humble next steps.

I would really like to see this feature implemented. A lot. Wish I could build it.

Hi @plouc could you start a Project, so we can plan around that work? Or you have other ideas to manage this work?

This would be super awesome. I currently have two charts on top of one another but this breaks the crosshair and legends. and trying to fix these is making my head hurt lol

+1 to letting @zimmerman-zimmerman have a go at a fix 馃拑

Hi @siemvaessen - just wondering if you made any progress on the biaxial chart? I looked through PRs and didn't see anything so thought I'd ask. Thanks!

Hi @plouc,

Do we have any update on biaxial support?. I need to have a line chart with 2 x-axis (top and bottom). The top x-axis would represent Jan to December 2019 and the bottom x-axis would represent Jan to December 2020.

Is this something doable with Nivo at least a little bit of customization? It would be really great if you could provide some pointers to achieve this

@premuditha - same here, would be great to see if it's possible.

I was using it, but because of this I required to change to some other framework, I hope this get done some day or have the time and knowledge to do it by my self and push it.

i'm also in need of this feature .. where would i find information/documentation about the layer api?

I'll add my voice to the chorus. Would love to see this added. If not that, if anyone has successfully done the hack above, seeing how that was implemented would help a ton.

This is how I hacked this. https://codesandbox.io/s/nivo-biaxis-chart-qv65c

Just stacked two charts on each other. Seems to be working ok

@plouc earlier you mention that figuring out an API that supports this might be the hardest part. These guys https://apexcharts.com/javascript-chart-demos/mixed-charts/multiple-yaxis/ have a solution... not sure but might be able to use some of the ideas from there.

For the record.. but not advocating for anyone to switch to that lib... i had initially looked at it for a project but ultimately went with Nivo. Nivo has a more active community and more full featured library.

This is how I hacked this. https://codesandbox.io/s/nivo-biaxis-chart-qv65c

Just stacked two charts on each other. Seems to be working ok

Nice! Did you manage to get the tooltip to work for both lines?

This is how I hacked this. https://codesandbox.io/s/nivo-biaxis-chart-qv65c

Just stacked two charts on each other. Seems to be working ok

Works great, thanks!
Anyone managed to implement the tooltip?

Building on @jmirick his solution, added a tooltip. With thanks to @stephanoshadjipetrou for coming up with the idea on how to chef this. https://codesandbox.io/s/pensive-jackson-q4rpj

Building on @jmirick his solution, added a tooltip. With thanks to @stephanoshadjipetrou for coming up with the idea on how to chef this. https://codesandbox.io/s/pensive-jackson-q4rpj

Nice!
Do you think there's a way to implement the tooltip to work with a biaxial chart that is composed from Bar and Line charts?

Building on @jmirick his solution, added a tooltip. With thanks to @stephanoshadjipetrou for coming up with the idea on how to chef this. https://codesandbox.io/s/pensive-jackson-q4rpj

Nice!
Do you think there's a way to implement the tooltip to work with a biaxial chart that is composed from Bar and Line charts?

@DavidTawil you can have a bar chart as the first rendered chart (non-interactive), and pass its data to the second chart to find the y value at the hovered x point. The trick part would be to align the bars with the line dots... you can check a brief check did in codesandbox - https://uv0no.csb.app/

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!

Bump

also bumping this thread. I am very seduced by the charts but lack of multiple axes support is a deal breaker for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhe1ka picture zhe1ka  路  3Comments

p45mark picture p45mark  路  3Comments

vagnervst picture vagnervst  路  4Comments

gcloeval picture gcloeval  路  3Comments

KENNYSOFT picture KENNYSOFT  路  3Comments