Esc

COMARK0426 · warning

comark/charts/unknown-spec-field

Use the table's headers as a spec's fields

Each row of the table becomes one data point, with a field per column named by its header. A field that's neither a header nor made by a transform reads nothing, so its axis or its marks come out empty.

Incorrect

::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": "duck", "type": "quantitative" }
  }
}
```
::
md
lint-comark example.mdexample.md:1:1 comark/charts/unknown-spec-field::chart 1: its Vega-Lite spec reads field duck, but its table has pond and ducks.Use the table's headers as field names.✖ 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