Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pie chart colors sporadically updating #13653

Closed
stacey-gammon opened this issue Aug 22, 2017 · 20 comments
Closed

Pie chart colors sporadically updating #13653

stacey-gammon opened this issue Aug 22, 2017 · 20 comments
Labels
bug Fixes for quality problems that affect the customer experience Feature:Visualizations Generic visualization features (in case no more specific feature label is available) impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@stacey-gammon
Copy link
Contributor

I filed something similar awhile ago and closed it because I thought it was due to changing data. But this time I am sure the data is not changing. Nor am I making any color overrides in a dashboard. Simply refreshing the page on a pie chart, and the colors change.

Not sure if this is intentional, but it doesn't make sense in context. A person gets used to a color representing a label, and then refreshing the page changes it. In addition it's troublesome for reporting because then your generated report might not match what you saw in the dashboard.

screen shot 2017-08-22 at 4 12 54 pm

screen shot 2017-08-22 at 4 13 43 pm

Most of the time 0 is mapped to the green, but every now and then I see it mapped to the blue.

cc @elastic/kibana-visualizations

@stacey-gammon stacey-gammon added Feature:Visualizations Generic visualization features (in case no more specific feature label is available) bug Fixes for quality problems that affect the customer experience labels Aug 22, 2017
@thomasneirynck
Copy link
Contributor

I've been trying to reproduce on master, to no avail. Do you know of specific steps to reproduce?

@stacey-gammon
Copy link
Contributor Author

I didn't do anything more than refresh the page :(

I do have some changes checked out but they shouldn't interfere as it's just test stuff and some reporting changes.

@stacey-gammon
Copy link
Contributor Author

stacey-gammon commented Aug 23, 2017

fwiw I've been running the reporting tests for awhile now and haven't seen the blue color show up for 0. I suspect it's still a legit issue, must just be difficult to repro.

EDIT: I spoke too soon, it just happened again. Still must be difficult to repro though.

@stacey-gammon
Copy link
Contributor Author

