XYGraph

fun <X, Y> XYGraph(xAxisModel: AxisModel<X>, yAxisModel: AxisModel<Y>, modifier: Modifier = Modifier, xAxisStyle: AxisStyle = rememberAxisStyle(), xAxisLabels: @Composable (X) -> Unit, xAxisTitle: @Composable () -> Unit = {}, yAxisStyle: AxisStyle = rememberAxisStyle(), yAxisLabels: @Composable (Y) -> Unit, yAxisTitle: @Composable () -> Unit = {}, horizontalMajorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.majorGridlineStyle, horizontalMinorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.minorGridlineStyle, verticalMajorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.majorGridlineStyle, verticalMinorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.minorGridlineStyle, panEnabled: Boolean = false, zoomEnabled: Boolean = false, allowIndependentZoom: Boolean = false, content: @Composable XYGraphScope<X, Y>.() -> Unit)

Provides a set of X-Y axes and grid for displaying X-Y plots.

Parameters

X

The data type for the x-axis

Y

The data type for the y-axis

xAxisModel

x-axis state controlling the display of the axis and coordinate transformation

yAxisModel

y-axis state controlling the display of the axis and coordinate transformation

xAxisStyle

Style for the x-axis

xAxisLabels

Composable to display labels for specific x-axis values

xAxisTitle

Title for the X-axis

yAxisStyle

Style for the y-axis

yAxisLabels

Composable to display labels for specific y-axis values

yAxisTitle

Title for the y-axis

panEnabled

True if the plot can be panned, false to disable. Enabling panning may interfere with scrolling a parent container if the drag point is on the plot.

zoomEnabled

True if the plot can be zoomed, false to disable. Enabling zooming may interfere with scrolling a parent container if the drag point is on the plot.

allowIndependentZoom

True if the zoom can be either only on the X axis, or only on the Y axis, or independently on the X and Y axes at the same time (the behavior depends on the target platform), False if the total zoom factor must be used.

Behavior for Android and iOS: True does not mean getting independent zoom coefficients simultaneously for each axis, if the zoom was initiated:

  • horizontally - the zoom coefficient will change only for the X axis,

  • vertically - the zoom coefficient will change only for the Y axis.

Behavior for Desktop platforms: (EXPERIMENTAL!) True means getting independent zoom coefficients simultaneously or separately for each axis, if the zoom was initiated:

  • horizontally - the zoom coefficient will change only for the X axis,

  • vertically - the zoom coefficient will change only for the Y axis,

  • diagonally - the zoom coefficient will change along the axes X and Y at the same time

Behavior for JS and wasmJS: (EXPERIMENTAL!) True means getting independent zoom coefficients simultaneously or separately for each axis, if the zoom was initiated:

  • horizontally - the zoom coefficient will change only for the X axis,

  • vertically - the zoom coefficient will change only for the Y axis,

  • diagonally - the zoom coefficient will change along the axes X and Y at the same time.

JS and wasmJS have slight differences in response behavior (for example, zoom coefficients for the same gesture will be interpreted with a difference of several tenths or hundredths), and zoom handling with the mouse wheel scroll while pressing Ctrl/Cmd is not supported (a problem with browser scaling)

content

The content to be displayed, which should include one plot for each series to be plotted on this XYGraph.


fun <X, Y> XYGraph(xAxisModel: AxisModel<X>, yAxisModel: AxisModel<Y>, modifier: Modifier = Modifier, xAxisStyle: AxisStyle = rememberAxisStyle(), xAxisLabels: (X) -> String = { it.toString() }, xAxisTitle: String? = null, yAxisStyle: AxisStyle = rememberAxisStyle(), yAxisLabels: (Y) -> String = { it.toString() }, yAxisTitle: String? = null, horizontalMajorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.majorGridlineStyle, horizontalMinorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.minorGridlineStyle, verticalMajorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.majorGridlineStyle, verticalMinorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.minorGridlineStyle, panEnabled: Boolean = false, zoomEnabled: Boolean = false, allowIndependentZoom: Boolean = false, content: @Composable XYGraphScope<X, Y>.() -> Unit)

An XYGraph overload that takes Strings for axis labels and titles instead of Composables for use cases where custom styling is not required.

Provides a set of X-Y axes and grid for displaying an X-Y plot.

Parameters

X

The data type for the x-axis

Y

The data type for the y-axis

xAxisModel

x-axis state controlling the display of the axis and coordinate transformation

yAxisModel

y-axis state controlling the display of the axis and coordinate transformation

xAxisStyle

Style for the x-axis

xAxisLabels

String factory of x-axis label Strings

xAxisTitle

Title for the X-axis

yAxisStyle

Style for the y-axis

yAxisLabels

String factory of y-axis label Strings

yAxisTitle

Title for the y-axis

panEnabled

True if the plot can be panned, false to disable. Enabling panning may interfere with scrolling a parent container if the drag point is on the plot.

zoomEnabled

True if the plot can be zoomed, false to disable. Enabling zooming may interfere with scrolling a parent container if the drag point is on the plot.

allowIndependentZoom

true if the zoom can be either X-axis only or Y-axis only, false if the total zoom factor must be used. true does not mean that independent zoom coefficients are obtained simultaneously for each axis, if the zoom was initiated horizontally - the zoom coefficient will change only for the X axis, if the zoom was initiated vertically - the zoom coefficient will change only for the Y axis.

content

The content to be displayed within this graph, which should include one plot for each data series to be plotted.