Skip to content
ChartForgeX
Class

ChartGrid

ChartForgeX.Core

Namespace
ChartForgeX.Core
Assembly
ChartForgeX
Modifiers
sealed
Attributes
Fluent

Describes a dependency-free small-multiple report made from multiple charts.

Inheritance

  • object
  • ChartGrid

Usage

Explore 124 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 83

Constructors

public ChartGrid() #

Methods

Add 2 overloads
public ChartGrid Add(Chart chart) #

Adds a chart to the grid.

Parameters

chart ChartForgeX.Core.Chart required
The chart to add.

Returns

ChartGrid The current chart grid.
public ChartGrid Add(Chart chart, int columnSpan, int rowSpan = 1) #

Adds a chart to the grid with a panel span.

Parameters

chart ChartForgeX.Core.Chart required
The chart to add.
columnSpan int required
The number of columns occupied by the chart panel.
rowSpan int = 1 optional
The number of rows occupied by the chart panel.

Returns

ChartGrid The current chart grid.
public static ChartGrid Create() #

Creates a new chart grid.

Returns

ChartGrid A new chart grid instance.
public static ChartGrid FromFacets<T, TKey>(ChartDataset<T?> dataset, Func<T?, TKey?> facet, Func<TKey?, ChartDataset<T?>, Chart> chartFactory, int columns = 2, IEqualityComparer<TKey?>? comparer = null) #

Builds a small-multiple grid from deterministic dataset groups.

Type Parameters

T
TKey

Parameters

dataset ChartForgeX.Data.ChartDataset<T?> required
facet System.Func<T?, TKey?> required
chartFactory System.Func<TKey?, ChartForgeX.Data.ChartDataset<T?>, ChartForgeX.Core.Chart> required
columns int = 2 optional
comparer System.Collections.Generic.IEqualityComparer<TKey?>? = null optional

Returns

ChartGrid
public IReadOnlyList<ChartGridPage> Paginate(int maximumChartsPerPage = 6) #

Splits this grid into ordered pages with at most the specified number of charts.

Parameters

maximumChartsPerPage int = 6 optional
The maximum chart count per page, independent of panel spans.

Returns

IReadOnlyList<ChartGridPage> Read-only page metadata and independently configurable grids; an empty grid produces no pages.
public ChartGrid PanelSpan(int chartIndex, int columnSpan, int rowSpan = 1) #

Sets the panel span for an existing chart in the grid.

Parameters

chartIndex int required
The zero-based chart index.
columnSpan int required
The number of columns occupied by the chart panel.
rowSpan int = 1 optional
The number of rows occupied by the chart panel.

Returns

ChartGrid The current chart grid.
public PreparedVisual Prepare(VisualRenderContext context) #

Prepares all panels once in the supplied fixed viewport and common frame.

Parameters

context ChartForgeX.Rendering.VisualRenderContext required
public ChartGrid ShareAxes() #

Applies shared cartesian x-axis and y-axis ranges to all compatible charts in the grid.

Returns

ChartGrid The current chart grid.
public ChartGrid ShareXAxis() #

Applies one shared cartesian x-axis range to all compatible charts in the grid.

Returns

ChartGrid The current chart grid.
public ChartGrid ShareYAxis() #

Applies one shared cartesian y-axis range to all compatible charts in the grid.

Returns

ChartGrid The current chart grid.

Properties

public string Title { get; set; } #

Gets or sets the report title.

public string Subtitle { get; set; } #

Gets or sets the report subtitle.

public int Columns { get; set; } #

Gets or sets the preferred number of columns on wide viewports.

public bool PreserveEmptyColumns { get; set; } #

Gets or sets whether composed SVG and PNG exports retain columns without charts.

public int Gap { get; set; } #

Gets or sets the gap between charts in pixels.

public int Padding { get; set; } #

Gets or sets the outer padding around exported grid content in pixels.

public int RasterScale { get; set; } #

Gets or sets the output pixel multiplier used by composed PNG grid exports.

public ChartSize? PanelSize { get; set; } #

Gets or sets the optional fixed panel size used by composed SVG and PNG grid exports.

public VisualPanelFit PanelFit { get; set; } #

Gets or sets how charts fit inside fixed-size grid panels.

public VisualTheme Theme { get; set; } #

Gets or sets the paired theme for the grid frame and, by default, every panel.

public ThemeMode ThemeMode { get; set; } #

Gets or sets the explicit palette mode for the grid frame and shared panels.

public bool UsePanelThemes { get; set; } #

Gets or sets whether each panel retains its chart's authored theme, mode and font request.

public TextStyleOverride TitleStyle { get; set; } #

Gets the text style used for the grid title.

public TextStyleOverride SubtitleStyle { get; set; } #

Gets the text style used for the grid subtitle.

public IReadOnlyList<Chart> Charts { get; } #

Gets the charts included in the grid.

public IReadOnlyList<ChartGridPanelSpan> PanelSpans { get; } #

Gets the panel spans for charts included in the grid.

public VisualAccessibility Accessibility { get; } #

Gets the text alternative for the complete chart comparison.

public SvgColorVariables? SvgColorVariables { get; set; } #

Gets or sets the CSS custom properties the grid SVG writes for mapped colours (see SvgColorVariables): the grid title, background, and every panel, including charts without their own variables. With ChartGrid.UsePanelThemes enabled, this mapping applies only to the outer frame; each panel retains its chart mapping or literal colours. PNG output always uses literal colours.

Extension Methods

public static ChartGrid Accessibility(ChartGrid chartGrid, Action<VisualAccessibility> configure) #

Configures ChartGrid.Accessibility in place: Gets the text alternative for the complete chart comparison.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
configure System.Action<ChartForgeX.Accessibility.VisualAccessibility> required
Configures the value.

Returns

ChartGrid The same instance.
public static ChartGrid Columns(ChartGrid chartGrid, int value) #

Sets ChartGrid.Columns: Gets or sets the preferred number of columns on wide viewports.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value int required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                  // C# fluent
new global::ChartForgeX.Core.ChartGrid { Columns = value };    chartGrid.Columns(value);
public static ChartGrid Gap(ChartGrid chartGrid, int value) #

Sets ChartGrid.Gap: Gets or sets the gap between charts in pixels.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value int required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                              // C# fluent
new global::ChartForgeX.Core.ChartGrid { Gap = value };    chartGrid.Gap(value);
public static ChartGrid Padding(ChartGrid chartGrid, int value) #

Sets ChartGrid.Padding: Gets or sets the outer padding around exported grid content in pixels.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value int required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                  // C# fluent
new global::ChartForgeX.Core.ChartGrid { Padding = value };    chartGrid.Padding(value);
public static ChartGrid PanelFit(ChartGrid chartGrid, VisualPanelFit value) #

Sets ChartGrid.PanelFit: Gets or sets how charts fit inside fixed-size grid panels.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value ChartForgeX.Primitives.VisualPanelFit required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                   // C# fluent
new global::ChartForgeX.Core.ChartGrid { PanelFit = value };    chartGrid.PanelFit(value);
PanelSize 2 overloads
public static ChartGrid PanelSize(ChartGrid chartGrid, int width, int height) #

Sets a fixed panel size for composed SVG and PNG grid exports.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance to configure.
width int required
The panel width in pixels.
height int required
The panel height in pixels.

Returns

ChartGrid The current chart grid.
public static ChartGrid PanelSize(ChartGrid chartGrid, ChartSize? value) #

Sets ChartGrid.PanelSize: Gets or sets the optional fixed panel size used by composed SVG and PNG grid exports.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value ChartForgeX.Primitives.ChartSize? required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                    // C# fluent
new global::ChartForgeX.Core.ChartGrid { PanelSize = value };    chartGrid.PanelSize(value);
public static ChartGrid PreserveEmptyColumns(ChartGrid chartGrid, bool value = true) #

Sets ChartGrid.PreserveEmptyColumns: Gets or sets whether composed SVG and PNG exports retain columns without charts.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value bool = true optional
The value; true when omitted.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                               // C# fluent
new global::ChartForgeX.Core.ChartGrid { PreserveEmptyColumns = value };    chartGrid.PreserveEmptyColumns(value);
public static ChartGrid RasterScale(ChartGrid chartGrid, int value) #

Sets ChartGrid.RasterScale: Gets or sets the output pixel multiplier used by composed PNG grid exports.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value int required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                      // C# fluent
new global::ChartForgeX.Core.ChartGrid { RasterScale = value };    chartGrid.RasterScale(value);
public static void Save(ChartGrid grid, string path, RasterImageOptions? rasterOptions = null) #

Saves a chart grid using the output path extension to choose SVG, HTML, PNG, or another raster image format.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
path string required
The output file path.
rasterOptions ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.
public static void SaveBmp(ChartGrid grid, string path, RasterImageOptions? options = null) #

Saves a chart grid as a BMP file.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
path string required
The output file path.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.
public static void SaveHtml(ChartGrid grid, string path) #

Saves a chart grid as a complete HTML file.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
path string required
The output file path.
public static void SavePng(ChartGrid grid, string path) #

Saves a chart grid as a PNG file.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
path string required
The output file path.
public static void SavePpm(ChartGrid grid, string path, RasterImageOptions? options = null) #

