# Blazor Sunburst Chart

URL: https://flexcoreui.com/demo/charts/sunburst  
Section: Charts  
Controls: SunburstChartControl, SunburstNode  
Keywords: sunburst chart, hierarchy chart, drill-down chart, radial chart

Explore a hierarchy as rings users drill into: a Blazor sunburst of COVID-19 cases and deaths across 210 countries in 6 continents.

## Documentation

### Params

| Name | Type | Default | Description |
|---|---|---|---|
| RootNode | SunburstNode? | null | The tree to draw; ring 1 is its children, ring 2 their children, and deeper levels appear after a drill-down. A new tree that does not contain the node drilled into resets the view to its root; otherwise the drill position is kept. Nothing is drawn when the root is null, has no children, or their totals sum to zero. |
| Title | string? | null | Text in a fx-sunburst-title line above the breadcrumb; nothing is rendered when empty. |
| Width | string | "100%" | Inline width of the root element, capped at 100 percent; the drawing inside is capped again at 680 px square by fx-sunburst-viewport. |
| Height | string | "620px" | Declared, but never read: the drawing is square and sized by its width. This page passes 620px and it has no effect. |
| CenterRadiusRatio | double | 0.28 | Radius of the center hub as a share of the 325-unit drawing radius, clamped to 0.15 to 0.45; the rings share what is left. |
| ValueFormat | string | "N0" | Numeric format of the hub value and of the two totals in the tooltip, in the current culture. |
| MetricName | string | "Cases" | Label of the first total in the tooltip, as Total Cases:. Used nowhere else. |
| SecondaryMetricName | string | "Deaths" | Label of the second total in the tooltip, shown only when the node has a SecondaryValue or its TotalSecondaryValue is above zero. |
| CenterTitle | string | "TOTAL CASES" | Upper line of the hub while the view is at RootNode; after a drill-down the hub shows the current node's Name upper-cased instead. |
| CenterColor | string | "#38bdf8" | Fill of the hub when the current node, the root included, has no Color; a node with a color wins. Hovering a hub that can zoom out darkens the fill 15 percent. |
| EnableDrilldown | bool | true | True: clicking a segment that has children makes it the current root, clicking the hub goes up one level, and the tooltip adds a drill hint. False: segment clicks still raise OnNodeClick and the hub does nothing. The breadcrumb buttons navigate either way. |
| ShowBreadcrumb | bool | true | Renders the pill above the drawing: a root button with RootNode.Name, or World, then one button per ancestor down to the current node. Each button jumps there, with or without EnableDrilldown. |
| ShowLabels | bool | true | Writes each node's Name along its segment, rotated to the mid angle and turned to stay readable on the left half. Segments under 0.045 radians get no label, 0.065 on ring 2; longer names are cut to about one character per 7.5 units of arc, three at least, with an ellipsis. |
| HighlightedNodeId | string? | null | The segment whose node Id matches gets the highlighted class, a white stroke and the glow, and every other segment is dimmed while it is set. The control never changes it; an id that matches nothing dims the whole chart. |
| CssClass | string? | null | Extra classes on the root fx-sunburst-container element. |

### Events

| Name | Type | Description |
|---|---|---|
| OnNodeClick | SunburstNode | A click on a ring segment, with that segment's node, before any drill-down. Not raised by the hub or the breadcrumb. |
| OnNodeHover | SunburstNode? | The node when the pointer enters a segment, then null when it leaves that segment. Not raised for the hub or the breadcrumb; the pointer leaving the whole control clears the tooltip without a callback. |

### Node

