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
Incorrect URL for Vega data files #7017
Comments
Looks like Vega extension should not assume that getdownloadurl returns just a path it can append to:
|
@domoritz - is there an easy way to override https://github.com/vega/vega/blob/dd006488d508e0f1e5154cb20eeea3ac7a3f4cd2/packages/vega-loader/src/loader.js#L85-L91 in the vega 4/5 jlab plugin to call a function in JLab that, given a relative path, will return a URL to use to download it? We could try to work under the assumption that we can get a base url (which is where we have an error in the vega4/5 extensions now), but really it would be more correct to let the system give us a download URL given a path. |
We can provide a custom loader to Vega and replace all the logic we want. We are currently only customizing the base URL in
file:// url and write a custom file handler that we set to https://github.com/vega/vega/blob/dd006488d508e0f1e5154cb20eeea3ac7a3f4cd2/packages/vega-loader/src/loader.js#L33.
Does this answer your question? |
It gives hope :).
|
I read https://tools.ietf.org/html/rfc8089 for a bit, and it seems that there is no correct way to give a |
@malramsay64 - did this ever work in JupyterLab? If so, what version? Copying reproducing instructions from vega/altair#1651:
import altair as alt
import pandas as pd
from pprint import pprint
alt.data_transformers.enable("json")
df = pd.DataFrame({"x": [1,2,3], "y": [1,2,3]})
alt.Chart(df).mark_line().encode(x="x", y="y") |
It's working for me in jlab 1.0.2:
|
…rver. Perhaps we should also use the services package to actually send the request to the server. That would complicate these plugins beyond simple rendermime plugins, though. Fixes jupyterlab#7017
…rver. Perhaps we should also use the services package to actually send the request to the server. That would complicate these plugins beyond simple rendermime plugins, though. Fixes jupyterlab#7017
This should be fixed in #7022 |
The fix works for me. Thank you @jasongrout for such a quick response and fix for this issue!! |
Description
When creating a figure with altair, using the data_transformer functionality, which stores the data in a local file and gets Vega load the file, results in a URL which is improperly formed, so the data never loads.
The URL has the _xsrf information in front of the name of the file which is being loaded.
Issue first raised vega/altair#1651 and directed here.
Reproduce
Install jupyterlab
In a new notebook run
In the browser tools there is the error
while the console has the error message
The problem seems to be in the GET request, which has the _xsrf information before the file information. Using the firefox dev tools to edit and resend the request, both the removal of the _xsrf parameter from the url, or moving it after the filename result in a successful request.
Expected behavior
It is expected that the chart is filled with a straight line,
instead there is no data in the chart.
Context
Troubleshoot Output
Command Line Output
Browser Output
The text was updated successfully, but these errors were encountered: