# Blazor Map Chart: Drill-Down Choropleth

URL: https://flexcoreui.com/demo/charts/map-story  
Section: Charts  
Controls: MapStoryControl, MapControl  
Keywords: map chart, choropleth, Blazor maps, geo map, drill-down map

A Blazor choropleth map that drills from world to continent to state or province over bundled boundaries; no tile server, no map key.

## Documentation

### Params

| Name | Type | Default | Description |
|---|---|---|---|
| Story | MapStory? | null | The levels, regions, color scale, callouts and source line to draw. |
| Geography | MapGeographyCatalog? | null | Boundary catalog the levels are drawn on. The bundled Natural Earth and NUTS-2 / US set when null. |
| Width | int | 960 | Drawing width in pixels. |
| Height | int | 640 | Drawing height in pixels. |

### Map

| Name | Type | Default | Description |
|---|---|---|---|
| Choropleth | ChoroplethLayout? | null | A fitted graphic from MapStoryComposer.Compose. When set, the map draws only that graphic, each region a button that raises ShapeClick; the toolbar, tiles, panning, Shapes and Markers are off. |
| Center / CenterChanged | GeoPoint | new(20, 0) | Map center of the plain map. Two-way with @bind-Center; panning, the arrow keys and opening a cluster change it. |
| Zoom / ZoomChanged | int | 2 | Zoom level of the plain map. Two-way with @bind-Zoom; the + and − buttons and keys change it. |
| ViewChanged | EventCallback<MapView> |  | Raised with the new center and zoom after a pan or a zoom. |
| MinZoom / MaxZoom | int | 0 / 18 | Zoom bounds. Outside 0 to 22, reversed, or with Zoom outside them, the control throws. |
| Width / Height | int | 800 / 420 | Size of the plain map in pixels; at least 1. A choropleth takes its size from the layout and scales to the container. |
| Markers | IReadOnlyList<MapMarker> | empty | Points on the plain map. Ids must be unique, or the control throws. A marker is a circle of radius 7 in its Color, with its Title as tooltip. |
| Shapes | IReadOnlyList<MapShape> | empty | Polygons or lines drawn under the markers, each a button that raises ShapeClick. |
| ClusterMarkers | bool | false | Markers within 32 px of each other share a numbered circle; clicking it centers there and zooms in two levels. |
| BubbleMarkers | bool | false | Sizes each marker by the square root of its Value, 5 to 40 px. |
| MarkerTemplate | RenderFragment<MapMarker>? | null | Content drawn beside each marker in a 150 × 50 box. |
| MarkerClick / ShapeClick | EventCallback<MapMarker> / EventCallback<MapShape> |  | Raised when a marker, or a shape or choropleth region, is clicked or activated with Enter or Space. The status bar shows the clicked marker's title and coordinates. |
| TileUrlTemplate | string? | null | Raster tile address with {z}, {x} and {y}. Null draws no tiles: a plain background with a 30° grid. |
| Attribution | string | "" | Text in the status bar under the plain map. |
| AriaLabel | string | "Map. Use arrow keys to pan and plus or minus to zoom." | Name of the map for assistive technology. |

## Examples

### Story

```razor
@using Fx.ControlKit.Maps

<MapStoryControl Story="_story" Width="960" Height="640" />
```

### Airports

```razor
@using Fx.ControlKit
@using Fx.ControlKit.Maps

@if (_country is null)
{
    <MapControl Choropleth="_airportLayout" ShapeClick="OpenCountry" Width="960" Height="560"
                AriaLabel="Airports per country. Each country is a button that opens its airports." />
}
else
{
    <div class="country-bar">
        <ButtonControl OnClick="BackToWorld">Back to the world map</ButtonControl>
        <span><strong>@_byCountry[_country][0].Country</strong>: @_byCountry[_country].Count airports with scheduled service</span>
        <span>With the map focused, arrow keys pan and plus or minus zooms.</span>
        <span class="marker-key"><i class="large"></i>Large <i class="medium"></i>Medium <i class="small"></i>Small</span>
    </div>
    <MapControl Shapes="_shapes" Markers="_markers" @bind-Center="_center" @bind-Zoom="_zoom" MinZoom="1" MaxZoom="10"
                ClusterMarkers="@(_markers.Count > 200)" MarkerClick="PickAirport" Width="960" Height="520"
                Attribution="Airports: OurAirports, public domain. Outlines: Natural Earth."
                AriaLabel="@($"Airports in {_byCountry[_country][0].Country}")" />
    @if (_picked is { } picked)
    {
        <div class="airport-card">
            <p><strong>@picked.Code</strong> @picked.Name, @picked.City. @picked.Type airport, elevation @(picked.ElevationFt?.ToString("N0") ?? "unknown") ft.</p>
            <ul>
                @foreach (var runway in AirportData.RunwaysOf(picked.Code))
                {
                    <li>Runway @runway.Name: @(runway.LengthFt?.ToString("N0") ?? "length unknown") ft, @runway.Surface.ToLowerInvariant()@(runway.Lighted ? ", lit" : "")@(runway.Closed ? ", closed" : "")</li>
                }
            </ul>
            @if (!string.IsNullOrEmpty(picked.Wikipedia))
            {
                <a href="@picked.Wikipedia" target="_blank" rel="noopener">Wikipedia article</a>
            }
        </div>
    }
}
```

### Svg

```razor
<div class="map-story-static">@((MarkupString)_europeSvg)</div>
```

