ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  ChartDirector 7 - autoAxis layout crash
Posted by jpcaron on Oct-04-2024 00:04
Attachments:
We had an instance where a data set  got the auto y-axis scaling to run the VM OOM.

I've attached the sampleLine.jsp with edits to introduce a set of datasets that reproduce the problem.

The work-around would be to set the y-axis explictly.

// BYPASS ISSUE - set scale deliberlately rather than autoscale
//c2.yAxis().setLinearScale(-2, 2 );

It seems to be an issue with the precision of doubles being used on the graph, and likely a loop that no longer converges on the correct scale for the graph.

Could ASE look at this example and provide guidance or a fix ?
chart-director-autoscale-crash.jsp
chart-director-autoscale-crash.jsp

7.68 Kb

  Re: ChartDirector 7 - autoAxis layout crash
Posted by Peter Kwan on Oct-06-2024 01:46
Hi jpcaron,

Thanks for reporting this issue to us and provide us with a method to reproduce the problem. We have determined that the problem occurs when the data range requires 17 significant digits or more. To put it into perspective, 17th significant digit resolution is like comparing an atom to the earth.

In Java, the "double precision floating point" is 64-bit only supports up to 16 significant digits. If more significant digits are required, even simply operations such as x = x + 0.1 may have no effect (just like adding an atom to the earth may not have any measurable effect). ChartDirector uses similar code in a loop to automatically compute the ticks along the axis. As the code has no effect, the loop never terminates and the code hangs. This explains why setting the axis scale deliberately can avoid the problem.

The code does not hang in earlier versions of ChartDirector because it contains safety checking code that will force terminate the loop if it iterates too many times. In this case, the chart will display but there will be no ticks on the axis.

To work around the issue, you may consider to include code to reduce the number of significant digits. For example, instead of 1234567890123456789, you can use 1234567890123000000. The error 456789 is just 0.00000000001% of the original number and should not be visible on the chart.

I will also create a patch to add the safety checking code back to ChartDirector to ensure it does not hang.

Best Regards
Peter Kwan

  Re: ChartDirector 7 - autoAxis layout crash
Posted by Peter Kwan on Oct-09-2024 00:26
Hi jpcaron,

Below please find the updated ChartDirector JAR file that can solve this problem.  If the data requires 17 or more significant figure, ChartDirector should still be able to come up with a reasonable scale.

https://www.advsofteng.com/support/cdjava708.zip

Best Regards
Peter Kwan