crossnote-app icon indicating copy to clipboard operation
crossnote-app copied to clipboard

Vega-lite problem

Open mikkelking opened this issue 5 years ago • 0 comments

Vega-lite Error in console

TypeError: Cannot read property 'orient' of undefined at Ks (vega-lite.min.js:15)

This is the code block that causes the problem:

  {
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "description": "A simple donut chart with embedded data.",
  "data": {
    "values": [
      {"category": 1, "value": 4},
      {"category": 2, "value": 6},
      {"category": 3, "value": 10},
      {"category": 4, "value": 3},
      {"category": 5, "value": 7},
      {"category": 6, "value": 8}
    ]
  },
  "mark": {"type": "arc", "innerRadius": 50},
  "encoding": {
    "theta": {"field": "value", "type": "quantitative"},
    "color": {"field": "category", "type": "nominal"}
  }
}

The above code works fine if I host vega-lite in my react-app or the vega-lite editor, so the json is ok

When I add "orient": "vertical", to the mark object, but then it complains about a similar problem with opacity

I tried adding "opacity": { "value": 0.7 }but that didn't fix the problem.

Digging into the vega-lite code, I suspect that it is not being supplied with a default config object. As it's building the chart, it looks for properties defined either locally or in the config, and I think that's why the error "Cannot read property 'orient' of undefined" comes from.

vega-embed seems to be used, and I presume markdown-it is somehow containing that. This is probably not a bug in crossnote, it is somewhere in. the containment heirarchy.

mikkelking avatar Oct 22 '20 10:10 mikkelking