Skip to content

Type Alias: ChoroplethTrace ​

ts
type ChoroplethTrace = Omit<CommonTraceAttributes, 'hoverinfo'> & object;

A choropleth map: the regions that locations name (countries, US states, or the features of a geojson) filled with the colors of their z values, on a map-projection subplot (layout.geo).

Type Declaration ​

NameTypeDescription
autocolorscale?booleanPick the colorscale from the sign of the color domain (Reds for ≥ 0, Blues for ≤ 0, RdBu across 0). Defaults to true unless colorscale is given.
coloraxis?"coloraxis" | `coloraxis${number}`Share a colorscale and domain with other traces through layout.coloraxis ('coloraxis', 'coloraxis2', …). Overrides this container's colorscale attributes.
colorbar?ColorbarThe colorbar of this colorscale (plan E5.3).
colorscale?| ColorScale | readonly string[] | readonly readonly (number | string)[][]Colorscale for numeric z values: a name ('Viridis', 'RdBu', …), a list of colors, or [position, color] stops from 0 to 1.
elevation?DataColumnA second value per location, drawn as height on a 3D globe (layout.geo.projection.type: 'globe3d'): each region rises from the sphere as a prism, the largest elevation elevationscale high and the others in proportion. A location whose elevation is 0, negative or not a number lies flat on the surface. A Holochart extra (Plotly has neither the globe nor this attribute); on a flat projection it is not drawn, and events and hovertemplate (%{elevation}) still carry it.
elevationscale?numberThe height of the region with the largest elevation, in globe radii. Values above 1 are drawn as 1: the room the globe keeps above its surface. Only with elevation, on a 3D globe. A Holochart extra. Minimum: 0
featureidkey?stringThe key of the geojson features that locations are matched against, e.g. 'properties.name'. Only with geojson.
geo?"geo" | `geo${number}`The geo subplot this trace is drawn on: 'geo' (layout.geo), 'geo2' (layout.geo2), ….
geojson?unknownGeoJSON whose features locations refers to: a FeatureCollection or Feature with Polygon or MultiPolygon geometries, or a URL of one. Without it, the regions are the features of the base map. Rings wound the RFC 7946 way (outer rings counter-clockwise) are rewound, with one warning.
hoverinfo?PerPoint< | "location" | "z" | "text" | "name" | `${"location" | "z" | "text" | "name"}+${string}` | "all" | "none" | "skip">Which fields hover labels show (the location, the value, the text and the trace name); 'skip' also turns hover events off for this trace. Default 'all'.
locationmode?"ISO-3" | "USA-states" | "country names" | "geojson-id"What the entries of locations name: 'ISO-3' country codes, 'USA-states' (two-letter codes or state names), 'country names' (names, or ISO codes), or 'geojson-id' for the features of geojson. Default 'geojson-id' when geojson is given.
locations?DataColumnLocation ids or names, one region each (see locationmode). A location that matches nothing is skipped, and one warning names the unmatched ones.
marker?ChoroplethTraceMarkerOutline and opacity of the regions.
reversescale?booleanReverse the colorscale (the lowest value gets the last color).
selected?ChoroplethTraceSelectedHow the selected regions are drawn while a selection is active.
showscale?booleanShow a colorbar for this colorscale (drawn by the colorbar component, plan E5.3).
text?PerPoint<string | number>Text per location, shown in hover labels (unless hovertext is set).
type"choropleth"Trace type.
unselected?ChoroplethTraceUnselectedHow the unselected regions are drawn while a selection is active.
z?DataColumnThe value of each location, mapped to a color through the colorscale. A location whose value is not a number is not drawn.
zauto?booleanCompute the color domain from z. Defaults to false when both zmin and zmax are given.
zmax?numberValue mapped to the last colorscale color (with zmin; turns zauto off).
zmid?numberWith cauto, widen the automatic domain so it is symmetric around this value (diverging data).
zmin?numberValue mapped to the first colorscale color (with zmax; turns zauto off).

Released under the MIT License.