Skip to content
ChartForgeX
Class

HtmlChartRenderer

ChartForgeX.Html

Namespace
ChartForgeX.Html
Assembly
ChartForgeX
Modifiers
sealed

Renders charts as dependency-free HTML with inline SVG.

Inheritance

  • object
  • HtmlChartRenderer

Constructors

public HtmlChartRenderer() #

Methods

RenderFragment 3 overloads
public string RenderFragment(Chart chart) #

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) #

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) #

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) #

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) #

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.

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) #

Renders one native drawing per width, as HtmlChartRenderer.RenderWidths 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.

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.

Properties

public string? Nonce { get; set; } #

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).

public static IReadOnlyList<int> StandardWidths { get; } #

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