← Gallery

Dashboard

Service desk operations

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

Preview
Service desk operationsFour chart families in one ChartGridMon, 08: 73Mon, 10: 77Mon, 12: 64Mon, 14: 43Mon, 16: 31Mon, 18: 35Tue, 08: 58Tue, 10: 62Tue, 12: 49Tue, 14: 28Tue, 16: 16Tue, 18: 20Wed, 08: 55Wed, 10: 59Wed, 12: 46Wed, 14: 25Wed, 16: 13Wed, 18: 17Thu, 08: 52Thu, 10: 56Thu, 12: 43Thu, 14: 22Thu, 16: 10Thu, 18: 14Fri, 08: 49Fri, 10: 53Fri, 12: 40Fri, 14: 19Fri, 16: 7Fri, 18: 11
Service desk operations
Service desk operationsFour chart families in one ChartGridMon, 08: 73Mon, 10: 77Mon, 12: 64Mon, 14: 43Mon, 16: 31Mon, 18: 35Tue, 08: 58Tue, 10: 62Tue, 12: 49Tue, 14: 28Tue, 16: 16Tue, 18: 20Wed, 08: 55Wed, 10: 59Wed, 12: 46Wed, 14: 25Wed, 16: 13Wed, 18: 17Thu, 08: 52Thu, 10: 56Thu, 12: 43Thu, 14: 22Thu, 16: 10Thu, 18: 14Fri, 08: 49Fri, 10: 53Fri, 12: 40Fri, 14: 19Fri, 16: 7Fri, 18: 11
Service desk operations
1040 × 620 pixels

Create this example

Create a console project, add the ChartForgeX and ChartForgeX.Interactivity.Html packages, 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 = OperationsDashboardRecipe.Create("wide", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(1040, 620)), theme, mode,
    new VisualFrame("Service desk operations", "Four chart families in one ChartGrid", 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>An operations dashboard: one ChartGrid of a trend, a share, a heatmap and a gauge.</summary>
public static class OperationsDashboardRecipe {
    public static ChartGrid Create(string variant = "wide", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("wide" or "compact")) throw new ArgumentOutOfRangeException(nameof(variant));
        var weeks = Enumerable.Range(1, 12).ToArray();
        var trend = Chart.Create().Title("Tickets per week").Subtitle("Opened against resolved")
            .XLabels(weeks.Select(week => "W" + week).ToArray())
            .AddSeries(ChartSeries.CreateArea(new ChartSeriesId("opened"), "Opened",
                weeks.Select(week => new ChartPoint(week, Math.Round(420 + Math.Sin(week * .8) * 60 + week * 6)))))
            .AddSeries(ChartSeries.CreateLine(new ChartSeriesId("resolved"), "Resolved",
                weeks.Select(week => new ChartPoint(week, Math.Round(400 + Math.Sin(week * .8 - .6) * 55 + week * 9)))));
        var channels = Chart.Create().Title("Tickets by channel").Subtitle("This quarter")
            .XLabels("Portal", "Email", "Phone", "Chat")
            .AddDonut("Tickets", new[] { new ChartPoint(1, 2430), new ChartPoint(2, 1320), new ChartPoint(3, 870), new ChartPoint(4, 640) });
        var hours = new[] { "08", "10", "12", "14", "16", "18" };
        var days = new[] { "Mon", "Tue", "Wed", "Thu", "Fri" };
        var load = Chart.Create().Title("Calls by hour").Subtitle("Average per weekday").XLabels(hours)
            .AddHeatmapRows(days, days.Select((day, d) => hours.Select((hour, h) => Math.Round(42 + 24 * Math.Sin((h + 1) * .9) + (d == 0 ? 12 : 0) - d * 3))))
            .Heatmap(heatmap => heatmap.ColorDimension(dimension => dimension.ShowLegend = false));
        var sla = Chart.Create().Title("Resolved within SLA").Subtitle("Target 95%")
            .AddSeries(ChartSeries.CreateGauge(new ChartSeriesId("sla"), "Within SLA",
                new ChartGaugeValue(92.4, targets: new[] { new ChartGaugeTarget(95) })));
        var compact = variant == "compact";
        var grid = ChartGrid.Create().ThemeMode(mode).Columns(compact ? 1 : 3).Gap(16)
            .PanelSize(compact ? 360 : 320, 260).PanelFit(VisualPanelFit.Stretch);
        return compact ? grid.Add(trend).Add(channels).Add(sla)
            : grid.Add(trend, 2).Add(channels).Add(load, 2).Add(sla);
    }
}
#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 = OperationsDashboardRecipe.Create("wide", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(1040, 620)), theme, mode,
    new VisualFrame("Service desk operations", "Four chart families in one ChartGrid", 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>An operations dashboard: one ChartGrid of a trend, a share, a heatmap and a gauge.</summary>
public static class OperationsDashboardRecipe {
    public static ChartGrid Create(string variant = "wide", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("wide" or "compact")) throw new ArgumentOutOfRangeException(nameof(variant));
        var weeks = Enumerable.Range(1, 12).ToArray();
        var trend = Chart.Create().Title("Tickets per week").Subtitle("Opened against resolved")
            .XLabels(weeks.Select(week => "W" + week).ToArray())
            .AddSeries(ChartSeries.CreateArea(new ChartSeriesId("opened"), "Opened",
                weeks.Select(week => new ChartPoint(week, Math.Round(420 + Math.Sin(week * .8) * 60 + week * 6)))))
            .AddSeries(ChartSeries.CreateLine(new ChartSeriesId("resolved"), "Resolved",
                weeks.Select(week => new ChartPoint(week, Math.Round(400 + Math.Sin(week * .8 - .6) * 55 + week * 9)))));
        var channels = Chart.Create().Title("Tickets by channel").Subtitle("This quarter")
            .XLabels("Portal", "Email", "Phone", "Chat")
            .AddDonut("Tickets", new[] { new ChartPoint(1, 2430), new ChartPoint(2, 1320), new ChartPoint(3, 870), new ChartPoint(4, 640) });
        var hours = new[] { "08", "10", "12", "14", "16", "18" };
        var days = new[] { "Mon", "Tue", "Wed", "Thu", "Fri" };
        var load = Chart.Create().Title("Calls by hour").Subtitle("Average per weekday").XLabels(hours)
            .AddHeatmapRows(days, days.Select((day, d) => hours.Select((hour, h) => Math.Round(42 + 24 * Math.Sin((h + 1) * .9) + (d == 0 ? 12 : 0) - d * 3))))
            .Heatmap(heatmap => heatmap.ColorDimension(dimension => dimension.ShowLegend = false));
        var sla = Chart.Create().Title("Resolved within SLA").Subtitle("Target 95%")
            .AddSeries(ChartSeries.CreateGauge(new ChartSeriesId("sla"), "Within SLA",
                new ChartGaugeValue(92.4, targets: new[] { new ChartGaugeTarget(95) })));
        var compact = variant == "compact";
        var grid = ChartGrid.Create().ThemeMode(mode).Columns(compact ? 1 : 3).Gap(16)
            .PanelSize(compact ? 360 : 320, 260).PanelFit(VisualPanelFit.Stretch);
        return compact ? grid.Add(trend).Add(channels).Add(sla)
            : grid.Add(trend, 2).Add(channels).Add(load, 2).Add(sla);
    }
}