Table of Contents

Interface IChartJsInterop

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

Minimal JS interop surface required by BOBCharts. Concrete implementations live in the same package and lazy-load _content/BlazOrbit.Charts/js/Types/Chart/ChartInterop.js.

The chart components themselves never call Microsoft.JSInterop.IJSRuntime directly; everything goes through this interface so JS-less hosts (static SSR, prerender) can plug in a no-op implementation.

public interface IChartJsInterop

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.

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.

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.

ValueTask UnobserveResizeAsync(string handle)

Parameters

handle string

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

Returns

ValueTask