# Your first static chart

Render the same typed ChartForgeX chart as SVG, HTML, and PNG from one C# definition.

 [All examples](/examples/) Static Chart 

 static-chart.svg  [SVG 143.4 KB](/site/examples/static-chart-light.svg) [SVG 143.4 KB](/site/examples/static-chart-dark.svg) [PNG 20 KB](/site/examples/static-chart-light.png) [PNG 20 KB](/site/examples/static-chart-dark.png) [HTML](/site/examples/static-chart-light.html) [HTML](/site/examples/static-chart-dark.html) [C# program](/site/examples/static-chart.csharp.txt)  

 ![Your first static chart: the SVG this program renders.](/site/examples/static-chart-light.svg) ![Your first static chart: the SVG this program renders, dark theme.](/site/examples/static-chart-dark.svg) 

Rendered by ChartForgeX from the program below. The files follow the page theme.

One typed definition renders to every surface. The output above is this program's SVG; choose `--dark` when running the complete program to use the dark theme.

## Describe the chart

Create the chart once: a title, axis titles, a size and the category labels. Series draw in the order you add them, so the failed checks sit on top of the passed area.

```csharp
using System;
using System.Collections.Generic;
using System.Linq;
using ChartForgeX;
using ChartForgeX.Core;
using ChartForgeX.Primitives;
using ChartForgeX.Themes;

var mode = args.Contains("--dark")
    ? ThemeMode.Dark : ThemeMode.Light;

var chart = Chart.Create()
    .ThemeMode(mode)
    .Title("Deployment health")
    .XAxis(x => x.Title("Run"))
    .YAxis(y => y.Title("Checks"))
    .Size(800, 434)
    .XLabels("Mon", "Tue", "Wed", "Thu", "Fri")
    .AddSmoothArea("Passed", Points(820, 940, 980, 1040, 1120))
    .AddSmoothLine("Failed", Points(22, 30, 28, 21, 18),
        ChartColor.FromRgb(248, 113, 113));
```

## Save each surface

`To*` methods return content, `Save*` methods write files, and `Write*` methods stream bytes. SVG is the highest-fidelity static target; HTML wraps inline SVG; PNG is useful for email and document pipelines.

```csharp
chart.SaveSvg("deployment-health.svg");
chart.SaveHtml("deployment-health.html");
chart.SavePng("deployment-health.png");
```

## Supply the points

A small helper turns plain values into points at x = 1, 2, 3 and so on, one for each category label.

```csharp
static IEnumerable<ChartPoint> Points(params double[] values) {
    for (var index = 0; index < values.Length; index++) {
        yield return new ChartPoint(index + 1, values[index]);
    }
}
```

<!-- PowerForge markdown source sha256:FF82B8932C7EABC860EE61D0BF746C43A13F120EE99232D45904BBAB76877F83; title=True -->

<!-- PowerForge markdown artifact sha256:64DBA936FDA063133D7B6D8742EF5DC9F0A408341445822C5985F22640CDDA89 -->
