question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.interactive only working with certain data types.

See original GitHub issue

Hi Altair users,

Is there a reason why adding “.interactive” does not work for the following example? I’m unable to pan or zoom. However if I use a temporal data type for the dates, then it works (although the rect marks now go on forever in the past).

df=pd.DataFrame({'days_between': ['2017-01-01', '2017-01-02', '2017-01-03'], 'variable': ['person_1', 'person_2', 'person_3'], 'value': [1,2,3]})

alt.Chart(df).mark_rect().encode(
    x='days_between:O',
    y='variable:N',
    color=alt.Color('value:Q', scale=alt.Scale(range=['green','yellow','red']))).properties(width=300, height=100).interactive()

visualization 3

With a temporal data type:

...
 x='days_between:T',
...

visualization 2

Any help is appreciated.

Al

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Casyfillcommented, Jun 11, 2018

same issue - .interactive() does not work with geoshapes for me:

alt.Chart(boundaries).project(type="mercator",center=[-73.99,40.72]
).properties(width=500,height=300).mark_geoshape(fill='lightgrey').encode().interactive()

results in

Javascript Error: Expression parse error: " ? {unit: \"\", intervals: []} : null". This usually means there's a typo in your chart specification. See the JavaScript console for the full traceback.

0reactions
jakevdpcommented, Nov 26, 2018

Vega-Lite achieves pan/zoom behavior by binding an interval selection to "scales". This is precisely what calling chart.interactive() does in Altair.

The issue here is that interval selections bound to scales for non-quantitative encodings do not have any effect in Vega-lite, and from the linked issues this appears to be by design. So no, there currently is no way to make this work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linked data types FAQ and tips - Microsoft Support
Linked data types pull in reliable data from online sources such as Bing, Wolfram, etc. If you want to view the type or...
Read more >
How to Select the Right Data Types | Tutorial by Chartio
The basic strategy for selecting the best data type is to select the smallest data type that matches the kind of data you...
Read more >
[Interactive Coding Exercise] Data Types - YouTube
We're releasing a free preview (first 3 hours) of our 60+ hour 100 Days of Python Bootcamp on YouTube.In this free series, you'll...
Read more >
How to get more new data types in Microsoft Excel - YouTube
Excel is evolving. With Stocks and Geography “ data types,” we introduced the idea of cells in the Excel grid containing more than...
Read more >
SQL Data Types | Advanced SQL - Mode Analytics
In previous lessons, you learned that certain functions work on some data types, but not others. For example, COUNT works with any data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found