Esc

COMARK0423 · warning

comark/charts/spec-with-annotations

Draw notes on a Vega-Lite chart as layers of its spec

comark-charts places annotations on the charts it lays out, and it can't find a row's shape in one Vega-Lite draws, so they aren't drawn. Draw the note in the spec instead, as a text or rule layer.

Incorrect

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

:::annotation{at="north"}
A family of eight moved in on Tuesday.
:::

```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-annotations::chart 1: annotations mark charts comark-charts lays out, not one drawn from a Vega-Lite spec.Remove them, or draw the note with a text or rule layer in the spec.✖ 1 problem

Correct

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

```vega-lite
{
  "layer": [
    { "mark": "bar" },
    {
      "mark": { "type": "text", "dy": -8 },
      "transform": [{ "filter": "datum.pond === 'north'" }],
      "encoding": { "text": { "value": "A family moved in" } }
    }
  ],
  "encoding": {
    "x": { "field": "pond", "type": "nominal" },
    "y": { "field": "ducks", "type": "quantitative" }
  }
}
```
::
md
lint-comark example.md✔ No problems