# HtmlChartRenderer

Renders charts as dependency-free HTML with inline SVG.

 Class  

`ChartForgeX.Html`

**Namespace**

`ChartForgeX.Html`

**Assembly**

`ChartForgeX`

**Source**

[HtmlChartRenderer.cs:28](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Html/HtmlChartRenderer.cs#L28)

**Modifiers**

sealed

Renders charts as dependency-free HTML with inline SVG.

## Inheritance

- object
- HtmlChartRenderer

 Filter members   

    Show inherited   

 

## Constructors

 `public HtmlChartRenderer()` [#](#constructor-ctor) 

## Methods

 RenderFragment 3 overloads 

 `public string RenderFragment(Chart chart)` [#](#method-renderfragment-chartforgex-core-chart) 

[HtmlChartRenderer.cs:28](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Html/HtmlChartRenderer.cs#L28)

Renders a chart as an embeddable HTML fragment.

Parameters

**chart ChartForgeX.Core.Chart required**

The chart to render.

Returns

 `string` An HTML fragment containing inline SVG. 

 `public string RenderFragment(Chart chart, string idScope)` [#](#method-renderfragment-chartforgex-core-chart-string) 

[HtmlChartRenderer.cs:36](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Html/HtmlChartRenderer.cs#L36)

Renders a chart as an embeddable HTML fragment with a caller-provided deterministic ID scope.

Parameters

**chart ChartForgeX.Core.Chart required**

The chart to render.

**idScope string required**

A stable scope used to keep IDs unique when embedding equivalent fragments together.

Returns

 `string` An HTML fragment containing inline SVG. 

 `public string RenderFragment(Chart chart, VisualSvgOptions svgOptions, ChartDataTableMode dataTable = None)` [#](#method-renderfragment-chartforgex-core-chart-chartforgex-rendering-visualsvgoptions-chartforgex-html-chartdatatablemode) 

[HtmlChartRenderer.cs:52](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Html/HtmlChartRenderer.cs#L52)

Renders inline SVG with an optional accessible table of authored display observations.

Parameters

**chart ChartForgeX.Core.Chart required**

The chart to render.

**svgOptions ChartForgeX.Rendering.VisualSvgOptions required**

The SVG export policy, including its deterministic ID scope.

**dataTable ChartForgeX.Html.ChartDataTableMode = None optional**

Whether data tables are omitted, disclosed in details, or visually hidden on screen and visible in print.

Returns

 `string` An HTML fragment containing SVG and, when requested, one captioned table per series. 

Exceptions

- `NotSupportedException` – A requested table contains a typed series without a table representation.

 `public string RenderPage(Chart chart)` [#](#method-renderpage-chartforgex-core-chart) 

[HtmlChartRenderer.cs:82](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Html/HtmlChartRenderer.cs#L82)

Renders a chart as a complete HTML document.

Parameters

**chart ChartForgeX.Core.Chart required**

The chart to render.

Returns

 `string` A complete HTML document. 

 RenderWidths 2 overloads 

 `public string RenderWidths(Chart chart, string idScope, params int[] widths)` [#](#method-renderwidths-chartforgex-core-chart-string-int32) 

[HtmlChartRenderer.Widths.cs:27](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Html/HtmlChartRenderer.Widths.cs#L27)

Renders one native drawing per width and lets the container choose between them, without script.

Parameters

**chart ChartForgeX.Core.Chart required**

The chart; its authored size is restored afterwards.

**idScope string required**

A stable scope; each drawing gets its own ID scope inside it.

**widths int[] required**

Drawing widths in CSS pixels, at least two, each from 160 to 8192. Defaults to [HtmlChartRenderer.StandardWidths](/api/chartforgex-html-htmlchartrenderer/).

Returns

 `string` A fragment that shows the widest drawing that fits its container, or the narrowest one scaled down. Every drawing is prepared natively at its own width, so ticks, captions and legends are laid out for that width, and grows until the next one takes over; the widest keeps its native width. 

 `public string RenderWidths(Chart chart, HtmlWidthSetOptions options, string idScope, params int[] widths)` [#](#method-renderwidths-chartforgex-core-chart-chartforgex-html-htmlwidthsetoptions-string-int32) 

[HtmlChartRenderer.Widths.cs:39](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Html/HtmlChartRenderer.Widths.cs#L39)

Renders one native drawing per width, as [HtmlChartRenderer.RenderWidths](/api/chartforgex-html-htmlchartrenderer/) does, and optionally the chart's data for scripts.

Parameters

**chart ChartForgeX.Core.Chart required**

The chart; its authored size is restored afterwards.

**options ChartForgeX.Html.HtmlWidthSetOptions required**

Whether the fragment carries the data block and hover positions.

**idScope string required**

A stable scope; each drawing gets its own ID scope inside it.

**widths int[] required**

Drawing widths in CSS pixels, at least two, each from 160 to 8192. Defaults to [HtmlChartRenderer.StandardWidths](/api/chartforgex-html-htmlchartrenderer/).

Returns

 `string` The fragment. The data block is one script element of type application/json inside it: browsers never run it, so content security policies do not apply to it. 

## Inherited Methods

 `public virtual bool Equals(object? obj)` [#](#method-equals-object) 

Inherited from object

Parameters

**obj object? required**

Returns

 `bool` 

 `public virtual int GetHashCode()` [#](#method-gethashcode) 

Inherited from object

Returns

 `int` 

 `public Type GetType()` [#](#method-gettype) 

Inherited from object

Returns

 `Type` 

 `public virtual string? ToString()` [#](#method-tostring) 

Inherited from object

Returns

 `string?` 

## Properties

 `public string? Nonce { get; set; }` [#](#property-nonce) 

[HtmlChartRenderer.cs:19](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Html/HtmlChartRenderer.cs#L19)

Gets or sets the content security policy nonce. When set, fragments and pages carry no style attributes: every inline style and style element moves into one style element with this nonce (see [HtmlStrictStyles](/api/chartforgex-html-htmlstrictstyles/)).

 `public static IReadOnlyList<int> StandardWidths { get; }` [#](#property-standardwidths) 

[HtmlChartRenderer.Widths.cs:14](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Html/HtmlChartRenderer.Widths.cs#L14)

The standard dashboard widths: desktop card, tablet and phone.

<!-- PowerForge markdown artifact sha256:F4B9AD0EFE9CF6CB1729F41C33881F73F6D08AE10C042BD866D030A7C1EA0395 -->