| Name | Type | Default | Description |
|---|---|---|---|
| Id | string | Guid.NewGuid().ToString("N") | Identity of the node: what HighlightedNodeId matches and how the hovered segment is recognized. A fresh GUID per node unless you set it, so a rebuilt tree has new ids. |
| Name | string | string.Empty | Segment label, tooltip title, breadcrumb button text, and the hub title after a drill-down. |
| Value | double | 0 | The node's own measure; see TotalValue for what the rings use. |
| SecondaryValue | double? | null | Second measure; feeds TotalSecondaryValue and the second tooltip total. |
| Color | string? | null | Segment fill, and the hub fill while the node is the current root. Null on ring 1 takes the next of eight palette colors; null on ring 2 takes one of five shades of the parent's color, cycling by position. |
| Description | string? | null | Declared, but the control never reads it. |
| Parent | SunburstNode? | null | Set by AddChild, never by the control. Drives Depth, the breadcrumb path, the zoom-out target, the tooltip's share of parent and the dimming of unrelated segments; a tree built with Children.Add loses all of those. |
| Children | List<SunburstNode> | new() | The next ring. Add through AddChild so Parent is set. |
| CustomAttributes | Dictionary<string, object?> | new(StringComparer.OrdinalIgnoreCase) | Case-insensitive bag for your own data; the control never reads it. This page keeps the ISO code and the continent name here. |
| IsLeaf | bool |  | True when Children is empty. Read-only; the control never reads it. |
| Depth | int |  | 0 at the node with no Parent, then one more per level. Read-only; the tooltip shows the share of parent only at depth 2. |
| TotalValue | double |  | What the rings and the hub value use. A leaf gives Value, floored at 0; a node with children gives Value when it is positive, else the sum of its children's totals. Read-only. |
| TotalSecondaryValue | double |  | The same rule applied to SecondaryValue; the tooltip's second total. Read-only. |

### Node methods

| Name | Type | Description |
|---|---|---|
| AddChild(SunburstNode child) | void | Sets the child's Parent to this node and appends it to Children. |
| GetAncestors() | IEnumerable<SunburstNode> | The chain from the top of the tree down to this node's parent. The control walks the breadcrumb itself and never calls it. |
| Flatten() | IEnumerable<SunburstNode> | This node, then every descendant depth-first. This page uses it to find a country by name for the leaderboard and the search box. |

### Color helper

| Name | Type | Description |
|---|---|---|
| AdjustLightness(string hex, double factor) | string | A 7- or 4-character hex color scaled toward black for a factor under 1 and toward white for a factor over 1; anything else comes back unchanged. |
| Darken(string hex, double percent) | string | AdjustLightness(hex, 1 - percent). The hub uses 0.15 while hovered; ChartControl uses 0.08 for the leaf colors of its Sunburst type. |
| Lighten(string hex, double percent) | string | AdjustLightness(hex, 1 + percent). |

### Css

| Name | Description |
|---|---|
| fx-sunburst-container | The root element: a centered flex column with user-select: none; CssClass is added here and Width is its inline width. fx-sunburst-title is the optional title line. |
| fx-sunburst-breadcrumbs | The breadcrumb pill; fx-breadcrumb-btn is each button, active marks the current node, fx-breadcrumb-sep the separators. |
| fx-sunburst-viewport | The square drawing area, max-width: 680px with aspect-ratio: 1 / 1; it holds the fx-sunburst-svg, a 700 by 700 view box, and the tooltip. |
| fx-sunburst-slice | Each ring segment; hovered, highlighted with a 3 px white stroke, and dimmed at opacity 0.35 come and go with the pointer and HighlightedNodeId. |
| fx-sunburst-label | A segment label, 10 px; level-1 makes the inner ring 11 px bold. Labels take no pointer events. |
| fx-sunburst-center-circle | The hub; drilldown-active while below the root. Its text is fx-center-sub for the title, fx-center-val for the value, fx-center-hint for the zoom-out hint and fx-center-subtitle for the root subtitle. |
| fx-sunburst-tooltip | The floating card, 12 px on a dark translucent background; inside are fx-tooltip-title, fx-tooltip-badge, fx-tooltip-stat rows of fx-stat-lbl and fx-stat-val, and fx-tooltip-hint. |

## Examples

### Covid

