Skip to content

Commit 42c1a4e

Browse files
Filmbostock
andauthored
document geo (#1391)
* document geo * line feed * edits --------- Co-authored-by: Mike Bostock <[email protected]>
1 parent 666a547 commit 42c1a4e

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/marks/geo.d.ts

+45
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,60 @@ import type {GeoPermissibleObjects} from "d3";
22
import type {ChannelValue, ChannelValueSpec} from "../channel.js";
33
import type {Data, MarkOptions, RenderableMark} from "../mark.js";
44

5+
/** Options for the geo mark. */
56
export interface GeoOptions extends MarkOptions {
7+
/**
8+
* A required channel for the geometry to render; defaults to identity,
9+
* assuming *data* is a GeoJSON object or an iterable of GeoJSON objects.
10+
*/
611
geometry?: ChannelValue;
12+
13+
/**
14+
* The size of Point and MultiPoint geometries, defaulting to a constant 3
15+
* pixels. If **r** is a number, it is interpreted as a constant radius in
16+
* pixels; otherwise it is interpreted as a channel and the effective radius
17+
* is controlled by the *r* scale, which defaults to a *sqrt* scale such that
18+
* the visual area of a point is proportional to its associated value.
19+
*
20+
* If **r** is a channel, geometries will be sorted by descending radius by
21+
* default, to limit occlusion; use the **sort** transform to control render
22+
* order. Geometries with a nonpositive radius are not drawn.
23+
*/
724
r?: ChannelValueSpec;
825
}
926

27+
/**
28+
* Returns a new geo mark with the given *data* and *options*. The **geometry**
29+
* channel, which defaults to the identity function assuming that *data* is a
30+
* GeoJSON object or an iterable of GeoJSON objects, is projected to the plane
31+
* using the plot’s top-level **projection**. For example, for a choropleth map
32+
* of county polygons with a *rate* property:
33+
*
34+
* ```js
35+
* Plot.geo(counties, {fill: (d) => d.properties.rate})
36+
* ```
37+
*
38+
* If *data* is a GeoJSON feature collection, then the mark’s data is
39+
* *data*.features; if *data* is a GeoJSON geometry collection, then the mark’s
40+
* data is *data*.geometries; if *data* is some other GeoJSON object, then the
41+
* mark’s data is the single-element array [*data*].
42+
*/
1043
export function geo(data?: Data | GeoPermissibleObjects, options?: GeoOptions): Geo;
1144

45+
/**
46+
* Returns a new geo mark whose *data* is the outline of the sphere on the
47+
* projection’s plane. (For use with a spherical **projection** only.)
48+
*/
1249
export function sphere(options?: GeoOptions): Geo;
1350

51+
/**
52+
* Returns a new geo mark whose *data* is a 10° global graticule. (For use with
53+
* a spherical **projection** only.) For more control, use [d3.geoGraticule][1]
54+
* with the geo mark.
55+
*
56+
* [1]: https://github.com/d3/d3-geo/blob/main/README.md#geoGraticule
57+
*/
1458
export function graticule(options?: GeoOptions): Geo;
1559

60+
/** The geo mark. */
1661
export class Geo extends RenderableMark {}

0 commit comments

Comments
 (0)