0

(How) can I rescale the whole plot?

I am using my own fork of mbostock's "Multi-Line Voronoi", and now I am encountering a dataset in which it would makes sense to rescale the y axis. By just showing less of the "y.domain".

Interactively, perhaps with +/- buttons. I have the +/- buttons ready lol - and I have even been able to rescale the y-axis itself. But not yet the plotted timeseries lines.

Do I have to delete all lines, voronoi areas, etc. and redraw the whole thing?

Or is there a cool D3 command to simply rescale the whole diagram?

Thanks!

AltSheets
  • 357
  • 1
  • 3
  • 10
  • I'd take a look at the D3 functions like `ease()` and `tween()` etc. and really everything in the "transitions" api docs: https://github.com/d3/d3/wiki/Transitions Here's an example I made in D3 that uses repositioning / scaling of lines - if you wait for the animation to end you will be able to right click + view source and the JS for the D3 animation is directly embedded on the page: http://infiniteinternet.ca/ Best of luck! – DrewT Jun 11 '16 at 02:27
  • wow infiniteinternet.ca is really pretty! – AltSheets Jun 11 '16 at 12:48
  • If I understand your code correctly, I should be able to do something along the lines of ... d3.selectAll(cities).tween("path", function() { return compressed_path }); ? ... See https://bl.ocks.org/mbostock/raw/8033015/7c3a92342c41489f931eafae667b3c54a0eae135/ and I guess I have to do the same to the voronoi areas? – AltSheets Jun 11 '16 at 13:00
  • I think what you would `return` in the `tween()` function would be an instance of `interpolate()` function to interpolate over the array of x,y. https://github.com/d3/d3/wiki/Transitions#d3_interpolate – DrewT Jun 11 '16 at 22:28
  • This is a really basic interpolation example I found: http://jsfiddle.net/TsMgJ/2/ – DrewT Jun 11 '16 at 22:29

0 Answers0