run javascript on altair plot clicks
up vote
0
down vote
favorite
I can generate altair plots consisting of multiple linked subplots, as can be seen in the famous car data visualization: https://altair-viz.github.io/gallery/selection_histogram.html
Clicks/Selections in one subplot can have an effect on the other subplot(s), mainly via filtering of the data.
However, I do not have a plot on its own, but it is embedded in a bigger web portal (think car dealership page). So my portal is driven by Flask serving pages embedding the altair plots. An example for this can be seen here: https://github.com/lemoncyb/flasked-altair
Functionally, I want to click on one car in the plot and then show some information about this car outside the scope of the plot (e.g. navigate to another page in the portal).
Technically, I want to run custom Javascript code upon clicks/selections.
How is this possible? How does one build bigger sites/applications around an altair plot that require interactions between the plot and the rest of the site?
javascript interaction vega vega-lite altair
add a comment |
up vote
0
down vote
favorite
I can generate altair plots consisting of multiple linked subplots, as can be seen in the famous car data visualization: https://altair-viz.github.io/gallery/selection_histogram.html
Clicks/Selections in one subplot can have an effect on the other subplot(s), mainly via filtering of the data.
However, I do not have a plot on its own, but it is embedded in a bigger web portal (think car dealership page). So my portal is driven by Flask serving pages embedding the altair plots. An example for this can be seen here: https://github.com/lemoncyb/flasked-altair
Functionally, I want to click on one car in the plot and then show some information about this car outside the scope of the plot (e.g. navigate to another page in the portal).
Technically, I want to run custom Javascript code upon clicks/selections.
How is this possible? How does one build bigger sites/applications around an altair plot that require interactions between the plot and the rest of the site?
javascript interaction vega vega-lite altair
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I can generate altair plots consisting of multiple linked subplots, as can be seen in the famous car data visualization: https://altair-viz.github.io/gallery/selection_histogram.html
Clicks/Selections in one subplot can have an effect on the other subplot(s), mainly via filtering of the data.
However, I do not have a plot on its own, but it is embedded in a bigger web portal (think car dealership page). So my portal is driven by Flask serving pages embedding the altair plots. An example for this can be seen here: https://github.com/lemoncyb/flasked-altair
Functionally, I want to click on one car in the plot and then show some information about this car outside the scope of the plot (e.g. navigate to another page in the portal).
Technically, I want to run custom Javascript code upon clicks/selections.
How is this possible? How does one build bigger sites/applications around an altair plot that require interactions between the plot and the rest of the site?
javascript interaction vega vega-lite altair
I can generate altair plots consisting of multiple linked subplots, as can be seen in the famous car data visualization: https://altair-viz.github.io/gallery/selection_histogram.html
Clicks/Selections in one subplot can have an effect on the other subplot(s), mainly via filtering of the data.
However, I do not have a plot on its own, but it is embedded in a bigger web portal (think car dealership page). So my portal is driven by Flask serving pages embedding the altair plots. An example for this can be seen here: https://github.com/lemoncyb/flasked-altair
Functionally, I want to click on one car in the plot and then show some information about this car outside the scope of the plot (e.g. navigate to another page in the portal).
Technically, I want to run custom Javascript code upon clicks/selections.
How is this possible? How does one build bigger sites/applications around an altair plot that require interactions between the plot and the rest of the site?
javascript interaction vega vega-lite altair
javascript interaction vega vega-lite altair
asked Nov 17 at 10:50
mnagel
4,38231650
4,38231650
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
This cannot be done via Altair itself, but Altair renders its plots via Vega-Lite, which itself is compiled down to Vega. Vega's View API provides a Javascript API for handling events and callbacks in the way you're asking about. You can read more in Vega's Event Handling documentation.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
This cannot be done via Altair itself, but Altair renders its plots via Vega-Lite, which itself is compiled down to Vega. Vega's View API provides a Javascript API for handling events and callbacks in the way you're asking about. You can read more in Vega's Event Handling documentation.
add a comment |
up vote
0
down vote
This cannot be done via Altair itself, but Altair renders its plots via Vega-Lite, which itself is compiled down to Vega. Vega's View API provides a Javascript API for handling events and callbacks in the way you're asking about. You can read more in Vega's Event Handling documentation.
add a comment |
up vote
0
down vote
up vote
0
down vote
This cannot be done via Altair itself, but Altair renders its plots via Vega-Lite, which itself is compiled down to Vega. Vega's View API provides a Javascript API for handling events and callbacks in the way you're asking about. You can read more in Vega's Event Handling documentation.
This cannot be done via Altair itself, but Altair renders its plots via Vega-Lite, which itself is compiled down to Vega. Vega's View API provides a Javascript API for handling events and callbacks in the way you're asking about. You can read more in Vega's Event Handling documentation.
answered Nov 18 at 3:19
jakevdp
17.1k33049
17.1k33049
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53350489%2frun-javascript-on-altair-plot-clicks%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown