d3fc
d3fc copied to clipboard
Question: Zoom Extent
Hi all,
I'm trying to limit the zoom so the max zoomability on the canvas (both X and Y +maybe some padding) are derived from the provided data.
I tried
...
const yExtFunc = fc.extentLinear().accessors([(d: DataLine) => d.max, (d: DataLine) => d.min]);
const xExtFunc = fc.extentTime().accessors([(d: DataLine) => d.time]);
const xExtent = xExtFunc(data);
const yExtent = yExtFunc(data);
const zoom = fc.zoom().extent([xExtent, yExtent]).on('zoom', render);
But the Zoom is still zoomable in+out to infinity. I tried to look for examples but it didn't seem like there are any examples with min/max limits on zooming.
Any help would be appreciated. Thank you!
You can set the extent via the scaleExtent
property. See the following code snippet:
https://github.com/d3fc/d3fc/tree/master/packages/d3fc-axis#label-rotation--offset
From the following example: https://github.com/d3fc/d3fc/tree/master/packages/d3fc-axis#label-rotation--offset
any solution for this ?
@ColinEberhardt It doesn't look like that link demonstrates scaleExtent any more. Is there an updated example of min/max zoom limits?