Fixed Line Coordinate
data class DayTemperature(val day: String, val temp: Int)
val weeklyTemp = listOf(
DayTemperature("Mon", 10),
DayTemperature("Tue", 6),
DayTemperature("Wed", 5),
DayTemperature("Thu", 7),
DayTemperature("Fri", 7),
DayTemperature("Sat", 11),
DayTemperature("Sun", 9)
).toDataFrame()
weeklyTemp.plot {
x("day")
line {
y("temp")
color = Color.BLUE
}
line {
y.constant(weeklyTemp[DayTemperature::temp].mean())
color = Color.GREEN
type = LineType.DOTTED
width = 2.5
}
}
val day = listOf("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
val temp = listOf(10, 6, 5, 7, 7, 11, 9)
plot {
x(day)
line {
y(temp)
color = Color.BLUE
}
line {
y.constant(temp.average())
color = Color.GREEN
type = LineType.DOTTED
width = 2.5
}
}
Last modified: 22 November 2023