
This example demonstrates swapping the x and y axes to produce an rotated area chart in which the area goes from left to right (instead of bottom to top).
The x and y axes in the example are configured as follows:
- Initially, the direction of the x-axis is left to right and is at the bottom of the chart, while the y-axis is from bottom to top and is on the left of the chart.
- Swap the x and y axes using XYChart.swapXY. Now the x-axis is from bottom to top and is on the left of the chart, while the y-axis is from left to right and is at the bottom of the chart.
- Use XYChart.setYAxisOnRight to move the y-axis to the opposite side of the plot area, so that the y-axis is on the top of the plot area (instead of at the bottom). (Note: setYAxisOnRight moves the primary y-axis to the opposite side. It is the right side by default, but will become the top side if x and y axes are swapped. The name of this method is for compatibility with earlier versions of ChartDirector in which XYChart.swapXY was not supported.)
- Use Axis.setReverse to reverse the direction of the x-axis, so that the x-axis is from top to bottom (instead of bottom to top).