删除 Vega Lite 日期 x 轴中的小刻度

Remove minor ticks in Vega Lite date x-axis

我有以下 Vega Lite 规格

{
  "config": {
    "view": {"stroke": "transparent"},
    "mark": {"tooltip": null},
    "axis": {
      "grid": false,

      "labelAngle": 0,
      "labelFont": "museo-sans-300",
      "labelFontSize": 15,
      "labelFontWeight": "normal",
      "titleFont": "museo-sans-300",
      "titleFontSize": 15,
      "titleFontWeight": "normal"
    }
  },
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "data": {"name": "data"},
  "mark": {
    "type": "line",
    "interpolate": "monotone",
    "point": {"filled": false, "fill": "white"}
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "timeUnit": "monthdate",
      "axis": {"title": null,"tickMinStep": 1}
    },
    "y": {"type": "quantitative", "field":"%"},
    "color": {
      "field": "metric",
      "type": "nominal",
      "legend": {
        "labelFont": "museo-sans-300",
        "labelFontSize": 15,
        "title": null,
        "offset": 0,
        "padding": 0
      }
    }
  },
  "width": 500,
  "datasets": {
    "data": [
      {
        "date": "2019-11-28",
        "metric": "linehaul_util_perc",
        "%": 48.36678571428571
      },
      {
        "date": "2019-11-29",
        "metric": "linehaul_util_perc",
        "%": 57.74388888888889
      },
      {"date": "2019-12-03", "metric": "linehaul_util_perc", "%": 57.25},
      {
        "date": "2019-12-04",
        "metric": "linehaul_util_perc",
        "%": 71.37883720930233
      },
      {"date": "2019-11-28", "metric": "recovery_perc", "%": 62.7},
      {"date": "2019-11-29", "metric": "recovery_perc", "%": 63.1},
      {"date": "2019-12-02", "metric": "recovery_perc", "%": 126.1},
      {"date": "2019-12-03", "metric": "recovery_perc", "%": 80.4},
      {"date": "2019-12-04", "metric": "recovery_perc", "%": 60.4},
      {"date": "2019-11-28", "metric": "rolling_recovery", "%": 73.9},
      {"date": "2019-11-29", "metric": "rolling_recovery", "%": 73.3},
      {"date": "2019-11-30", "metric": "rolling_recovery", "%": 71.5},
      {"date": "2019-12-01", "metric": "rolling_recovery", "%": 72.2},
      {"date": "2019-12-02", "metric": "rolling_recovery", "%": 76.5},
      {"date": "2019-12-03", "metric": "rolling_recovery", "%": 76.6},
      {"date": "2019-12-04", "metric": "rolling_recovery", "%": 75.5}
    ]
  }
}

生成以下图像

这是正确的,除了我只想在带有文本的日子里显示刻度(即主要刻度)。将最小刻度距离设置为 1 似乎不起作用,尽管我可以使用 tickCount 更改它。然而,这将需要一些额外的逻辑来首先确定集合中的天数,因此如果没有它就可以做到这一点。

事实证明,我只是没有仔细阅读文档。这个问题可以使用 tickCount 来解决,因为它可以将 'day' 作为参数,这正是我所需要的。