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

Selection doesn't work with time variables #886

Closed
sidravi1 opened this issue May 22, 2018 · 4 comments
Closed

Selection doesn't work with time variables #886

sidravi1 opened this issue May 22, 2018 · 4 comments
Labels
vega: vega-lite Requires upstream action in `vega-lite`

Comments

@sidravi1
Copy link

Hi,

The selection doesn't seem to work with time variable:

cars = data.cars.url

brush = alt.selection(type='interval')

points = alt.Chart().mark_point().encode(
    x='Year:T',  # This is the only thing different from the example
    y='Miles_per_Gallon:Q',
    color=alt.condition(brush, 'Origin:N', alt.value('lightgray'))
).properties(
    selection=brush
)

bars = alt.Chart().mark_bar().encode(
    y='Origin:N',
    color='Origin:N',
    x='count(Origin):Q'
).transform_filter(
    brush.ref()
)

alt.vconcat(points, bars, data=cars)

image

Changing x to be "Horsepower:Q" in points works as expected

@jakevdp
Copy link
Collaborator

jakevdp commented May 22, 2018

This is a known bug in vega-lite; see vega/vega-lite#3737

@jakevdp
Copy link
Collaborator

jakevdp commented May 22, 2018

As a workaround, you can use a timeUnit: x=alt.X('Year:T', timeUnit='year')

@jakevdp jakevdp added the vega: vega-lite Requires upstream action in `vega-lite` label May 22, 2018
@jakevdp
Copy link
Collaborator

jakevdp commented May 22, 2018

Closing as a duplicate of #828

@jakevdp jakevdp closed this as completed May 22, 2018
@sidravi1
Copy link
Author

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vega: vega-lite Requires upstream action in `vega-lite`
Projects
None yet
Development

No branches or pull requests

2 participants