Kibana bar chart colours are different from saved

Wondering if anyone can answer this question and maybe help guide me in the right direction...

Our product leverages Kibana within an iframe and we are on version 7.17.6 cloud.

In the dashboards that we've built, we are using a lot of the "aggregated based bar chart" type widgets.

In a lot of these widgets, we choose specific colours to represent data and then save the dashboard (see screenshot):

Sometimes we notice that with new deployments of our software, the colours that we selected do not persist and we end up getting slightly different colours that are selected randomly(?) (see screenshot):

Does anyone know why that is? Is this something by design? Is this a bug? Is there any way we can make sure that our selected colours persist?

Any guidance would be much appreciated,

Thanks!
Kristina

Hi @KristinaRaja

welcome to the Kibana community.

When changing the color, was the dashboard in edit or view mode?

From a quick look int he former case the SO it looks like the color is persisted on the visualization JSON and should be applied in all places.
In the latter the color is persisted on the dashboard panel config and seems to not be reflected when embedded.
Can you have a look in your dashboard/visualization SO if you can find the custom color defined?

Going to Stack Management > Saved Objects > find your visualization (if saved in the Visualize library) or Dashboard SO > click the ... > Inspect.

In the saved object there should be something like:

"uiState":{\"vis\":{\"colors\":{\"Failed\":\"#e9b0c3\", "Good":"#aaa", etc...}}}

if the color is persisted instead in the embeddableConfig property, then it has been set when in dashboard view mode and it won't be reflected when embedded from my tests.

Hi Marco,

This was very useful and likely will fix our issue, so thank you very much!

There is one caveat that remains on one of our widgets that maybe you have an idea on how we could solve...let me try explaining.....

We have a widget that is an aggregated based bar chart that is built by using a query as its source instead of an index pattern (see screenshot):

When trying to save this widget to library, we get the following message and it seems the widget is no longer usable:

Is there a way we can still define the colours for the bars on objects that are not saved to the library? Or, is there anything else we can do in this scenario?

Thanks again,
Kristina

Is the visualization using the saved search working on the original cloud instance?
I've just tried on a 7.17.6 instance to create a dashboard with 4 agg based charts, two from a dataView and the other two from a saved search, all with custom color and export it as iframe.

I cannot reproduce the bug:

There are charts created from both library and directly from dashboard.

Very interesting. This has never worked for me on any of our instances. Do you think we're doing something incorrectly somewhere - either, with the saved search or something in the stack management perhaps?

Steps I've taken to create the exported dashboard:


From library

  • Created an agg-based visualization (for either a dataView or saved search)
  • changed the color within the agg-based editor
  • save it in the library
  • add it to the dashboard via Add from library

From dashboard

  • create a new visualization from the dashboard directly
  • changed the color within the agg-based editor
  • save and return

I re-created the widget from library instead of from the dashboard directly and that worked!!!!!!!!!

Last additional question.....

Is there a way I can also set Line Chart colours in the UIStateJSON?

I see that I can change the threshold line colour pretty easily and I also see that Palette colour is defined, but is there a way to add in our own colours for the lines somewhere?

Once again, thanks so so much!!!
Kristina

You mean setting the color of the threshold line?

Sorry, I will re-explain.

For the line charts, I know we can select a colour palette for the widget to follow but is there a way to set custom colours that is outside of the colour palette?

Technically yes.
I would argue to use Lens for any color for metric series already without hacking the saved object.

Is there any way to do it without using Lens?

Not via UI.