Charts-kt manages several layers of display and gives the visual elements the expected "drawing zone" in the expected layer, so you don't have to handle this yourself.

The layers

This is a view of a Chart layers:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/dfbcd67b-50e7-44bd-9f44-33301ecf38ec/Untitled.png

Each visual element drawing is restricted to a given layer, this ensures that, for example, the axes can't be hidden by the marks as they are always on top of them.

The marks layers

For the sake of simplification the schema displayed only a single "mark layer", but there are 4 of them for each Mark in the chart:

Keep in mind that drawing on a layer (for example when you draw a highlighted mark on the marks top layer) does not clear the other layers.

The axes layers

As for the marks, there are as many axis layer as axes displayed in the chart.

The background elements layer

This layer is used to draw background elements like the "alternate backgrounds", or the "grid lines" to increase the readability of your chart.

Chart background

The chart background layer is simply filled with a solid color.

The drawing Zones

A DrawingZone is an on-screen zone defined by its position and its size.