vega-lite: duplicate parameter definition error in layered charts (because of `"point": true`)

Original observed in this Altair issue comment: https://github.com/altair-viz/altair/pull/2528#issuecomment-992989438. Open the Chart in the Vega Editor

{
  "params": [
    {
      "name": "highlight",
      "select": {"type": "point", "clear": "mouseout", "on": "mouseover"}
    }
  ],
  "vconcat": [
    {
      "height":100,
      "mark": {"type": "line", "point": true},
      "encoding": {
        "x": {"field": "date", "timeUnit": "year", "type": "nominal"},
        "y": {"aggregate": "mean", "field": "price", "type": "quantitative"}
      }
    },
    {
      "mark": {"type": "rect"},
      "encoding": {
        "fill": {"aggregate": "mean", "field": "price", "type": "quantitative"},
        "stroke": {
          "condition": {"value": "black", "param": "highlight", "empty": false},
          "value": null
        },
        "x": {"field": "date", "timeUnit": "year", "type": "temporal"}
      }
    }
  ],
  "data": {"url": "data/stocks.csv"},
  "$schema": "https://vega.github.io/schema/vega-lite/v5.2.0.json"
}

gives image When setting -upon first sight unrelated- "point": true to "point": false it will work: image

Defining the parameter on the view, it will also work with "point": true.

{
  "vconcat": [
    {
      "height": 100,
      "mark": {"type": "line", "point": true},
      "encoding": {
        "x": {"field": "date", "timeUnit": "year", "type": "nominal"},
        "y": {"aggregate": "mean", "field": "price", "type": "quantitative"}
      },
      "params": [
        {
          "name": "highlight",
          "select": {"type": "point", "clear": "mouseout", "on": "mouseover"}
        }
      ]
    },
    {
      "mark": {"type": "rect"},
      "encoding": {
        "fill": {"aggregate": "mean", "field": "price", "type": "quantitative"},
        "stroke": {
          "condition": {"value": "black", "param": "highlight", "empty": false},
          "value": null
        },
        "x": {"field": "date", "timeUnit": "year", "type": "temporal"}
      }
    }
  ],
  "data": {"url": "data/stocks.csv"},
  "$schema": "https://vega.github.io/schema/vega-lite/v5.2.0.json"
}

image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 18 (17 by maintainers)

Most upvoted comments

There is a contributing page in the repo. It mentions VS Code as preferable IDE: https://github.com/vega/vega-lite/blob/next/CONTRIBUTING.md#suggested-programming-environment.

But I’ve no much experience in this either.