apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
63.17k stars 14k forks source link

Time column/range dashboard filter doesn't work with bar chart with timestamp column on x-axis #27628

Open fzhengTT opened 8 months ago

fzhengTT commented 8 months ago

Bug description

I'm using a dataset with 3 time columns: submission_ts, start_ts, and end_ts. I made a bar chart with submission_ts on the x-axis and the count of training jobs on the y-axis, submission_ts is by default placed in the Filter section of the chart.

In the dashboard, I have a time column and time range filter. Ideally, I want to plot submission_ts on the x-axis of the bar chart and filter data using start_ts or end_ts. After I selected start_ts for time column dashboard filter and Last Day for time range dashboard filter, the bar chart presented a bug like the screenshot below: ticks/units disappear on the x-axis, incorrect unit on the y-axis, incorrect dimension/legend (seems like start_ts is being treated as one of the dimensions).

Screenshot 2024-03-22 at 4 18 14 PM

I also noticed that the SQL query which powers the bar chart is not rendered correctly (see the screenshot below). The outer most SELECT statement selects the time column chosen for the filter, but not the time column I chose to put on the x-axis.

Screenshot 2024-03-22 at 4 32 15 PM

How to reproduce the bug

  1. Make a bar chart with timestamp column on the x-axis using a dataset with multiple time columns.
  2. Add the chart to a dashboard and create 2 filters: one time column filter and one time range filter.
  3. For the time column filter, select a column which is not the one on the x-axis of the bar chart.
  4. Select any range for the time range filter.
  5. Apply the filters and should be able to see the bug on the bar chart.

I also noticed that in the video Apache Superset: Dashboard filters 101 (https://www.youtube.com/watch?v=cafjAk7t5MM&t=615s), at 11min 43s, after the presenter applied the filters, the chart Sales over Time (first row second column) also had the same bug as I described here.

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

3.9

Node version

I don't know

Browser

Chrome

Additional context

No response

Checklist

SuicidalManiac commented 2 months ago

I have the same issue. Did you have any luck to resolve the issue yet? It seems like the date filtering doesn't like it when the filter is not on the default date column and/or the date in the x-axis is not the same date that gets filtered.