altair-viz / jupyterlab_voyager

JupyterLab extension visualize data with Voyager
BSD 3-Clause "New" or "Revised" License
298 stars 35 forks source link

Cannot open Vega-Lite file with data url #40

Closed kanitw closed 6 years ago

kanitw commented 6 years ago

Step to reproduce:

  1. Clone Vega-Lite repository
  2. Start jupyter lab in the Vega-Lite code folder
  3. Go to examples/specs folder
  4. Right click on any example with URL data (not inline data) -> Open with -> Voyager (json)

cc: @felixcodes

zzhangjii commented 6 years ago

Hi @kanitw , the standard vl.json form jupyterlab_voyager accepts are:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
  "description": "A scatterplot showing horsepower and miles per gallons.",
  "data": {"url": "https://vega.github.io/vega-datasets/data/cars.json"},
  "mark": "point",
  "encoding": {
    "x": {"field": "Horsepower", "type": "quantitative"},
    "y": {"field": "Miles_per_Gallon", "type": "quantitative"},
    "color": {"field": "Origin", "type": "nominal"},
    "shape": {"field": "Origin", "type": "nominal"}
  }
}

the program will try to extract src_file.data.url, so make sure it has the 'data' field and 'url' inside 'data'.
Also, if the url is local url, then it probably won't work because the filepath may conflict with the jupyterlab filebrowser path

kanitw commented 6 years ago

Yes, but users wouldn't know that. I wonder if there is a way to fix this in the plugin.

Also if you need a config in Voyager to pass in path prefix for data url, let us know!

zzhangjii commented 6 years ago

local data url working now