← Gallery

Sunburst

Allocation through the team hierarchy

Explore the example, download the output or use the C# source in your own project.

Preview
Allocation through the team hierarchyChart with 1 data series: Regional allocation.
Allocation through the team hierarchy
Allocation through the team hierarchyChart with 1 data series: Regional allocation.
Allocation through the team hierarchy
360 × 360 pixels

Create this example

Create a console project, add the ChartForgeX package, and replace Program.cs with this source. Run it to write SVG, PNG and HTML with the default system fonts.

For the same typography as the gallery, download the gallery-font recipe and copy the gallery’s fonts directory beside your program.

#region Setup
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using ChartForgeX;
using ChartForgeX.Core;
using ChartForgeX.Primitives;
using ChartForgeX.Rendering;
using ChartForgeX.Themes;
using ChartForgeX.Topology;
using ChartForgeX.Typography;
using ChartForgeX.VisualArtifacts;
using ChartForgeX.VisualBlocks;

var mode = ThemeMode.Light;
var theme = VisualTheme.Graphite();
var model = SunburstCurvedLabelsRecipe.Create("compact-curved-labels", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(360, 360)), theme, mode,
    new VisualFrame("Allocation through the team hierarchy", "", showLegend: null, showSurface: false));
var prepared = model.Prepare(context);
File.WriteAllText("visual.svg", prepared.ToSvg());
File.WriteAllBytes("visual.png", prepared.ToPng());
File.WriteAllText("visual.html", prepared.ToArtifact("example", VisualArtifactKind.Chart).ToHtmlPage());
#endregion

/// <summary>Places complete supported primary names on captured native circular lanes without changing hierarchy allocation.</summary>
public static class SunburstCurvedLabelsRecipe {
    /// <summary>Creates the source model for a compact or wide consumer, independently of the export backend.</summary>
    public static Chart Create(string variant = "curved-labels", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("curved-labels" or "compact-curved-labels")) throw new ArgumentOutOfRangeException(nameof(variant));
        var chart = Chart.Create().Legend(false).DataLabels().TransparentBackground(false)
            .AddSunburst("Regional allocation", new[] {
                new ChartHierarchyItem("all", "Allocation"),
                new ChartHierarchyItem("operations", "Operations and service delivery", "all"),
                new ChartHierarchyItem("engineering", "Engineering and platform ownership", "all"),
                new ChartHierarchyItem("reconciliation", "Regional reconciliation", "operations", 25),
                new ChartHierarchyItem("settlement", "Settlement operations", "operations", 25),
                new ChartHierarchyItem("automation", "Automation services", "engineering", 25),
                new ChartHierarchyItem("platform", "Platform operations", "engineering", 25)
            }).Sunburst(options => {
                options.CurvedLabels = true;
                options.SectorGap = 3;
                options.CornerRadius = 3;
                options.MinimumLabelFontSize = 11;
            });
        chart.Series[0].DataLabelStyle(style => style.FontSize(13));
        return chart;
    }
}
#region Setup
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using ChartForgeX;
using ChartForgeX.Core;
using ChartForgeX.Primitives;
using ChartForgeX.Rendering;
using ChartForgeX.Themes;
using ChartForgeX.Topology;
using ChartForgeX.Typography;
using ChartForgeX.VisualArtifacts;
using ChartForgeX.VisualBlocks;

var mode = ThemeMode.Dark;
var theme = VisualTheme.Graphite();
var model = SunburstCurvedLabelsRecipe.Create("compact-curved-labels", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(360, 360)), theme, mode,
    new VisualFrame("Allocation through the team hierarchy", "", showLegend: null, showSurface: false));
var prepared = model.Prepare(context);
File.WriteAllText("visual.svg", prepared.ToSvg());
File.WriteAllBytes("visual.png", prepared.ToPng());
File.WriteAllText("visual.html", prepared.ToArtifact("example", VisualArtifactKind.Chart).ToHtmlPage());
#endregion

/// <summary>Places complete supported primary names on captured native circular lanes without changing hierarchy allocation.</summary>
public static class SunburstCurvedLabelsRecipe {
    /// <summary>Creates the source model for a compact or wide consumer, independently of the export backend.</summary>
    public static Chart Create(string variant = "curved-labels", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("curved-labels" or "compact-curved-labels")) throw new ArgumentOutOfRangeException(nameof(variant));
        var chart = Chart.Create().Legend(false).DataLabels().TransparentBackground(false)
            .AddSunburst("Regional allocation", new[] {
                new ChartHierarchyItem("all", "Allocation"),
                new ChartHierarchyItem("operations", "Operations and service delivery", "all"),
                new ChartHierarchyItem("engineering", "Engineering and platform ownership", "all"),
                new ChartHierarchyItem("reconciliation", "Regional reconciliation", "operations", 25),
                new ChartHierarchyItem("settlement", "Settlement operations", "operations", 25),
                new ChartHierarchyItem("automation", "Automation services", "engineering", 25),
                new ChartHierarchyItem("platform", "Platform operations", "engineering", 25)
            }).Sunburst(options => {
                options.CurvedLabels = true;
                options.SectorGap = 3;
                options.CornerRadius = 3;
                options.MinimumLabelFontSize = 11;
            });
        chart.Series[0].DataLabelStyle(style => style.FontSize(13));
        return chart;
    }
}