Hello,
I am attempting to get SciChart working in a Blazor Server app.
I have followed the examples here:
https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-browser-global-module
https://github.com/ABTSoftware/SciChart.JS.Examples/blob/master/Tutorials/2D_Browser_CDN_Tutorials_JavaScript/Tutorial_2_Adding_Series_and_data/index.html
https://www.scichart.com/documentation/js/current/webframe.html#Deploying%20Wasm%20or%20WebAssembly%20and%20Data%20Files%20with%20your%20app.html
https://cdn.jsdelivr.net/npm/scichart@2.2.2393/README.md
I have the following line in my “_Layout.cshtml” file in the head section:
<script src="https://cdn.jsdelivr.net/npm/scichart@2.1.2290/_wasm/scichart.browser.js" crossorigin="anonymous"></script>
In my scichart js I have:
export async function initSciChart() {
SciChart.SciChartSurface.setRuntimeLicenseKey("....");
SciChart.SciChartSurface.useWasmFromCDN();
}
However when I call this over JSInterop i get the following error:
Error: Microsoft.JSInterop.JSException: SciChart.SciChartSurface.useWasmFromCDN is not a function
TypeError: SciChart.SciChartSurface.useWasmFromCDN is not a function
at Module.initSciChart (https://localhost:7195/Pages/Strategy/StrategyMain.razor.js:33:30)
at https://localhost:7195/_framework/blazor.server.js:1:3501
at new Promise ()
at kt.beginInvokeJSFromDotNet (https://localhost:7195/_framework/blazor.server.js:1:3475)
at https://localhost:7195/_framework/blazor.server.js:1:72001
at Array.forEach ()
at kt._invokeClientMethod (https://localhost:7195/_framework/blazor.server.js:1:71987)
at kt._processIncomingData (https://localhost:7195/_framework/blazor.server.js:1:70029)
at connection.onreceive (https://localhost:7195/_framework/blazor.server.js:1:64432)
at o.onmessage (https://localhost:7195/_framework/blazor.server.js:1:48766)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeVoidAsync(IJSObjectReference jsObjectReference, String identifier, Object[] args)
at TradeLogicBS.Web.Pages.Strategy.StrategyMain.OnAfterRenderAsync(Boolean firstRender) in D:\Repos\TradeLogicBS\TradeLogicBS\TradeLogicBS.Web\Pages\Strategy\StrategyMain.razor:line 63
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
How do we set this up properly to access the scichart modules in a blazor server application?
Thank you,
- Leland asked 1 year ago
- Hello, I believe the issue may appear due to the old library version specified in your case. “useWasmFromCDN” was introduced and updated in recent releases. So try out the latest one (2.2.2393 at the moment) by updating your bundle script source.
- Thank you, updating to 2.2.2393 corrected the issue. As a note the docs at: https://cdn.jsdelivr.net/npm/scichart@2.2.2393/README.md use version 2.1.2261 which does not work.
- You must login to post comments
Thank you, updating to 2.2.2393 corrected the issue. As a note the docs at: https://cdn.jsdelivr.net/npm/scichart@2.2.2393/README.md use version 2.1.2261 which does not work.
- Leland answered 1 year ago
- You must login to post comments
Duplicates found in the forums:
- Andrew Burnett-Thompson answered 1 year ago
- You must login to post comments
Please login first to submit.