I think I have a way to reproduce (btw looks like this has been around for while - #7561).

I think the problem is that the colors aren't saved with the visualization and the mappedColors array will get wiped on a page refresh (kibana/src/ui/public/vis/components/color/mapped_colors.js).

So say you open a dashboard and look at a pie chart for last 24 hours. The top slices get the default colors:
screen shot 2017-09-22 at 3 18 00 pm

Now switch to last 7 days which in my data set, has a completely new set of top values, so they all have new colors:
screen shot 2017-09-22 at 3 18 11 pm

Then refresh the page. This will wipe out the mappedColors array and give the last 7 days top values the default colors:
screen shot 2017-09-22 at 3 19 26 pm

To fix it, I think we need to persist the colors on a saved visualization in their config, so it doesn't load up the defaults on a page refresh.

cc @elastic/kibana-visualizations

@stacey-gammon
Copy link
Contributor Author

actually

To fix it, I think we need to persist the colors on a saved visualization in their config, so it doesn't load up the defaults on a page refresh.

This is wrong. The visualization could have been saved with an entirely different set of labels. So when we are just browsing data, how do you say - you viewed this label on this visualization at some point and it had color x, so from now on, always give it color x? We aren't saving the visualization during these steps at all, we're just exploring data on a dashboard.

We also aren't saving the dashboard at all.

Another possible complication - what if you have a pie chart that has a slew of colors, and in your data there are millions of possible values. As you explore data, if we persist this color mapping, it will grow and grow. For instance, what if a pie slice is filtered on time. As time goes on, your going to run out of unique colors to give the slices.

@ppisljar
Copy link
Member

i think this is expected behavior ... but i agree its confusing and probably not right ...

each series name is mapped to a color. when a new series is found it gets the color from:

  • uiState saved with dashboard (someone set the color on the dashboard)
  • uiState saved with visualization (someone set the color when creating vis)
  • new color from the palette

on refresh, as you noticed the series->color mapping is lost and is rebuild
clicking around kibana without refreshing keeps the color mapping (so running a query which will produce different series will assign them new colors from the palette)

@ppisljar
Copy link
Member

on dashboard:

  • should series with same name (for example US, FR) have the same color across all charts ?
  • should refreshing the page produce the same colors ?
  • should every user of the dashboard view same colors ?

@alexfrancoeur
Copy link

Do we think this comment (#10148 (comment)) is related? Sounds like the same behavior.

@stacey-gammon
Copy link
Contributor Author

It's hard to tell. From what I can tell there are a couple issues - One is that the color mappings may change depending on which time range you load up first on a dashboard. This isn't really a bug, just how it works, and how to fix it is unclear. The second I think is that even during the same time range, a refresh sometimes drops the first default mapping green color and it goes to purple instead. I think this is a legit bug that is really hard to repro (but @kobelb ran into it during reporting tests as well, so I don't think I'm going crazy!).

I'm not sure which version that person is referring to. I'd take a guess that it's the first since that's more prevalent, in which case, a solution is probably not around the corner.

@vijaygoturi
Copy link

@stacey-gammon @alexfrancoeur I am working on kibana 5.6. If the color mapping change depending upon the time range, what is the case usability of giving the color selection option in the visualization. Hope I am on the same page with you guys.

@stacey-gammon
Copy link
Contributor Author

@vijaygoturi - if you select the legend colors manually, they should always map to that value (is that not the case for you? Maybe I misunderstood the bug you were seeing).

If you don't manually select colors, or for legend values that you haven't selected colors for, they can change based on the time range.

This is the flow for how that happens:

  1. You load a pie chart with time A, which maps Legend values cat -> green and dog -> purple.
  2. You change to time B and the pie chart now shows legend values bunny -> blue, frog -> yellow.
  3. You hard refresh the page at time B, or share the visualization/dashboard at time B to someone else. Now bunny -> green and frog -> purple.

The color mapping grows as you browse through time so no legend color is ever repeated (or at least minimally, I imagine we run out of colors at some point), but when the page is refreshed, the mapping resets and starts over again.

If you set the colors on the legend manually, and save it with the visualization or dashboard, that data will be saved in elasticsearch and load up. It's actually stored in the url too, so you can share and the colors should stay the same.

Does that answer your question?

@vijaygoturi
Copy link

@stacey-gammon I am trying to save the colors manually and show the visualization on a html page with the Iframe. But the color are not getting reflected instead it is taking the auto colors.

@stacey-gammon
Copy link
Contributor Author

Ah, gotcha, thanks for clarifying. In that case, I would open a new bug, if you don't mind. This issue doesn't cover the case for manually setting the colors (possible they are related, but should probably be filed separately).

@vijaygoturi
Copy link

@stacey-gammon sure. I already opened a bug on this #14787

@timroes timroes added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Sep 16, 2018
@RenataBoodram
Copy link

@stacey-gammon I think I'm seeing a similar issue on my line graph (Kibana 6.3.2).

As per comment #7561 (comment) - I perform a hard refresh and the unpinned colours change. I have not updated any values nor have I changed timeframe. Is this expected behaviour?

@SVirgil
Copy link

SVirgil commented Nov 21, 2018

Hello!
Can we get an ETA for fixing this?

@ghost
Copy link

ghost commented Feb 5, 2020

Hello,

I'm running Kibana 7.5.2 and I'm facing the same issue. I found a way to reproduce this issue. I experienced this issue by missclicking on the Canvas icon and wanted to go back as quick as possible to the dashboard. Go into your dashboard, click on "Canvas" icon on the left, then before this appear, click on the Dashboard icon, whithout waiting for the Canvas page to appear.

@knightian
Copy link

knightian commented Oct 31, 2020

Yep I have same problem. I have a donut wit 2 slices shown from filters. The filters are generated from "now" so now - now-5m for example. Because "now" changes value on refresh (updates to current time) it is automatically refreshing the colours of my donut slices. This is really annoying.

@stratoula stratoula added the impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. label Jul 26, 2021
@ganesh-s05
Copy link

+1

@flash1293
Copy link
Contributor

This is the expected behavior as long as "sync color palettes" option on dashboard is enabled. To have stable colors even when refreshing, turn off the option - this will cause each chart to assign colors in order of slices appearing in the chart:
Screenshot 2021-10-11 at 11 49 40

We are continuing to think about improving color management in general to avoid confusing default behaviors like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Visualizations Generic visualization features (in case no more specific feature label is available) impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests