influxdata/giraffe

Trigger zoom programmatically

Closed this issue ยท 4 comments

T0-B1 commented

I can't seem to find a way to trigger the zoom update if i provide a custom onSetXDomain callback in the config object.
I would like to be able to call something like handleXBrushEnd.
I need this for 2 reasons:

  • First because the only way to set the xDomain property is to provide also the onSetXDomain, so i don't know how to zoom if i want to provide an initial xDomain.

  • Second, would be handy to have the possibility to "sync" the domain of multiple plots, changing it for every one of them whenever a zoom event occurs on any.

Is this feasible?

EDIT

A possibility would be to add an InteractionHandler for the zoom, like in #417, and a setDomain function in the InteractionHandlerArguments.

Great suggestion, this is exactly what the InteractionHandler is meant to address. We'll take a look and discuss it internally. Thanks for reaching out!

@T0-B1 when you talk about an interaction handler for zoom, do you mean for when the domain changes when a user drags the cursor and zooms into the graph? Or are you referring to using a browser's zoom function?

T0-B1 commented

@T0-B1 when you talk about an interaction handler for zoom, do you mean for when the domain changes when a user drags the cursor and zooms into the graph? Or are you referring to using a browser's zoom function?

Domain changes

@T0-B1 we have just merged default handlers for custom domains. To use the default zoom/unzoom behavior, just add the includeXDomainZoom or includeYDomainZoom properties in your configuration as a boolean true