vegafusion icon indicating copy to clipboard operation
vegafusion copied to clipboard

Panic when field name includes a `:`

Open boydgreenfield opened this issue 10 months ago • 6 comments

When a field name includes a :, vegafusion cannot handle it and raises a PanicException. Here's a minimal example for which the spec works fine in the Vega Editor:

import vegafusion as vf
import vl_convert as vlc

spec = {
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {"values": [        
        {"Horsepower:": 225, "Miles_per_Gallon": 14, "Origin": "USA"},
        {"Horsepower:": 95, "Miles_per_Gallon": 24, "Origin": "Japan"},
        {"Horsepower:": 95, "Miles_per_Gallon": 22, "Origin": "USA"},
        {"Horsepower:": 97, "Miles_per_Gallon": 18, "Origin": "USA"},
      ]},
  "mark": "point",
  "encoding": {
    "x": {"field": "Horsepower:", "type": "quantitative"},
    "y": {"field": "Miles_per_Gallon", "type": "quantitative"},
    "color": {"field": "Origin", "type": "nominal"},
  }
}


vlc.vegalite_to_vega(spec)  # works
vf.runtime.build_pre_transform_spec_plan(vlc.vegalite_to_vega(spec))  # raises PanicException

boydgreenfield avatar Apr 25 '24 15:04 boydgreenfield