<BubbleMap
echarts={echarts}
geoJson={geoJson}
data={colos}
lng="lon"
lat="lat"
name="city"
value="requests"
/> Installation
BubbleMap and ChoroplethMap require echarts as a peer dependency. Consumers provide the GeoJSON feature collection; map components do not fetch map data or use map tiles.
npm install echarts Barrel
import { BubbleMap, ChoroplethMap } from "@cloudflare/kumo"; Granular
import { BubbleMap, ChoroplethMap } from "@cloudflare/kumo/components/chart"; Usage
import { BubbleMap, ChoroplethMap, type MapGeoJson } from "@cloudflare/kumo";
import * as echarts from "echarts/core";
import { MapChart, ScatterChart } from "echarts/charts";
import { TooltipComponent, VisualMapComponent } from "echarts/components";
import { CanvasRenderer } from "echarts/renderers";
echarts.use([
MapChart,
ScatterChart,
TooltipComponent,
VisualMapComponent,
CanvasRenderer,
]);
// Load GeoJSON in your app and pass it to map components.
const geoJson = world as MapGeoJson;
const colos = [
{ iata: "SFO", city: "San Francisco", lat: 37.77, lon: -122.42, requests: 1200 },
{ iata: "LHR", city: "London", lat: 51.5, lon: -0.12, requests: 1500 },
];
const countries = [
{ country: "United States of America", requests: 4200 },
{ country: "Germany", requests: 3100 },
];
export default function Example() {
return (
<>
<BubbleMap
echarts={echarts}
geoJson={geoJson}
data={colos}
lng="lon"
lat="lat"
name="city"
value="requests"
/>
<ChoroplethMap
echarts={echarts}
geoJson={geoJson}
data={countries}
name="country"
value="requests"
/>
</>
);
} Examples
Bubble Map
Plot raw rows by longitude and latitude. The value accessor controls proportional bubble size.
<BubbleMap
echarts={echarts}
geoJson={geoJson}
data={colos}
lng="lon"
lat="lat"
name="city"
value="requests"
minRadius={8}
/> Custom Tooltips
Provide tooltipFormatter when the default name/value tooltip is not enough. The formatter returns HTML rendered by ECharts, so escape user-provided values.
<BubbleMap
echarts={echarts}
geoJson={geoJson}
data={colos}
lng="lon"
lat="lat"
name="city"
value="requests"
tooltipFormatter={(row) =>
"<strong>" + row.city + "</strong><br />" + row.requests.toLocaleString()
}
/> Choropleth Map
Shade regions by value. Data rows are joined to GeoJSON features by name (matched against the feature's nameProperty, default "name").
<ChoroplethMap
echarts={echarts}
geoJson={geoJson}
data={countries}
name="country"
value="requests"
/> API Reference
BubbleMap
Component "BubbleMap" not found in registry. Run pnpm build:ai-metadata to regenerate.