You can define a comprehensive visual theme using a CustomStyle lambda. This allows you to group styling configurations for various plot elements like global, axis, legend, panel, plotCanvas, and strip in one place. This style can then be applied to plots using functions like pointPlotWithStyle or within a layout { style { ... } } block.
Key configuration areas include:
global: Controls general line, background, and text properties.axis: Configures ticks, ticksLength, onTop, and tooltip.legend: Sets position, direction, justification, and background.panel: Manages background and grid (major/minor lines).plotCanvas: Styles the overall canvas, including the title and background.
val styleOrangeConstructor: CustomStyle.() -> Unit = {
global {
line { color = orangeNormal; width = 2.0 }
background { fillColor = orangeLight; borderLineWidth = 2.0 }
text { color = orangeDark }
}
axis {
ticks { color = orangeNormal; width = 1.0 }
ticksLength = 7.0
onTop = true
}
legend {
position = LegendPosition.Bottom
}
panel.grid {
majorLine { color = orangeNormal; width = .5 }
minorLine { blank = true }
}
plotCanvas.background { fillColor = yellowLight; borderLineWidth = 1.0 }
axis.tooltip.background { borderLineColor = orangeDark }
}
// Usage
pointPlotWithStyle("Scatter plot", Style.None, styleOrangeConstructor)