Esc

COMARK0422 · warning

comark/charts/spec-with-props

Leave type, x, and y off a chart drawn from a Vega-Lite spec

A chart drawn from a Vega-Lite spec takes its mark and its columns from the spec, so type, x, and y on the block are ignored. Only title still applies. Name the columns in the spec's encoding.

Incorrect

::chart{type="bar" title="Ducks per pond"}
| pond | ducks |
| --- | --: |
| north | 12 |
| south | 7 |
| east | 9 |

```vega-lite
{
  "mark": "bar",
  "encoding": {
    "x": { "field": "pond", "type": "nominal" },
    "y": { "field": "ducks", "type": "quantitative" }
  }
}
```
::
md
lint-comark example.mdexample.md:1:1 comark/charts/spec-with-props::chart 1: type doesn't apply to a chart drawn from a Vega-Lite spec.Name the columns in the spec's encoding instead.✖ 1 problem

Correct

::chart{title="Ducks per pond"}
| pond | ducks |
| --- | --: |
| north | 12 |
| south | 7 |
| east | 9 |

```vega-lite
{
  "mark": "bar",
  "encoding": {
    "x": { "field": "pond", "type": "nominal" },
    "y": { "field": "ducks", "type": "quantitative" }
  }
}
```
::
md
lint-comark example.md✔ No problems