-
Notifications
You must be signed in to change notification settings - Fork 1
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
The avenger-html renderer does not display charts #77
Comments
I haven't tried in VSCode, but it's been working for me in JupyterLab. Could you check the browser console for logging/errors? |
Also, what browser did you use for JupyterLab? I've been working in Chrome mostly |
Ah, WebGPU isn't available by default on Linux yet (https://developer.chrome.com/docs/web-platform/webgpu/troubleshooting-tips), and it's not falling back to WebGL for some reason. I might publish a new version that only uses WebGL since I don't think there's much of a performance difference. |
I just pushed a new version that should use WebGL all the time. Try 0.0.7 |
Thanks @jonmmease , interestingly I see the same warnings and errors are above after installing 0.0.7 (and confirming in the notebook that this is the loaded version of avenger). I can also confirm that enabling the flags |
Huh, ok. I'll need to dig in some more. Does using those flags work for you for now? |
Yup, no rush from my end on this. |
@joelostblom could you try again with 0.0.8? I think I worked out how to force the use of WebGL, so those browser flags shouldn't be needed any more. |
huh, that's coming from inside Vega embed. Here's a standalone html file that loads vega-embed and avenger in dev mode (so that the source isn't minified). Could you unzip this and open this in the same web browser? I assume it will still error, but hopefully the stack trace will be more useful |
I tried the file in both chromium and firefox and I can see the chart just fine without any message in the console log. Running jupyterlab in the same two browsers shows the error message above an no chart (same behavior in VS Code too). Let me know if there is anything else that would be informative if I try. |
Huh, the only difference between that HTML file and what is displayed in JupyterLab should be the dev url. Could you try this HTML file, which doesn't use the dev URLs and I would think would produce the original error. If this does not error, then there must be something about displaying in JupyterLab/VSCode that's interfering somehow. |
The avenger-html renderer shouldn't affect |
Running the following code gives an error on the two first cell executions, but on the third execution the chart shows up: from IPython.display import HTML
import altair as alt
from vega_datasets import data
source = data.cars.url
chart = alt.Chart(source).mark_circle().encode(
x='Horsepower:Q',
y='Miles_per_Gallon:Q',
color='Origin:N',
)
chart.save('avenger-test.html')
HTML('avenger-test.html') The first time I run the cell I see this error and no chart: The second time I see this error and still no chart: The third time I run the cell, there is no error and the chart shows up. With the chart you sent, it shows up on the first try and there are no warnings. This is the produced HTML content in the file: <!DOCTYPE html>
<html>
<head>
<style>
#vis.vega-embed {
width: 100%;
display: flex;
}
#vis.vega-embed details,
#vis.vega-embed details summary {
position: relative;
}
</style>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega@5"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega-embed@6"></script>
</head>
<body>
<div id="vis"></div>
<script>
(function(vegaEmbed) {
var spec = {"config": {"view": {"continuousWidth": 300, "continuousHeight": 300}}, "data": {"url": "https://cdn.jsdelivr.net/npm/[email protected]/data/cars.json"}, "mark": {"type": "circle"}, "encoding": {"color": {"field": "Origin", "type": "nominal"}, "x": {"field": "Horsepower", "type": "quantitative"}, "y": {"field": "Miles_per_Gallon", "type": "quantitative"}}, "$schema": "https://vega.github.io/schema/vega-lite/v5.17.0.json"};
var embedOpt = {"mode": "vega-lite"};
function showError(el, error){
el.innerHTML = ('<div style="color:red;">'
+ '<p>JavaScript Error: ' + error.message + '</p>'
+ "<p>This usually means there's a typo in your chart specification. "
+ "See the javascript console for the full traceback.</p>"
+ '</div>');
throw error;
}
const el = document.getElementById('vis');
vegaEmbed("#vis", spec, embedOpt)
.catch(error => showError(el, error));
})(vegaEmbed);
</script>
</body>
</html> Since you mentioned that this is not related to avenger, we don't need to troubleshoot it, I was just trying to understand what was going wrong along the way. Maybe I messed up something with the setup, but I just tried recreating an environment and then running |
Thanks for starting this exciting project @jonmmease ! I was playing around with it a bit and it seems like I can't get the html renderer to work in either jupyterlab or vscode. This is the output I see using the example from the readme:
This is on Pop!_OS 22.04 LTS in a new conda env with the following:
Code
The text was updated successfully, but these errors were encountered: