diff --git a/docs/kd.tree b/docs/kd.tree index 1fe87fd4b..e5f94fb7f 100644 --- a/docs/kd.tree +++ b/docs/kd.tree @@ -110,7 +110,7 @@ - + diff --git a/docs/topics/API.md b/docs/topics/API.md index 34acd9932..912071742 100644 --- a/docs/topics/API.md +++ b/docs/topics/API.md @@ -58,5 +58,5 @@ [save](Save-API.md) [toBufferedImage](ToBufferedImage-API.md) ## Other -[coordFlip](Coordinates-API.md) +[coordinatesTransformation](CoordinatesTransformation-API.md) [reversed](Reversed-API.md) diff --git a/docs/topics/apiRef/Coordinates-API.md b/docs/topics/apiRef/Coordinates-API.md deleted file mode 100644 index bd07f0065..000000000 --- a/docs/topics/apiRef/Coordinates-API.md +++ /dev/null @@ -1 +0,0 @@ -# Coordinates \ No newline at end of file diff --git a/docs/topics/apiRef/CoordinatesTransformation-API.md b/docs/topics/apiRef/CoordinatesTransformation-API.md new file mode 100644 index 000000000..e1f566b02 --- /dev/null +++ b/docs/topics/apiRef/CoordinatesTransformation-API.md @@ -0,0 +1,56 @@ +# Coordinates Transformation + + +

var PlotBuilder. coordinatesTransformation: CoordinatesTransformation?

+
+ +Defines the coordinate system transformation applied to the plot. + +The `coordinatesTransformation` property enables customization of how data points are projected onto the plot's axes. If +not explicitly set, the transformation is automatically selected based on the provided data and configured layers. + +## `CoordinatesTransformation` {id="coordinates_transformation_class"} + +A class that represents plotting coordinates system transformation. + +* `CoordinatesTransformation.cartesian()` — a Cartesian coordinate system transformation. + This coordinate system is the standard 2-dimensional coordinate system used in most plots, + where the horizontal axis represents X values and the vertical axis represents Y values. + Default for most layers. +* `CoordinatesTransformation.cartesianFixed(ratio: Double = 1.0)` — a Cartesian coordinate system + with a fixed aspect ratio transformation. + This coordinate system maintains a consistent proportional relationship between the X and Y axes, + controlled by the `ratio` parameter. The `ratio` specifies how many units on the y-axis + correspond to a single unit on the x-axis. When `ratio` is set to 1.0 (default), one unit on the x-axis + is equivalent to one unit on the y-axis, resulting in equal scaling for both axes. + A `ratio` greater than 1.0 will make units on the y-axis proportionally longer than those on the x-axis, + whereas a `ratio` less than 1.0 will make units on the x-axis proportionally longer. + Default for [`tiles`](https://kotlin.github.io/kandy/tiles-api.html) layer. +* `CoordinatesTransformation.cartesianFlipped()` — a Cartesian coordinate system with + swapped axes transformation. + In this coordinate system, the x-axis is oriented vertically, + and the y-axis is oriented horizontally. +* `CoordinatesTransformation.cartesianFlippedFixed(ratio: Double = 1.0)` — a Cartesian coordinate system + with swapped axes and a fixed aspect ratio transformation. + This coordinate system flips the orientation of the axes, so the x-axis is oriented vertically, + and the y-axis is oriented horizontally, while maintaining a consistent proportional relationship + between these axes, controlled by the `ratio` parameter. + The `ratio` specifies how many units on the new y-axis (originally the x-axis) correspond to a single unit + on the new x-axis (originally the y-axis). When `ratio` is set to 1.0 (default), one unit on the new x-axis + is equivalent to one unit on the new y-axis, resulting in equal scaling for both axes. + A `ratio` greater than 1.0 will make units on the new y-axis proportionally longer than those on the new x-axis, + whereas a `ratio` less than 1.0 will make units on the new x-axis proportionally longer. + +## Examples + +```kotlin +plot { + ... + // Using the default Cartesian coordinate system transformation + coordinatesTransformation = CoordinatesTransformation.cartesian() + // Using a Cartesian coordinate system with a fixed aspect ratio transformation + coordinatesTransformation = CoordinatesTransformation.cartesianFixed(ratio = 1.5) + // Using a Cartesian coordinate system with flipped axes transformation + coordinatesTransformation = CoordinatesTransformation.cartesianFlipped() +} +```