|
layoutAxes blocks forever |
| Posted by SRoeber on Mar-02-2026 20:25 |
|
Hi,
in my XY chart I’m using an X‑axis with a data scale and zoom. At very large zoom levels, layoutAxes blocks indefinitely. Is this a known bug, or is there a workaround?
Best regards,
Steffen |
Re: layoutAxes blocks forever |
| Posted by Peter Kwan on Mar-02-2026 23:56 |
|
Hi SRoeber,
I have tried the Mega Zoom/Scroll MFC sample code that comes with ChartDirector for C++. It plots 60 million data points, and can zoom up to 1000000x. I added an layoutAxes line to the chart and it does not hang at any zoom level.
The layoutAxes is normally used to perform auto-scaling of the axis. However, for chart that can zoom/scroll, the axis scale should be controlled by the user. (The user can use zoom in/out and scrolling to control the axis scale.) Your code can use the
ViewPortManager.getValueAtViewPort and ViewPortManager.getViewPortAtValue to determine to predict the axis scale.
If you need further help, is it possible to provide a simple example that can demonstrate the problem? We need to know your programming language, development framework (eg. is it a desktop of web application) and the chart type, chart configuration (eg. number of axes, type of axes - linear/log/date/label...) and at which zoom level does it blocks. (The ViewPortManager.setZoomInWidthLimit can be used to avoid the user zooming over a certain limit.)
The following are the documentation for the API I mentioned above for ChartDirector for C++. Other editions of ChartDirector should have similar documentation.
https://www.advsofteng.com/doc/cdcpp.htm#ViewPortManager.getValueAtViewPort.htm
https://www.advsofteng.com/doc/cdcpp.htm#ViewPortManager.getViewPortAtValue.htm
https://www.advsofteng.com/doc/cdcpp.htm#ViewPortManager.setZoomInWidthLimit.htm
Best Regards
Peter Kwan |
Re: layoutAxes blocks forever |
| Posted by SRoeber on Mar-03-2026 17:17 |
|
Hi, I'm using c++qt based API and XY charts.
charts has just 100 values.
chart->xAxis()->setDateScale(viewPortStartDate, viewPortEndDate);
See attached screenshot showing last values. After last value
CAS_LOG(cTracer::cout, "{}:{}", m_viewer->getViewPortWidth(), m_viewer->canZoomIn(m_viewer->getZoomDirection()));
chart.layoutAxes();
blocke forever.
Even if I disable layoutAxes, then it block in packPlotArea same way.
Same behaviour if I call zoomAround or zoomTo or zoomAt
|
Re: layoutAxes blocks forever |
| Posted by Peter Kwan on Mar-04-2026 13:19 |
|
Hi SRoeber,
In your log window, I saw something like:
ViewPortStartDate: 0.3469.... ViewPortEndDate: 0.3603....
It does not mention how does it get the ViewPortStartDate and ViewPortEndDate. If they are really 0.3469...., it looks abnormal, as this corresponds to the date 0000-01-01 00:00:00.3469, which is over 2000 years ago. May be it should use setLinearScale instead of setDateScale. For setDateScale, ChartDirector expects the dates to be generated by the Chart::chartTime function. See:
https://www.advsofteng.com/doc/cdcpp.htm#dateformat.htm
The date scale is for charts in which the exact date/time is significant. For example, in stock charts, we need to know the date/time of a stock price.
If you just want to plot some parameters over some time duration, you can use linear scale. The time duration in this case is just a number. It is treated in the same way as weight or speed or lengths, just in different units.
Because a double precision floating point number only has 17 digits precision at most, it cannot encode a date "year/month/day/hour/minute/seconds/milliseconds" sub-millisecond precision. For your case, I think the date axis failed to layout the date labels for your time range.
Would you mind to try linear scale to see if it can address the problem?
Best Regards
Peter Kwan |
Re: layoutAxes blocks forever |
| Posted by SRoeber on Mar-04-2026 20:19 |
|
| Yes, linear scale works. thank you. |
|