elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.65k stars 8.23k forks source link

Color ranges break with Last value for array of values #188263

Open nickofthyme opened 4 months ago

nickofthyme commented 4 months ago

Kibana version:

8.14.0, 8.15.0, main

Describe the bug:

When support was added for array of values (aka aggTopHit) in https://github.com/elastic/kibana/pull/119165, we did not consider the interoperability of this feature with the custom color ranges.

The good news is this a mostly graceful bug that does not throw an error but simply ignores the color ranges.

This applies to any place that uses the Last value agg with color ranges.

Lens Metric

https://github.com/user-attachments/assets/9fb9907b-1f16-4ea7-9c5b-b28dc7fdd697

Lens Table

https://github.com/user-attachments/assets/bdbb29de-8ee0-4d0a-abb1-06e3987d222d

Steps to reproduce:

  1. Load eCommerce orders sample data
  2. Create a Lens Metric chart with Last value of products.base_price
  3. Select Dynamic coloring
  4. Enable the Show array values option

Expected behavior:

Incompatible UI should be disabled or hidden when used. How do we handle preserving this disabled config as to not loose user config when toggling the array values switch.

Any additional context:

Issue originally noticed by @dej611 in https://github.com/elastic/kibana/pull/184886#discussion_r1648607227

Right now there are few inconsistencies when enabling array support.

  • Color by value is still enabled but when opening the panel it's just full of errors, and many features like "Distribute values" do not work

    Screenshot 2024-06-21 at 09 59 15
  • When color by value is enabled it is possible to fall into various glitches

    • Static color is kept even when transitioning to dynamic coloring Screenshot 2024-06-21 at 10 09 37
    • If I swap a primary dimension with color X with another with dynamic coloring, the previous color X is preserved:

    multi_values_metric

  • max dimension is ignored

Screenshot 2024-06-21 at 10 09 37
  • when configuring a breakdown things gets a bit confused
Screenshot 2024-06-21 at 10 09 52 Screenshot 2024-06-21 at 10 07 44

I would propose to disable/hide incompatible features when array values are enabled in Last values. In particular:

  • Dynamic colouring I think should be hidden (and previous configured values should be ignored)
  • Max dimension should be disabled (with explanation tooltip) or hidden

_Originally posted by @dej611 in https://github.com/elastic/kibana/pull/184886#discussion_r1648607227_

cc: @teresaalvarezsoler

elasticmachine commented 4 months ago

Pinging @elastic/kibana-visualizations (Team:Visualizations)