```razor
@using Fx.ControlKit
@using Fx.ControlKit.Charts
@using Fx.ControlKit.Grid

<ButtonGroupControl Items="_metricItems" Values="@(new[] { _useDeathsAsMetric ? "deaths" : "cases" })"
                    ValuesChanged="@(v => SwitchMetric(v.Count > 0 && v[0] == "deaths"))"
                    Selection="ChoiceSelectionMode.Single" AriaLabel="Metric" />
<ButtonControl CssClass="btn-sm" OnClick="ResetToWorld">Reset view</ButtonControl>

<div class="sunburst-body">
    <!-- Continent Quick-Filters & Search Bar -->
    <div class="row g-2 align-items-center mb-3">
        <div class="col-lg-8 col-md-12">
            <div class="d-flex flex-wrap gap-1 align-items-center">
                <span class="text-muted small fw-semibold me-1">Continents:</span>
                <button type="button" class="btn btn-sm @(_activeContinentFilter == null ? "btn-dark" : "btn-light border")"
                        @onclick="() => FilterByContinent(null)">
                    All Continents
                </button>
                <button type="button" class="btn btn-sm @(_activeContinentFilter == "Asia" ? "text-white" : "btn-light border")"
                        style="background: @(_activeContinentFilter == "Asia" ? "#0284c7" : "");"
                        @onclick='() => FilterByContinent("Asia")'>
                    <span class="d-inline-block rounded-circle me-1" style="width:8px;height:8px;background:#0284c7;"></span>
                    Asia (15.9M)
                </button>
                <button type="button" class="btn btn-sm @(_activeContinentFilter == "North America" ? "text-white" : "btn-light border")"
                        style="background: @(_activeContinentFilter == "North America" ? "#d97706" : "");"
                        @onclick='() => FilterByContinent("North America")'>
                    <span class="d-inline-block rounded-circle me-1" style="width:8px;height:8px;background:#d97706;"></span>
                    North America (14.6M)
                </button>
                <button type="button" class="btn btn-sm @(_activeContinentFilter == "Europe" ? "text-white" : "btn-light border")"
                        style="background: @(_activeContinentFilter == "Europe" ? "#059669" : "");"
                        @onclick='() => FilterByContinent("Europe")'>
                    <span class="d-inline-block rounded-circle me-1" style="width:8px;height:8px;background:#059669;"></span>
                    Europe (13.5M)
                </button>
                <button type="button" class="btn btn-sm @(_activeContinentFilter == "South America" ? "text-white" : "btn-light border")"
                        style="background: @(_activeContinentFilter == "South America" ? "#c026d3" : "");"
                        @onclick='() => FilterByContinent("South America")'>
                    <span class="d-inline-block rounded-circle me-1" style="width:8px;height:8px;background:#c026d3;"></span>
                    South America (10.7M)
                </button>
                <button type="button" class="btn btn-sm @(_activeContinentFilter == "Africa" ? "text-white" : "btn-light border")"
                        style="background: @(_activeContinentFilter == "Africa" ? "#6366f1" : "");"
                        @onclick='() => FilterByContinent("Africa")'>
                    <span class="d-inline-block rounded-circle me-1" style="width:8px;height:8px;background:#6366f1;"></span>
                    Africa (2.1M)
                </button>
                <button type="button" class="btn btn-sm @(_activeContinentFilter == "Oceania" ? "text-white" : "btn-light border")"
                        style="background: @(_activeContinentFilter == "Oceania" ? "#e11d48" : "");"
                        @onclick='() => FilterByContinent("Oceania")'>
                    <span class="d-inline-block rounded-circle me-1" style="width:8px;height:8px;background:#e11d48;"></span>
                    Oceania (49.9K)
                </button>
            </div>
        </div>

        <div class="col-lg-4 col-md-12">
            <div class="input-group input-group-sm">
                <span class="input-group-text bg-white border-end-0">🔍</span>
                <input type="text" class="form-control border-start-0" placeholder="Search country (e.g. Italy, India, USA)..."
                       value="@_searchQuery"
                       @oninput="HandleSearchInput" />
                @if (!string.IsNullOrEmpty(_searchQuery))
                {
                    <button class="btn btn-outline-secondary" type="button" @onclick="ClearSearch">✕</button>
                }
            </div>
        </div>
    </div>

    <!-- Main Content Stage -->
    <div class="row g-4">
        <!-- Sunburst Chart Stage -->
        <div class="col-xl-8 col-lg-7">
            <div class="card shadow-sm border h-100" style="background: #ffffff; border-radius: 12px;">
                <div class="card-header bg-white py-2 px-3 d-flex justify-content-between align-items-center border-bottom">
                    <span class="fw-bold text-secondary" style="font-size: 13px;">
                        Interactive Radial Sunburst Partition
                    </span>
                    <span class="badge bg-light text-dark border">
                        @(_useDeathsAsMetric ? "Showing Total Deaths" : "Showing Total Cases")
                    </span>
                </div>
                <div class="card-body p-3 d-flex flex-column align-items-center justify-content-center" style="min-height: 640px;">
                    <SunburstChartControl RootNode="@_sunburstRoot"
                                          MetricName="@(_useDeathsAsMetric ? "Deaths" : "Cases")"
                                          SecondaryMetricName="@(_useDeathsAsMetric ? "Cases" : "Deaths")"
                                          CenterTitle="@(_useDeathsAsMetric ? "TOTAL DEATHS" : "TOTAL CASES")"
                                          CenterColor="@(_useDeathsAsMetric ? "#e11d48" : "#38bdf8")"
                                          ValueFormat="N0"
                                          EnableDrilldown="true"
                                          ShowBreadcrumb="true"
                                          ShowLabels="true"
                                          HighlightedNodeId="@_highlightedNodeId"
                                          OnNodeClick="HandleNodeClick"
                                          OnNodeHover="HandleNodeHover"
                                          Height="620px" />
                </div>
            </div>
        </div>

        <!-- Right Side Panel: Stats, Active Inspector, and Leaderboard -->
        <div class="col-xl-4 col-lg-5 d-flex flex-column gap-3">
            <!-- Global Metrics Overview -->
            <div class="card shadow-sm border" style="border-radius: 12px;">
                <div class="card-header bg-white py-2 px-3 fw-bold small text-secondary">
                    Global Pandemic Key Metrics
                </div>
                <div class="card-body p-3">
                    <div class="row g-2 text-center">
                        <div class="col-6">
                            <div class="p-2 rounded" style="background: #eff6ff; border: 1px solid #bfdbfe;">
                                <div class="text-muted" style="font-size: 11px; text-transform: uppercase;">Total Cases</div>
                                <div class="fw-bold text-primary" style="font-size: 17px;">56,956,080</div>
                            </div>
                        </div>
                        <div class="col-6">
                            <div class="p-2 rounded" style="background: #fef2f2; border: 1px solid #fecaca;">
                                <div class="text-muted" style="font-size: 11px; text-transform: uppercase;">Total Deaths</div>
                                <div class="fw-bold text-danger" style="font-size: 17px;">1,397,672</div>
                            </div>
                        </div>
                        <div class="col-6">
                            <div class="p-2 rounded" style="background: #f8fafc; border: 1px solid #e2e8f0;">
                                <div class="text-muted" style="font-size: 11px; text-transform: uppercase;">Case Fatality Rate</div>
                                <div class="fw-bold text-dark" style="font-size: 17px;">2.45%</div>
                            </div>
                        </div>
                        <div class="col-6">
                            <div class="p-2 rounded" style="background: #f8fafc; border: 1px solid #e2e8f0;">
                                <div class="text-muted" style="font-size: 11px; text-transform: uppercase;">Territories</div>
                                <div class="fw-bold text-dark" style="font-size: 17px;">210 Countries</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Active Region Inspector Card -->
            <div class="card shadow-sm border" style="border-radius: 12px;">
                <div class="card-header bg-white py-2 px-3 fw-bold small text-secondary d-flex justify-content-between align-items-center">
                    <span>Region Inspector</span>
                    @if (_selectedOrHoveredNode != null && _selectedOrHoveredNode.Depth == 2)
                    {
                        <span class="badge bg-success-subtle text-success border border-success-subtle">Country</span>
                    }
                    else if (_selectedOrHoveredNode != null && _selectedOrHoveredNode.Depth == 1)
                    {
                        <span class="badge bg-info-subtle text-info border border-info-subtle">Continent</span>
                    }
                </div>
                <div class="card-body p-3">
                    @if (_selectedOrHoveredNode != null)
                    {
                        var node = _selectedOrHoveredNode;
                        var cases = _useDeathsAsMetric ? (node.SecondaryValue ?? 0) : node.Value;
                        var deaths = _useDeathsAsMetric ? node.Value : (node.SecondaryValue ?? 0);
                        var cfr = cases > 0 ? (deaths / cases * 100.0) : 0.0;
                        var pctWorld = (cases / CovidDataService.WorldTotalCases) * 100.0;

                        <div class="d-flex align-items-center gap-2 mb-3">
                            <span class="d-inline-block rounded-circle" style="width:14px; height:14px; background: @(node.Color ?? "#38bdf8");"></span>
                            <h5 class="mb-0 fw-bold">@node.Name</h5>
                            @if (node.CustomAttributes.TryGetValue("IsoCode", out var iso) && iso is string isoStr && !string.IsNullOrEmpty(isoStr))
                            {
                                <span class="badge bg-secondary">@isoStr</span>
                            }
                        </div>

                        <div class="d-flex flex-column gap-2 mb-3" style="font-size: 13px;">
                            <div class="d-flex justify-content-between border-bottom pb-1">
                                <span class="text-muted">Total Confirmed Cases:</span>
                                <strong class="text-primary">@cases.ToString("N0")</strong>
                            </div>
                            <div class="d-flex justify-content-between border-bottom pb-1">
                                <span class="text-muted">Total Reported Deaths:</span>
                                <strong class="text-danger">@deaths.ToString("N0")</strong>
                            </div>
                            <div class="d-flex justify-content-between border-bottom pb-1">
                                <span class="text-muted">Case Fatality Rate:</span>
                                <strong>@cfr.ToString("0.00")%</strong>
                            </div>
                            <div class="d-flex justify-content-between border-bottom pb-1">
                                <span class="text-muted">Share of Global Cases:</span>
                                <strong>@pctWorld.ToString("0.0")%</strong>
                            </div>
                            @if (node.CustomAttributes.TryGetValue("Continent", out var cont) && cont != null)
                            {
                                <div class="d-flex justify-content-between">
                                    <span class="text-muted">Continent:</span>
                                    <span>@cont</span>
                                </div>
                            }
                        </div>

                        @if (node.Children.Count > 0)
                        {
                            <button class="btn btn-sm btn-outline-primary w-100" @onclick="() => FilterByContinent(node.Name)">
                                Drill down into @node.Name (expand @node.Children.Count countries)
                            </button>
                        }
                    }
                    else
                    {
                        <div class="text-muted text-center py-4" style="font-size: 13px;">
                            <div style="font-size: 28px; margin-bottom: 6px;">👆</div>
                            Hover or click any segment on the sunburst chart to inspect country details and statistics.
                        </div>
                    }
                </div>
            </div>

            <!-- Top 10 Impacted Countries -->
            <div class="card shadow-sm border flex-grow-1" style="border-radius: 12px;">
                <div class="card-header bg-white py-2 px-3 fw-bold small text-secondary d-flex justify-content-between align-items-center">
                    <span>Top 10 Highest Cases</span>
                    <span class="text-muted" style="font-size: 11px;">Click to highlight</span>
                </div>
                <div class="card-body p-0">
                    <div class="list-group list-group-flush" style="font-size: 12.5px;">
                        @{ var topMax = _topCountries.Count > 0 ? _topCountries.Max(c => c.TotalCases) : 0.0; }
                        @foreach (var (country, idx) in _topCountries.Select((c, i) => (c, i + 1)))
                        {
                            var isSelected = _highlightedNodeName == country.Name;
                            var pct = topMax > 0 ? (country.TotalCases / topMax) * 100.0 : 0.0; // scaled to the #1 entry

                            <button type="button"
                                    class="list-group-item list-group-item-action d-flex flex-column py-2 px-3 @(isSelected ? "bg-light border-primary" : "")"
                                    @onclick="() => HighlightCountry(country.Name)">
                                <div class="d-flex justify-content-between align-items-center mb-1">
                                    <span>
                                        <b class="text-muted me-1">#@idx</b>
                                        <strong>@country.Name</strong>
                                        <small class="text-muted ms-1">(@country.Continent)</small>
                                    </span>
                                    <strong class="text-primary font-monospace">@country.TotalCases.ToString("N0")</strong>
                                </div>
                                <div class="progress" style="height: 4px;">
                                    <div class="progress-bar" style="width: @pct%; background-color: @country.Color;"></div>
                                </div>
                            </button>
                        }
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Underlying Data Explorer Section -->
    <div class="card shadow-sm border mt-4 mb-4" style="border-radius: 12px;">
        <div class="card-header bg-white py-3 px-4 d-flex justify-content-between align-items-center">
            <div>
                <h5 class="mb-0 fw-bold">Underlying COVID-19 Dataset Explorer</h5>
                <small class="text-muted">Tabulated country records powered by FlexCore GridControl with sorting, filtering, and paging</small>
            </div>
            <button class="btn btn-sm btn-outline-secondary" @onclick="() => _showGrid = !_showGrid">
                @(_showGrid ? "Hide Data Table ▲" : "Show Data Table ▼")
            </button>
        </div>

        @if (_showGrid)
        {
            <div class="card-body p-3">
                <GridControl TValue="CovidCountryData"
                             DataSource="@_filteredTableData"
                             AllowSorting="true"
                             AllowFiltering="true"
                             AllowPaging="true"
                             PageSize="15"
                             ShowRowCountInFooter="true"
                             Height="420px"
                             CssClass="fx-grid-compact">
                    <GridColumnsBase>
                        <GridColumn Field="@nameof(CovidCountryData.IsoCode)" HeaderText="ISO" Width="75px" TextAlign="TextAlign.Center" />
                        <GridColumn Field="@nameof(CovidCountryData.Name)" HeaderText="Country / Territory" Width="220px" />
                        <GridColumn Field="@nameof(CovidCountryData.Continent)" HeaderText="Continent" Width="140px" />
                        <GridColumn Field="@nameof(CovidCountryData.TotalCases)" HeaderText="Total Cases" Width="130px" Type="ColumnType.Number" TextAlign="TextAlign.Right" Format="#,##0" />
                        <GridColumn Field="@nameof(CovidCountryData.TotalDeaths)" HeaderText="Total Deaths" Width="120px" Type="ColumnType.Number" TextAlign="TextAlign.Right" Format="#,##0" />
                        <GridColumn Field="@nameof(CovidCountryData.TotalCasesPerMillion)" HeaderText="Cases / Million" Width="130px" Type="ColumnType.Number" TextAlign="TextAlign.Right" Format="#,##0.0" />
                        <GridColumn Field="@nameof(CovidCountryData.TotalDeathsPerMillion)" HeaderText="Deaths / Million" Width="130px" Type="ColumnType.Number" TextAlign="TextAlign.Right" Format="#,##0.0" />
                    </GridColumnsBase>
                </GridControl>
            </div>
        }
    </div>
</div>
```

