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

Message ListMessage List     Post MessagePost Message

  multiple axes for scatterplot
Posted by Chris Haidinyak on Feb-27-2025 05:17
Hi,

Is there a way to create multiple X and Y axes on scatterplots? I saw one example using a linelayer but am not able to find an analog for scatterlayer. Also, the getYCoor allows the secondary axis but getXCoor does not. Maybe it is not currently possible? Please advise; thank you.

I essentially want to include mutiple layers on the same plot area but with different axes and then set both scales to auto so that they can sit in the same drawing area for comparison purposes. I draw ovals showing the contour of the X/Y data set which is why I want getXCoor to also include a secondary axis so I can properly overlay the oval.

Best,
  Chris Haidinyak

  Re: multiple axes for scatterplot
Posted by Peter Kwan on Feb-28-2025 04:12
Hi Chris,

The reason why it is useful to plot two data series on a chart is to compare them. This requires either the x and y coordinates of the two data series are related.

If you let ChartDirector auto-scale both the x-axis and y-axis for the two data series, the axis scales are unpredictable (it depends on the data), and you cannot control how the two series are aligned in any direction. The two data series are essentially overlay randomly.

In ChartDirector, it assumes the x-axis of the data series must be "related" (because x is commonly used for the independent variable, and y is the dependent variable). This should not cause any limitation as the x and y axes can be swapped in ChartDirector.

For example, if you want to overlay two time series differ by 6 hours (or 21600 seconds). Then the two x-series are related - they only differ by 21600. You can align the second data series with the first data series by simply subtracting 21600 from the former's x-coordinates. In this way, you only need one x-axis to plot the chart.

You may still want to show the second x-axis as being differ by 6 hours from the first x-axis for human reading. To do this, you can use "c->xAxis2()->syncAxis(c->xAxis(), 1, 21600);".

There is only one axis for getXCoor because the x-coordinates for the different x-axes are "related", and you can convert any x-coordinate to the x-coordinate used by the primary xAxis.


Best Regards
Peter Kwan