Saves a chart grid as a PPM file.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
path string required
The output file path.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.
SaveRasterImage 2 overloads
public static void SaveRasterImage(ChartGrid grid, string path, RasterImageFormat format, RasterImageOptions? options = null) #

Saves a chart grid as an opaque raster image file.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
path string required
The output file path.
format ChartForgeX.Core.RasterImageFormat required
The raster image format.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.
public static void SaveRasterImage(ChartGrid grid, string path, RasterImageOptions? options = null) #

Saves a chart grid as an opaque raster image file using the output path extension to choose the format.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
path string required
The output file path.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.
public static void SaveSvg(ChartGrid grid, string path) #

Saves a chart grid as an SVG file.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
path string required
The output file path.
public static void SaveTiff(ChartGrid grid, string path, RasterImageOptions? options = null) #

Saves a chart grid as a TIFF file.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
path string required
The output file path.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.
public static ChartGrid Subtitle(ChartGrid chartGrid, string value) #

Sets ChartGrid.Subtitle: Gets or sets the report subtitle.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value string required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                   // C# fluent
new global::ChartForgeX.Core.ChartGrid { Subtitle = value };    chartGrid.Subtitle(value);
SubtitleStyle 2 overloads
public static ChartGrid SubtitleStyle(ChartGrid chartGrid, TextStyleOverride value) #

Sets ChartGrid.SubtitleStyle: Gets the text style used for the grid subtitle.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value ChartForgeX.Typography.TextStyleOverride required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                        // C# fluent
new global::ChartForgeX.Core.ChartGrid { SubtitleStyle = value };    chartGrid.SubtitleStyle(value);
public static ChartGrid SubtitleStyle(ChartGrid chartGrid, Action<TextStyleOverride> configure) #

Configures a copy of ChartGrid.SubtitleStyle (a new one when not set) and assigns a copy of it once the callback returns, leaving the property unchanged when the callback throws: Gets the text style used for the grid subtitle.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
configure System.Action<ChartForgeX.Typography.TextStyleOverride> required
Configures the copy.

Returns

ChartGrid The same instance.
public static ChartGrid SvgColorVariables(ChartGrid chartGrid, SvgColorVariables? value) #

Sets ChartGrid.SvgColorVariables: Gets or sets the CSS custom properties the grid SVG writes for mapped colours (see SvgColorVariables): the grid title, background, and every panel, including charts without their own variables. With ChartGrid.UsePanelThemes enabled, this mapping applies only to the outer frame; each panel retains its chart mapping or literal colours. PNG output always uses literal colours.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value ChartForgeX.Themes.SvgColorVariables? required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                            // C# fluent
new global::ChartForgeX.Core.ChartGrid { SvgColorVariables = value };    chartGrid.SvgColorVariables(value);
Theme 2 overloads
public static ChartGrid Theme(ChartGrid grid, Action<VisualThemeBuilder> configure) #

Replaces the grid theme with an independently configured immutable snapshot.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to configure.
configure System.Action<ChartForgeX.Themes.VisualThemeBuilder> required
The theme customization callback.

Returns

ChartGrid The current chart grid.
public static ChartGrid Theme(ChartGrid chartGrid, VisualTheme value) #

Sets ChartGrid.Theme: Gets or sets the paired theme for the grid frame and, by default, every panel.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value ChartForgeX.Themes.VisualTheme required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                // C# fluent
new global::ChartForgeX.Core.ChartGrid { Theme = value };    chartGrid.Theme(value);
public static ChartGrid ThemeMode(ChartGrid chartGrid, ThemeMode value) #

Sets ChartGrid.ThemeMode: Gets or sets the explicit palette mode for the grid frame and shared panels.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value ChartForgeX.ThemeMode required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                    // C# fluent
new global::ChartForgeX.Core.ChartGrid { ThemeMode = value };    chartGrid.ThemeMode(value);
public static ChartGrid Title(ChartGrid chartGrid, string value) #

Sets ChartGrid.Title: Gets or sets the report title.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value string required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                // C# fluent
new global::ChartForgeX.Core.ChartGrid { Title = value };    chartGrid.Title(value);
TitleStyle 2 overloads
public static ChartGrid TitleStyle(ChartGrid chartGrid, TextStyleOverride value) #

Sets ChartGrid.TitleStyle: Gets the text style used for the grid title.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value ChartForgeX.Typography.TextStyleOverride required
The value.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                     // C# fluent
new global::ChartForgeX.Core.ChartGrid { TitleStyle = value };    chartGrid.TitleStyle(value);
public static ChartGrid TitleStyle(ChartGrid chartGrid, Action<TextStyleOverride> configure) #

