SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components

0
0

Hello!

Tell me what I’m doing wrong?
The error does not always appear (floating error).

enter image description here

In my code, along the stack, it will go to your product

enter image description here

Version
1.0.1295
Images
  • You must to post comments
0
0

AxisBase2D.js. if !this.parentSurface or visibleSeries is an empty array or !xVisibleRange or !range, then maxRange will also be undefined

The static code analyzer will sound an alarm that there will probably be an attempt to use an uninitialized variable. Do you use static code analyzers?

enter image description here

Images
  • You must to post comments
0
0

the problem went away when I commented out yAxis.growBy = new NumberRange (0.35, 0.15)

javascript
createMainYAxis () {
const yAxis = new NumericAxis(this.wasmContext)
yAxis.drawMinorTickLines = false
yAxis.majorGridLineStyle = {
strokeThickness: 1,
color: 'rgba(238, 238, 238, 0.1)'
}
// yAxis.growBy = new NumberRange(0.35, 0.15) // by commenting out this line the error disappears
yAxis.autoRange = EAutoRange.Always
this.mainYAxis = yAxis
this.chartSurface.yAxes.add(yAxis)
},

  • You must to post comments
0
0

Hi Roman

Thank you for your feedback on this. It’s a strange error as AxisBase.getWindowedYRange() should not be called unless axis is in a Parent SciChartSurface, but the error only occurs when parent SciChartSurface is undefined.

I’m curious what exact set of circumstances you have in code to get this bug? We never saw it in tests or development.

Best regards,
Andrew

  • You must to post comments
0
0

In JavaScript almost everything is an object, null and undefined are exceptions. This error occurs when a property is read or a function is called on an undefined variable. Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong to objects. Since undefined is not an object type, calling a function or a property on such a variable causes the TypeError: Cannot read property of undefined.

If you are not sure a variable that will always have some value, the best practice is to check the value of variables for null or undefined before using them. To avoid getting these types of errors, you need to make sure that the variables you are trying to read do have the correct value. This can be done in various ways. You can do if checks before dealing with objects whose values are bound to change:

if (myVar !== undefined) {
    ...
}

Or

if (typeof(myVar) !== 'undefined') {
    ...
}
  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.