diff --git a/src/transforms/centroid.d.ts b/src/transforms/centroid.d.ts index 62104ef262..03aceccc63 100644 --- a/src/transforms/centroid.d.ts +++ b/src/transforms/centroid.d.ts @@ -1,10 +1,30 @@ import type {ChannelTransform, ChannelValue} from "../channel.js"; import type {Initialized} from "./basic.js"; +/** Options for the centroid and geoCentroid transforms. */ export interface CentroidOptions { + /** + * A channel supplying GeoJSON geometry; defaults to the identity transform, + * assuming that the data is GeoJSON geometry. + */ geometry?: ChannelValue; } +/** + * Given a **geometry** input channel of GeoJSON geometry, derives **x** and + * **y** output channels representing the planar (projected) centroids of the + * geometry. The centroids are computed in screen coordinates according to the + * plot’s associated **projection** (or *x* and *y* scales), if any. + * + * For centroids of spherical geometry, see Plot.geoCentroid. + */ export function centroid(options?: T & CentroidOptions): Initialized; +/** + * Given a **geometry** input channel of spherical GeoJSON geometry, derives + * **x** and **y** output channels representing the spherical centroids of the + * geometry. + * + * For planar (projected) centroids, see Plot.centroid. + */ export function geoCentroid(options?: T & CentroidOptions): T & {x: ChannelTransform; y: ChannelTransform};