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

Updating a filter value resets all of my series configuration #10994

Open
TuringLovesDeathMetal opened this issue Aug 2, 2024 · 5 comments
Open
Labels
🐛 bug Something isn't working as expected. This can be an error or an unexpected user experience

Comments

@TuringLovesDeathMetal
Copy link
Contributor

Description

If I update a filter value, my chart configuration gets reset.

See user Slack video here: https://lightdash.slack.com/archives/C047QNA8YPR/p1722602240392489

Steps to Reproduce the Bug or Issue

I can't seem to reproduce this locally...

I've tried:

  • having two dimensions and two series in my chart
  • changing a bunch of chart configurations
  • filtering on a different dimension
  • changing the value of the filter

it seems to not break for me...

version

No response

Cloud or self-hosting

None

@TuringLovesDeathMetal TuringLovesDeathMetal added the 🐛 bug Something isn't working as expected. This can be an error or an unexpected user experience label Aug 2, 2024
@joaoviana
Copy link
Contributor

Able to replicate this

  • I believe the chart must be grouped by at least 1 dimension and one of the dimensions referenced on the grouped series needs to be used as a filter

Local link: http://localhost:3000/projects/3675b69e-8324-4110-bdca-059031aa8da3/tables/orders?create_saved_chart_version={"tableName":"orders","metricQuery":{"exploreName":"","dimensions":["orders_order_id","orders_status","orders_is_completed","orders_order_date_day"],"metrics":["orders_average_order_size","customers_unique_customer_count"],"filters":{"dimensions":{"id":"226a3351-9d37-49fe-9518-23afce36f83c","and":[{"id":"f8bfeab1-ad54-4c2c-9c86-d225088d19f9","target":{"fieldId":"orders_status"},"operator":"equals","values":[],"required":false}]}},"sorts":[{"fieldId":"orders_average_order_size","descending":true}],"limit":500,"tableCalculations":[],"additionalMetrics":[]},"pivotConfig":{"columns":["orders_status","orders_is_completed"]},"tableConfig":{"columnOrder":["orders_order_id","orders_status","orders_is_completed","orders_order_date_day","orders_average_order_size","customers_unique_customer_count"]},"chartConfig":{"type":"cartesian","config":{"layout":{"xField":"orders_order_id","yField":["orders_average_order_size","customers_unique_customer_count"]},"eChartsConfig":{"series":[{"type":"bar","yAxisIndex":1,"encode":{"xRef":{"field":"orders_order_id"},"yRef":{"field":"customers_unique_customer_count","pivotValues":[{"field":"orders_status","value":"returned"},{"field":"orders_is_completed","value":false}]}},"color":"#0d2e1f"},{"type":"bar","yAxisIndex":0,"encode":{"xRef":{"field":"orders_order_id"},"yRef":{"field":"customers_unique_customer_count","pivotValues":[{"field":"orders_status","value":"placed"},{"field":"orders_is_completed","value":false}]}}},{"type":"bar","yAxisIndex":0,"encode":{"xRef":{"field":"orders_order_id"},"yRef":{"field":"customers_unique_customer_count","pivotValues":[{"field":"orders_status","value":"shipped"},{"field":"orders_is_completed","value":false}]}}},{"type":"bar","yAxisIndex":0,"encode":{"xRef":{"field":"orders_order_id"},"yRef":{"field":"customers_unique_customer_count","pivotValues":[{"field":"orders_status","value":"return_pending"},{"field":"orders_is_completed","value":false}]}}},{"type":"bar","yAxisIndex":0,"encode":{"xRef":{"field":"orders_order_id"},"yRef":{"field":"customers_unique_customer_count","pivotValues":[{"field":"orders_status","value":"completed"},{"field":"orders_is_completed","value":true}]}}},{"type":"bar","yAxisIndex":0,"encode":{"xRef":{"field":"orders_order_id"},"yRef":{"field":"orders_average_order_size","pivotValues":[{"field":"orders_status","value":"returned"},{"field":"orders_is_completed","value":false}]}},"color":"#e00000"},{"type":"bar","yAxisIndex":0,"encode":{"xRef":{"field":"orders_order_id"},"yRef":{"field":"orders_average_order_size","pivotValues":[{"field":"orders_status","value":"placed"},{"field":"orders_is_completed","value":false}]}}},{"type":"bar","yAxisIndex":0,"encode":{"xRef":{"field":"orders_order_id"},"yRef":{"field":"orders_average_order_size","pivotValues":[{"field":"orders_status","value":"shipped"},{"field":"orders_is_completed","value":false}]}}},{"type":"bar","yAxisIndex":0,"encode":{"xRef":{"field":"orders_order_id"},"yRef":{"field":"orders_average_order_size","pivotValues":[{"field":"orders_status","value":"return_pending"},{"field":"orders_is_completed","value":false}]}}},{"type":"bar","yAxisIndex":0,"encode":{"xRef":{"field":"orders_order_id"},"yRef":{"field":"orders_average_order_size","pivotValues":[{"field":"orders_status","value":"completed"},{"field":"orders_is_completed","value":true}]}}}]},"metadata":{"orders_average_order_size_n2.placed.false":{"color":"#71bfeb"},"orders_average_order_size_n2.shipped.false":{"color":"#d4a7d9"},"orders_average_order_size_n2.returned.false":{"color":"#e00000"},"orders_average_order_size_n2.return_pending.false":{"color":"#ff6666"},"customers_unique_customer_count_n2.shipped.false":{"color":"#f5fcff"},"customers_unique_customer_count_n2.returned.false":{"color":"#0d2e1f"},"customers_unique_customer_count_n2.return_pending.false":{"color":"#8bbf71"}}}}}