Configures a copy of ChartGrid.TitleStyle (a new one when not set) and assigns a copy of it once the callback returns, leaving the property unchanged when the callback throws: Gets the text style used for the grid title.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
configure System.Action<ChartForgeX.Typography.TextStyleOverride> required
Configures the copy.

Returns

ChartGrid The same instance.
public static byte[] ToBmp(ChartGrid grid, RasterImageOptions? options = null) #

Renders a chart grid to BMP bytes.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.

Returns

byte[] A BMP image.
ToHtmlFragment 2 overloads
public static string ToHtmlFragment(ChartGrid grid) #

Renders a chart grid to a standalone HTML fragment containing inline SVG charts.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.

Returns

string An HTML fragment.
public static string ToHtmlFragment(ChartGrid grid, string idScope) #

Renders a chart grid to an HTML fragment with an additional deterministic ID scope.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
idScope string required
A caller-provided scope used to keep IDs unique when embedding equivalent fragments together.

Returns

string An HTML fragment.
public static string ToHtmlPage(ChartGrid grid) #

Renders a chart grid to a complete HTML document.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.

Returns

string An HTML page.
public static byte[] ToPng(ChartGrid grid) #

Renders a chart grid to PNG bytes.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.

Returns

byte[] A PNG image.
public static byte[] ToPpm(ChartGrid grid, RasterImageOptions? options = null) #

Renders a chart grid to PPM bytes.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.

Returns

byte[] A PPM image.
public static byte[] ToRasterImage(ChartGrid grid, RasterImageFormat format, RasterImageOptions? options = null) #

Renders a chart grid to opaque raster image bytes.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
format ChartForgeX.Core.RasterImageFormat required
The raster image format.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.

Returns

byte[] Encoded raster image bytes.
public static RgbaImage ToRgbaImage(ChartGrid grid) #

Renders a chart grid directly to an in-memory RGBA image without encoding it.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.

Returns

RgbaImage The rendered RGBA image.
ToSvg 2 overloads
public static string ToSvg(ChartGrid grid) #

Renders a chart grid to SVG markup.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.

Returns

string SVG markup.
public static string ToSvg(ChartGrid grid, string idScope) #

Renders a chart grid to SVG markup with an additional deterministic ID scope.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
idScope string required
A caller-provided scope used to keep SVG element IDs unique when embedding multiple SVG grids in one document.

Returns

string SVG markup.
public static byte[] ToTiff(ChartGrid grid, RasterImageOptions? options = null) #

Renders a chart grid to TIFF bytes.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.

Returns

byte[] A TIFF image.
public static VisualArtifact ToVisualArtifact(ChartGrid grid, string? id = null, VisualArtifactSourceLanguage sourceLanguage = Native) #

Wraps a chart grid in a reusable visual artifact.

Parameters

grid ChartForgeX.Core.ChartGrid required
id string? = null optional
sourceLanguage ChartForgeX.VisualArtifacts.VisualArtifactSourceLanguage = Native optional
public static ChartGrid UsePanelThemes(ChartGrid chartGrid, bool value = true) #

Sets ChartGrid.UsePanelThemes: Gets or sets whether each panel retains its chart's authored theme, mode and font request.

Parameters

chartGrid ChartForgeX.Core.ChartGrid required
The instance.
value bool = true optional
The value; true when omitted.

Returns

ChartGrid The same instance.

Examples

// C# initializer or property                                         // C# fluent
new global::ChartForgeX.Core.ChartGrid { UsePanelThemes = value };    chartGrid.UsePanelThemes(value);
public static void WriteBmp(ChartGrid grid, Stream stream, RasterImageOptions? options = null) #

Writes a chart grid to a BMP stream.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
stream System.IO.Stream required
The destination stream.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.
public static void WritePpm(ChartGrid grid, Stream stream, RasterImageOptions? options = null) #

Writes a chart grid to a PPM stream.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
stream System.IO.Stream required
The destination stream.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.
public static void WriteRasterImage(ChartGrid grid, Stream stream, RasterImageFormat format, RasterImageOptions? options = null) #

Writes a chart grid to an opaque raster image stream.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
stream System.IO.Stream required
The destination stream.
format ChartForgeX.Core.RasterImageFormat required
The raster image format.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.
public static void WriteTiff(ChartGrid grid, Stream stream, RasterImageOptions? options = null) #

Writes a chart grid to a TIFF stream.

Parameters

grid ChartForgeX.Core.ChartGrid required
The chart grid to render.
stream System.IO.Stream required
The destination stream.
options ChartForgeX.Core.RasterImageOptions? = null optional
Optional raster export options.