@@ -2,15 +2,60 @@ import type {GeoPermissibleObjects} from "d3";
2
2
import type { ChannelValue , ChannelValueSpec } from "../channel.js" ;
3
3
import type { Data , MarkOptions , RenderableMark } from "../mark.js" ;
4
4
5
+ /** Options for the geo mark. */
5
6
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
+ */
6
11
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
+ */
7
24
r ?: ChannelValueSpec ;
8
25
}
9
26
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
+ */
10
43
export function geo ( data ?: Data | GeoPermissibleObjects , options ?: GeoOptions ) : Geo ;
11
44
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
+ */
12
49
export function sphere ( options ?: GeoOptions ) : Geo ;
13
50
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
+ */
14
58
export function graticule ( options ?: GeoOptions ) : Geo ;
15
59
60
+ /** The geo mark. */
16
61
export class Geo extends RenderableMark { }
0 commit comments