# Domain controller round-trip time · Line

Preview

![Domain controller round-trip time](family-line-latency-week-light.png)

![Domain controller round-trip time](family-line-latency-week-dark.png)

800 × 440 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](family-line-latency-week-light.gallery.csharp.txt) 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 = LatencyWeekRecipe.Create("latency-week", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(800, 440)), theme, mode,
    new VisualFrame("Domain controller round-trip time", "Hourly ping from the monitoring host, 19\u201325 October 2026 (UTC)", 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>Builds a week of hourly ping latency for three domain controllers, as a monitoring report shows it.</summary>
public static class LatencyWeekRecipe {
    /// <summary>Creates the latency week; the compact variant keeps the same data.</summary>
    public static Chart Create(string variant = "latency-week", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("latency-week" or "compact-latency-week")) throw new ArgumentOutOfRangeException(nameof(variant));
        var start = new DateTime(2026, 10, 19, 0, 0, 0, DateTimeKind.Utc);
        var chart = Chart.Create().XAxis(x => x.TimeScale(timeZone: TimeZoneInfo.Utc)).YAxis(y => y.Title("Round-trip time (ms)")).ValueUnit("ms")
            .ValueFormat(ChartValueFormat.Number("0.#", CultureInfo.InvariantCulture));
        var controllers = new[] { ("dc-01", 18d), ("dc-02", 27d), ("dc-03", 41d) };
        for (var controller = 0; controller < controllers.Length; controller++) {
            var (name, baseline) = controllers[controller];
            var points = new List<ChartPoint>();
            for (var hour = 0; hour < 7 * 24; hour++) {
                // Working hours add load; a fixed pseudo-random jitter stands in for measurement noise.
                var load = hour % 24 is >= 8 and < 18 && hour / 24 % 7 < 5 ? 9 : 0;
                var noise = Math.Sin(hour * 12.9898 + controller * 78.233) * 43758.5453;
                var ripple = (noise - Math.Floor(noise)) * 6;
                var incident = controller == 2 && hour is >= 98 and < 102 ? 46 : 0;
                points.Add(new ChartPoint(start.AddHours(hour), Math.Round(baseline + load + ripple + incident, 1)));
            }
            chart.AddSeries(ChartSeries.CreateLine(new ChartSeriesId(name), name, points));
        }
        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 = LatencyWeekRecipe.Create("latency-week", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(800, 440)), theme, mode,
    new VisualFrame("Domain controller round-trip time", "Hourly ping from the monitoring host, 19\u201325 October 2026 (UTC)", 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>Builds a week of hourly ping latency for three domain controllers, as a monitoring report shows it.</summary>
public static class LatencyWeekRecipe {
    /// <summary>Creates the latency week; the compact variant keeps the same data.</summary>
    public static Chart Create(string variant = "latency-week", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("latency-week" or "compact-latency-week")) throw new ArgumentOutOfRangeException(nameof(variant));
        var start = new DateTime(2026, 10, 19, 0, 0, 0, DateTimeKind.Utc);
        var chart = Chart.Create().XAxis(x => x.TimeScale(timeZone: TimeZoneInfo.Utc)).YAxis(y => y.Title("Round-trip time (ms)")).ValueUnit("ms")
            .ValueFormat(ChartValueFormat.Number("0.#", CultureInfo.InvariantCulture));
        var controllers = new[] { ("dc-01", 18d), ("dc-02", 27d), ("dc-03", 41d) };
        for (var controller = 0; controller < controllers.Length; controller++) {
            var (name, baseline) = controllers[controller];
            var points = new List<ChartPoint>();
            for (var hour = 0; hour < 7 * 24; hour++) {
                // Working hours add load; a fixed pseudo-random jitter stands in for measurement noise.
                var load = hour % 24 is >= 8 and < 18 && hour / 24 % 7 < 5 ? 9 : 0;
                var noise = Math.Sin(hour * 12.9898 + controller * 78.233) * 43758.5453;
                var ripple = (noise - Math.Floor(noise)) * 6;
                var incident = controller == 2 && hour is >= 98 and < 102 ? 46 : 0;
                points.Add(new ChartPoint(start.AddHours(hour), Math.Round(baseline + load + ripple + incident, 1)));
            }
            chart.AddSeries(ChartSeries.CreateLine(new ChartSeriesId(name), name, points));
        }
        return chart;
    }
}
```

<!-- PowerForge markdown artifact sha256:8961ED4B741416B840ECA1AC364DB7434DBA6A63039850275B31FF2BEBA7F8C2 -->
