@d3fc/d3fc-zoom

中文文档
1.2.0发布于 2024/06/13MITESM + CJS近 30 天下载 6万

A zoom component which operates in domain values

原始使用文档

d3fc-zoom

A domain-value based alternative to d3-zoom. Designed to easily allow co-ordinating zoom/pan actions across multiple scales and out-of-band updates to the scale's domains. This is traded off against a slightly reduced feature-set.

Main D3FC package

Installing

npm install @d3fc/d3fc-zoom

API Reference

# fc.zoom()

Constructs a new zoom behaviour instance. The returned behaviour, zoom, is both an object and a function, and is typically applied to selected elements via selection.call.

# zoom(selection, xScale, yScale)

Applies this zoom behaviour to the specified selection, binding the necessary event listeners to allow panning and zooming. It accepts an xScale and/or a yScale to which the pan or zoom operation will be directly applied before the zoom event is raised.

This function is typically not invoked directly, and is instead invoked via selection.call:

selection.call(fc.zoom().on("zoom", render), xScale, yScale)

A d3.zoom component is used internally to bind the necessary event listeners. Therefore you can unbind the behaviour as follows:

selection.on(".zoom", null);

# zoom.on(typenames[, callback])

This component dispatches zoom events. There are no arguments passed to the event handler. Typically this would be used to re-render the chart.

See d3-dispatch's on for a full description.

# zoom.extent(...)

See d3-zoom extent.

# zoom.filter(...)

See d3-zoom filter.

# zoom.wheelDelta(...)

See d3-zoom wheelDelta.

# zoom.touchable(...)

See d3-zoom touchable.

# zoom.clickDistance(...)

See d3-zoom clickDistance.

# zoom.tapDistance(...)

See d3-zoom tapDistance.

# zoom.duration(...)

See d3-zoom duration.

# zoom.interpolate(...)

See d3-zoom interpolate.

版本与发布记录

@d3fc/d3fc-zoom 共发布 3 个版本,首次发布于 2020/10/14;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.2.0latest2024/06/132 年前
1.1.12020/11/066 年前
1.1.02020/10/146 年前

关于 @d3fc/d3fc-zoom 的常见问题

@d3fc/d3fc-zoom 是什么?

A zoom component which operates in domain values

如何安装 @d3fc/d3fc-zoom?

在项目目录运行 npm install @d3fc/d3fc-zoom,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:d3-dispatch(*)、d3-selection(*)、d3-zoom(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@d3fc/d3fc-zoom 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/d3fc__d3fc-zoom 是否存在。

@d3fc/d3fc-zoom 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@d3fc/d3fc-zoom 可以商用吗?

@d3fc/d3fc-zoom 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@d3fc/d3fc-zoom 的下载量有多少?

根据 npm 官方下载统计,@d3fc/d3fc-zoom 在 2026/10/11 – 2026/11/09 这 30 天内被下载 59,579 次,日均约 1,986 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@d3fc/d3fc-zoom 还在维护吗?

最新版本 1.2.0 发布于 2024/06/13(2 年前);至今共发布 3 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/10/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。