仅在中心线上的点

Points only in the central line

我正在使用 this example named "Line Chart with Point Markers" 作为参考,但没有看到其他示例或任何关于条件或 "selected by symbol" 点的线索。

插图显示了一个典型案例(另见 SPC),我只需要带点的蓝色中心线。

您可以通过对数据集的过滤版本进行分层来做到这一点。修改您链接到的示例,它可能看起来像这样 (vega editor):

{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "description": "Stock prices of 5 Tech Companies over Time.",
  "data": {"url": "data/stocks.csv"},
  "encoding": {
    "x": {"timeUnit": "year", "field": "date", "type": "temporal"},
    "y": {"aggregate": "mean", "field": "price", "type": "quantitative"},
    "color": {"field": "symbol", "type": "nominal"}
  },
  "layer": [
    {
      "mark": {"type": "line", "point": true},
      "transform": [{"filter": "datum.symbol == 'GOOG'"}]
    },
    {
      "mark": {"type": "line"},
      "transform": [{"filter": "datum.symbol != 'GOOG'"}]
    }
  ]
}