🏠 back to Observable

Any SIMPLE examples of V6 zoom for a line chart

I’ve come across several examples of the zoom function, but have been unable to find anything for a simple line chart that is using V6. And I keep coming up against the same error no matter what I try in my own code:

  function dozoom(event){
        console.log("in dozoom");
        var transform = d3.zoomTransform(this);
        var newX = event.transform.rescaleX(this.xScale);

transform is always undefined, which, as I understand it, is what happened in V6.

Any help would be appreciated.

Not sure if this would help:

Could you share your notebook that has this problem as it would make debugging ̷f̷u̷n̷ easier.

Not for V6, no. that’s no longer used.

1 Like

Your question doesn’t really seem to be specific to Observable. In fact, a search for opentip on Observable turns up no results, require('opentip') doesn’t work, and the Module Debugger doesn’t find a way to load it either. So you might try another forum.

Having said that, the the changes in how d3.zoom now uses the event model in V6 are described in Fil’s Migration guide:

1 Like

I did read the migration guide, and did find that it helped, thanks. As for another forum, if you have a suggestion, that’d be great. Other than Stackoverflow (which I’d already searched extensively) which is pretty toxic.

How about D3 slack: