Class ChartJsInterop
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
-
objectChartJsInterop
- 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
jsRuntimeIJSRuntimeRuntime 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
svgElementReferenceElement reference of the chart's
<svg>root.fileNamestringSuggested file name (without extension).
widthint?Optional explicit pixel width for the rasterized image.
heightint?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
containerElementReferenceElement reference of the chart's host.
callbackTargetDotNetObjectReference<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
handlestringHandle previously returned by ObserveResizeAsync(ElementReference, DotNetObjectReference<object>).
Returns
- ValueTask