The first error occurs when trying to zoom on empty surface :
Uncaught TypeError: Cannot read properties of undefined (reading 'width') at MouseWheelZoomModifier2.ChartModifierBase2D2.growBy (ChartModifierBase2D.js:121:48)
And the other one when trying to drag:
Uncaught Error: category x axis with id=DefaultAxisId should have data series count > 0 at CategoryAxis2.CategoryAxisBase2.getCurrentCoordinateCalculatorInternal (CategoryAxisBase.js:95:19)
I have seen errors similar to the second one in other scenarios and sometimes it is fatal.
E.g i have tried to add annotation right after first value was added and first line raised similar error:
const xCalc = this.surface.xAxes.get(0).getCurrentCoordinateCalculator() as CategoryCoordinateCalculator; const realX = xCalc.transformDataToIndex(time); const target = this.getOrAddAnnotation(); target.x1 = realX; target.y1 = value;
Also getCurrentCoordinateCalculatorInternal error occurs when empty series & seriesData added without suspend.
I would appreciate any help and clarification
Can you try getting v2.1 of SciChart.js and applying these properties:
Set these when you create your CategoryAxis.
defaultXStart should be the unix timestamp you want to appear at the bottom-left of the axis when there is no data
defaultXStep should be the timeframe for your candlestick chart. E.g. if it’s a daily timeframe then put the unix timestamp for 1 day
Try that. Does it work?
Once data has been loaded on the CategoryAxis it should behave as normal
Because of the way CategoryAxis works, it’s impossible to measure (draw) the chart without data, because category axis by its very definition is using the indexes to data to measure values and perform zooming, panning operations.
Obviously SciChart.js shouldn’t crash or throw errors, so let’s discuss what should be an acceptable solution when the chart is shown but no data on a category axis.
Which sounds more correct:
Please login first to submit.