Geo area chart
Show geographic data as colored regions on a map with the GeoAreaChart component.
A geo area chart visualizes data by geographic regions (countries, states, …) on a map. Each region takes its color from a measure value or an attribute value, so you can compare regions, for example, revenue by country.
Buckets
| Prop | Required | Takes | What it does |
|---|---|---|---|
area | Yes | One attribute | Draws one region per value. Use an attribute with a geo area label in the logical data model (LDM). Values that don’t match a region aren’t drawn. |
color | No | One measure | Colors the regions by value, from a light shade for the lowest value to the full color for the highest. |
segmentBy | No | One attribute | Colors the regions by attribute value, one color per value, and adds a category legend. When set, it decides the colors instead of color. |
filters | No | Filters | Limits the data the chart shows. |
Sorting
GeoAreaChart applies no default sorting. Pass sortBy to sort the data of the area layer. The category legend lists the segmentBy values in alphabetical order, whatever sortBy you pass.
Configuration
Pass these options in the config prop (IGeoAreaChartConfig). See Configuration on the Geo chart page for details.
| Option | What it changes |
|---|---|
colorPalette, colorMapping | Colors of the regions. A color measure uses shades of the first palette color, or of the color that colorMapping sets for the area attribute. segmentBy values take one palette color each. |
legend | enabled (default true) shows or hides the legend. position (default "auto") places it in a corner: "top-left", "top-right", "bottom-left", or "bottom-right". |
areas | fillOpacity (default 0.7), borderColor (default "#FFFFFF"), and borderWidth (default 1) of the regions. |
viewport | area sets the initial view: "auto" fits the data, which is also what happens when you set no view; "world" or a continent such as "continent_eu" shows that region. frozen: true locks map interaction. navigation.pan and navigation.zoom (both default true) turn panning and zooming on or off. |
bounds, center, zoom | A custom initial view. bounds takes priority over center and zoom. They apply only when viewport.area is "custom" or not set; any other viewport.area, including "auto", overrides all three. |
maxZoomLevel | Maximum zoom level (default 8). null removes the limit. |
mapStyle | A MapLibre style URL or inline style specification, used instead of the base map from the backend. |
cooperativeGestures | With true (default), zooming with the mouse wheel needs Ctrl or ⌘, and moving the map on a touch screen needs two fingers. |
separators | Thousands and decimal separators in the tooltip values. |
limit | Maximum number of data points. See Limits. |
Limits
- A geo area chart renders up to 50,000 data points, or the number you set in
limit. With more, the chart shows an error andonErrorreceives aDataTooLargeToDisplaySdkError. Filter the data to fit. - The chart draws each region once. When a region has more than one
segmentByvalue, it takes the color of the first one in the data.
Notes
GeoAreaChartis a convenience wrapper overGeoChartfor the single-area-layer scenario.- Geo charts are MapLibre-based and do not require a Mapbox access token. If you are upgrading an older app, see Geo pushpin chart for details about legacy Mapbox compatibility (
LegacyGeoPushpinChart, deprecatedmapboxToken). - Geo charts start a MapLibre web worker. You don’t need to configure your bundler; for Content Security Policy requirements and self-hosting the worker, see Map worker, bundlers, and CSP.
Structure
import "@gooddata/sdk-ui-geo/styles/css/main.css";
import { GeoAreaChart } from "@gooddata/sdk-ui-geo";
<GeoAreaChart
area={<attribute>}
color={<measure>}
segmentBy={<attribute>}
config={<geo-area-config>}
filters={<filters>}
/>
Example
import "@gooddata/sdk-ui-geo/styles/css/main.css";
import { GeoAreaChart } from "@gooddata/sdk-ui-geo";
import * as Md from "./catalog.js";
<div style={{ height: 600, width: 900 }}>
<GeoAreaChart area={Md.Country.Name} color={Md.Revenue.Sum} />
</div>;
Props
| Prop | Type | Required | Description | Inherited from |
|---|---|---|---|---|
area | AttributeOrPlaceholder | Yes | Attribute containing area identifiers (country, state, region, …). | — |
additionalLayers | IGeoLayer[] | No | Layers rendered after the primary layer (e.g., overlays). | IGeoSingleLayerWrapperProps |
backend | IAnalyticalBackend | No | Backend used for data execution. Falls back to BackendProvider when omitted. | IGeoCommonExecutionProps |
color | AttributeMeasureOrPlaceholder | No | Measure or attribute used for color encoding. | IGeoAreaChartBaseProps |
config | IGeoAreaChartConfig | No | Configuration specific to area layers. | IGeoAreaChartBaseProps |
drillableItems | ExplicitDrill[] | No | Configure drillability; e.g. which parts of the visualization can be interacted with. | IVisualizationProps |
ErrorComponent | ComponentType<IErrorProps> | No | React component to display in the event when there is an error with either obtaining the data from backend or with the data itself. | IVisualizationProps |
execConfig | IExecutionConfig | No | Additional execution configuration forwarded to backend. | IGeoCommonExecutionProps |
exportTitle | string | No | Set title to use for exported files. | IVisualizationProps |
filters | NullableFiltersOrPlaceholders | No | Filters applied to every layer execution. | IGeoCommonExecutionProps |
LoadingComponent | ComponentType<ILoadingProps> | No | React component to display while loading data from the backend. | IVisualizationProps |
locale | string | No | Set Locale for visualization localization. | IVisualizationProps |
onBoundsChanged | BoundsChangedCallback | No | Callback fired when the map visible bounds change. | IGeoCommonExecutionProps |
onCenterPositionChanged | CenterPositionChangedCallback | No | Callback fired when the map center changes. | IGeoCommonExecutionProps |
onDataView | OnDataView | No | (Alpha) Called when the visualization loads a DataView, i.e. it receives data from the backend. | IVisualizationCallbacks |
onDrill | OnFiredDrillEvent | No | Called when user triggers a drill on a visualization. | IVisualizationCallbacks |
onError | OnError | No | Called when an error occurs while loading data for the visualization. | IVisualizationCallbacks |
onExportReady | OnExportReady | No | Called when the visualization is ready to be exported. | IVisualizationCallbacks |
onLoadingChanged | OnLoadingChanged | No | Called when loading status of the visualization changes - vis starts or stops loading | IVisualizationCallbacks |
onViewportInteractionEnd | ViewportInteractionEndCallback | No | Callback fired when a user-triggered viewport interaction finishes. | IGeoCommonExecutionProps |
onZoomChanged | ZoomChangedCallback | No | Callback fired when map zoom changes. | IGeoCommonExecutionProps |
placeholdersResolutionContext | object | No | Resolution context for composed placeholders. | IGeoCommonExecutionProps |
segmentBy | AttributeOrPlaceholder | No | Optional segment attribute that drives category legend items. | IGeoAreaChartBaseProps |
sortBy | SortsOrPlaceholders | No | Sorting applied to the primary layer execution definition. | IGeoSingleLayerWrapperProps |
theme | ITheme | No | Theme override. Defaults to the nearest ThemeProvider. | IGeoCommonExecutionProps |
workspace | string | No | Workspace identifier. Falls back to WorkspaceProvider when omitted. | IGeoCommonExecutionProps |
Related
Display geographic data on an interactive map with the GeoChart component.
Plot data points on a map with pushpin markers using the GeoPushpinChart component.
Shared behavior of GoodData.UI visual components — responsive sizing, the style and data props model, and the visualization lifecycle callbacks.