Pre loader

SciChart for .net Blazor project: Cannot read properties of undefined (reading 'SCRTDoubleVector')

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
0
0

Hello,
I am new to SciChart and wanted to try to implement one in a new test project for later projects.
I want to add a new chart to the normal blazor homepage.
I almost got it done and it currently looks like in the attached picture.
But I still get this error message: Unhandled exception rendering component: Cannot read properties of undefined (reading ‘SCRTDoubleVector’)
TypeError: Cannot read properties of undefined (reading ‘SCRTDoubleVector’).

I want the SciChart to initialize in my Home.razor file.
This is the code in my .js:

window.initializeSciChartWithSettings = async function () {
const {
SciChartSurface,
NumericAxis,
FastLineRenderableSeries,
XyDataSeries,
NumberRange
} = SciChart;

const { sciChartSurface, wasmContext } = await SciChartSurface.create("sciChartSurface");

sciChartSurface.xAxes.add(new NumericAxis(wasmContext));
sciChartSurface.yAxes.add(new NumericAxis(wasmContext));

const dataSeries = new XyDataSeries(sciChartSurface.engine, {
xValues: [1, 2, 3, 4, 5],
yValues: [1, 2, 3, 4, 5]
});

const lineSeries = new FastLineRenderableSeries(sciChartSurface.engine, {
dataSeries: dataSeries,
strokeThickness: 2,
stroke: "#2596BE"
});
sciChartSurface.renderableSeries.add(lineSeries);

window.sciChartSurface = sciChartSurface;
window.sciChartDataSeries = dataSeries;

return { sciChartSurface };
};

I really don´t know what to do and would be thankful for every awnser!

Version
SciChart 4 - test version
Images
  • You must to post comments
Best Answer
1
0

Update: We’ve just released an official SciChart.Blazor wrapper which uses SciChart.js v4.0.933

This incorporates most of the 2D chart types and has a Razor like syntax. It also handles full lifecycle of the component and deletes SciChart memory either on dispose / or finalizer. This is currently in beta and under active development.

You can try it out here on Github, at
github.com/abtsoftware/scichart.blazor.examples

  • You must to post comments
0
1

I don’t think there is sciChartSurface.engine property.
Try passing wasmContext instead.

This line

const lineSeries = new FastLineRenderableSeries(sciChartSurface.engine, {
   dataSeries: dataSeries,
   strokeThickness: 2,
   stroke: "#2596BE"
});

Should be this

const lineSeries = new FastLineRenderableSeries(wasmContext, {
   dataSeries: dataSeries,
   strokeThickness: 2,
   stroke: "#2596BE"
});

You can also access the wasmContext via sciChartSurface.webAssemblyContext2D so this will also work:

const lineSeries = new FastLineRenderableSeries(sciChartSurface.webAssemblyContext2D, {
   // ... 
});
  • You must to post comments
0
0

I was able to fix the issue later that week. It indeed had something to do with the sciChartSurface.engine property. I don’t know why but it was recommended to me by the SciChartAi.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.