How conditionally set color to the cell text in Data Table

I am using ELK Stack 7.3.2

I have a Data Table in Canvas.

Here is my query:
SELECT "@timestamp" as time, hostname, status, vm, latency FROM "boris-topic*"
where hostname is not null
order by time desc

Here is my table.

I want to color Up/Down based on state change.

Please advise.

Conditional per-field coloring can be achieved via the field formatters. coloring the full row is not supported right now. Maybe looking at the source of the color field formatter can give you an inspiration for your data table. I don't think that formatting one field depending on the value of another is easily implementable right now though.


Can you please show me an example of conditional field coloring in Canvas Data Table.

| essql
query="SELECT processName, processType, hostname, status, "@timestamp" as time FROM "boris-index" "
| mapColumn "value"
fn={getCell "status" | switch {case if={compare "eq" to="UP"} then="Healthy"} {case if={compare "eq" to="DOWN"} then="Unhealthy"} default="Unknown"}
| table showHeader=true
font={font family="'Open Sans', Helvetica, Arial, sans-serif" size=18 align="left" color="#000000" weight="bold" underline=false italic=false}
| render

Is there a decent way to color value text or background using mapColumn or get Cell?

@tims - can u provide some insight here?


Hi @bkleynbok, unfortunately, conditional coloring at the row or cell level inside of a datatable is not possible right now in Canvas. We have an open issue for this here:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.