linearBg
Creates a new FormattedFrame by just changing the background colors of the selected cells.
The background color of each selected cell is calculated by interpolating between from and to, given the numeric value of that cell. The interpolation is linear.
If the numeric cell value falls outside the range from..to, the colors at the bounds will be used.
This function is shorthand for:
.with{ background(linear(it, from, to)) }
For more information: See format on the documentation website.
See also with, background, and linear.
Examples using linearBg:
df.format { temperature }.linearBg(-20 to FormattingDsl.blue, 50 to FormattingDsl.red)
.format { age }.notNull().perRowCol { row, col ->
textColor(
linear(col[row], col.min() to green, col.max() to red)
)
}.toStandaloneHtml().openInBrowser()Check out the full Grammar.
Parameters
The lower bound of the interpolation range and the color that will be returned when the cell value touches this bound.
The upper bound of the interpolation range and the color that will be returned when the cell value touches this bound.