Home >Java >javaTutorial >How to Resolve Domain Axis Rescaling Issues in CombinedDomainXYPlot?

How to Resolve Domain Axis Rescaling Issues in CombinedDomainXYPlot?

Susan Sarandon
Susan SarandonOriginal
2024-12-18 06:44:11777browse

How to Resolve Domain Axis Rescaling Issues in CombinedDomainXYPlot?

Resolving Domain Axis Rescaling Issue in CombinedDomainXYPlot

In a CombinedDomainXYPlot chart, where multiple subplots share a domain axis, the range axes automatically adjust to data changes. However, the domain axis does not exhibit the same behavior, which can be problematic when hiding or showing series.

Underlying Mechanism

CombinedDomainXYPlot establishes a combined maximum range for the shared domain axis during the getDataRange() computation. This ensures that the axis can be shared among the subplots. Visibility changes for individual series do not affect the domain axis, but changing the dataset triggers an update through the configure() method.

Resolving the Issue

To manually refresh the domain axis scaling:

  • Use mainPlot.getDomainAxis().configure(); to update the shared domain axis.
  • This method considers both data changes and the combined maximum range.

Alternatively, to achieve automatic updates:

  • Utilize addSeries() or removeSeries() instead of setSeriesVisible(). This triggers the necessary axis reconfigurations.

Additional Notes

  • Ensure proper instantiation of Initial Threads and pack().
  • The provided example showcase these concepts with subplots and series visibility toggling.
  • The code provided includes custom button actions for triggering updates and visibility changes.

The above is the detailed content of How to Resolve Domain Axis Rescaling Issues in CombinedDomainXYPlot?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn