Candlestick Settings DSL
val df = dataFrameOf(
"date" to List(10) { LocalDate(2022, 1, it + 1) },
"open" to listOf(10.0, 15.0, 12.0, 18.0, 14.0, 16.0, 20.0, 22.0, 19.0, 25.0),
"high" to listOf(18.0, 17.0, 20.0, 22.0, 18.0, 22.0, 25.0, 24.0, 27.0, 28.0),
"low" to listOf(8.0, 10.0, 9.0, 11.0, 12.0, 15.0, 18.0, 17.0, 18.0, 22.0),
"close" to listOf(15.0, 12.0, 18.0, 14.0, 16.0, 20.0, 22.0, 19.0, 25.0, 23.0),
)
df.plot {
candlestick("date", "open", "high", "low", "close") {
increase {
fillColor = Color.hex("#00fefe")
alpha = 0.9
}
decrease {
fillColor = Color.hex("#ea2211")
alpha = 0.5
}
borderLine.color = Color.GREY
width = 0.7
}
y.axis.name = "Price, €"
x.axis.name = "Date"
}
val date = List(10) { LocalDate(2022, 1, it + 1) }
val open = listOf(10.0, 15.0, 12.0, 18.0, 14.0, 16.0, 20.0, 22.0, 19.0, 25.0)
val high = listOf(18.0, 17.0, 20.0, 22.0, 18.0, 22.0, 25.0, 24.0, 27.0, 28.0)
val low = listOf(8.0, 10.0, 9.0, 11.0, 12.0, 15.0, 18.0, 17.0, 18.0, 22.0)
val close = listOf(15.0, 12.0, 18.0, 14.0, 16.0, 20.0, 22.0, 19.0, 25.0, 23.0)
plot {
candlestick(date, open, high, low, close) {
increase {
fillColor = Color.hex("#00fefe")
alpha = 0.9
}
decrease {
fillColor = Color.hex("#ea2211")
alpha = 0.5
}
borderLine.color = Color.GREY
width = 0.7
}
y.axis.name = "Price, €"
x.axis.name = "Date"
}
Last modified: 27 March 2024