Transform filter from selection of temporal data is empty
See original GitHub issueI’m trying to use selection_interval
to show a histogram of values selected from a scatterplot. This works fine with quantitative data but fails with temporal data that has not been transformed.
import altair as alt
import pandas as pd
import numpy as np
# Make dataframe from datetimes, random values, and sequential counts
dates = pd.date_range(start='1-1-2017-01', periods=200, freq='H')
values = np.random.randint(0, 20, size=200)
count = range(len(dates))
data = pd.DataFrame({'dt': dates, 'values': values, 'count': count})
brush = alt.selection_interval(encodings=['x'])
points = alt.Chart(data).mark_point().encode(
# Unmodified datetime, counts, and transformed datatime data for the x-axis
x='dt:T',
# x='count:Q',
# x=alt.X('dt:T', timeUnit='yearmonthdatehours', axis=alt.Axis(title='Transformed dt')),
y='values:Q',
).properties(
selection=brush
)
bars = alt.Chart(data).mark_bar().encode(
x='values:Q',
y='count()'
).transform_filter(
brush.ref()
)
points | bars
Initial plot with temporal dt
on the x-axis
Empty bar chart/histogram when I select data in the scatterplot
Works fine with quantitative counts
on the x-axis
Also works when dt
is transformed
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Filter on null, blank, or empty values | ThoughtSpot Software
Filtering on NULL and empty values is a special case, and can be tricky if your data contains more than one of these....
Read more >Create an interactive filter for whether a field is empty or ...
You can create a Boolean interactive filter that lets users filter report widgets based on whether a specific field is empty or populated....
Read more >Row Filtering in Power BI and Power Query: Remove Blank ...
When you have blank values in your data table, you can use Power Query ... transformations in Power Query, the selected column is...
Read more >Selection Parameters | Vega-Lite
With layered and multi-view displays, a strategy that determines how selections' data queries are resolved when applied in a filter transform, ...
Read more >Manage historical data in System-Versioned Temporal Tables
Managing temporal table data retention begins with determining ... see Select rows to migrate by using a filter function (Stretch Database).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s up to you: free to just report issues here. I’m happy to echo them upstream where it’s appropriate.
@gschivley I am going through Altair issues to find those that have been resolved and can be closed. It looks to me like this issue has been solved in the latest version of Altair so I am closing it, but please feel free to reopen and add a comment if there is something you don’t think is resolved yet.