@joaoviana
Copy link
Contributor

joaoviana commented Aug 6, 2024

On the main issue represented by the video from the Slack issue, it seems that the filter affected the series values.

We could be smarter with the Type, Axis, and Value labels and keep them intact (as well as the order) when there's a behaviour like this.

Image

EDIT

It's quite tricky to pinpoint what is causing this issue.

I just tested another similar scenario and it seems right to me - the colours for each series remain intact after applying a filter

See playlist_deleted low

before

Image

after

Image

@ZeRego
Copy link
Contributor

ZeRego commented Aug 7, 2024

@TuringLovesDeathMetal @joaoviana This happens when the pivot (grouped by) values change.

Demo:
(this can be replicated with a single metric in the y axis but is easier to understand with 2 as the pivot values are part of the series name)

demo.mp4

Context:

  • we generate a unique reference and a series for each combination of the pivot value and the y axis metric
  • series groups and their configuration are extrapolated from the series. They are not saved in the database.

Example:
If in the first query we have the series:

  • placed average order size
  • completed average order size
  • placed completed order count
  • completed completed order count

On the second query we have the series:

  • return_pending average order size
  • returned average order size
  • return_pending completed order count
  • returned completed order count

Since the series references are different, we don't keep any configuration.

series groups and their configuration are extrapolated from the series. They are not saved in the database.

I believe this is the root problem. Users expect the settings for that group ( aka y-axis metric ) to be saved but it's not. At the moment, when the user updates that config we are updating all the series that belong to that group.

We could save the Type, Axis, Value labels, Show symbol, Smooth. The new series would still have different colours.

@joaoviana
Copy link
Contributor

One Q on the example @ZeRego , if you revert the filter back to placed completed, do you get the previous colours back?

@ZeRego
Copy link
Contributor

ZeRego commented Aug 7, 2024

@joaoviana Yes. We recently started to store series colours so we know the color of a series that reappears. They are stored in CartesianChart['metadata']

@joaoviana joaoviana changed the title Updating a filter value resets all of my chart configuration Updating a filter value resets all of my series configuration Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working as expected. This can be an error or an unexpected user experience
Projects
None yet
Development

No branches or pull requests

3 participants