Pre loader

How can I listen/subscribe to the change in width of the chart/xAxes?

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

1
0

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?

Version
3.1.346
Images
  • Andrew Burnett-Thompson
    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?
  • Jim Risen
    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.
  • Nung Khual
    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.
  • Andrew Burnett-Thompson
    Hi Nung, can you share a codepen that reproduces the issue?
  • Andrew Burnett-Thompson
    Hi there, waiting on code to reproduce this so we can proceed with a solution. Best regards, Andrew
  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.