Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

This is a common, but often challenging, interaction. It'd be great to see how it should work in nivo.

You must be logged in to vote

Replies: 7 comments

Comment options

I created a simple line chart with a brush using nivo components. I didn't create a pull request since I had to do some hacked actions to make it work.

  1. I had to add a new child component called Brush inside the Line component.
  2. I added three new props to the Line component that are then passed to the Brush component. Two to set the initial Brush position, and a callback to call onBrush.
  3. I had to modify the SvgWrappercomponent to provide a handler to each children, that gives them access to a ref of the parent svg component. I needed this ref to convert mouse coordinates to svg coordinates.

Do you approve of these API modification, or would you do things differently. I can generate a pull request from your comments if you want.

You must be logged in to vote
0 replies
Comment options

@guzmonne this is great. Your description and examples of 'hacked actions' to make this work are helpful for understanding how to customize or enhance Nivo.

Here's what I was thinking of doing with a stacked bar chart. I've seen this before with D3 but wasn't sure how to bring it to Nivo:

capture d ecran 2018-02-18 a 20 47 48

You must be logged in to vote
0 replies
Comment options

I believe you could accomplish it with nivo by extending the Bar components to handle child components, or hacking it like I did with the Line component.

I published a medium article explaining how I did it, and the shortcomings of my method.

You must be logged in to vote
0 replies
Comment options

Great work @guzmonne!
I've just noticed this issue while I was exposition such feature in a 'zoom' related issue.
I'm thinking about the same "generic" kinda brush feature that would simply return the range (start/end) of the selected data to be able to do whatever you want with it such as this sample from highcharts:
https://www.highcharts.com/demo/line-time-series

Having a generic simple capability to select an area by dragging dropping the mouse to act on it is a top feature.

You must be logged in to vote
0 replies
Comment options

@guzmonne this is great. Your description and examples of 'hacked actions' to make this work are helpful for understanding how to customize or enhance Nivo.

Here's what I was thinking of doing with a stacked bar chart. I've seen this before with D3 but wasn't sure how to bring it to Nivo:

capture d ecran 2018-02-18 a 20 47 48

can I get your code for bar chart with nivo-brush-zoom its too urgent for me please

You must be logged in to vote
0 replies
Comment options

Can someone explain how to do this with the responsive heat map.

You must be logged in to vote
0 replies
Comment options

Since this wasn't a bug, I decided to move this to a discussion.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
💡
Ideas
Labels
7 participants
Converted from issue

This discussion was converted from issue #32 on May 06, 2025 02:35.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.