```csharp
private readonly SelectionItem[] _metricItems = { new("cases", "Total cases (56.96M)"), new("deaths", "Total deaths (1.40M)") };

private SunburstNode _sunburstRoot = default!;

private SunburstNode? _selectedOrHoveredNode;

private bool _useDeathsAsMetric = false;

private string? _activeContinentFilter;

private string? _highlightedNodeId;

private string? _highlightedNodeName;

private string _searchQuery = "";

private bool _showGrid = false;

private List<CovidCountryData> _allCountryData = new();

private List<CovidCountryData> _topCountries = new();

private List<CovidCountryData> _filteredTableData = new();

protected override void OnInitialized()
{
    LoadData();
}

private void LoadData()
{
    _allCountryData = CovidDataService.GetFlatCountryData();
    _topCountries = _allCountryData.OrderByDescending(c => c.TotalCases).Take(10).ToList();
    _filteredTableData = _allCountryData;
    _sunburstRoot = CovidDataService.GetCovidSunburstTree(_useDeathsAsMetric);
    _selectedOrHoveredNode = _sunburstRoot;
}

private void SwitchMetric(bool useDeaths)
{
    _useDeathsAsMetric = useDeaths;
    _sunburstRoot = CovidDataService.GetCovidSunburstTree(_useDeathsAsMetric);
    if (!string.IsNullOrEmpty(_activeContinentFilter))
    {
        var match = _sunburstRoot.Children.FirstOrDefault(c => c.Name.Equals(_activeContinentFilter, StringComparison.OrdinalIgnoreCase));
        if (match != null)
            _selectedOrHoveredNode = match;
    }
    else
    {
        _selectedOrHoveredNode = _sunburstRoot;
    }
}

private void ResetToWorld()
{
    _activeContinentFilter = null;
    _highlightedNodeId = null;
    _highlightedNodeName = null;
    _searchQuery = "";
    _sunburstRoot = CovidDataService.GetCovidSunburstTree(_useDeathsAsMetric);
    _selectedOrHoveredNode = _sunburstRoot;
    _filteredTableData = _allCountryData;
}

private void FilterByContinent(string? continent)
{
    _activeContinentFilter = continent;
    _highlightedNodeId = null;
    _highlightedNodeName = null;

    if (string.IsNullOrEmpty(continent))
    {
        ResetToWorld();
        return;
    }

    var fullTree = CovidDataService.GetCovidSunburstTree(_useDeathsAsMetric);
    var targetContinent = fullTree.Children.FirstOrDefault(c => c.Name.Equals(continent, StringComparison.OrdinalIgnoreCase));
    if (targetContinent != null)
    {
        _sunburstRoot = targetContinent;
        _selectedOrHoveredNode = targetContinent;
        _filteredTableData = _allCountryData.Where(c => c.Continent.Equals(continent, StringComparison.OrdinalIgnoreCase)).ToList();
    }
}

private void HighlightCountry(string name)
{
    _highlightedNodeName = name;
    var node = _sunburstRoot.Flatten().FirstOrDefault(n => n.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
    if (node != null)
    {
        _highlightedNodeId = node.Id;
        _selectedOrHoveredNode = node;
    }
}

private void HandleSearchInput(ChangeEventArgs e)
{
    _searchQuery = e.Value?.ToString() ?? "";
    if (string.IsNullOrWhiteSpace(_searchQuery))
    {
        _highlightedNodeId = null;
        _highlightedNodeName = null;
        _filteredTableData = _allCountryData;
        return;
    }

    var match = _allCountryData.FirstOrDefault(c => c.Name.Contains(_searchQuery, StringComparison.OrdinalIgnoreCase));
    if (match != null)
    {
        HighlightCountry(match.Name);
    }

    _filteredTableData = _allCountryData
        .Where(c => c.Name.Contains(_searchQuery, StringComparison.OrdinalIgnoreCase) || c.Continent.Contains(_searchQuery, StringComparison.OrdinalIgnoreCase))
        .ToList();
}

private void ClearSearch()
{
    _searchQuery = "";
    _highlightedNodeId = null;
    _highlightedNodeName = null;
    _filteredTableData = _allCountryData;
}

private void HandleNodeClick(SunburstNode node)
{
    _selectedOrHoveredNode = node;
    _highlightedNodeId = node.Id;
    _highlightedNodeName = node.Name;
}

private void HandleNodeHover(SunburstNode? node)
{
    if (node != null)
    {
        _selectedOrHoveredNode = node;
    }
}
```

