I have a chart with stacked xAxes, and I am trying to calculate the stackedLength of each xAxis base on the total length or width available for the xAxes.
The issue come when I am changing the size of the screen or changing the width of the chart using flex-basis. When I do that, I get the error message in the picture below.
My question is, is there a way for me to listen/subscribe to the width change or get the latest width?
- Some questions. Why do you need to calculate the size. The custom layout strategy – is that one we posted or another? Does it have bugs and if so can we help resolve them?
- Some hints that might be relevant: 1. stackedAxisLength can accept relative values as percentages: axis.stackedAxisLength = ‘60%’; 2. A more powerful way to override the calculation of stackedAxisLength based on the available space would be by creating a custom Axis Layout Strategy, where you get the available size as params of “layoutAxes” method called on each render. 3. And, JFYI, It is also possible to attach a callback on the root element resize event by overriding “sciChartSurface.changeViewportSize” which is called by the ResizeObserver subscription.
- I have try both percentage and pixel for stack length and yes I am using the custom layout strategy. The issue comes when I decrease the width of the chart by reducing the width of the parent div or when I increase the scope range for the xAxes. The default xAxis by itself is fine, but the issue comes when I add the stacked xAxes.
- Hi Nung, can you share a codepen that reproduces the issue?
- Hi there, waiting on code to reproduce this so we can proceed with a solution. Best regards, Andrew
- You must login to post comments