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

Dashboard-level filters are not applying to charts (that are in-scope) #29519

Open
3 tasks done
clavidk opened this issue Jul 8, 2024 · 3 comments
Open
3 tasks done
Labels
dashboard:filtersets Related to the filtersets of the Dashboard viz:charts Namespace | Anything related to viz types

Comments

@clavidk
Copy link

clavidk commented Jul 8, 2024

Bug description

In mixed charts, query B does not seem to inherit default dashboard-level filters sometimes...

How to reproduce the bug

Hard to reproduce consistently but:

  1. Create a mixed chart with 2 queries, and a primary AND secondary Y-axis.
  2. Primary chart should be a line chart, secondary chart should be a bar chart.
  3. Create a dashboard-level date filter with a default value that is from 2023-11-01 to Now.
  4. Refresh dashboard
  5. Repeat steps 1&2
  6. Refresh dashboard
  7. Notice that query B is not filtered to the default dashboard-level date filter.
  8. Go into edit the chart and notice that query A has automatically added the dashboard-level filter in its filter section:
image

However, query B does not seem to have inherited the dashboard level filter.
image

What I expect:
All charts are filtered to date ranges from 2023-11-01 to Now. All queries in mixed chart have inherited the dashboard-level filters into its filter section.

What I see:
My chart I created after my dashboard filter shows all date ranges (not filtered)

Screenshots/recordings

See above

Superset version

master / latest-dev

Python version

I don't know

Node version

I don't know

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@dosubot dosubot bot added dashboard:filtersets Related to the filtersets of the Dashboard viz:charts Namespace | Anything related to viz types labels Jul 8, 2024
Copy link

dosubot bot commented Jul 8, 2024

Hey @clavidk,

I'm here to help you with your Superset issue. I'm a bot designed to assist you with bugs, questions, and contributions while you wait for a human maintainer. Let's tackle this together!

The issue you're experiencing with dashboard-level filters not applying to some mixed charts (combo line + bar charts with a primary and secondary y-axis) is likely due to the adhoc_filters and adhoc_filters_b parameters having a comparator set to "No filter". This configuration means that the chart is not set up to apply any date range filter by default.

To resolve this, ensure that the comparator values in both adhoc_filters and adhoc_filters_b are set to accept the date range filter from the dashboard. Here is an example configuration:

adhoc_filters:
  - clause: WHERE
    subject: order_date
    operator: TEMPORAL_RANGE
    comparator: No filter
    expressionType: SIMPLE

adhoc_filters_b:
  - clause: WHERE
    subject: order_date
    operator: TEMPORAL_RANGE
    comparator: No filter
    expressionType: SIMPLE

Additionally, the transformProps function in the superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts file handles the transformation of chart properties, including the application of filters. Ensuring that the filterState and queriesData are correctly processed in this function can help in applying the dashboard-level date range filter to mixed charts [[1]](https://github.com/apache/superset/blob/master/superset/examples/configs/charts/Featured Charts/Mixed.yaml)[2].

If the issue persists, you might want to check for any recent updates or changes in the Superset codebase that address the application of dashboard-level filters to mixed charts. Recent updates have improved the dashboard native filter feature, which provides a way to apply and manipulate filters over many charts at the dashboard level, including mixed charts [3][4][5][6].

To continue talking to Dosu, mention @dosu.

@clavidk
Copy link
Author

clavidk commented Jul 16, 2024

Ah edit: it seems like query B is not inheriting the dashboard level filters:
image
Query B ^ date filter says no filter

Whereas Query A inherits the dashboard filter:
image

@mneves24
Copy link

Same here
Screenshot 2024-08-23 at 18 23 08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard:filtersets Related to the filtersets of the Dashboard viz:charts Namespace | Anything related to viz types
Projects
None yet
Development

No branches or pull requests

2 participants