Can we assign colors to specific fields in kibana?

Hello,

I can see how to select a color palette for a kibanaq dashboard lens visualization, but what I'd really like to be able to do is choose a particular field (like a "bad" field) and assign it red, and choose a "good" field and assign it green. I can't figure out how to do - is it possible?

Thanks!

Hi @smchamberlin ! This is on our immediate roadmap, so we hope to have this capability soon! You can watch this issue to track our progress: [Lens] Support categorical coloring by name · Issue #101942 · elastic/kibana · GitHub

In the meantime, there is a bit of an inelegant workaround. It may or may not work for you.

You should be able to use [runtime fields](https://runtime fields) added to your data view to map specific values to specific ranges and color based on those numeric ranges. You could have a table with two columns where one cell on each row displays the value and the other mapped value and the corresponding color.

Let me know if you have any more questions!

Hi Andrew,

Is there an active example of how to utilize runtime fields in our dashboards? The documentation says it can be done without changing the code, but everything I see requires some API configuration. Could I get a bit more clarity on this? Much appreciated.

You can add a field from the data view menu

Or from the data view management page

When the flyout opens, give your field a name and a type and toggle on "Set value." There, you define your field with a script.

Does this help?

1 Like

Hey Andrew,

Thanks for the response, I see where to edit the script but I still have a few questions.

1). Where do I specify color? So if I suppose have values that are ranging between 1-50 and I want them to be green, and 51-100 and have them be red, where and how do I specify that in the script/service?

2). If I create this runtime field, how do I apply it to the graph on my dashboard?

3). We update our data via Jenkins scripts every 24 hours, would we need to modify the particular graph we're editing with the runtime field manually?

Thanks Andrew! I have the same questions as Vidhu ... Where do we specify the color, and how does that field get picked up/applied in the dashboard?

Also is there an ETA on when the color mapping feature would be made available? Very glad to hear it's being considered.

Thanks!

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

Most possible target for MVP (assigning colors by term) is 8.11.

This is possible today for numeric data without bringing in a runtime field.

The only reason I brought up runtime fields was because I thought we were talking about string or keyword fields—"bad" and "good" for example, in which case you would currently have to map those to numeric values. Support for coloring by terms ("bad" or "good," etc) is what is coming in [Lens] Support categorical coloring by name · Issue #101942 · elastic/kibana · GitHub.

My apologies if I misunderstood the intent of this topic!

You can easily define color ranges for numeric data in Lens.

Take this example of a metric visualization.

First, select "Dynamic" under "Color mode."

Then, click the palette bar.

This will open the palette editing interface where you can edit what colors should be assigned to what numeric ranges.

Let me know if this helps.

1 Like

Hi Andrew!

Thank you so much for this, I think it will definitely help us when we need to create color mapping based on numbers. That being said, we currently have a graph where we have 20 entries, in our case Customer Scenario's (CD1-Cd50 for example), and each have a set number of "open" or "closed" issues.

red: open
closed: green

The data is shown in the proper color at high level, but when drilling down it chooses only one color.

So if I hit CD59, which is mostly open issues so mostly red, it shows me a green vs red breakdown:

but when I click on the RED, the whole graph turns green:

So perhaps the above assigning words to colors might help, has that been updated and available since I see the ticket is closed? If so, how would I best go about that?

So I see above that the issue has been closed, has the functionality to assign WORDS to colors been integrated yet?

Hey @Andrew_Tate

Has Support for coloring by terms ("bad" or "good," etc) is what is coming in [Lens] Support categorical coloring by name · Issue #101942 · elastic/kibana · GitHub been made available in a specific version? If so we can update our stack to that version.

thanks!

1 Like

It was made available in 8.11
[Lens] Color mapping for categorical dimensions by markov00 · Pull Request #162389 · elastic/kibana (github.com)

1 Like