brucala / Deneb.jl

Julia API for creating Vega-Lite visualizations
https://brucala.github.io/Deneb.jl/dev/
BSD 3-Clause "New" or "Revised" License
21 stars 1 forks source link

Escape special chars in encoding shorthand syntax #9

Open brucala opened 1 year ago

brucala commented 1 year ago

Due to the shorthand string syntax, using chars like ( or : in the Encoding can give unexpected results:

julia > Encoding("Beak Length (mm):Q")
Deneb.EncodingSpec: 
{
  "x": {
    "aggregate": "Beak Length ",
    "field": "mm",
    "type": "quantitative"
  }
}

At the moment there are no escaping rules to avoid that. In the meantime one can simply use the verbose syntax without the shorthands:

> julia> Encoding(x=(field="Beak Length (mm)", type=:quantitative))
Deneb.EncodingSpec: 
{
  "x": {
    "field": "Beak Length (mm)",
    "type": "quantitative"
  }
}