Table of Contents

Class ChartJsInterop

Namespace
BlazOrbit.Charts.Services.JsInterop
Assembly
BlazOrbit.Charts.dll

Default IChartJsInterop implementation. Lazily imports _content/BlazOrbit.Charts/js/Types/Chart/ChartInterop.js on the first call and forwards every member to the underlying ES module.

All public methods follow the BlazOrbit teardown contract: each call is wrapped against the four canonical "circuit / runtime gone" exceptions so late invocations during dispose silently no-op instead of bubbling.

public sealed class ChartJsInterop : ModuleJsInteropBase, IChartJsInterop
Inheritance
object
ChartJsInterop
Implements
Inherited Members

Constructors

ChartJsInterop(IJSRuntime)

Initializes a new ChartJsInterop bound to the supplied Microsoft.JSInterop.IJSRuntime. The JS module is not imported until the first method call.

public ChartJsInterop(IJSRuntime jsRuntime)

Parameters

jsRuntime IJSRuntime

Runtime used to import the chart module.

Methods

ExportSvgAsPngAsync(ElementReference, string, int?, int?)

Serializes the supplied <svg> element to a PNG image and triggers a browser download. Runs entirely client-side; the server never sees the image bytes.

public ValueTask ExportSvgAsPngAsync(ElementReference svg, string fileName, int? width = null, int? height = null)

Parameters

svg ElementReference

Element reference of the chart's <svg> root.

fileName string

Suggested file name (without extension).

width int?

Optional explicit pixel width for the rasterized image.

height int?

Optional explicit pixel height for the rasterized image.

Returns

ValueTask

ObserveResizeAsync(ElementReference, DotNetObjectReference<object>)

Installs a ResizeObserver on the supplied container element. Each observed resize re-invokes OnResize(width, height) on the caller's Microsoft.JSInterop.DotNetObjectReference<TValue>. Returns an opaque handle that must be passed to UnobserveResizeAsync(string) to detach the observer.

public ValueTask<string> ObserveResizeAsync(ElementReference container, DotNetObjectReference<object> callbackTarget)

Parameters

container ElementReference

Element reference of the chart's host.

callbackTarget DotNetObjectReference<object>

.NET object exposing OnResize.

Returns

ValueTask<string>

Handle that identifies this observer registration.

UnobserveResizeAsync(string)

Removes a previously installed ResizeObserver. Idempotent: a missing handle is a no-op.

public ValueTask UnobserveResizeAsync(string handle)

Parameters

handle string

Handle previously returned by ObserveResizeAsync(ElementReference, DotNetObjectReference<object>).

Returns

ValueTask