COMARK0425 · warning
comark/charts/spec-with-data
Leave data out of a Vega-Lite spec
A chart's data is its table, which stays in the page so readers and agents can read the numbers. The table replaces any data in the spec, so numbers written there are never drawn.
Incorrect
::chart{title="Ducks per pond"}
| pond | ducks |
| --- | --: |
| north | 12 |
| south | 7 |
| east | 9 |
```vega-lite
{
"data": { "values": [{ "pond": "north", "ducks": 12 }] },
"mark": "bar",
"encoding": {
"x": { "field": "pond", "type": "nominal" },
"y": { "field": "ducks", "type": "quantitative" }
}
}
```
:: lint-comark example.mdexample.md:1:1 comark/charts/spec-with-dataRemove
data from the spec.✖ 1 problemCorrect
::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" }
}
}
```
:: lint-comark example.md✔ No problems